Package wt.change2.constraints
Class ChangeMgmtConstraintHelper
java.lang.Object
wt.change2.constraints.ChangeMgmtConstraintHelper
Change Management helper for creating links for a change object and a
changeable objects that have association constraints. The helper wraps the
association constraints service in order to get the correct link type
definition for a base link class and validates that the change object to
changeable relation is valid.
To create a change link that supported with association constraints the
recommended order of operations is:
Steps 2 and 3 are optional steps if setting attributes on the link is not needed or required. The type definition reference needs to be set in order set soft attributes defined on a soft type link.
The following change links are currently supported:
Supported API: true
Extendable: false
- Create a new instance of the link setting the change item role and the changeable role.
- (Optional) Set any initial or required attributes on the typed link.
- Call the change service to store the link associations
ChangeHelper2.service.storeAssocations(ChangeItemIfc, WTCollection)to save the link or collection of links.
Steps 2 and 3 are optional steps if setting attributes on the link is not needed or required. The type definition reference needs to be set in order set soft attributes defined on a soft type link.
The following change links are currently supported:
- wt.change2.RelevantAnalysisData
- wt.change2.RelevantRequestData2
- wt.change2.ChangeRecord2
- wt.change2.AffectedActivityData
- wt.change2.ReportedAgainst
- wt.change2.HangingChangeLink
Supported API: true
Extendable: false
-
Method Summary
Modifier and TypeMethodDescriptionstatic TypeIdentifiergetLinkType(Class<?> baseLinkClass, TypeIdentifier changeItemType, WTContainerRef containerRef) Attempts to get the type for the change item and the base link class from a cache.static WTCollectiongetValidChangeables(TypeIdentifier changeItemType, Class<?> baseLinkClass, WTCollection changeables, WTContainerRef containerRef) Validate that the collection of changeables are valid types for the association of the base link class and the change object.static WTCollectiongetValidChangeables(ChangeItem changeItem, Class<?> baseLinkClass, WTCollection changeables, WTContainerRef containerRef) Validate that the collection of changeables are valid types for the association of the base link class and the change object.static List<TypeIdentifier>getValidChangeableTypes(TypeIdentifier tid, Class<?> baseLinkClass, WTContainerRef containerRef) Given the baseLinkClass and the change item returns a list of all the valid changeable objects for the association.static List<TypeIdentifier>getValidChangeableTypes(ChangeItem changeItem, Class<?> baseLinkClass) Given the baseLinkClass and the change item returns a list of all the valid changeable objects for the association.static voidvalidateConstraints(WTCollection links) Validates that the change item and the link object are valid association types.
-
Method Details
-
validateConstraints
Validates that the change item and the link object are valid association types. If no valid types are found then all Changeable2 object types are valid. No valid type indicates that there are not constraints defined for the link.
Supported API: true- Parameters:
link-changeItem-changeables-- Throws:
WTException
-
getValidChangeableTypes
public static List<TypeIdentifier> getValidChangeableTypes(ChangeItem changeItem, Class<?> baseLinkClass) throws WTException Given the baseLinkClass and the change item returns a list of all the valid changeable objects for the association. If no valid types are found then all Changeable2 object types are valid. No valid types indicates that there are no constraints defined for the link.
Supported API: true- Parameters:
changeItem-baseLinkClass-- Returns:
- Throws:
WTException
-
getValidChangeableTypes
public static List<TypeIdentifier> getValidChangeableTypes(TypeIdentifier tid, Class<?> baseLinkClass, WTContainerRef containerRef) throws WTException Given the baseLinkClass and the change item returns a list of all the valid changeable objects for the association. If no valid types are found then all Changeable2 object types are valid. No valid types indicates that there are no constraints defined for the link.
Supported API: true- Parameters:
changeItem-baseLinkClass-- Returns:
- Throws:
WTException
-
getValidChangeables
public static WTCollection getValidChangeables(ChangeItem changeItem, Class<?> baseLinkClass, WTCollection changeables, WTContainerRef containerRef) throws WTException Validate that the collection of changeables are valid types for the association of the base link class and the change object. The return collection contains only the valid changeables for the association.
Supported API: true- Parameters:
changeItem-baseLinkClass-changeables-- Returns:
- the valid changeables for the association
- Throws:
WTException
-
getValidChangeables
public static WTCollection getValidChangeables(TypeIdentifier changeItemType, Class<?> baseLinkClass, WTCollection changeables, WTContainerRef containerRef) throws WTException Validate that the collection of changeables are valid types for the association of the base link class and the change object. The return collection contains only the valid changeables for the association.
Supported API: true- Parameters:
changeItemType-baseLinkClass-changeables-containerRef-- Returns:
- the valid changeables for the association
- Throws:
WTException
-
getLinkType
public static TypeIdentifier getLinkType(Class<?> baseLinkClass, TypeIdentifier changeItemType, WTContainerRef containerRef) throws WTException Attempts to get the type for the change item and the base link class from a cache. If the type is not in the cache it will attempt to get the type from the association constraint service. If no constraints have been defined for the link then the type identifier for the base link class passed is returned.
Supported API: true- Parameters:
baseLinkClass-changeItem-- Returns:
- the type identifier for the association link
- Throws:
WTException
-