com.waveset.object
Class TaskDefinition

java.lang.Object
  extended bycom.waveset.object.PersistentObject
      extended bycom.waveset.object.TaskDefinition
All Implemented Interfaces:
java.lang.Comparable, javax.naming.Referenceable, XmlObject

public class TaskDefinition
extends PersistentObject

A class that represents a generic background task definition. Instances of these are created to represent the "types" of tasks that may be launched. A launched instance of this task definition is represented as a TaskInstance object.


Nested Class Summary
static class TaskDefinition.ExecMode
          An enumeration class Used for values of the _execMode field.
 
Nested classes inherited from class com.waveset.object.PersistentObject
PersistentObject.Comparator, PersistentObject.InitialInstance
 
Field Summary
static java.lang.String ATT_FORMATTER
           
static java.lang.String ATT_PROGRESS_INTERVAL
           
static java.lang.String ATT_QUOTANAME
           
static java.lang.String ATT_REPORTS_PROGRESS
           
static java.lang.String ATT_RESULTOP
           
static java.lang.String code_id
           
static java.lang.String ELEMENT
          The XML element name used for this type and all subtypes.
static java.lang.String TASK_TYPE_BULK
          Task type name used for bulk account operations
static java.lang.String TASK_TYPE_DEFERRED_TASK_SCANNER
          Task type name used for deferred task scanners.
static java.lang.String TASK_TYPE_EXTRACT
          Task type name used for extraction.
static java.lang.String TASK_TYPE_IMPORT
          Task type name used for loading.
static java.lang.String TASK_TYPE_LOAD
          Task type name used for loading.
static java.lang.String TASK_TYPE_MAINTENANCE
          Task type name used for account maintenance.
static java.lang.String TASK_TYPE_RECONCILE
          Task type name used for reconciliation.
static java.lang.String TASK_TYPE_REPORT
          Task type name used for reports.
static java.lang.String TASK_TYPE_SCANNER
          Task type name used for Risk Analysis.
static java.lang.String TASK_TYPE_SOURCE_ADAPTER
          Task type name used for Source adapters.
static java.lang.String TASK_TYPE_SYNCHRONIZER
          Task type name used for synchronizers.
static java.lang.String TASK_TYPE_TASK_CONFIGURATION
          Task type name used for task configuration.
static java.lang.String TASK_TYPE_WORKFLOW
          Task type name used for workflow cases.
static java.lang.String VISIBILITY_ALL
           
static java.lang.String VISIBILITY_INVISIBLE
          Visibility constants.
static java.lang.String VISIBILITY_RUN
           
static java.lang.String VISIBILITY_SCHEDULE
           
 
Fields inherited from class com.waveset.object.PersistentObject
_trace, trace
 
Constructor Summary
TaskDefinition()
          Noarg constructor primarily for getInitialInstances.
TaskDefinition(org.w3c.dom.Element e)
          Constructor to deserialize from an DOM node.
 
Method Summary
protected  void addSubclassAttributes(java.lang.StringBuffer b)
          Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist).
protected  void addSubclassElements(java.lang.StringBuffer b)
          Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist).
protected  WSAttribute getAttributeValues(java.lang.String attrName)
           
 java.lang.String getDescription()
          Get the description string.
 java.lang.String getElementName()
          The element name will always be TaskDefinition, even though there may be several types.
 TaskDefinition.ExecMode getExecMode()
          Get the default execution mode.
 int getExecutionLimit()
          Get the limit in seconds that the task is allowed to execute.
 void getExecutionLimit(int i)
          Deprecated. - Use instead #setExecutionLimit(int). Bug#14437.
 java.lang.String getExecutor()
          Get the name of the class that executes this task.
 XmlObject getExtension()
          Get the definition extension.
 Form getForm()
          Get the form object which describes requried and optional initialization data for the task.
 java.util.List getHosts()
           
 int getProgressInterval()
          Get the interval in milliseconds that the task applet should check for progress updates.
 java.lang.String getQuotaName()
           
 java.lang.String getResultFormatter()
           
 int getResultLimit()
          Get the limit in seconds that a task instance is allowed to live after the task has completed.
 TaskSchedule.ResultOption getResultOption()
          Get the result option.
 java.lang.String getTaskType()
          Get the task type name.
 Type getType()
          Return the type of this object.
static java.lang.String getTypeDisplayNameKey(java.lang.String name)
           
 java.lang.String getVisibility()
           
 boolean isRestartable()
           
 boolean isSingleton()
          Test a flag indicating if the task can be suspended and resumed.
 boolean isSuspendable()
          Test a flag indicating if the task can be suspended and resumed.
 boolean isSyncControlAllowed()
          Test a flag indicating if the synchronous execution of the task can be requested by the user.
 boolean isSyncExecution()
          Test a flag indicating if the default execution mode is synchronous.
 java.util.List listExtendedResultTypes()
           
 java.util.List listQueryableAttributes()
           
 java.util.List listSummaryAttributes()
          Returns the complete list of defined attributes that this type of persistent object exposes as summary attributes (regardless of whether this particular object has a value for each).
protected  void parseSubclassAttributes(org.w3c.dom.Element e)
          Each concrete subclass should parse from the XML buffer any persisted subclass-specific fields (generally, the same ones that it writes into the buffer).
protected  void parseSubclassElements(org.w3c.dom.Element e)
          Each concrete subclass should parse from the XML buffer any persisted subclass-specific elements (generally, the same ones that it writes into the buffer).
 boolean reportsProgress()
          Test a flag indicating if the task will be reporting progress during execution.
 boolean requiresExecutorDelete()
           
 void setDescription(java.lang.String s)
          Set the description string.
 void setExecMode(TaskDefinition.ExecMode mode)
          Change the execution mode.
 void setExecutionLimit(int i)
          Set the limit in seconds that the task is allowed to execute.
 void setExecutor(java.lang.String name)
          Set the name of the class that executes this class.
 void setExtendedResultTypes(java.util.List types)
           
 void setExtension(XmlObject obj)
          Set the definition extension.
 void setForm(Form f)
          Get the form object which describes requried and optional initialization data for the task.
 void setHosts(java.util.List l)
           
 void setProgressInterval(int l)
          Set the interval in milliseconds tha the task status applet should check for progress updates.
 void setQuotaName(java.lang.String s)
          Get the quota name.
 void setReportsProgress(boolean b)
          Set a flag indicating if the task will be reporting progress as it executes.
 void setRestartable(boolean b)
           
 void setResultFormatter(java.lang.String s)
           
 void setResultLimit(int l)
          Set the limit in seconds that a task instance is allowed to live after the task has completed.
 void setResultOption(TaskSchedule.ResultOption o)
          Set the result option.
 void setSingleton(boolean b)
          Set a flag indicating if the task can be suspended and resumed.
 void setSuspendable(boolean b)
          Set a flag indicating if the task can be suspended and resumed.
 void setSyncControlAllowed(boolean b)
          Set a flag indicating if the task can be suspended and resumed.
 void setTaskType(java.lang.String name)
          Set the task type name.
 void setType(Type t)
          This is exposed so we can implement a "change type" database upgrade operation.
 void setVisibility(java.lang.String s)
           
 void visit(Visitor v)
          Visitor interface.
 
Methods inherited from class com.waveset.object.PersistentObject
addCommonElements, addEndTag, addMemberObjectGroup, addMemberObjectGroup, addPersistentAttributes, addStartTag, addSummaryAttributes, addXmlHeader, attributesMatch, attributesMatch, attributesMatch, checkReference, checkReferences, clearId, cloneAs, cloneObject, compareTo, create, create, create, create, createLastModItem, createLastModItem, createLastModItemList, directObjectGroupMember, dump, dumpFile, equals, fakeId, getAttribute, getAttributeValues, getAuthReferences, getAuthType, getBasicAttributes, getBasicAttributes, getBasicAttributes, getCache, getCounterValue, getCreateDate, getCreator, getDisplayableName, getDisplayName, getEncryptedValues, getId, getIdOrName, getInitialInstances, getLastMod, getLastModDate, getLastModifier, getLastModItemId, getLockInfo, getMemberObjectGroupRefs, getMemberObjectGroupRefsUpTo, getMemberObjectGroups, getName, getNameOrId, getProperties, getProperty, getPropertyAsString, getPropertyList, getQueryableAttributes, getReference, getReferences, getRuleDrivenMemberObjectGroupRefs, getRuleDrivenMemberObjectGroupRefsUpTo, getRuleDrivenMemberObjectGroups, getSubtype, getSummaryAttributes, getSummaryString, hasEncryptedData, hashCode, identityEquals, isAlias, isHidden, isId, isProtected, isProtectedFromDelete, isReferencedIn, listOperationalAttributes, listQueryableReferenceAttributes, objectGroupMember, objectGroupMemberRef, parseCommonElement, parseCommonElements, parsePersistentAttributes, parseXml, parseXml, prepareForSerialization, prepareToSerialize, println, reEncrypt, reEncryptSubclassAttributes, removeMemberObjectGroup, removeProperty, resolve, resolve, resolve, resolveArray, resolveArrayByFetching, resolveObjectReference, resolveObjectReferences, resolveReference, resolveSummaryAttributes, resolveSummaryAttributes, ruleDrivenObjectGroupMemberRef, setAuthType, setAuthType, setCache, setCreateDate, setCreator, setDisplayName, setDisplayName, setHidden, setIsAlias, setLastMod, setLastMod, setLastModDate, setLastModifier, setMemberObjectGroupRef, setMemberObjectGroupRefs, setMemberObjectGroups, setName, setProperties, setProperty, setPropertyList, setProtected, setProtectedFromDelete, setRuleDrivenMembersCache, setSubtype, setTrace, toString, toXml, toXml, toXml, toXmlFile
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

ELEMENT

public static final java.lang.String ELEMENT
The XML element name used for this type and all subtypes.

See Also:
Constant Field Values

TASK_TYPE_WORKFLOW

public static final java.lang.String TASK_TYPE_WORKFLOW
Task type name used for workflow cases.

See Also:
Constant Field Values

TASK_TYPE_REPORT

public static final java.lang.String TASK_TYPE_REPORT
Task type name used for reports.

See Also:
Constant Field Values

TASK_TYPE_MAINTENANCE

public static final java.lang.String TASK_TYPE_MAINTENANCE
Task type name used for account maintenance.

See Also:
Constant Field Values

TASK_TYPE_SCANNER

public static final java.lang.String TASK_TYPE_SCANNER
Task type name used for Risk Analysis.

See Also:
Constant Field Values

TASK_TYPE_EXTRACT

public static final java.lang.String TASK_TYPE_EXTRACT
Task type name used for extraction.

See Also:
Constant Field Values

TASK_TYPE_IMPORT

public static final java.lang.String TASK_TYPE_IMPORT
Task type name used for loading.

See Also:
Constant Field Values

TASK_TYPE_LOAD

public static final java.lang.String TASK_TYPE_LOAD
Task type name used for loading.

See Also:
Constant Field Values

TASK_TYPE_BULK

public static final java.lang.String TASK_TYPE_BULK
Task type name used for bulk account operations

See Also:
Constant Field Values

TASK_TYPE_RECONCILE

public static final java.lang.String TASK_TYPE_RECONCILE
Task type name used for reconciliation.

See Also:
Constant Field Values

TASK_TYPE_SOURCE_ADAPTER

public static final java.lang.String TASK_TYPE_SOURCE_ADAPTER
Task type name used for Source adapters.

See Also:
Constant Field Values

TASK_TYPE_DEFERRED_TASK_SCANNER

public static final java.lang.String TASK_TYPE_DEFERRED_TASK_SCANNER
Task type name used for deferred task scanners.

See Also:
Constant Field Values

TASK_TYPE_SYNCHRONIZER

public static final java.lang.String TASK_TYPE_SYNCHRONIZER
Task type name used for synchronizers.

See Also:
Constant Field Values

TASK_TYPE_TASK_CONFIGURATION

public static final java.lang.String TASK_TYPE_TASK_CONFIGURATION
Task type name used for task configuration.

See Also:
Constant Field Values

VISIBILITY_INVISIBLE

public static final java.lang.String VISIBILITY_INVISIBLE
Visibility constants. Should have constants but I'm not sure exactly how these should work, is it an enumeration of a set of things that can be or'd together?

See Also:
Constant Field Values

VISIBILITY_RUN

public static final java.lang.String VISIBILITY_RUN
See Also:
Constant Field Values

VISIBILITY_SCHEDULE

public static final java.lang.String VISIBILITY_SCHEDULE
See Also:
Constant Field Values

VISIBILITY_ALL

public static final java.lang.String VISIBILITY_ALL
See Also:
Constant Field Values

ATT_RESULTOP

public static final java.lang.String ATT_RESULTOP
See Also:
Constant Field Values

ATT_QUOTANAME

public static final java.lang.String ATT_QUOTANAME
See Also:
Constant Field Values

ATT_REPORTS_PROGRESS

public static final java.lang.String ATT_REPORTS_PROGRESS
See Also:
Constant Field Values

ATT_PROGRESS_INTERVAL

public static final java.lang.String ATT_PROGRESS_INTERVAL
See Also:
Constant Field Values

ATT_FORMATTER

public static final java.lang.String ATT_FORMATTER
See Also:
Constant Field Values
Constructor Detail

TaskDefinition

public TaskDefinition()
Noarg constructor primarily for getInitialInstances.


TaskDefinition

public TaskDefinition(org.w3c.dom.Element e)
               throws WavesetException
Constructor to deserialize from an DOM node.

Method Detail

listExtendedResultTypes

public java.util.List listExtendedResultTypes()
Returns:
the types of sub-objects that should be deleted along with each task instance that refers to this TaskDefinition. Each item in the list represents a PersistentObject type.

Each associated sub-object will expose a queryable attribute (Attribute.TASKID) with a value matching the id of the "parent" task instance.


setExtendedResultTypes

public void setExtendedResultTypes(java.util.List types)

requiresExecutorDelete

public boolean requiresExecutorDelete()
Returns:
true if the Executor class must be invoked in order to clean up state associated with a task instance that:
  1. is not represented as persistent objects in the repository; or
  2. is represented as persistent objects in the repository but the objects do not fit the pattern for extended result types;

getType

public Type getType()
Description copied from class: PersistentObject
Return the type of this object. This must be implemented by each subclass.

Specified by:
getType in class PersistentObject
Returns:
the associated Type object.

getElementName

public java.lang.String getElementName()
The element name will always be TaskDefinition, even though there may be several types.

Specified by:
getElementName in interface XmlObject
Overrides:
getElementName in class PersistentObject

setType

public void setType(Type t)
This is exposed so we can implement a "change type" database upgrade operation. Use with extreme care. Should this get generalized and moved to PersistentObject, we can at least check to see if we're moving to a type within our type hierarchy, but even that could technically violate OO.


visit

public void visit(Visitor v)
           throws WavesetException
Visitor interface.

Overrides:
visit in class PersistentObject
Throws:
WavesetException

getTaskType

public java.lang.String getTaskType()
Get the task type name. This will usually be one of the standard type names defined by one of the static constants.

See Also:
TASK_TYPE_REPORT, TASK_TYPE_MAINTENANCE, TASK_TYPE_WORKFLOW

setTaskType

public void setTaskType(java.lang.String name)
Set the task type name. This should ordinarilly be one of the standard type names defined by one of the static constants. If you need to invent a new standard type, add a constant for it.

See Also:
TASK_TYPE_REPORT, TASK_TYPE_MAINTENANCE, TASK_TYPE_WORKFLOW

getExecutor

public java.lang.String getExecutor()
Get the name of the class that executes this task.


setExecutor

public void setExecutor(java.lang.String name)
Set the name of the class that executes this class.

Be careful when setting this, the class name must resolve on the server to a TaskExecutor implementation. We could try to catch this, but we may not be in a context that has access to the executor class at this moment?


getForm

public Form getForm()
Get the form object which describes requried and optional initialization data for the task.


setForm

public void setForm(Form f)
Get the form object which describes requried and optional initialization data for the task.


isSuspendable

public boolean isSuspendable()
Test a flag indicating if the task can be suspended and resumed.


setSuspendable

public void setSuspendable(boolean b)
Set a flag indicating if the task can be suspended and resumed.


isSyncControlAllowed

public boolean isSyncControlAllowed()
Test a flag indicating if the synchronous execution of the task can be requested by the user.


setSyncControlAllowed

public void setSyncControlAllowed(boolean b)
Set a flag indicating if the task can be suspended and resumed.


getExecMode

public TaskDefinition.ExecMode getExecMode()
Get the default execution mode.


setExecMode

public void setExecMode(TaskDefinition.ExecMode mode)
Change the execution mode.

If exec mode is null or ExecMode.DEFAULT, we'll set it to ExecMode.ASYNC. This oddity is due to the fact that ExecMode can be used for user exec mode requests so we have to allow DEFAULT, even though it is meaningless here.


isSyncExecution

public boolean isSyncExecution()
Test a flag indicating if the default execution mode is synchronous.


isSingleton

public boolean isSingleton()
Test a flag indicating if the task can be suspended and resumed.


setSingleton

public void setSingleton(boolean b)
Set a flag indicating if the task can be suspended and resumed.


getExecutionLimit

public int getExecutionLimit()
Get the limit in seconds that the task is allowed to execute. A limit of zero means there is no limit.


getExecutionLimit

public void getExecutionLimit(int i)
Deprecated. - Use instead #setExecutionLimit(int). Bug#14437.

Set the limit in seconds that the task is allowed to execute. A limit of zero means there is no limit.


setExecutionLimit

public void setExecutionLimit(int i)
Set the limit in seconds that the task is allowed to execute. A limit of zero means there is no limit.


getResultLimit

public int getResultLimit()
Get the limit in seconds that a task instance is allowed to live after the task has completed.

A limit of zero means that the TaskInstance will be deleted immediately after the task is complete.

A limit of -1 means that the TaskInstance will never be automatically deleted, though it may be manually deleted by the user.


getResultOption

public TaskSchedule.ResultOption getResultOption()
Get the result option.


setResultOption

public void setResultOption(TaskSchedule.ResultOption o)
Set the result option.


setResultLimit

public void setResultLimit(int l)
Set the limit in seconds that a task instance is allowed to live after the task has completed.

A limit of zero means that the TaskInstance will be deleted immediately after the task is complete.

A limit of -1 means that the TaskInstance will never be automatically deleted, though it may be manually deleted by the user.


getExtension

public XmlObject getExtension()
Get the definition extension.


setExtension

public void setExtension(XmlObject obj)
Set the definition extension.


getDescription

public java.lang.String getDescription()
Get the description string.


setDescription

public void setDescription(java.lang.String s)
Set the description string. This will normally be displayed in the task list GUI, and should contain a short but meaningful description of what this task does.


setQuotaName

public void setQuotaName(java.lang.String s)
Get the quota name. Quotas are used to enforce simultaneous access to named items


getQuotaName

public java.lang.String getQuotaName()

setVisibility

public void setVisibility(java.lang.String s)

getVisibility

public java.lang.String getVisibility()

reportsProgress

public boolean reportsProgress()
Test a flag indicating if the task will be reporting progress during execution. This flag will determine if the task ui pages launch a status applet.


setReportsProgress

public void setReportsProgress(boolean b)
Set a flag indicating if the task will be reporting progress as it executes.


getProgressInterval

public int getProgressInterval()
Get the interval in milliseconds that the task applet should check for progress updates. Defaults to 5000 milliseconds.


setProgressInterval

public void setProgressInterval(int l)
Set the interval in milliseconds tha the task status applet should check for progress updates.


getHosts

public java.util.List getHosts()

setHosts

public void setHosts(java.util.List l)

getResultFormatter

public java.lang.String getResultFormatter()

setResultFormatter

public void setResultFormatter(java.lang.String s)

setRestartable

public void setRestartable(boolean b)

isRestartable

public boolean isRestartable()

listQueryableAttributes

public java.util.List listQueryableAttributes()
Overrides:
listQueryableAttributes in class PersistentObject
Returns:
the complete list of defined attributes that this type of PersistentObject exposes as queryable attributes (regardless of whether this object has a value for each).

Any subclass of PersistentObject that overrides this method should first invoke super.getQueryableAttributes() to ensure that the subclass includes queryable attributes that are common to all PersistentObjects.


listSummaryAttributes

public java.util.List listSummaryAttributes()
Description copied from class: PersistentObject
Returns the complete list of defined attributes that this type of persistent object exposes as summary attributes (regardless of whether this particular object has a value for each).

Any subclass of PersistentObject that overrides this method should first invoke super.listSummaryAttributes() to ensure that the subclass includes summary attributes that are common to all PersistentObjects.

Any subclass that overrides this implementation must also consider the length of the summary string that will be generated from these attributes.

Overrides:
listSummaryAttributes in class PersistentObject
Returns:
the complete list of defined attributes that this type of PersistentObject exposes as summary attributes (regardless of whether this object has a value for each).

Any subclass of PersistentObject that overrides this method should first invoke super.listSummaryAttributes() to ensure that the subclass includes summary attributes that are common to all PersistentObjects.

See Also:
Constants.MAX_SUMMARY_STRING_LENGTH, PersistentObject.getSummaryString()

getAttributeValues

protected WSAttribute getAttributeValues(java.lang.String attrName)
Overrides:
getAttributeValues in class PersistentObject
Parameters:
attrName - - the name of the attribute for which to return values.
Returns:
a WSAttribute that represents the value (or values) that this object contains for the specified attribute.

addSubclassAttributes

protected void addSubclassAttributes(java.lang.StringBuffer b)
Description copied from class: PersistentObject
Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist). PersistentObject's default implementation is a no-op.

NOTE: Any subclass that overrides this method must similarly override parseSubclassAttributes() so that the subclass attributes are restored.

Overrides:
addSubclassAttributes in class PersistentObject
See Also:


addSubclassElements

protected void addSubclassElements(java.lang.StringBuffer b)
Description copied from class: PersistentObject
Each concrete subclass may append to the buffer an XML representation of any fields it adds to PersistentObject (if those field values must persist). PersistentObject's default implementation is a no-op.

NOTE: Any subclass that overrides this method must similarly override parseSubclassElements() so that the subclass elements are restored.

Overrides:
addSubclassElements in class PersistentObject
See Also:


parseSubclassAttributes

protected void parseSubclassAttributes(org.w3c.dom.Element e)
                                throws WavesetException
Description copied from class: PersistentObject
Each concrete subclass should parse from the XML buffer any persisted subclass-specific fields (generally, the same ones that it writes into the buffer).

Overrides:
parseSubclassAttributes in class PersistentObject
Throws:
WavesetException
See Also:

PersistentObject's default implementation is a no-op.

, PersistentObject.parseXml(Element)

parseSubclassElements

protected void parseSubclassElements(org.w3c.dom.Element e)
                              throws WavesetException
Description copied from class: PersistentObject
Each concrete subclass should parse from the XML buffer any persisted subclass-specific elements (generally, the same ones that it writes into the buffer).

Overrides:
parseSubclassElements in class PersistentObject
Throws:
WavesetException
See Also:

PersistentObject's default implementation is a no-op.

, PersistentObject.parseXml(Element)

getTypeDisplayNameKey

public static java.lang.String getTypeDisplayNameKey(java.lang.String name)