Class AbstractTaskContentProvider
- All Implemented Interfaces:
IPageFlowScopeAdapter
,IContentProvider
,IRefreshable
,IRefreshableContentProvider
,ITransactionalContentProvider
,IUpdateableContentProvider
,ITaskContentProvider
,Serializable
- Direct Known Subclasses:
TaskContentProvider
ITaskContentProvider
.
This class contains all base implementation for queuing, reading and updating a single task instance
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Flag to enable ad-hoc routing (assignment) of the taskprotected boolean
Flag whether task should be automatically accepted before any edits take place.protected ITaskData
Stores current task data being editedprotected ITaskInfo
Stores current task info bein editedprotected int
How many users are allowed to accept a task.protected boolean
Flag whether task must be accepted before any edits take place.protected boolean
Flag whether task state needs to be refreshedprotected ITaskData
Stores task info before any edits took placeprotected ITaskInfo
Stores task data before any edits took placeprotected String
Stores ID of the taskprotected String
Stores task type ID.protected static final String
protected static final String[]
Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts a task for the current uservoid
Commits changes done to task info and business data.void
Commits changes done to task info and business data without requiring user to accept a taskvoid
Reverts back all un-committed changes to the taskvoid
Cancels current task.void
Completes a taskvoid
Deletes a taskboolean
Returns ad-hoc routing flagboolean
Returns autoAccept flagReturns ID of the current userint
Returns max number of users allowed to accept a task.boolean
Returns needAcceptToUpdate flagboolean
Check whether the task info needs refresh.boolean
Returnstrue
whenIRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from the data source by executingIRefreshable.refresh()
method.Object[]
Returns list of properties supported by this content provider.Returns task IDReturns task info for current task ID.protected ITaskServiceProvider
Returns task type IDReturns task type nameClass<?>
Returns java type of the given propertyReturns value of the given propertyboolean
boolean
hasProperty
(Object propertyKey) Checks if the given property is supported by this content providervoid
Initializes this content provider with given task.boolean
Returnstrue
if the provider is currenlty in auto-refresh modeboolean
Check whether current user accepted the task.boolean
isReadOnly
(Object propertyKey) Returns true if the given property is readonly.boolean
Checks if current user can apply changes to this taskprotected abstract ITaskData
Creates new instance of task business data.void
Queues a new task with task info and data set.void
refresh()
Reloads current task state from taskIDvoid
reset()
Resets all un-committed back to un-initialized statevoid
Resumes a taskvoid
setAdhocRouting
(boolean allowAdhocRouting) Sets ad-hoc routing flagvoid
setAutoAccept
(boolean autoAccept) Sets autoAccept flagvoid
setAutoRefresh
(boolean autorefresh) Sets auto refresh mode on.void
setMaxAllowedToAccept
(int maxAllowedToAccept) Sets max number of users allowed to accept a taskvoid
setNeedAcceptToUpdate
(boolean needAcceptToUpdate) Sets needAcceptToUpdate flagvoid
setNeedRefresh
(boolean needRefresh) Tells the provider that the input parameters have changed and the output results need to be refreshed the next time any output property is requested viaIContentProvider.getValue(Object)
.void
Sets new task ID to load.void
setTaskTypeID
(String taskTypeID) Set the task Type ID when queuing a new taskvoid
Sets new value of the given propertyboolean
Returns true if this content provider supports auto refresh feature.void
Suspends a taskvoid
Un-accepts a task from the current userMethods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.webmethods.caf.faces.data.IContentProvider
toString
-
Field Details
-
m_currentTaskData
Stores current task data being edited -
m_previousTaskInfo
Stores task data before any edits took place -
m_currentTaskInfo
Stores current task info bein edited -
m_previousTaskData
Stores task info before any edits took place -
m_taskID
Stores ID of the task -
m_taskTypeID
Stores task type ID. This is used when queuing new task -
m_autoAccept
protected boolean m_autoAcceptFlag whether task should be automatically accepted before any edits take place. Default is true -
m_needAcceptToUpdate
protected boolean m_needAcceptToUpdateFlag whether task must be accepted before any edits take place. Default is true. If task is not accepted and this flag is set to true, then task will be auto-accepted or exception will be thrown when attempting to update a task -
m_maxAllowedToAccept
protected int m_maxAllowedToAcceptHow many users are allowed to accept a task. Default is 1 -
m_needRefresh
protected boolean m_needRefreshFlag whether task state needs to be refreshed -
m_adhocRouting
protected boolean m_adhocRoutingFlag to enable ad-hoc routing (assignment) of the task -
PROPERTY_KEY_TASKDATA
- See Also:
-
PROPERTY_KEYS
-
-
Constructor Details
-
AbstractTaskContentProvider
public AbstractTaskContentProvider()Default empty constructor
-
-
Method Details
-
init
Initializes this content provider with given task. This is used from task rules, so TaskContentProvider should exhibit special behavior: not requiring to accept for update, allowing max number of accepted, no need to refresh. -
getTaskID
Returns task ID- Specified by:
getTaskID
in interfaceITaskContentProvider
-
getTaskTypeID
Returns task type ID- Specified by:
getTaskTypeID
in interfaceITaskContentProvider
-
getTaskTypeName
Returns task type name- Specified by:
getTaskTypeName
in interfaceITaskContentProvider
-
hasPendingChanges
- Throws:
ContentProviderException
-
getAutoAccept
public boolean getAutoAccept()Returns autoAccept flag- Specified by:
getAutoAccept
in interfaceITaskContentProvider
-
setAutoAccept
public void setAutoAccept(boolean autoAccept) Sets autoAccept flag- Specified by:
setAutoAccept
in interfaceITaskContentProvider
-
getAdhocRouting
public boolean getAdhocRouting()Returns ad-hoc routing flag- Specified by:
getAdhocRouting
in interfaceITaskContentProvider
-
setAdhocRouting
public void setAdhocRouting(boolean allowAdhocRouting) Sets ad-hoc routing flag- Specified by:
setAdhocRouting
in interfaceITaskContentProvider
-
setTaskID
Sets new task ID to load. Setting a task ID will refresh state of the provider- Specified by:
setTaskID
in interfaceITaskContentProvider
- Parameters:
taskID
- task ID to set
-
setTaskTypeID
Set the task Type ID when queuing a new task- Parameters:
taskTypeID
- task type ID to set
-
getTaskInfo
Returns task info for current task ID. If task ID is not set then empty task info is returned allowing to queue a new task- Specified by:
getTaskInfo
in interfaceITaskContentProvider
- Returns:
- task info
-
completeTask
Completes a task- Specified by:
completeTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
resumeTask
Resumes a task- Specified by:
resumeTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
suspendTask
Suspends a task- Specified by:
suspendTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
acceptTask
Accepts a task for the current user- Specified by:
acceptTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
unacceptTask
Un-accepts a task from the current user- Specified by:
unacceptTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
applyChangesNoAccept
Commits changes done to task info and business data without requiring user to accept a task- Throws:
ContentProviderException
-
applyChanges
Commits changes done to task info and business data. This operation will check if task is accepted by current user if appropriate flag is set and will auto-accept a task or throw an error if task is not accepted and auto-accept is not enabled- Specified by:
applyChanges
in interfaceITransactionalContentProvider
- Throws:
ContentProviderException
- if error happens during commit
-
cancelChanges
Reverts back all un-committed changes to the task- Specified by:
cancelChanges
in interfaceITransactionalContentProvider
- Throws:
ContentProviderException
-
isUpdateable
Checks if current user can apply changes to this task- Returns:
- return true if the current user can apply changes to this task
- Throws:
Exception
-
reset
Resets all un-committed back to un-initialized state- Throws:
Exception
-
refresh
Reloads current task state from taskID- Specified by:
refresh
in interfaceIRefreshable
- Throws:
ContentProviderException
- if error loading data from the data source
-
queueNewTask
Queues a new task with task info and data set.- Specified by:
queueNewTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
getNeedInfoRefresh
public boolean getNeedInfoRefresh()Check whether the task info needs refresh.- Returns:
- return true if task info needs refresh, e.g. for example if new task ID was set
-
getNeedRefresh
public boolean getNeedRefresh()Returns
true
whenIRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from the data source by executingIRefreshable.refresh()
method.Implementations may return an accurate value from this method if they can track the changes to the input parameter properties or they may require the clients to call
IRefreshable.setNeedRefresh(boolean)
explicitely.- Specified by:
getNeedRefresh
in interfaceIRefreshable
- Returns:
true
when the output properties are not up-to-date with the current input parameters, i.e.IRefreshable.refresh()
needs to be executed manually or automatically.
-
isReadOnly
Returns true if the given property is readonly. If it is readonly,
IUpdateableContentProvider.setValue(Object, Object)
will definitely fail.- Specified by:
isReadOnly
in interfaceIUpdateableContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
- Returns:
- true if the property is readonly
- Throws:
PropertyNotFoundException
ELException
-
setValue
public void setValue(Object propertyKey, Object value) throws ELException, PropertyNotFoundException Sets new value of the given property
- Specified by:
setValue
in interfaceIUpdateableContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
value
- new property value- Throws:
PropertyNotFoundException
- if property is not foundELException
-
getPropertyKeys
Returns list of properties supported by this content provider. Can returnObject[0]
, never null.- Specified by:
getPropertyKeys
in interfaceIContentProvider
- Returns:
- array of property keys which is typically of type
String
orInteger
-
getType
Returns java type of the given property- Specified by:
getType
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- property java
Class
- Throws:
PropertyNotFoundException
- if property is not supported
-
getValue
Returns value of the given property- Specified by:
getValue
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- value of the property, can be
null
- Throws:
PropertyNotFoundException
- if property is not supportedELException
-
hasProperty
Checks if the given property is supported by this content provider- Specified by:
hasProperty
in interfaceIContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
- Returns:
true
if property is supported
-
isAutoRefresh
public boolean isAutoRefresh()Returnstrue
if the provider is currenlty in auto-refresh mode- Specified by:
isAutoRefresh
in interfaceIRefreshable
- Returns:
- false if auto-refresh mode is off or not supported
-
setAutoRefresh
Sets auto refresh mode on. When auto refresh mode is on, the provider calls
IRefreshable.getNeedRefresh()
to determine whether the refresh needs to be done before returning any result properties. If it returnstrue
, the provider callsIRefreshable.refresh()
method to updated the result properties.- Specified by:
setAutoRefresh
in interfaceIRefreshable
- Parameters:
autorefresh
- true to turn it on- Throws:
ContentProviderException
- if auto refresh mode is not supported- See Also:
-
setNeedRefresh
public void setNeedRefresh(boolean needRefresh) Tells the provider that the input parameters have changed and the output results need to be refreshed the next time any output property is requested viaIContentProvider.getValue(Object)
.- Specified by:
setNeedRefresh
in interfaceIRefreshable
- Parameters:
needRefresh
-true
if the input parameters have changed
-
supportsAutoRefresh
public boolean supportsAutoRefresh()Returns true if this content provider supports auto refresh feature.- Specified by:
supportsAutoRefresh
in interfaceIRefreshable
- Returns:
- true when auto refresh is supported
- See Also:
-
getMaxAllowedToAccept
public int getMaxAllowedToAccept()Returns max number of users allowed to accept a task. Default = 1- Specified by:
getMaxAllowedToAccept
in interfaceITaskContentProvider
-
setMaxAllowedToAccept
public void setMaxAllowedToAccept(int maxAllowedToAccept) Sets max number of users allowed to accept a task- Specified by:
setMaxAllowedToAccept
in interfaceITaskContentProvider
-
getNeedAcceptToUpdate
public boolean getNeedAcceptToUpdate()Returns needAcceptToUpdate flag- Specified by:
getNeedAcceptToUpdate
in interfaceITaskContentProvider
-
setNeedAcceptToUpdate
public void setNeedAcceptToUpdate(boolean needAcceptToUpdate) Sets needAcceptToUpdate flag- Specified by:
setNeedAcceptToUpdate
in interfaceITaskContentProvider
- Parameters:
needAcceptToUpdate
- true means user must first accept a task before updating it
-
cancelTask
Cancels current task. This will set status of task to "cancelled"- Specified by:
cancelTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
deleteTask
Deletes a task- Specified by:
deleteTask
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
getCurrentUserID
Returns ID of the current user- Specified by:
getCurrentUserID
in interfaceITaskContentProvider
- Throws:
ContentProviderException
-
newTaskData
Creates new instance of task business data. This must be overridden as each task type implements its business data in its unique class- Returns:
- business data object
- Throws:
ContentProviderException
-
isCurrentUserAccepted
Check whether current user accepted the task.- Returns:
- return true if the current user accpted the task.
- Throws:
Exception
-
getTaskServiceProvider
-