import com.teamcenter.services.rac.core._2008_06.DataManagement; import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateOut; import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse; public static TCComponent createObject(Map<String, String> map, String object_type) { DataManagementService dmService1 = DataManagementService.getService(TcUtil.getSession()); DataManagement.CreateInput input = new DataManagement.CreateInput(); input.stringProps = map; input.boName = object_type; DataManagement.CreateIn createIn = new DataManagement.CreateIn(); createIn.data = input; createIn.clientId = "RCP"; try { CreateResponse createObjects = dmService1.createObjects(new DataManagement.CreateIn[] { createIn }); if (createObjects.serviceData.sizeOfPartialErrors() > 0) { try { throw new Exception(createObjects.serviceData.getPartialError(0).getMessages()[0]); } catch (Exception e) { e.printStackTrace(); } } else { CreateOut[] output = createObjects.output; return output[0].objects[0]; } } catch (ServiceException e1) { e1.printStackTrace(); } return null; } ———————————————— 版权声明:本文为CSDN博主「潇潇_零度」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_41482046/article/details/107504830