進階自訂 > Business Logic Customization > Customizing MPMLink > Configuring and Customizing Automatic BOM Transformation > Solution
  
Solution
Use the out of the box configuration and customization hooks to implement your logic.
Prerequisite Knowledge
To perform this task, you need to have an understanding of the following:
Basic MPMLink and BOM structure
Basic development involving Java
Management of resource bundle file customizations
Windchill xconfmanager concepts
Solution Elements
The out of the box configuration for the main class that handles the template flow is located in the <WT_HOME>/codebase/com/ptc/windchill/mpml/xconfs/mpmlink.service.properties.xconf file.
The configuration is given below:
<Service context="default"
name="com.ptc.windchill.associativity.reconciliation.resolver.AbstractAddUsageResolver">
<Option cardinality="singleton" requestor="wt.part.WTPart"
serviceClass="com.ptc.windchill.mpml.reconciliation.resolver.MPMLinkAddedUsageDiscrepancyResolver"/>
</Service>
You can update the configuration to include custom delegate.
The out of the box property configuration is provided in the <WT_HOME>/codebase/com/ptc/core/foundation/associativity/xconfs/associativity.properties.xconf file.
The out of the box property configuration given below provides the default behavior to perform transformation the same way as under the nearest common equivalence context:
<Property name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" multivalued="," default=""/>
<Property name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPartUsageLink" multivalued="," default=""/>
These out of the box properties let any instance of WTPart to be pasted anywhere on the downstream structure, which means no constraints.
The properties are supported for Part Usage and Part. Priority is always given to Part Usage. Only when Part Usage is valid, the configurations for Part is considered. If you do not want to control the transformation for Part Usage, keep the out of the box property configuration for the Part Usage, which makes all the usages to be valid.
The format of the property is: <base_prefix>.<upstream_view>.<downstream_view>.<type_internal_name>. The keys for the property are explained in the given table:
Element
Type
Description
base_prefix
Property Key Component
The prefix com.ptc.windchill.associativity.reconciliation.addusage
is mandatory and constant. Only properties with this prefix are considered for the add template configurations.
upstream_view
Property Key Component
The internal name of the view, which forms the upstream view context for equivalence link. For example: design.
This key needs a corresponding downstream_view configuration as well. The key is optional.
downstream_view
Property Key Component
The internal name of the view, which forms the downstream view context for equivalence link. For example: manufacturing.
This key needs a corresponding upstream_view configuration as well. The key is optional.
type_internal_name
Property Key Component
The internal name of the type that is valid for transformation. The key should not contain the hierarchy name. For example: com.ptc.ElectricalPart.
This key supports inheritance. So, if defined for a super type, the associated configurations are applicable for sub-types, unless explicitly defined.
The key is mandatory.
Examples of configuring the property with the above keys are given below:
Specifying the type: com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart
Specifying the type with the upstream and downstream view: com.ptc.windchill.associativity.reconciliation.addusage.design.manfacturing.wt.part.WTPart
The system supports reading property for the usage and child in the same order of priority. All the properties are supported for usage as well as child though it may not be applicable in some cases.
For each of the property keys, you can define a list of key=value pairs. The pairs are customizable and additional options can be added which will be available in the delegates and can be handled using custom logic. The out of the box key value pairs are given in the table:
Element
Type
Description
transformoption
Properties
Describes how the given type should be transformed in a downstream structure. The default valid supported values are addSame, newBranch, and newPart. These values are equivalent to the interface actions Paste, Paste as New Branch, and Paste as New Part. For example, transformOption=addSame.
If a downstream structure exists, the service internally prioritizes the addExisting option. If not specified, the default value is addSame.
The value is case sensitive.
structureoption
Properties
Describes the action to be performed on the children of the node which is being transformed. You can carry forward the children, transform the children recursively, or not carry forward the children.
Valid values are 0, 1, and 2. For example, structureOption=0. The default value is 0. The values are explained below:
0: Do not duplicate the children.
1: Duplicate the children but do not transform them.
2: Duplicate the children and recursively transform them.
In some cases, the value maybe not applicable. For example, if transformOption is addSame, then structureOption is not applicable.
attribute.<internal_name>
Properties
Specifies the internal name of the attribute on the type which is used to control transformation validity. For example, attribute.lineNumber.value=20,attribute.phantom=true. The supported attribute types are Global, Local, Alias, and Calculated.
This is a multi-valued property and allows specifying multiple attributes. This is optional and if not provided, transformation is validated only on the type. Out of the box, the system performs string comparison.
targetType
Properties
Identifies the downstream type under which valid upstream parts can be consumed. The path containing the given type in hierarchy is marked as valid. You need to specify the internal name of the type as the value and not the hierarchical name of the type. For example, targetType=com.ptc.ElectricalPart
It is optional. If not specified, the nearest common equivalence context is used as the default target.
targetAttribute.<internal_name>
Properties
Specifies the target node where the upstream node should be pasted or transformed. It contains the prefix targetAttribute. For example, targetAttribute.lineNumber.value=20,targetAttribute.phantom=true.
It is optional. If not provided, the system uses targetType. It stops at the first matching instance in the path hierarchy, navigating from the leaf to the root.
doAndValidationForAttr
Properties
Specifies whether to perform an AND or OR operation to find a match when multiple attributes are defined for matching on the source or target.
Default is true.
forceNewDownstreamCreation
Properties
Specifies if a new downstream branch or part should be created when a downstream branch already exists. For example, when using transformOption=newPart.
Default value is false.
continueNavigationForReusedChildren
Properties
Specifies whether you want to continue navigating the structure if, as part of transformation, the children were reused and carried forward as is to the downstream branch. It is useful when you transform parent using the addSame action, but in the structure, you use the newBranch or newPart action for a node. It may impact the performance.
Default value is false.
useProcessPlanLogicEnabled
Properties
Specifies that if a downstream structure does not exist, search for a process-plan created for the part and use the downstream structure associated with the upstream node given in the process-plan.
Examples of configuring the property with the above keys are given below:
<Property name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.CustomPart" multivalued="," default=""/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.CustomPart" value="transformOption=newBranch"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.CustomPart" value="structureOption=0"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.CustomPart" value="targetType=wt.part.WTPart"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.CustomPart" value="targetAttribute.phantom=true"/>