Using MultiValued Attributes in Customizing Configuration Specifications
This section describes how to use multivalued attributes while customizing configuration specifications.
Defining the Attributes
For defining the attributes for customization, perform these steps:
1. Search for the “Custom Configuration Specification” managed type in the Type Manager.
2. Search for the effRange global attribute and delete the SingleValued constraint to make it MultiValued.
* 
If you use different global attributes in the customization, ensure that you make appropriate changes in the example customization in the next steps.
Implementing the Logic
1. Make changes in the setAttributesMap method in your delegate to handle the multivalued attribute. Values for the multivalued attributes are passed in an array:
@Override
public void setAttributesMap(Map<String, CustomConfigSpecAttribute> attributesMap) {
effContextRef = (ObjectReference) attributesMap.get(EFF_CONTEXT).getValue();
inputTimestamp = (Timestamp) attributesMap.get(EFF_DATE).getValue();
String[] effRanges = (String[]) attributesMap.get(EFF_RANGE).getValue();
if(effRanges != null && effRanges.length > 1) {
this.effRangeStr = effRanges[0] + " - " + effRanges[effRanges.length-1];
}
}
The first element of an array is considered as a starting range and the last element as an ending range. This customization searches for parts with serial effectivity defined in this range.
2. Compile your example to apply the changes in the source code.
Result
The customization that you just created, resolves parts to the version based on the serial effectivity. To test whether this works correctly, add Serial Effectivities for some revisions of parts in the structure. Then use the CustomConfigSpec to verify whether it resolves the structure to the correct versions based on the effectivity context and range given as input.
1. Create Serial Effectivity for the part.
2. Create CustomConfigSpec. Use your structure root as effectivity context. In this example, GOLF_CART.
3. In the Edit Filter window, click OK to apply the configuration specification. Part for which you created the Serial Effectivity is resolved to the version if the serial effectivity exists in the range passed in step 2:
Isto foi útil?