Class DefaultResultingChangeEventHandler

All Implemented Interfaces:
KeyedEventListener

public class DefaultResultingChangeEventHandler extends ResultingChangeEventHandler
This default implementation for processing the events that can change the resulting change status of changeable.

Supported API: true
Extended API: true
See Also:
  • 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:
      WTException
      WTPropertyVetoException
    • 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:
      WTException
      WTPropertyVetoException
    • handleEvent_REASSIGN

      public void handleEvent_REASSIGN(WTCollection targets) throws WTException, WTPropertyVetoException
      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:
      WTException
      WTPropertyVetoException
    • handleEvent_INSERT

      public void handleEvent_INSERT(WTCollection targets) throws WTException, WTPropertyVetoException
      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:
      WTException
      WTPropertyVetoException
    • handleEvent_REMOVE

      public void handleEvent_REMOVE(WTCollection targets) throws WTException, WTPropertyVetoException
      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:
      WTException
      WTPropertyVetoException
    • 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:
      notifyVetoableMultiObjectEvent in interface KeyedEventListener
      Overrides:
      notifyVetoableMultiObjectEvent in class ChangeStatusEventHandler
      Parameters:
      event -
      Throws:
      WTException - thrown if any abnormal processing occurs.
      WTPropertyVetoException - thrown if any abnormal processing occurs.
    • getEventRegisterProperty

      protected final String getEventRegisterProperty()
      Returns the property "wt.change2.ResultingChangeEventHandler.events" to register the events for resulting change in wt.properties.

      Supported API: true
      Specified by:
      getEventRegisterProperty in class ChangeStatusEventHandler
    • 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:
      calculate in class ChangeStatusEventHandler
      Parameters:
      changeables - - the list containing object identifiers of changeables for which the calculation needs to be performed
      changeItem - - 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 a true value. Only sets the Changeable2.HAS_RESULTING_CHANGE attributes.

      Supported API: true
      Specified by:
      getChangeablesToSetIndicator in class ChangeStatusEventHandler
      Returns:
      StatementSpec - the defined statement spec for retrieve the changeable branch ids.
      Throws:
      WTException
      WTPropertyVetoException
    • getChangeablesToResetIndicator

      public QuerySpec getChangeablesToResetIndicator() 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 to false. Only resets the Changeable2.HAS_RESULTING_CHANGE attributes.

      Supported API: true
      Specified by:
      getChangeablesToResetIndicator in class ChangeStatusEventHandler
      Returns:
      query spec - the defined query for retrieve the changeable branch ids.
      Throws:
      WTException
      WTPropertyVetoException
    • 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 to false. 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:
      getChangeablesToResetIndicator in class ChangeStatusEventHandler
      Parameters:
      changeItems - - the set of changeItems to consider for the reset
      Returns:
      query spec - the defined query for retrieve the changeable branch ids.
      Throws:
      WTException
      WTPropertyVetoException