추가 Windchill 기능 > 제조 공정 관리 > 제품 구조 탐색기(PSE) 사용자 정의 > 모델 서브클래스를 처리하도록 PSE 사용자 정의
  
모델 서브클래스를 처리하도록 PSE 사용자 정의
목표
사용자 정의 모델 비즈니스 객체를 작성했으며 모델 서브클래스를 완전히 지원하도록 PSE를 사용자 정의하려고 합니다.
범위/적용 가능성/가정
모델 서브클래스를 별도로 작성했습니다.
의도한 결과
기본 제공 모델 객체와 마찬가지로 PSE에서 모델 서브클래스 인스턴스가 검색 및 제공됩니다.
솔루션
다음 세 영역에서 변경 작업을 수행합니다.
LogicalAttributes.xml
PSE 테이블 및 패널
사용자 정의 명령 위임
사전 지식
이 목표를 달성하려면 다음 사항을 이해해야 합니다.
XML 파일 사용자 정의 관리
RBINFO 파일 사용자 정의 관리
솔루션 요소
요소
유형
설명
LogicalAttributes.xml
XML 파일
"논리 형식"에서 해당 "외부 형식"으로의 모델 속성 매핑을 구성하는 데 사용됩니다.
절차 - 모델 서브클래스를 처리하도록 PSE 사용자 정의
이 단원에서는 다음 항목에 대해 설명합니다.
LogicalAttributes.xml
PSE 테이블 및 패널
사용자 정의 명령 위임
LogicalAttributes.xml
<Windchill>/codebase/LogicalAttributes.xml에 있는 LogicalAttributes.xml 파일은 "논리 형식"에서 해당 "외부 형식"으로의 모델 속성 매핑을 구성하는 데 사용됩니다. 한 객체에서 다른 객체로의 연관을 나타내는 모든 모델 속성에는 매핑이 필요합니다. 예를 들어, WTPart에서 WTPartMaster로의 참조에 대해 정의된 몇몇 엔트리는 다음과 같습니다.
<Class name="wt.part.WTPart">
<Property>
<LogicalForm>defaultUnit</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|defaultUnit</ExternalForm>
</Property>
<Property>
<LogicalForm>masterReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster</ExternalForm>
</Property>
<Property>
<LogicalForm>name</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|name</ExternalForm>
</Property>
<Property>
<LogicalForm>number</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|number</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationName</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization~MBA|name</ExternalForm>
</Property>
<Property>
<LogicalForm>usedLineNumber</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink~MBA|
lineNumber.value</ExternalForm>
</Property>
<Property>
<LogicalForm>usedLink</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink</ExternalForm>
</Property>
</Class>
"ext.cust.CustPart"가 wt.part.WTPart를 확장하고 "ext.cust.SubPartMaster"가 wt.part.WTPartMaster를 확장하는 예를 사용할 경우 <Windchill>/codebase/LogicalAttributesSite.xml라는 사이트 관련 파일에 다음을 추가해야 합니다.
<Class name="ext.cust.CustPart">
<Property>
<LogicalForm>defaultUnit</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|defaultUnit</ExternalForm>
</Property>
<Property>
<LogicalForm>masterReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster</ExternalForm>
</Property>
<Property>
<LogicalForm>name</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|name</ExternalForm>
</Property>
<Property>
<LogicalForm>number</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|number</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationName</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization~MBA|name</ExternalForm>
</Property>
<LogicalForm>usedLineNumber</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink~MBA|
lineNumber.value</ExternalForm>
</Property>
<Property>
<LogicalForm>usedLink</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink</ExternalForm>
</Property>
</Class>
PSE 테이블 및 패널
LogicalAttributes.xml 파일에는 새 모델 속성을 추가할 필요가 없지만 적절한 PSE 구성 XML 파일에는 추가해야 합니다. 자세한 내용은 하위 유형에 대해 PSE 사용자 정의를 참조하십시오.
* 
서브클래스 객체에 대해서만 정의된 새 모델 속성을 지정할 때 "wt.part.WTPart" 컨텍스트에 정의된 해당 "AttributeGroup", "AttributeTable" 또는 "Table"을 적절한 서브클래스 컨텍스트에 복사해야 합니다.
새 모델 속성만 나열하면 됩니다. 기존 속성은 상속됩니다. 예를 들어, 이름 및 번호는 WTPart에서 상속됩니다.
상속된 서브클래스 패널에서 속성을 제거하려면 "<Placement remove="true"/>"를 사용합니다. 예:
<AttributeDefinition id="contextName”>
<Placement remove="true"/>"
</AttributeDefinition>
사용자 정의 객체에 대한 요소 그룹을 추가할 때는 기존 파일을 편집하는 대신 모든 사용자 정의 변경 사항을 별도의 파일에 저장하는 것이 좋습니다. 일관된 파일 이름을 지정하십시오(예: CustomExplorerForTablesAndPanels.xml).
앞의 "ext.cust.CustPart"가 "wt.part.WTPart"를 확장하는 예를 사용할 경우 다음 AttributeGroup
<ExplorerElementGroup>
<LogicContext application="ptc.wnc.StructureExplorer"
dataType="wt.part.WTPart"/>
<AttributeGroup id="ptc.wnc.exp.ViewPropertiesPanel" displayMode="view">
<CellDefinition id="number">
<AttributeDefinition attributeId="number"/>
</CellDefinition>
<CellDefinition id="organizationIdentifier">
<AttributeDefinition attributeId="organizationIdentifier"/>
</CellDefinition>
<CellDefinition id="name">
<AttributeDefinition attributeId="name"/>
</CellDefinition>
<CellDefinition id="versionIterationView">
<AttributeDefinition attributeId="versionIterationView"/>
</CellDefinition>
...
</AttributeGroup>
</ElementGroup>
을 다음과 같이 "ext.cust.CustPart"에 대한 LogicContext 아래에 복사해야 합니다.
<ExplorerElementGroup>
<LogicContext application="ptc.wnc.StructureExplorer"
dataType=" ext.cust.CustPart "/>
<AttributeGroup id="ptc.wnc.exp.ViewPropertiesPanel" displayMode="view">
<!-- name and number will inherit from WTPart -->
<!-- adding new modeled attributes here -->
<CellDefinition id="intMBA">
<AttributeDefinition attributeId="intMBA"/>
</CellDefinition>
...
</AttributeGroup>
</ElementGroup>
사용자 정의 명령 위임
PSE는 Command/CommandDelegate 매핑을 사용하여 PSE의 일부 작업을 제어합니다. 가장 주목할 예는 "복제 작업"입니다. 사용자 정의 클래스를 "복제"하려면 적절한 복사 위임자를 서브클래스화해야 합니다. "CustPart"의 경우 wt.enterprise.CopyWTPartDelegate의 서브클래스에 해당하고 사용자 정의 모델 속성의 복사를 처리하는 클래스를 작성해야 합니다.
사용자 정의 클래스에 대한 복사 위임자 작성
모델 서브클래스를 작성하기 위해 기본 제공 비즈니스 객체(예: 부품)를 사용자 정의한 경우, 부품 복사 또는 다른 이름으로 저장 시 추가 모델 속성이 제대로 처리될 수 있도록 사용자 정의 복사 위임자 클래스를 작성 및 구성해야 합니다.
이 문서에서는 단순한 예(단일 문자열 속성 "myAttr"를 사용하여 wt.part.WTPart를 확장하는 사용자 정의 부품 클래스 "MyPart")를 보여줍니다.
복사 위임자 작성
그림에 나온 것처럼 단순히 wt.enterprise.CopyWTPartDelegate를 확장하고 해당 newCopy() 메소드를 무시할 수 있습니다. 이 목적은 모든 사용자 정의 속성(이 예의 경우 myAttr)을 처리하는 것입니다. 다음은 이 메소드가 구현되는 방법을 보여 주는 예입니다.
public final RevisionControlled newCopy( RevisionControlled object
)throws WTException {
//##begin newCopy%461E645C0050f.body preserve=yes
if (object == null) return null;
MyPart new_copy = (MyPart) super.newCopy(object);
MyPart original = (MyPart) object;
String my_attr = original.getMyAttr();
if (my_attr != null) {
try {
new_copy.setMyAttr(original.getMyAttr());
}
catch (WTPropertyVetoException e) {
throw new WTException(e);
}
return new_copy;
//##end newCopy%461E645C0050f.body
}
복사 위임자 작성
복사 위임자 구성
사용자 정의 복사 위임자 CopyMyPartDelegate를 MyPart의 복사 위임자 클래스로 사용하도록 Windchill에 지시하려면 구성 파일 <windchill-install-directory>/codebase/wt/enterprise/EnterpriseServerDelegate.properties에 다음 줄을 삽입해야 합니다.
wt.services/svc/default/wt.enterprise.CopyDelegate/null/<my-
package>.MyPart/0=<mypackage>.
CopyMyPartDelegate/singleton
사용자 정의 지점
현지화 가능 레이블 및 열거 사용자 정의
각 모델 객체에는 객체 생성 중 작성된, 연관된 RBINFO 파일이 있습니다. 이 파일에는 PSE에서 속성 및 열의 레이블로 사용되는 현지화된 문자열이 포함되어 있습니다. 레이블을 변경해야 할 경우 해당 RBIFNO 파일을 편집해야 합니다. 예를 들어, "booleanMBA" 속성의 레이블을 변경하려면 CustPartModelRB.rbInfo 파일에서 다음 줄을 편집합니다.
CustPart.booleanMBA.value=New Label for booleanMBA
모델 열거는 PSE에서 드롭다운 메뉴로 렌더링될 때 열거의 내부 값을 표시합니다. 드롭다운 메뉴에 표시되는 레이블을 변경하려면 열거에 대한 해당 RBINFO 파일을 편집해야 합니다. 예를 들어, "apple", "dog", "cat" 값을 사용하여 "public final class MyEnum extends EnumeratedType" 클래스를 생성하고 드롭다운 메뉴의 표시 값을 변경하려면 다음과 같이 MyEnumRB.rbInfo 파일을 편집합니다.
# Entry Contents
apple.value=Apples
dog.value=Dogs
cat.value=Cats
기타 리소스
PSE 테이블 표시 사용자 정의