進階自訂 > Business Logic Customization > Packages Customization > Identifying Users in Context Replication and Activating Replicated Users > Solution
  
Solution
Scenario One — How matching users in the target system are identified during Context Replication Package Import
The intended outcomes can be achieved either by changing the appropriate service delegate configuration to apply one of OOTB delegates or by writing a custom delegate.
The role of the configured PrincipalMatchDelegate service implementation in determining how a user in the target system is found, is as described the following diagram.
Solution Elements
These elements determine how matching users in the target system are identified during Context Replication Package Import.
* 
In the following, the selector value is a pre-determined designator of the usage context and is meant for identifying the service configuration appropriate for a specific usage. The selector value must not be modified – only the corresponding serviceClass value may be changed
Element
Type
Description
service.properties.xconf
Service Delegate configuration file
Location: <Windchill> codebase/service.properties
The following service configuration elements determine which serviceClass is applied in each of the following cases:
If Source data references a non-disabled user the selector is UserInContextReplicationImport :
<Service context="default" name="wt.org.delegate.PrincipalMatchDelegate">
<Option cardinality="singleton" requestor="wt.org.WTUser" selector="UserInContextReplicationImport" serviceClass="wt.org.delegate.ImportedUserByUserNameMatchDelegate"/> </Service>
If Source data references a disabled user the selector is DisabledUserInContextReplicationImport :
<Service context="default" name="wt.org.delegate.PrincipalMatchDelegate">
<Option cardinality="singleton" requestor="wt.org.WTUser" selector="DisabledUserInContextReplicationImport" serviceClass="wt.org.delegate.ImportedDisabledUserMatchDelegate"/>
</Service>
ImportedUserByUserNameMatchDelegate
OOTB delegate JAVA class
Location: <Windchill>/codebase/wt/org/ImportedUserByUserNameMatchDelegate.class
This delegate implementation is for use with the selector “UserInContextReplicationImport”. OOTB, this is the delegate configured by default for this selector.
This delegate is only for use in finding matching non-disabled users in Context Replication Import. It uses the source user’s name to find a matching non-disabled user in the target system
ImportedUserByEmailIdMatchDelegate
OOTB delegate JAVA class
Location: <Windchill>codebase/wt/org/ImportedUserByEmailIdMatchDelegate.class
This delegate implementation is for use with the selector “UserInContextReplicationImport”. This is NOT the delegate configured by default for this selector.
This delegate is only for use in finding matching non-disabled users in Context Replication Import. It uses the source user’s email address to find a matching non-disabled user in the target system
ImportedDisabledUserMatchDelegate
OOTB delegate JAVA class
Location: <Windchill>codebase/wt/org/ImportedDisabledUserMatchDelegate.class
This delegate implementation is for use with the selector “DisabledUserInContextReplicationImport”. This is the delegate configured by default for this selector.
This delegate is only for use in finding matching disabled users in Context Replication Import. It uses the source user’s name, email address, full name, and last name to find a matching disabled user in the target system
PrincipalMatchDelegate
Delegate JAVA interface for customizers
All customized delegate implementations must adhere to the contract established by this interface
Procedure
To change the behavior so that user’s email addresses are used to identify non-disabled users on the target system during context replication import, change the serviceClass in the configuration element associated with the selector UserInContextReplicationImport to use the wt.org.ImportedUserByEmailIdMatchDelegate implementation:
<Service context="default" name="wt.org.delegate.PrincipalMatchDelegate">
<Option cardinality="singleton" requestor="wt.org.WTUser"
selector="UserInContextReplicationImport"
serviceClass="wt.org.delegate.ImportedUserByEmailIdMatchDelegate"/>
</Service>
* 
This configuration is only supported for the selector UserInContextReplicationImport. It does not apply to the selector DisabledUserInContextReplicationImport since there are no alternative delegate implementations for the selector DisabledUserInContextReplicationImport other than the default one configured OOTB.
To change the behavior to use more customized logic based on other attributes of the user, see Customization Points and Limitations.