Distribution Target Assignment Validation
A distribution target is validated before it is associated to a part. The validation logic is provided by a certain API of a class, whose name is obtained from the Windchill ESI preference named Distribution Target Assignment Validator. Out-of-the-box, the preference is set to com.ptc.windchill.esi.tgt.ESITargetAssignmentValidator.
Validation for auto-assignment
Out-of-the-box, the required validation happens in the API isTargetValidForAutoAssignment(obj : Persistable, target : ESITarget) of class ESITargetAssignmentValidator. This method returns a true (thereby asserting that the input target is auto-assignable to the input part) if any of the following is met:
The target’s view as given by the preference View To Distribution Target Mappings is identical to the view of the part.
The input part is not associated to any Windchill view.
The number of the input target does not figure in the value of the preference View To Distribution Target Mappings.
* 
1. The API isTargetValidForAutoAssignment() checks if the input target is auto-assignable to the input object purely from a Windchill view stand-point. For example, it does not check if the target resides in the same context as the input object, or if defaultForContext attribute on the target is set to true.
2. The API performs the said validation only for parts. In other words, it always returns a true for other types of objects.
3. The validation may be customized by defining a class that provides a custom version of the API isTargetValidForAutoAssignment(Persistable, ESITarget) and setting the preference Distribution Target Assignment Validator to the name of the custom class.
4. Automatic assignment of a distribution target to a Made From Object (such as a Made From Set or a Co-produce) occurs provided a single distribution target qualifies for the auto-assignment. In other words, if two or more distribution targets are found to be valid for auto-assignment, no distribution target will be assigned automatically to the Made From Object.
Validation for explicit assignment
Out-of-the-box, the required validation happens in the API isTargetValid(obj : Persistable, target : ESITarget) of class ESITargetAssignmentValidator. This method returns a true (thereby asserting that the input target is explicitly assignable to the input part) if any of the following is met:
The target’s view as given by the preference View To Distribution Target Mappings is identical to, or is a child of the view of the part.
The input part is not associated to any Windchill view.
The number of the input target does not figure in the value of the preference View To Distribution Target Mappings.
* 
1. The API isTargetValid() checks if the input target is explicitly assignable to the input object purely from a Windchill view stand-point. For example, it does not check if the target resides in the same context as the input object, or if the defaultForContext attribute on the target is set to true.
2. The API performs the said validation only for parts. In other words, it always returns a true for other types of objects.
3. The validation may be customized by defining a class that provides a custom version of the API isTargetValid(Persistable, ESITarget) and setting the preference Distribution Target Assignment Validator to the name of the custom class.
4. Explicit assignment of a distribution target to a Made From Object (such as a Made From Set or a Co-produce) succeeds provided the object is not already assigned to a distribution target. In other words, if the object is already assigned to a distribution target, or if two or more distribution targets are selected for explicit assignment, the action will fail.
Was this helpful?