1、获取版本的分类属性
public static MultiKeyMap getClassificationObjectProperties(AppXSession session,ItemRevision itemRev) { MultiKeyMap keyMap = new MultiKeyMap(); try { ClassificationService ccService = ClassificationService.getService(session.getConnection()); Classification.FindClassificationObjectsResponse findClassificationObjects = ccService .findClassificationObjects(new WorkspaceObject[] { (WorkspaceObject) itemRev }); Map icos_map = findClassificationObjects.icos; if (icos_map != null && icos_map.size() > 0) { ModelObject[] objects = (ModelObject[]) icos_map.get(itemRev); if (objects != null && objects.length > 0) { Classification.GetClassificationObjectsResponse classificationObjects = ccService .getClassificationObjects(objects); Map clsObjs_map = classificationObjects.clsObjs; Classification.ClassificationObject ico_object = (Classification.ClassificationObject) clsObjs_map.get(objects[0]); Classification.ClassificationProperty[] properties = ico_object.properties; String classId = ico_object.classId; com.teamcenter.services.strong.classification._2009_10.Classification.GetAttributesForClassesResponse2 attributesForClasses2 = ccService .getAttributesForClasses2(new String[] { classId }); Map map = attributesForClasses2.attributes; com.teamcenter.services.strong.classification._2009_10.Classification.ClassAttribute2[] objects1 = (com.teamcenter.services.strong.classification._2009_10.Classification.ClassAttribute2[]) map .get(classId); for (int i = 0; i < properties.length; i++) { for (int j = 0; j < objects1.length; j++) { if (properties[i].attributeId == objects1[j].id) { String value = ""; Classification.ClassificationPropertyValue[] values = properties[i].values; if (CustomArrayUtil.getLength(values) > 0) { List<String> data = new ArrayList<String>(); for (int k = 0; k < values.length; k++) { String dbValue = values[k].dbValue; data.add(dbValue); } value = StringUtils.join(data, ";"); } keyMap.put(properties[i].attributeId, objects1[j].name, value); break; } } } } } } catch (ServiceException e) { e.printStackTrace(); } System.out.println("keyMap:" + keyMap); return keyMap; }
标签:map,icos,Classification,获取,keyMap,objects,版本,properties,属性 From: https://www.cnblogs.com/wwssgg/p/17080192.html