I want to retrieve the attribute value of the clasification node
- April 25, 2025
- 1 reply
- 612 views
Version: Windchill 12.1
Use Case: i have the string attribute called "Cappio" it has update based on the classification attribute value. step 1: I created the Classification tree, in the Bolt node i created the attribute "M" it having the enumeration list. Step 2: i need to retrieve the attribute value, update in the "Cappio" attribute using Persistable Adapter
Description:
# I am getting the default value of the attribute, but i don't want the default value i need the value that is stored in the attribute
public static String getEnumerationItemDisValue(String Nodeview, String accoppiamento) throws WTException {
String displayValue = null;
boolean enforce = SessionServerHelper.manager.setAccessEnforced(false);
QuerySpec qs = new QuerySpec();
int enumerentry = qs.appendClassList(LWCEnumerationEntry.class, true);
int enumvalue = qs.appendClassList(LWCLocalizablePropertyValue.class, true);
int enumlink = qs.appendClassList(LWCEnumerationEntryLink.class, false);
int enumpv = qs.appendClassList(LWCPropertyValue.class, false);
int enummaster = qs.appendClassList(LWCMasterEnumerationDefinition.class, false);
int pd = qs.appendClassList(LWCPropertyDefinition.class, false);
qs.appendWhere(new SearchCondition(LWCMasterEnumerationDefinition.class, WTAttributeNameIfc.ID_NAME,
LWCEnumerationEntryLink.class, "enumerationReference.key.id"), new int[]{enummaster, enumlink});
qs.appendAnd();
qs.appendWhere(new SearchCondition(LWCPropertyValue.class, "holderReference.key.id",
LWCEnumerationEntryLink.class, "thePersistInfo.theObjectIdentifier.id"), new int[]{enumpv, enumlink});
qs.appendAnd();
qs.appendWhere(new SearchCondition(LWCEnumerationEntry.class, WTAttributeNameIfc.ID_NAME,
LWCEnumerationEntryLink.class, "entryReference.key.id"), new int[]{enumerentry, enumlink});
qs.appendAnd();
qs.appendWhere(new SearchCondition(LWCEnumerationEntry.class, WTAttributeNameIfc.ID_NAME,
LWCLocalizablePropertyValue.class, "holderReference.key.id"), new int[]{enumerentry, enumvalue});
qs.appendAnd();
qs.appendWhere(new SearchCondition(LWCLocalizablePropertyValue.class, "propertyReference.key.id",
LWCPropertyDefinition.class, WTAttributeNameIfc.ID_NAME), new int[]{enumvalue, pd});
qs.appendAnd();
qs.appendWhere(new SearchCondition(LWCMasterEnumerationDefinition.class,
LWCMasterEnumerationDefinition.NAME, SearchCondition.EQUAL, enumName), new int[]{enummaster});
qs.appendOrderBy(LWCPropertyValue.class, "value", false);
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);
while (qr.hasMoreElements()) {
Object[] o = (Object[]) qr.nextElement();
LWCEnumerationEntry entry = (LWCEnumerationEntry) o[enumerentry];
LWCLocalizablePropertyValue entryValue = (LWCLocalizablePropertyValue) o[enumvalue];
if (entry.getName().equals(accoppiamento)) {
displayValue = entryValue.getValue();
System.out.println("Display Name of " + accoppiamento + " is " + displayValue);
break;
}
}
SessionServerHelper.manager.setAccessEnforced(enforce);
return displayValue;
}

