手順
カスタムコンフィギュレーションまたはカスタムロジックを含める手順を以下に示します。
1. enumCustomize ツールを使用して DiscrepancyTypeRB.rbInfo に新規 CUSTOM_DISCREPANCY を作成します。
2. 新規委任 CustomDiscrepancyDelegate を作成し、WT_HOME/codebase/com/ptc/windchill/associativity/xconfs/associativity.service.properties.xconf ファイルにエントリを追加します。
<Option cardinality="singleton" selector="CUSTOM_DISCREPANCY" requestor="null"
serviceClass="com.ptc.windchill.associativity.reconciliation.part.CustomDiscrepancyDelegate"/>
CustomDiscrepancyDelegate に以下のメソッドを実装します。
public Collection<Discrepancy2> detect(ReconciliationContext context, AssociativePath currentPath,AssociativePath oldPath) throws WTException ;
矛盾を検出するロジックを提供します。
public void verify(ReconciliationContext context, Collection<? extends Discrepancy2> discrepancies) throws WTException;
矛盾を検証するロジックを提供します。矛盾を検出するロジックと、それが有効で解決によって処理可能であるかを検証するロジックが別個に提供されます。
public ReconciliationReport resolve(ReconciliationContext context, Collection<? extends Discrepancy2> discrepancies) throws WTException;
矛盾を解決するロジックを提供します。
protected AbstractDiscrepancy2 getDiscrepancyInstance(ReconciliationContext context) throws WTException;
カスタム矛盾のインスタンスを返します。これをオーバーライドして、JSON (ReconciliationContext, String) メソッドのインスタンスを使用してデフォルトの情報を設定できます。
public boolean isOccurrenceBased();
矛盾がオカレンスに基づくか親子関係に基づくかを指定します。
public String toJSON(ReconciliationContext context, Discrepancy2 discrepancy) throws WTException;
サーバーからクライアントに情報を転送する手段を提供します。各委任によって、必要なすべての情報が確実に変換され、Discrepancy2 に再び変換可能になります。これを解決しなければならない場合、具体的な情報を JSON に追加する前にスーパーメソッドを呼び出します。
public Discrepancy2 fromJSON(ReconciliationContext context, String discrepancyData) throws WTException;
クライアントの情報を再びサーバーオブジェクトに転送する手段を提供します。各委任によって、必要なすべてのデータが確実に変換されて JSON (ReconciliationContext, Discrepancy2) と一貫したものになります。具体的な情報を処理する前にスーパーメソッドを呼び出します。
CustomDiscrepancyDelegate のコンフィギュレーションを以下に示します。
public class CustomDiscrepancyDelegate extends AbstractDiscrepancyDelegate {
private static final Logger logger LogR.getLogger(CustomDiscrepancyDelegate.class.getName());
@Override
protected AbstractDiscrepancy2 getDiscrepancyInstance(ReconciliationContext context) throws WTException {
return new CustomDiscrepancy();
}
@Override
public Collection<Discrepancy2> detect(ReconciliationContext context, AssociativePath currentPath, AssociativePath oldPath) throws WTException {
// Provide logic for discrepancy detection
}
@Override
public void verify(ReconciliationContext context, Collection<? extends Discrepancy2> discrepancies) throws WTException {
// Provide logic for discrepancy verify
}
@Override
public ReconciliationReport resolve (ReconciliationContext context, Collection<? extends Discrepancy?> discrepancies) throws WTException {
// Provide logic for discrepancy resolve
}
@Override
public String toJSON(ReconciliationContext context, Discrepancy2 discrepancy) throws WTException {
if (!(discrepancy instanceof CustomDiscrepancy)) {
if (logger.isDebugEnabled()) {
logger.debug("Discrepancy is not of type CustomDiscrepancy. Returning");
}
return "";
}
return super.toJSON(context, discrepancy);
}
public Discrepancy2 fromJSON(ReconciliationContext context, String discrepancyData) throws WTException {
return super.fromJSON(context, discrepancyData);
}
@Override
public boolean isoccurrenceBased() {
// set it to true if discrepancy is occurrence based
return false;
}

/**
* Possible values for compare mode are CompareMode.UPSTREAM,CompareMode.DOWNSTREAM,CompareMode.BOTH
* Default value is compare upstream CompareMode.UPSTREAM .
* For custom delegate to support SSA and reconciliation return CompareMode.BOTH & enhance detect logic
* to support downstream comparison.
* There could be cases where some discrepancies don't make sense for downstream compare or
* vice versa so return appropriate enumeration value.
*
*/
public default CompareMode getCompareMode() {
return CompareMode.UPSTREAM;
}
}
これは役に立ちましたか?