Package com.ptc.windchill.esi.delegate
Interface ESIBOMDifferenceMangementDelegate
- All Known Implementing Classes:
ESIBOMDifferenceMangementDelegateImpl
public interface ESIBOMDifferenceMangementDelegate
Provides services which can used for customizing the difference calculation of BOM.
Supported API: true
Extendable: true
Supported API: true
Extendable: true
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCurrToPrevUsageLinksEntry(WTPartUsageLink currentUsageLink, Collection<ESIQueryTargetAssociation> queryTargetAssocs, Map<WTPartUsageLink, Set<WTPartUsageLink>> currToPrevUsageLinks) Populates the output Map (in currToPrevUsageLinks) using the input arguments.voidadjustDelta(WTPart part, Collection<Object>[] linkDiff, TreeNavigator navigator, Map<WTPartUsageLink, WTPart>[] delta) Traverses the elements in the input array and populates the output array as appropriate, after allocating memory for a given element in the latter as needed.voidadjustUsage(com.infoengine.object.factory.Element element, String attName, WTPart part, ESITarget target) Update the attribute "Usage" on the input Element using the value defined for the preference "View To BOM Type Mappings".voidcheckAndUpdateRawMaterialLinksForChangedLineNumber(Map<RawMaterialLink, String> rmLinkAttrMap, RawMaterialLink rawMaterialLink, boolean ignoreLineNumbers, Set<RawMaterialLink> chgRMLinksToRemove, Set<RawMaterialLink> addedRMLinks, Set<RawMaterialLink> deletedRMLinks, RawMaterialLink rawMaterialLinkHistory, VdbBuilder builder) Populate the maps appropriately for raw material links if line number is changed.booleancompareAttrsOtherThanLineNumber(WTPartUsageLink partUsageLink, HashMap<String, HashMap<String, String>> attrDiffs) Traverses the input Map looking for changes to any of the attributes other than "Line Number" on the input part usage link.booleancompareFindNumbers(WTPartUsageLink partUsageLink1, WTPartUsageLink partUsageLink2) Compares the findNumber attribute on the two input part usage links and returns a boolean value that indicates the outcome of the comparison.booleancompareQuantities(WTPartUsageLink partUsageLink1, WTPartUsageLink partUsageLink2) Compares the quantity attribute on the two input part usage links and returns a boolean value that indicates the outcome of the comparison.getChildNodes(Persistable object, Map<Persistable, Map<ObjectToObjectLink, Persistable>> roleAObjectAndAssocLinks, boolean immediateOnly) Return the collection of child nodes for input persistable object from specified input input roleAObjectAndAssocLinks map.getLastPublishedUsageLink(Collection<ESIQueryTargetAssociation> latestLinkHistories, WTPart prevPublishedPart, WTPartUsageLink partUsageLink, ESITarget target) Fetches a Collection of ESIQueryTargetAssociations that hold the part usage links that were last published to the input distribution target and returns it to the caller.getLastPublishedUsageLink(WTPart prevPublishedPart, WTPartUsageLink partUsageLink, ESITarget target) Fetches a Collection of ESIQueryTargetAssociations that hold the part usage links that were last published to the input distribution target and returns it to the caller.getPartUsageLinks(Set<Persistable> links) Fetches part usage links
Supported API: truegetRawMaterialLinks(Set<Persistable> links) Return the set of Raw Material links given the set of links Supported API: truegetRealLeafNodes(Collection<Persistable> leafNodes) Return the collection of part that do not have any part usages.voidgetUpdatedRMLinksForChangedAttributes(RawMaterialLink link, RawMaterialLink rawMaterialLinkHistory, Set<RawMaterialLink> changedRMLinks, Set<RawMaterialLink> unchgRMLinksToRemove, Set<RawMaterialLink> addedRMLinks, Set<RawMaterialLink> deletedRMLinks, Map<RawMaterialLink, String> rmLinkAttrMap, VdbBuilder builder) Populate the maps appropriately for raw material links if line number is changed.getUsageLinkWithMatchingCompId(WTPart part, WTPartUsageLink partUsageLink, ESITarget target) Fetches an ESIQueryTargetAssociation object that holds a part usage link associated with the input part, and whose componentId matches that of the input part usage link.
Supported API: truebooleanReturns true if the given part has any children (connected to aWTPartMastervia aWTPartUsageLink) or was ever released by ESI to any target as a BOM.booleanReturns a true if the input part has any children (connected to aWTPartMastervia aWTPartUsageLink), or was ever released by ESI to the input distribution target as a BOM.voidpopulateDelta(Set<Object> links, Map<ObjectToObjectLink, Persistable> linksToRoleBObjects, int type, Map<WTPartUsageLink, WTPart> delta) Populates the Map in delta using the input parameters.HashSet[]retrieveBOMDifferencesForCPLinks(WTPart previousPart, WTPart currentPart, boolean ignoreLineNumbers, ESITarget esiTarget, HashSet<Persistable>[] delta, VdbBuilder builder) Returns a array of Sets (the Sets at indices 0, 1, 2 and 3 hold the added, deleted, changed and unchanged CoProduceMemberLink or CoProduceUsageLink links ,fetched by comparing the currently and previously published links.HashSet[]retrieveBomDifferencesForRMLinks(WTPart previousPart, WTPart currentPart, boolean ignoreLineNumbers, ESITarget esiTarget, HashSet<Persistable>[] delta, VdbBuilder builder) Returns a array of Sets (the Sets at indices 0, 1, 2 and 3 hold the added, deleted, changed and unchanged raw material links respectively, fetched by comparing the currently and previously published raw material links.retrieveBomDifferencesUsingObjComparison(WTPart currentPart, WTPart previousPart, boolean ignoreLineNumbers, Map<WTPartUsageLink, Set<WTPartUsageLink>> currToPrevUsageLinks, ESITarget esiTarget, VdbBuilder builder, Map<WTPartUsageLink, Collection<ESIQueryTargetAssociation>> partUsagesToTargetAssocsMap) Compares the bill of material of the current WTPart iteration with that of a previously published WTPart iteration.
-
Method Details
-
isBom
Returns true if the given part has any children (connected to aWTPartMastervia aWTPartUsageLink) or was ever released by ESI to any target as a BOM. Otherwise returns false
Supported API: true- Parameters:
part- The WTPart to be evaluated.- Returns:
- boolean
- Throws:
WTException
-
isBom
Returns a true if the input part has any children (connected to aWTPartMastervia aWTPartUsageLink), or was ever released by ESI to the input distribution target as a BOM. Otherwise returns a false. If a true was passed in for allViews, iterations of the input part in all views are considered while checking if the part was ever published as a BOM; otherwise, only those iterations that reside in the view of the input part iteration are considered.
Supported API: true- Parameters:
part- Input part to be evaluated.target- Input distribution target.allViews- This is either true or false, according as iterations in all views are to be considered for the database lookup or otherwise respectively.- Returns:
- A true, if the input part iteration has any children, or was ever released to the input distribution target as a BOM; a false, otherwise.
- Throws:
WTException
-
adjustUsage
void adjustUsage(com.infoengine.object.factory.Element element, String attName, WTPart part, ESITarget target) Update the attribute "Usage" on the input Element using the value defined for the preference "View To BOM Type Mappings". This method does the following: 1. Using the number on the input target, fetch the relevant view using the value defined for the preference "View To Distribution Target Mappings". 2. From this view, fetch the usage using the value defined for the preference "View To BOM Type Mappings". 3. Update the "Usage" attribute on the input Element with the thus fetched usage if appropriate. Log a message stating that the usage on the BOM iteration is ignored, if applicable.
Supported API: true- Parameters:
element- - The element to be updated.attName- - The name of the attribute whose value needs to be adjusted.part- - Input part for which usage needs to be updated.target- - Distribution target for which the input part is being rendered.
-
retrieveBomDifferencesUsingObjComparison
Map<String,Object> retrieveBomDifferencesUsingObjComparison(WTPart currentPart, WTPart previousPart, boolean ignoreLineNumbers, Map<WTPartUsageLink, Set<WTPartUsageLink>> currToPrevUsageLinks, ESITarget esiTarget, VdbBuilder builder, Map<WTPartUsageLink, throws WTException, WTPropertyVetoExceptionCollection<ESIQueryTargetAssociation>> partUsagesToTargetAssocsMap) Compares the bill of material of the current WTPart iteration with that of a previously published WTPart iteration. Returns a Map holding the following Strings as keys - "AttributeDifferenceList", "LinksDifferenceList". The value associated with the former is a Map (see the JavaDoc of the API ESIObjectComparisonUtility.computeAttrDifferences() for more information). The value associated with the latter is an array of Sets (the Sets at indices 0, 1, 2 and 3 hold the added, deleted, changed and unchanged part usage and raw material links respectively, fetched by comparing the current and previously published part iterations). Besides, the method optionally populates a Map with currently and previously published part usage links/raw material links.Note: The method is too long and ugly to be maintained. It has to be re-factored.
Supported API: true- Parameters:
currentPart- - Current iteration of the assembly part.previousPart- - Previously published iteration of the assembly part.ignoreLineNumbers- - If true, a change to the LineNumber attribute is ignored. In other words, even if the value of this attribute on a usage link has changed since the link was last published, the link is considered to be an unchanged one.currToPrevUsageLinks- - A Map where each key is a part usage link that is currently being published, and each value is a Set of the corresponding previously published part usage links. Can be null, if the caller does not wish to populate the Map.esiTarget- - The currently processed distribution target.- Returns:
- A Map as mentioned in the method description.
- Throws:
wt.part.LineNumberUsageExceptionWTExceptionWTPropertyVetoException
-
retrieveBomDifferencesForRMLinks
HashSet[] retrieveBomDifferencesForRMLinks(WTPart previousPart, WTPart currentPart, boolean ignoreLineNumbers, ESITarget esiTarget, HashSet<Persistable>[] delta, VdbBuilder builder) throws WTException Returns a array of Sets (the Sets at indices 0, 1, 2 and 3 hold the added, deleted, changed and unchanged raw material links respectively, fetched by comparing the currently and previously published raw material links. Supported API: true- Parameters:
previousPart- - Previously published iteration of the assembly part.currentPart-ignoreLineNumbers- - If true, a change to the LineNumber attribute is ignored. In other words, even if the value of this attribute on a usage link has changed since the link was last published, the link is considered to be an unchanged one.esiTarget- - The currently processed distribution target.builder-- Returns:
- A array of Sets as mentioned in the method description.
- Throws:
wt.part.LineNumberUsageExceptionWTExceptionWTPropertyVetoException
-
retrieveBOMDifferencesForCPLinks
HashSet[] retrieveBOMDifferencesForCPLinks(WTPart previousPart, WTPart currentPart, boolean ignoreLineNumbers, ESITarget esiTarget, HashSet<Persistable>[] delta, VdbBuilder builder) throws WTException Returns a array of Sets (the Sets at indices 0, 1, 2 and 3 hold the added, deleted, changed and unchanged CoProduceMemberLink or CoProduceUsageLink links ,fetched by comparing the currently and previously published links.
Supported API: true- Parameters:
previousPart- - Previously published iteration of the assembly part.currentPart-ignoreLineNumbers- - If true, a change to the LineNumber attribute is ignored. In other words, even if the value of this attribute on a usage link has changed since the link was last published, the link is considered to be an unchanged one.esiTarget- - The currently processed distribution target.builder-- Returns:
- A array of Sets as mentioned in the method description.
- Throws:
wt.part.LineNumberUsageExceptionWTExceptionWTPropertyVetoException
-
compareFindNumbers
Compares the findNumber attribute on the two input part usage links and returns a boolean value that indicates the outcome of the comparison. Supported API: true- Parameters:
partUsageLink1- - First part usage link.partUsageLink2- - Second part usage link.- Returns:
- A true, if findNumber is set on both the input part usage links and are equal, or are both null; a false, otherwise.
-
compareQuantities
Compares the quantity attribute on the two input part usage links and returns a boolean value that indicates the outcome of the comparison. Supported API: true- Parameters:
partUsageLink1- - First part usage link.partUsageLink2- - Second part usage link.- Returns:
- A true, if quantity is set on both the input part usage links and are equal with identical units, or are both null; a false, otherwise.
-
getRealLeafNodes
Return the collection of part that do not have any part usages. Supported API: true- Parameters:
leafNodes- - The collection or part for which part usages needs to be verified and mark object as real leaf node i.e. part having no usages.- Returns:
- - The collection of parts that do not have part usages.
- Throws:
WTException
-
getChildNodes
Collection<Persistable> getChildNodes(Persistable object, Map<Persistable, Map<ObjectToObjectLink, Persistable>> roleAObjectAndAssocLinks, boolean immediateOnly) Return the collection of child nodes for input persistable object from specified input input roleAObjectAndAssocLinks map. Children will be returned provided they are already available in the input map otherwise no data for child will be provided. Supported API: true- Parameters:
object- - The object for which child nodes needs to be fetched.roleAObjectAndAssocLinks- - A Map that holds RoleA object as a key and Map as value. A value map containing associated link as RoleB objects as value.immediateOnly- - A flag that indicate weather to fetch immediate children or indirect child aswell. When specifed as true, API will returns direct child only, otherwise, returns all child nodes.
Example:
P1
+--C1
---+--C11
-------+--C111
---+--C12
+--C2
---+--C21
---+--C22
When immediateOnly specified as 'true' for P1 object then will return C1, C2 is returned in collection.
When immediateOnly specified as 'false' for P1 object then will return C1,C2,C11,C12, C21,C22,C111 is returned in collection.- Returns:
- - The collection of child nodes for input persistable object.
-
getPartUsageLinks
Fetches part usage links
Supported API: true- Parameters:
links- - Part usage links collection that is currently being published.
-
addCurrToPrevUsageLinksEntry
void addCurrToPrevUsageLinksEntry(WTPartUsageLink currentUsageLink, Collection<ESIQueryTargetAssociation> queryTargetAssocs, Map<WTPartUsageLink, Set<WTPartUsageLink>> currToPrevUsageLinks) Populates the output Map (in currToPrevUsageLinks) using the input arguments. See the parameter descriptions below for more information. Supported API: true- Parameters:
currentUsageLink- - Part usage link that is currently being published.queryTargetAssocs- - Collection of ESIQueryTargetAssociations that represent the release history for previously published part usage links.currToPrevUsageLinks- - The input part usage link is added as a key, and a Set of usage links in the input collection of query target associations is added as a value to this Map. This is done provided the value Set (that is populated by this method) ends up having at least one usage link.
-
compareAttrsOtherThanLineNumber
boolean compareAttrsOtherThanLineNumber(WTPartUsageLink partUsageLink, HashMap<String, HashMap<String, String>> attrDiffs) Traverses the input Map looking for changes to any of the attributes other than "Line Number" on the input part usage link. Returns a boolean depending on whether or not an attribute other than "Line Number" has changed. Supported API: true- Parameters:
partUsageLink- Input part usage link.attrDiffs- A HashMap where each key is a fully qualified class name indicating a type (e.g., "wt.part.WTPartUsageLink") and each value is a Map; each key in this value Map is of the form "<object identifier>_<attribute name>" (for e.g., "wt.part.WTPartMaster:427685_Unit", where wt.part.WTPartMaster:427685 is the object identifier of the role B end of the given part usage link) and each value is the value of the attribute on the usage link (for e.g., "each"). This is populated using the output that results from comparing two BOMs, using the Object Comparison Framework.- Returns:
- A true, if no attribute other than "Line Number" has changed as per the contents of the input HashMap; a false, otherwise.
-
getRawMaterialLinks
Return the set of Raw Material links given the set of links Supported API: true- Parameters:
links- - Set of links which can be either WTPartUsageLink or RawMaterialLink- Returns:
- - Set of RawMaterialLinks
-
getLastPublishedUsageLink
Collection<ESIQueryTargetAssociation> getLastPublishedUsageLink(WTPart prevPublishedPart, WTPartUsageLink partUsageLink, ESITarget target) throws WTException Fetches a Collection of ESIQueryTargetAssociations that hold the part usage links that were last published to the input distribution target and returns it to the caller. Supported API: true- Parameters:
prevPublishedPart- Part iteration that was previously published to the input distribution target.partUsageLink- Part usage link that is currently being published. This is one of the inputs used for fetching the output.target- Input distribution target.- Returns:
- Collection of ESIQueryTargetAssociations; for the commonly known use cases, this will be a singleton one. An empty Collection is returned if the last published part usage links could not be fetched for some reason.
- Throws:
WTException- If any of the invoked APIs threw this exception.
-
getLastPublishedUsageLink
Collection<ESIQueryTargetAssociation> getLastPublishedUsageLink(Collection<ESIQueryTargetAssociation> latestLinkHistories, WTPart prevPublishedPart, WTPartUsageLink partUsageLink, ESITarget target) throws WTException Fetches a Collection of ESIQueryTargetAssociations that hold the part usage links that were last published to the input distribution target and returns it to the caller.
Supported API: true- Parameters:
latestLinkHistories- Collection of ESIQueryTargetAssociations that represent all the usage links with release history, associated with the previously published part iteration. The contents of this Collection remain unaffected upon calling this method.prevPublishedPart- Part iteration that was previously published to the input distribution target.partUsageLink- Part usage link that is currently being published. This is one of the inputs used for fetching the output.target- Input distribution target.- Returns:
- Collection of ESIQueryTargetAssociations; for the commonly known use cases, this will be a singleton one. An empty Collection is returned if the last published part usage links could not be fetched for some reason.
- Throws:
WTException- If any of the invoked APIs threw this exception.
-
getUsageLinkWithMatchingCompId
ESIQueryTargetAssociation getUsageLinkWithMatchingCompId(WTPart part, WTPartUsageLink partUsageLink, ESITarget target) throws WTException Fetches an ESIQueryTargetAssociation object that holds a part usage link associated with the input part, and whose componentId matches that of the input part usage link.
Supported API: true- Parameters:
part- Input part from which to fetch the output usage link. Cannot be null.partUsageLink- Input part usage link used for setting up the database query parameters.target- Input distribution target.- Returns:
- An ESIQueryTargetAssociation object holding the output part usage link and the input distribution target.
- Throws:
WTException- If any of the invoked APIs threw this exception.
-
checkAndUpdateRawMaterialLinksForChangedLineNumber
void checkAndUpdateRawMaterialLinksForChangedLineNumber(Map<RawMaterialLink, String> rmLinkAttrMap, RawMaterialLink rawMaterialLink, boolean ignoreLineNumbers, Set<RawMaterialLink> chgRMLinksToRemove, Set<RawMaterialLink> addedRMLinks, Set<RawMaterialLink> deletedRMLinks, RawMaterialLink rawMaterialLinkHistory, VdbBuilder builder) throws WTExceptionPopulate the maps appropriately for raw material links if line number is changed.
Supported API: true- Parameters:
rmLinkAttrMap- - Input raw material link invalid input: '&' link attribute maps.rawMaterialLink- - Input raw material link.ignoreLineNumbers- - Boolean value for ignore line number preferencechgRMLinksToRemove- - Changed raw material linkaddedRMLinks- - Map to populate added link if line number is changed.deletedRMLinks- - Map to populate deleted link if line number is changed.rawMaterialLinkHistory- - Previously published raw material link.builder- - Instance of VdbBuilder.- Throws:
WTException- If any of the invoked APIs threw this exception.
-
getUpdatedRMLinksForChangedAttributes
void getUpdatedRMLinksForChangedAttributes(RawMaterialLink link, RawMaterialLink rawMaterialLinkHistory, Set<RawMaterialLink> changedRMLinks, Set<RawMaterialLink> unchgRMLinksToRemove, Set<RawMaterialLink> addedRMLinks, Set<RawMaterialLink> deletedRMLinks, Map<RawMaterialLink, String> rmLinkAttrMap, VdbBuilder builder) throws WTExceptionPopulate the maps appropriately for raw material links if line number is changed.
Supported API: true- Parameters:
link- - Input raw material link.changedRMLinks- - Map of changed raw material links.unchgRMLinksToRemove- - Changed raw material linkaddedRMLinks- - Map to populate added link if line number is changed.deletedRMLinks- - Map to populate deleted link if line number is changed.rmLinkAttrMap- - Input raw material link invalid input: '&' link attribute maps.builder- - Instance of VdbBuilder.ignoreLineNumbers- - Boolean value for ignore line number preference- Throws:
WTException- If any of the invoked APIs threw this exception.
-
populateDelta
void populateDelta(Set<Object> links, Map<ObjectToObjectLink, Persistable> linksToRoleBObjects, int type, Map<WTPartUsageLink, WTPart> delta) Populates the Map in delta using the input parameters. The method could typically be invoked once for each type of part usage links fetched from the object comparison framework - i.e., added, deleted, changed or unchanged. Supported API: true- Parameters:
links- - Set of part usage and raw material links obtained from the object comparison framework.linksToRoleBObjects- - Map holding part usage links as keys, and the other end (role B) objects as values that represent the usages of the BOM being published.type- - Its value indicates the type of part usage and raw material links that are passed in links. For e.g., a value 0 indicates added links, 1 indicates deleted links etc.delta- - Output Map to be populated with part usage links and the relevant other end objects. When invoked for deleted links, the Map will hold null values, considering that such links will not figure in linksToRoleBObjects.
-