windchill创建部件

public static WTPart createPart(String number, String name, String unit, boolean endItem, Folder folder,
			WTUser user, String softType) throws WTException, WTPropertyVetoException {
		// SessionHelper.manager.setAdministrator();
		WTPart part = WTPart.newWTPart();
		if (StringUtils.isNotBlank(number)) {
			part.setNumber(number);
		}
		View view = ViewHelper.service.getView("Design");
		part.setView(ViewReference.newViewReference(view));//设置默认视图
		part.setName(name);
		part.setDefaultUnit(QuantityUnit.toQuantityUnit(unit));//设置单位
		part.setEndItem(endItem);
		FolderHelper.assignLocation((FolderEntry) part, folder);//更改存放文件夹
		VersionControlHelper.assignIterationCreator(part, WTPrincipalReference.newWTPrincipalReference(user));// 修改对象的创建者
		VersionControlHelper.setIterationModifier(part, WTPrincipalReference.newWTPrincipalReference(user));// 更新者
		if (StringUtils.isNotBlank(softType)) {
			TypeIdentifier id = TypeIdentifierHelper.getTypeIdentifier(softType);// 设置部件类型
			System.out.println(TypeIdentifierHelper.getTypeIdentifier(softType));
			part = (WTPart) CoreMetaUtility.setType(part, id);
		}
		part = (WTPart) PersistenceHelper.manager.save(part);
		// logger.debug("====>create wtpart " + number + " success");
		return part;
	}

上一篇:手把手和你一起实现一个Web框架实战——EzWeb框架(三)[Go语言笔记]Go项目实战


下一篇:动态规划——LeetCode 1143. 最长公共子序列