Package wt.change2.listeners
Class DefaultResultingChangeEventHandler
java.lang.Object
wt.services.ServiceEventListenerAdapter
wt.change2.listeners.ChangeStatusEventHandler
wt.change2.listeners.ResultingChangeEventHandler
wt.change2.listeners.DefaultResultingChangeEventHandler
- All Implemented Interfaces:
KeyedEventListener
This default implementation for processing the events that can change the
resulting change status of changeable.
Supported API: true
Extended API: true
Supported API: true
Extended API: true
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor
Supported API: true -
Method Summary
Modifier and TypeMethodDescriptioncalculate(Collection<Long> changeables, ChangeItem changeItem) This method calculates the change status indicator for a collection of changeables.This method returns the query spec that would get the branch identifiers of changeables for which the change status indicator is set in the database and the change status indicator should be updated tofalse.getChangeablesToResetIndicator(WTCollection changeItems) This method returns the query spec that would get the branch identifiers of changeables for which the change status indicator is set in the database and the change status indicator should be updated tofalse.getChangeablesToSetIndicator(WTCollection changeItems) This method returns the query spec that would get the branch identifiers of changeables that the change status indicator is NOT set in the database and the change status indicator should be updated to atruevalue.protected final StringReturns the property "wt.change2.ResultingChangeEventHandler.events" to register the events for resulting change inwt.properties.voidhandleEvent_INSERT(WTCollection targets) HandleEvent method for the INSERT event for the default implementation.voidhandleEvent_NEW_VERSION(WTCollection targets) HandleEvent method for the NEW_VERSION event for the default implementation.voidhandleEvent_REASSIGN(WTCollection targets) HandleEvent method for the REASSIGN event for the default implementation.voidhandleEvent_REMOVE(WTCollection targets) HandleEvent method for the REMOVE event for the default implementation.voidhandleEvent_STATE_CHANGE(WTCollection targets) HandleEvent method for the STATE_CHANGE event for the default implementation.voidCalls the notify vetoable multi-object of the super class.Methods inherited from class wt.change2.listeners.ResultingChangeEventHandler
appendChangeNoticeConditionMethods inherited from class wt.change2.listeners.ChangeStatusEventHandler
appendByChangeables, appendByChangeItem, appendLatestChangeCondition, buildCompoundQuerySpec, buildCompoundQuerySpec2, buildJoinQuerySpec, getChangeableQueryClass, getChangeables, getChangeables, getGeneratedEventKeys, setChangeableQueryClass, updateChangeStatus, updateChangeStatus
-
Constructor Details
-
DefaultResultingChangeEventHandler
public DefaultResultingChangeEventHandler()Default constructor
Supported API: true- Throws:
WTException
-
-
Method Details
-
handleEvent_NEW_VERSION
public void handleEvent_NEW_VERSION(WTCollection targets) throws WTException, WTPropertyVetoException HandleEvent method for the NEW_VERSION event for the default implementation.
On a Revise event of a change object, if the change object of the latest revision is in a non-resulting state, and the predecessor version is in a resulting state, we would recalculate to determine if the changeable objects are resulting by the any other changes and update the flag accordingly.
On a revise of a changeable, the resulting change is reset
Supported API: true- Parameters:
targets-- Throws:
WTExceptionWTPropertyVetoException
-
handleEvent_STATE_CHANGE
public void handleEvent_STATE_CHANGE(WTCollection targets) throws WTException, WTPropertyVetoException HandleEvent method for the STATE_CHANGE event for the default implementation.
On a state Change event, where the change item moves from non resulting to resulting, if the changeable objects as resulting data do not have resulting change due to other changes, it will set resulting change flag to true.
When the change moves to non-resulting state the resulting data is calculated to determine if the changeable is resulting in any other changes.
Supported API: true- Parameters:
targets-- Throws:
WTExceptionWTPropertyVetoException
-
handleEvent_REASSIGN
HandleEvent method for the REASSIGN event for the default implementation.
On a Reassign of the life cycle event which in turn could set the state of the target object, the resulting change needs to be reflected appropriately.
If the change item is set to a resulting state and the changeable objects as resulting data do not have resulting change due to other changes, it will set resulting change flag to true.
If the change is set to non-resulting state the changeable objects as resulting data is calculated to determine if the changeable is resulting in any other changes.
Supported API: true- Parameters:
targets-- Throws:
WTExceptionWTPropertyVetoException
-
handleEvent_INSERT
HandleEvent method for the INSERT event for the default implementation.
On an insert of an resulting data link, if the changeable does not have a resulting change by other changes, it will set resulting change flag to true.
Supported API: true- Parameters:
targets-- Throws:
WTExceptionWTPropertyVetoException
-
handleEvent_REMOVE
HandleEvent method for the REMOVE event for the default implementation.
On a Remove of resulting data links, the changeable objects are recalculated to determine if it is resulting in other changes and update the flag accordingly.
On the removal of latest revision of a change item, the resulting change flag would be calculated based on the life cycle state of the predecessor version of change item.
Supported API: true- Parameters:
targets-- Throws:
WTExceptionWTPropertyVetoException
-
notifyVetoableMultiObjectEvent
public void notifyVetoableMultiObjectEvent(Object event) throws WTException, WTPropertyVetoException Calls the notify vetoable multi-object of the super class. If this class is extended for customization make sure that this method is overridden as shown -@Override public void notifyVetoableMultiObjectEvent(Object event) throws Exception { super.notifyVetoableMultiObjectEvent(event); }
Supported API: true- Specified by:
notifyVetoableMultiObjectEventin interfaceKeyedEventListener- Overrides:
notifyVetoableMultiObjectEventin classChangeStatusEventHandler- Parameters:
event-- Throws:
WTException- thrown if any abnormal processing occurs.WTPropertyVetoException- thrown if any abnormal processing occurs.
-
getEventRegisterProperty
Returns the property "wt.change2.ResultingChangeEventHandler.events" to register the events for resulting change inwt.properties.
Supported API: true- Specified by:
getEventRegisterPropertyin classChangeStatusEventHandler
-
calculate
protected HashMap<Long,Boolean> calculate(Collection<Long> changeables, ChangeItem changeItem) throws WTException This method calculates the change status indicator for a collection of changeables. The implementation class for the change status indicator should implement the business logic to calculate the value of the indicator (true/false) for the given changeables. The change item may be specified if it is required for the calculation. For some calculations, the change item might be needed to exclude changeables due to the change item. Only calculates for Changeable2.HAS_RESULTING_CHANGE.
Supported API: true- Specified by:
calculatein classChangeStatusEventHandler- Parameters:
changeables- - the list containing object identifiers of changeables for which the calculation needs to be performedchangeItem- - the change item that has to be excluded/included in the calculation.- Returns:
- map where the keys are the object identifiers and the value indicates if the change status is on or off. The map key size should be equal to the size of the changeable collection.
- Throws:
WTException
-
getChangeablesToSetIndicator
public StatementSpec getChangeablesToSetIndicator(WTCollection changeItems) throws WTException, WTPropertyVetoException This method returns the query spec that would get the branch identifiers of changeables that the change status indicator is NOT set in the database and the change status indicator should be updated to atruevalue. Only sets the Changeable2.HAS_RESULTING_CHANGE attributes.
Supported API: true- Specified by:
getChangeablesToSetIndicatorin classChangeStatusEventHandler- Returns:
- StatementSpec - the defined statement spec for retrieve the changeable branch ids.
- Throws:
WTExceptionWTPropertyVetoException
-
getChangeablesToResetIndicator
This method returns the query spec that would get the branch identifiers of changeables for which the change status indicator is set in the database and the change status indicator should be updated tofalse. Only resets the Changeable2.HAS_RESULTING_CHANGE attributes.
Supported API: true- Specified by:
getChangeablesToResetIndicatorin classChangeStatusEventHandler- Returns:
- query spec - the defined query for retrieve the changeable branch ids.
- Throws:
WTExceptionWTPropertyVetoException
-
getChangeablesToResetIndicator
public QuerySpec getChangeablesToResetIndicator(WTCollection changeItems) throws WTException, WTPropertyVetoException This method returns the query spec that would get the branch identifiers of changeables for which the change status indicator is set in the database and the change status indicator should be updated tofalse. Only resets the Changeable2.HAS_RESULTING_CHANGE attributes. It will only consider doing the reset for the specified change items passed into the API in the WTCollection.
Supported API: true- Specified by:
getChangeablesToResetIndicatorin classChangeStatusEventHandler- Parameters:
changeItems- - the set of changeItems to consider for the reset- Returns:
- query spec - the defined query for retrieve the changeable branch ids.
- Throws:
WTExceptionWTPropertyVetoException
-