Package wt.impact
Class ImpactedDelegate
java.lang.Object
wt.impact.ImpactDelegate
wt.impact.ImpactedDelegate
- All Implemented Interfaces:
Serializable,Comparable<ImpactDelegate>
- Direct Known Subclasses:
LotBaselineImpactedDelegate,ManagedBaselineImpactedDelegate
Delegate used to abstract the behavior of
Supported API: true
Extendable: true
Impacted objects.
All extended delegates must implement constructors:
- A constructor with no arguments that calls
super(). - A constructor with only an Impacted argument that calls
super(impacted).
Concrete delegate implementations must be registered in the service.properties file as:
<Service context="default" name="wt.impact.ImpactedDelegate">
<Option selector="order-number" cardinality="duplicate"
serviceClass="delegate-class-name"
requestor="impacted-class-name"/<
</Service>
Where:
order-number = Integer value defining the ascending order in
which this delegate is applied (e.g., "10").
delegate-class-name = Full class name of this delegate.
impacted-class-name = Full class name of the Impacted object
that this delegate supports.
Supported API: true
Extendable: true
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImpactedDelegate(WTCollection impacteds) Construct ImpactedDelegate for a collection of Impacted objects.ImpactedDelegate(Impacted impacted) Construct ImpactedDelegate for an Impacted object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn true to allow multiple Impacted objects to be served by a single ImpactedDelegate instance, or false to force a separate ImpactedDelegate instance for each Impacted object.protected booleanapplyImpactIntent(ImpactIntentType intent, Impacted impacted, WTSet impactObjs) Apply the specified intent of the impacting objects on the impacted object.protected booleanApply impacts to allImpactedobjects represented by an extended delegate.final booleanapplyImpacts(ImpactorDelegate impactorDelegate) Apply impacts to allImpactedobjects represented by this delegate.protected booleancompatibleOneOffs(Object version1, Object version2) Returns true if any of the following are true: Both versions are one-off versions (i.e., implementOneOffVersionedand have a non-null one-off version identifier). Neither version is a one-off version. Returns false if none of the above are true.protected WTSetdetermineLaterRevisions(WTValuedMap newToExistingRevisionMap) Determine if an existing baseline member revision should be replaced with a new, later revision.protected booleanequivalentViews(Object version1, Object version2) Returns true if any of the following are true: Both versions implementViewManageableand they have the same view. Both versions implement ViewManageable and both views are null.. Neither version implements ViewManageable. Returns false if none of the above are true.protected WTSetFilter outImpactedobjects that should not have any impacts applied.protected booleanfilterImpactingObject(Persistable persistable) Given an impacting object, choose whether or not to filter it out of applyImpact processing before it occurs.protected voidfilterImpactingObjects(WTKeyedMap impactToIntentMap) Filter out impacting object map entries that are not handled by a delegate implementation.protected voidfinalizeApplyImpacts(boolean beforeCommit) Finalize the apply impacts process.final WTSetReturn the immutable Impacted object set for this delegate (guaranteed non-null, may be empty).protected List<ImpactIntentType>Get the order in which to apply the intents.abstract Set<TypeIdentifier>Return immutable set of TypeIdentifier objects defining the supportedImpactortypes (may be null or empty).Return immutable set of TypeIdentifier objects defining the unsupportedImpactorsub-types (may be null or empty).protected voidInitialize the apply impacts process.protected voidinitializeApplyImpacts(Map<ImpactIntentType, WTSet> intentToImpactsMap) Initialize the apply impacts process.protected final Map<ImpactIntentType,WTSet> invertImpactIntentMap(WTKeyedMap impactToIntentMap) Invert an impact-intent map and assign default intents.final booleanisSupported(TypeIdentifier impactorTypeId, Object container) Determine if an Impactor type is supported by this delegate.final booleanisSupported(Impactor impactor, Object container) Determine if an Impactor object is supported by this delegate.Methods inherited from class wt.impact.ImpactDelegate
compareTo, filterCopyFowardForNewIteration, filterCopyFowardForNewRevision, filterLinks, getExcludedTypes, getImpactClass, getRegisteredClass, getSelector, getSingleExcludedTypes, isCreateRuleValidationEnabled, isNewIterationCopyForwardEnabled, isNewRevisionCopyForwardEnabled, isRemoveRuleValidationEnabled
-
Constructor Details
-
ImpactedDelegate
Construct ImpactedDelegate for an Impacted object.
Supported API: true -
ImpactedDelegate
Construct ImpactedDelegate for a collection of Impacted objects.
Supported API: true
-
-
Method Details
-
allowMultipleImpacteds
public boolean allowMultipleImpacteds()Return true to allow multiple Impacted objects to be served by a single ImpactedDelegate instance, or false to force a separate ImpactedDelegate instance for each Impacted object.Allowing multiple Impacted objects per delegate may improve the performance of the applyXXX() methods, depending on how they are implemented. If disallowed then ordering delegates by individual Impacted object attribute values is possible.
If false is returned then attempts to add more than one Impacted object to a delegate will cause an exception to be thrown.
Supported API: true -
getImpacteds
Return the immutable Impacted object set for this delegate (guaranteed non-null, may be empty).
Supported API: true -
getSupportedImpactorTypes
Return immutable set of TypeIdentifier objects defining the supportedImpactortypes (may be null or empty). All sub-types of those returned will be supported automatically.
Supported API: true- Returns:
- Set of supported impactor types (null or empty for none).
- Throws:
WTException
-
getUnsupportedImpactorTypes
Return immutable set of TypeIdentifier objects defining the unsupportedImpactorsub-types (may be null or empty). Unsupported sub-types, and all of their sub-types, are subtracted from the set of supported types.
Supported API: true- Returns:
- Set of unsupported impactor types (null or empty for none).
- Throws:
WTException
-
isSupported
public final boolean isSupported(TypeIdentifier impactorTypeId, Object container) throws WTException Determine if an Impactor type is supported by this delegate.
Supported API: true- Parameters:
impactorTypeId- TypeIdentifier of Impactor object.container- WTContained or WTContainerRef object used to derive the association rule's organization or site context (must be non-null).- Returns:
- True if Impactor type is supported by this delegate.
- Throws:
WTException
-
isSupported
Determine if an Impactor object is supported by this delegate.
Supported API: true- Parameters:
impactor- Impactor object.container- WTContained or WTContainerRef object used to derive the association rule's organization or site context. If null then the Impactor object's container is used.- Returns:
- True if Impactor object is supported by this delegate.
- Throws:
WTException
-
applyImpacts
Apply impacts to allImpactedobjects represented by this delegate.Extended delegate implementations are provided by overriding method
applyImpacts(), or one of its subordinate methods.
Supported API: true- Parameters:
impactorDelegate- ImpactorDelegate implementation for anImpactorobject. If the delegate is for and unsupported Impactors then an error message is logged and false is returned.- Returns:
- True if impacts were applied, false if not.
- Throws:
WTException
-
applyImpacts
Apply impacts to allImpactedobjects represented by an extended delegate. May be overridden by extended delegates to meet specific requirements.Default order of execution:
- Call
initializeApplyImpacts()to initialize the apply process - Call
filterImpactedsForApply()to remove Impacted objects that should not be applied - Call
ImpactorDelegate.getImpactIntents()to get impact-to-intent map - Call
filterImpactingObjects(WTKeyedMap)to filter out unsupported impacting objects - Call
invertImpactIntentMap(WTKeyedMap)to create inverted impact-to-intent map with default intents added - Start transaction
- Call
initializeApplyImpacts(Map)to initialize the apply process immediately after the transaction is started - Iterate over all Impacted objects {
- Iterate over all intent values returned from
getIntentApplyOrder(){ - Call
applyImpactIntent(ImpactIntentType, Impacted, WTSet)for the current intent value - }
- }
- Call
finalizeApplyImpacts(boolean)passing true to finalize the apply process before transaction commit - Commit transaction
- Call
finalizeApplyImpacts(boolean)passing false to finalize the apply process after transaction commit
Supported API: true- Returns:
- True if impacts were applied, false if not.
- Throws:
WTException
- Call
-
initializeApplyImpacts
Initialize the apply impacts process. The default implementation does nothing. Extended delegates may override this method to implement required pre-processing. This method is called before any apply processing is performed.
Supported API: true- Throws:
WTException
-
initializeApplyImpacts
protected void initializeApplyImpacts(Map<ImpactIntentType, WTSet> intentToImpactsMap) throws WTExceptionInitialize the apply impacts process. The default implementation does nothing. Extended delegates may override this method to implement required pre-processing. This method is called immediately after the database transaction is started.
Supported API: true- Parameters:
intentToImpactsMap- Map of ImpactIntentType value to a set of impact objects for that intent. Map is guaranteed non-null, but may be empty. It will only contain entries for intent values actually present in the input map and returned bygetIntentApplyOrder().- Throws:
WTException
-
finalizeApplyImpacts
Finalize the apply impacts process. The default implementation does nothing. Extended delegates may override this method to implement required post-processing. This method is called twice: immediately before and after database transaction commit.
Supported API: true- Parameters:
beforeCommit- True when called before transaction commit, and false when called after transaction commit.- Throws:
WTException
-
filterImpactedsForApply
Filter outImpactedobjects that should not have any impacts applied. The default implementation does no filtering. Extended delegates may override this method to filter out Impacted objects that should not be modified. For example, this method may be overridden to remove access controlled Impacted objects that are not modifiable. Extended delegates are not allowed to add additional Impacted objects to the set.
Supported API: true- Returns:
- Set of filtered Impacted objects.
- Throws:
WTException
-
filterImpactingObjects
Filter out impacting object map entries that are not handled by a delegate implementation. The default implementation does no filtering. Extended delegates may override this method and filter out impacting object they cannot handle. This method is called early in the apply impacts process in order to reduce map size.
Supported API: true- Parameters:
impactToIntentMap- Map of impacting objects to their ImpactIntentType values. Impacting objects may be theImpactIntentobject itself, or an object associated with it.- Throws:
WTException
-
filterImpactingObject
Given an impacting object, choose whether or not to filter it out of applyImpact processing before it occurs. Return true to filter out this impacted object from the list of impacted objects, otherwise return false. By default this just returns false and no objects will be filtered. Extending delegates can override this method to filter out impacted objects that may be invalid prior to applying the impact.
Supported API: true- Parameters:
persistable- Impacting object to filter- Returns:
- boolean true to filter the given object out
- Throws:
WTException
-
getIntentApplyOrder
Get the order in which to apply the intents. The intents are applied in the ordered specified by the returned list. If the list does not contain a specific intent value then that intent will not be applied. Extended delegates may override this method and specify a different order.Default order:
- None
- Remove
- Replace
- Add
- Add or Replace Latest
Supported API: true- Returns:
- Ordered list of ImpactIntentType values.
- Throws:
WTException
-
applyImpactIntent
protected boolean applyImpactIntent(ImpactIntentType intent, Impacted impacted, WTSet impactObjs) throws WTException Apply the specified intent of the impacting objects on the impacted object. If an extended delegate does not support the specified intent then it should just return false.
Supported API: true- Parameters:
intent- Impact intent to be applied (guaranteed non-null).impacted-Impactedobject on which to apply the impact (guaranteed non-null).impactObjs- Set of impacting objects to be applied (guaranteed non-empty).- Returns:
- True if one or more impacting objects was applied to the impacted object.
- Throws:
WTException
-
invertImpactIntentMap
protected final Map<ImpactIntentType,WTSet> invertImpactIntentMap(WTKeyedMap impactToIntentMap) throws WTException Invert an impact-intent map and assign default intents. The inversion process will also filter out map entries for intent values that will not be applied.
Supported API: true- Parameters:
impactToIntentMap- Map of impact object to itsImpactIntentTypevalue.- Returns:
- Map of ImpactIntentType value to a set of impact objects for that intent.
The impact object sets will have the same type of WTReference as the input map.
Map is guaranteed non-null, but may be empty. It will only contain entries for
intent values actually present in the input map and returned by
getIntentApplyOrder(). - Throws:
WTException
-
determineLaterRevisions
Determine if an existing baseline member revision should be replaced with a new, later revision.
Supported API: true- Parameters:
newToExistingRevisionMap- Map of new revision to existing member revision (will be inflated).- Returns:
- Set of new revisions that are later than the existing baseline members.
- Throws:
WTException
-
equivalentViews
Returns true if any of the following are true:- Both versions implement
ViewManageableand they have the same view. - Both versions implement ViewManageable and both views are null..
- Neither version implements ViewManageable.
Supported API: true- Throws:
WTException
- Both versions implement
-
compatibleOneOffs
Returns true if any of the following are true:- Both versions are one-off versions (i.e., implement
OneOffVersionedand have a non-null one-off version identifier). - Neither version is a one-off version.
Supported API: true- Throws:
WTException
- Both versions are one-off versions (i.e., implement
-