Class AssuringWorklistUpdate
- java.lang.Object
-
- de.aristaflow.adept2.model.common.defaultimplementation.DefaultUserAttributeContainer
-
- de.aristaflow.adept2.model.common.defaultimplementation.SerialisableUserAttributeContainer
-
- de.aristaflow.adept2.model.worklistmodel.AssuringWorklistUpdate
-
- All Implemented Interfaces:
UserAttributeContainer
,WorklistUpdate
,Serializable
public class AssuringWorklistUpdate extends de.aristaflow.adept2.model.common.defaultimplementation.SerialisableUserAttributeContainer implements WorklistUpdate
A worklist update may contain soft update types, that is, it is unclear whether an item is added or changed or removed or not present at all. This stems from using filters making the previous status of the item undecidable. When first incorporating an update into a worklist, this is decidable. For the subsequent users of theWorklistUpdate
, for instanceClientWorklistListener
, the soft state can be assured and a hard state can be set using this class.
This class allows to override the update type of specific worklist items. By assuring the update typesWorklistConstants.WorklistItemUpdateType.ADDED_OR_CHANGED
to eitherWorklistConstants.WorklistItemUpdateType.ADDED
orWorklistConstants.WorklistItemUpdateType.CHANGED
andWorklistConstants.WorklistItemUpdateType.REMOVED_OR_NOTHING
to eitherWorklistConstants.WorklistItemUpdateType.REMOVED
or complete removal of the item from the update.- Author:
- Ulrich Kreher
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected long
initialisationDate
The date of the last initialisation of the worklist.protected Map<ClientWorklistItem,WorklistItemUpdate<ClientWorklistItem>>
itemUpdates
All items of the worklist update in which the types will be set to hard if appropriate.protected int
maxPriority
The highest priority of all items of this update.protected long
sourceRevision
The source revision of the update.protected long
targetRevision
The target revision of the update.protected UUID
worklistID
The worklist ID.
-
Constructor Summary
Constructors Constructor Description AssuringWorklistUpdate(UUID worklistID, long initialisationDate, int maxPriority, long sourceRevision, long targetRevision, Collection<WorklistItemUpdate<ClientWorklistItem>> updates, Map<String,String> userAttributes)
Creates a new wrapper for the designated worklist update allowing to override and assure the update type of specific worklist items.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assureWorklistItemAdded(ClientWorklistItem item)
Sets the worklist update type of the designated worklist item toWorklistConstants.WorklistItemUpdateType.ADDED
.void
assureWorklistItemChanged(ClientWorklistItem item)
Sets the worklist update type of the designated worklist item toWorklistConstants.WorklistItemUpdateType.CHANGED
.void
assureWorklistItemRemoved(ClientWorklistItem item)
Sets the worklist update type of the designated worklist item toWorklistConstants.WorklistItemUpdateType.REMOVED
.void
assureWorklistItemUnknown(ClientWorklistItem item)
Removes the designated worklist item from this worklist update.Collection<WorklistItemUpdate<ClientWorklistItem>>
getAll()
Returns all updates, i.e. the differences from the source revision up to (and including) the target revision.int
getMaxPriority()
Returns the highest priority of this update, that is the highest priority of all items of this update.WorklistRevision
getSourceRevision()
Gets the source revision, i.e. the worklist revision (initialisation date and update count) to which this update can be applied.long
getTargetRevision()
Returns the target revision, i.e. the new revision (update count) the client worklist will have after applying this update.UUID
getWorklistID()
The ID of the worklist for which this update is intended.-
Methods inherited from class de.aristaflow.adept2.model.common.defaultimplementation.DefaultUserAttributeContainer
getUserAttributes, getUserAttributeValue, removeUserAttributeValue, setUserAttributes, setUserAttributeValue, subEquals, subHashCode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.model.common.UserAttributeContainer
getUserAttributes, getUserAttributeValue, removeUserAttributeValue, setUserAttributeValue
-
-
-
-
Field Detail
-
itemUpdates
protected final Map<ClientWorklistItem,WorklistItemUpdate<ClientWorklistItem>> itemUpdates
All items of the worklist update in which the types will be set to hard if appropriate.
-
worklistID
protected final UUID worklistID
The worklist ID.
-
sourceRevision
protected final long sourceRevision
The source revision of the update.
-
targetRevision
protected final long targetRevision
The target revision of the update.
-
initialisationDate
protected final long initialisationDate
The date of the last initialisation of the worklist.
-
maxPriority
protected final int maxPriority
The highest priority of all items of this update.
-
-
Constructor Detail
-
AssuringWorklistUpdate
public AssuringWorklistUpdate(UUID worklistID, long initialisationDate, int maxPriority, long sourceRevision, long targetRevision, Collection<WorklistItemUpdate<ClientWorklistItem>> updates, Map<String,String> userAttributes)
Creates a new wrapper for the designated worklist update allowing to override and assure the update type of specific worklist items.- Parameters:
worklistID
-initialisationDate
-maxPriority
-sourceRevision
-targetRevision
-updates
- The worklist item which to be wrapped and of which to override and assure update types of specific worklist items.userAttributes
-
-
-
Method Detail
-
getWorklistID
public UUID getWorklistID()
Description copied from interface:WorklistUpdate
The ID of the worklist for which this update is intended.- Specified by:
getWorklistID
in interfaceWorklistUpdate
- Returns:
- The ID of the worklist for which this update is intended.
-
getSourceRevision
public WorklistRevision getSourceRevision()
Description copied from interface:WorklistUpdate
Gets the source revision, i.e. the worklist revision (initialisation date and update count) to which this update can be applied. An exception is the initial revision can always be applied (by clearing the list before applying the update). The update contains all changes that have been made to the worklist since the update count of thesource revision
up to (and including) thetarget revision (update count)
.- Specified by:
getSourceRevision
in interfaceWorklistUpdate
- Returns:
- The source revision, i.e. the revision of the worklist (initialisation date and update count) to which this update can be applied.
-
getTargetRevision
public long getTargetRevision()
Description copied from interface:WorklistUpdate
Returns the target revision, i.e. the new revision (update count) the client worklist will have after applying this update.The update contains all changes that have been made to the worklist since the
source revision (update count)
up to (and including) thetarget revision
.Like the source revision the target revision refers to the initialisation date of the worklist.
- Specified by:
getTargetRevision
in interfaceWorklistUpdate
- Returns:
- The target revision, i.e. the new revision the client worklist will have after applying this update.
-
getMaxPriority
public int getMaxPriority()
Description copied from interface:WorklistUpdate
Returns the highest priority of this update, that is the highest priority of all items of this update. This also includes removed items! In case of an empty complete update (source revision 0), the priority will beWorklistConstants.Priority.NORMAL
.- Specified by:
getMaxPriority
in interfaceWorklistUpdate
- Returns:
- The highest priority of all items of this update.
-
getAll
public Collection<WorklistItemUpdate<ClientWorklistItem>> getAll()
Description copied from interface:WorklistUpdate
Returns all updates, i.e. the differences from the source revision up to (and including) the target revision. The map contains all worklist items including the ones which are deleted since the source revision.The returned collection is unmodifiable.
When compiling the individual recorded updates into a worklist update, the case when there are multiple recorded updates for the same worklist item (i.e. same ID, not necessarily same state) needs special attention. In this case the recorded updates need to be compressed, since a worklist update may only contain one update per worklist item. It is assumed, that every revision only contains one added, removed or changed worklist item. To compress these individual updates, only the first (since the source revision) and the last recorded update of a certain worklist item need to be considered: The state of the client worklist item (which is the key of the map), is the state at the time of its last update.
TheWorklistConstants.WorklistItemUpdateType
(which is the value in the map) is determined by looking at the type of the first and the last recorded update for that item. The following shows the relevant combinations and their results.How different worklist item update types aggregate. type of first recorded update type of last recorded update resulting update type ADDED CHANGED ADDED ADDED REMOVED omit (NOTHING) ADDED ADDED_OR_CHANGED ADDED ADDED REMOVED_OR_NOTHING omit (NOTHING) CHANGED CHANGED CHANGED CHANGED REMOVED REMOVED CHANGED ADDED_OR_CHANGED CHANGED CHANGED REMOVED_OR_NOTHING REMOVED REMOVED ADDED CHANGED REMOVED ADDED_OR_CHANGED CHANGED REMOVED REMOVED_OR_NOTHING REMOVED ADDED_OR_CHANGED CHANGED ADDED_OR_CHANGED ADDED_OR_CHANGED REMOVED REMOVED_OR_NOTHING ADDED_OR_CHANGED ADDED_OR_CHANGED ADDED_OR_CHANGED ADDED_OR_CHANGED REMOVED_OR_NOTHING REMOVED_OR_NOTHING REMOVED_OR_NOTHING ADDED ADDED_OR_CHANGED REMOVED_OR_NOTHING ADDED_OR_CHANGED ADDED_OR_CHANGED REMOVED_OR_NOTHING REMOVED_OR_NOTHING REMOVED_OR_NOTHING - Specified by:
getAll
in interfaceWorklistUpdate
- Returns:
- The updates / differences between source and target revision.
-
assureWorklistItemAdded
public void assureWorklistItemAdded(ClientWorklistItem item)
Sets the worklist update type of the designated worklist item toWorklistConstants.WorklistItemUpdateType.ADDED
. The designated worklist originally had the update typeWorklistConstants.WorklistItemUpdateType.ADDED_OR_CHANGED
. Assuring the update simplifies worklist update handling since soft states are eliminated.- Parameters:
item
- The worklist item which had the soft update typeWorklistConstants.WorklistItemUpdateType.ADDED_OR_CHANGED
and has effectively been added. This changes its update type toWorklistConstants.WorklistItemUpdateType.ADDED
.
-
assureWorklistItemChanged
public void assureWorklistItemChanged(ClientWorklistItem item)
Sets the worklist update type of the designated worklist item toWorklistConstants.WorklistItemUpdateType.CHANGED
. The designated worklist originally had the update typeWorklistConstants.WorklistItemUpdateType.ADDED_OR_CHANGED
. Assuring the update simplifies worklist update handling since soft states are eliminated.- Parameters:
item
- The worklist item which had the soft update typeWorklistConstants.WorklistItemUpdateType.ADDED_OR_CHANGED
and has effectively been changed. This changes its update type toWorklistConstants.WorklistItemUpdateType.CHANGED
.
-
assureWorklistItemRemoved
public void assureWorklistItemRemoved(ClientWorklistItem item)
Sets the worklist update type of the designated worklist item toWorklistConstants.WorklistItemUpdateType.REMOVED
. The designated worklist originally had the update typeWorklistConstants.WorklistItemUpdateType.REMOVED_OR_NOTHING
. Assuring the update simplifies worklist update handling since soft states are eliminated.- Parameters:
item
- The worklist item which had the soft update typeWorklistConstants.WorklistItemUpdateType.REMOVED_OR_NOTHING
and has effectively been removed. This changes its update type toWorklistConstants.WorklistItemUpdateType.REMOVED
.
-
assureWorklistItemUnknown
public void assureWorklistItemUnknown(ClientWorklistItem item)
Removes the designated worklist item from this worklist update. The designated worklist originally had the update typeWorklistConstants.WorklistItemUpdateType.REMOVED_OR_NOTHING
. Assuring the update simplifies worklist update handling since soft states are eliminated.- Parameters:
item
- The worklist item which had the soft update typeWorklistConstants.WorklistItemUpdateType.REMOVED_OR_NOTHING
and has effectively been unknown before. This removes the worklist item from this update.S
-
-