
💡 특정 필드나 속성에 대해 선택할 수 있는 값들의 목록을 제공하는 기능이다.
자재아이템에서 품목자산분류, 세부분류1,2에대해서 콤보박스에 값을 넣어주는 작업
TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("A4MaterialsItem");
TCComponentItemRevisionType revisionType = itemType.getItemRevisionType();
TCPropertyDescriptor revisionProperty = revisionType.getPropertyDescriptor("a4MaCodeL1");
🔎 TCPropertyDescriptor : Teamcenter 아이템에 정의된 속성들의 속성 정보(예: 이름, 타입, 제약조건 등)를 포함하는 메타데이터를 설명하는 객체
TCComponentListOfValues listOfValue1 = revisionProperty.getLOV();//출력 ListOfValuesString
ListOfValuesInfo maCode1 =listOfValue1.getListOfValues(); //출력 A4_MaCodeL1LOV
String[] str1 = maCode1.getLOVDisplayValues(); //이름
Object[] lov1 = maCode1.getListOfValues(); //코드
TCComponentListOfValues[] filter1 = maCode1.getListOfFilters(); //하위 LOV
LOV에 포함된 값들의 목록을 가져와 사용자들에게 보여지는 값, 저장되는 코드값, 하위 LOV들을 확인해볼수있다.
private Map<String, ComboData> listComboMap; //이름, 코드, LOV저장 품목자산
lass
ComboData {
String code;
TCComponentListOfValues lovId;
public ComboData(String code, TCComponentListOfValues lovId) {
this.code = code;
this.lovId = lovId;
}
TCComponentItemType itemType;
try {
itemType = (TCComponentItemType) session.getTypeComponent("A4MaterialsItem");
TCComponentItemRevisionType revisionType = itemType.getItemRevisionType();
TCPropertyDescriptor revisionProperty = revisionType.getPropertyDescriptor("a4MaCodeL1");
TCComponentListOfValues listOfValue1 = revisionProperty.getLOV();//출력 ListOfValuesString
ListOfValuesInfo maCode1 = listOfValue1.getListOfValues(); //출력 A4_MaCodeL1LOV
String[] str1 = maCode1.getLOVDisplayValues(); //이름
Object[] lov1 = maCode1.getListOfValues(); //코드
TCComponentListOfValues[] filter1 = maCode1.getListOfFilters(); //하위 LOV
listComboMap = new LinkedHashMap<>();
for(int i=0;i<lov1.length;i++) {
listComboMap.put(str1[i], new ComboData(lov1[i].toString(), filter1[i]));
}
for(String key : listComboMap.keySet()) {
listCombo.add(key);
}
} catch (TCException e1) {
e1.printStackTrace();
}
ComboData selectedData = listComboMap.get(selectedText); // 저장된 데이터 가져오기
ListOfValuesInfo maCode2;
try {
maCode2 = (selectedData.lovId).getListOfValues();
String[] str2 = maCode2.getLOVDisplayValues(); //이름
Object[] lov2 = maCode2.getListOfValues(); //코드
TCComponentListOfValues[] filter2 = maCode2.getListOfFilters(); //하위 LOV
detailComboMap1 = new LinkedHashMap<>();
for(int i=0;i<lov2.length;i++) {
detailComboMap1.put(str2[i], new ComboData(lov2[i].toString(), filter2[i]));
}
for(String key : detailComboMap1.keySet()) {
detailCombo1.add(key);
}
} catch (TCException e1) {
e1.printStackTrace();
}