一、插件概述
1、Plugin定义
一个插件(plug-in)是Eclipse平台中的最小功能单元,它可以被独立的开发和发布。
2、Plugin的内容组成
1)JAR中的Java代码
2)一些只读文件和其它资源(例如图片、web模板、消息资源文件、本地类库等)。
3)一个插件清单,用于声明它与其它插件之间的连接关系,一个插件的清单由几个文件表示:
①manifest.mf文件是一个OSGI bundle清单,它描述了插件间运行时的依赖关系;
②plugin.xml是一个XML文件,它描述了扩展和扩展点的信息
3、Eclipse Plugin体系结构
4、在Dependencies页签加入以下Required Plug-ins:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.external
com.teamcenter.rac.kernel
com.teamcenter.rac.neva
com.teamcenter.rac.tcapps
com.teamcenter.rac.util
Debug配置文件:
-Xms256m -Xmx1024m -Djava.library.path=C:\Siemens\Teamcenter11\tccs\lib -Dautologin.user=infodba -Dautologin.pass=infodba
5、菜单添加的三要素
Command:有一个唯一的ID号,它代表了一个动作的抽象意义,例如拷贝,粘贴,保存。它不代表一个动作的实施。
Menu contributions:代表一个特定的视图或者一个命令的视图话呈现。它创建了菜单和工具条的结构框架并且把他们插入到Eclipse的正确位置。每个位置都是用URI( Uniform Resource Identifier )来标识的。Menu contribution能够定义一个菜单的标签,助记符和图标。它和已经被定义的Command之间相互关联。一个菜单可以通过visibleWhen来控制它的显示。
Handlers:大多数是继承于AbstractHandler类。Handlers在它的execute(*)方法中提供了一个应用程序上下文。如果一个命令没有一个激活的handlers被定义,任何一个Menu contributions中定义的Command都不可见。一个Command可以定义一个默认的handler来确保它能够有一个可被激活的handler。handler可以通过ActiveWhen语句来被显示的激活声明或者被编程的形式激活。Handler也可以在任何一个Menu contributions中用enabledWhen表达式,显示的定义一个按钮什么时候可显示。
6、plugin.xml页签
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<!-- 2021年9月练习 -->
<command id="com.dgt.hyl.ox.sept.commands.CreateComponenCommand" name="创建零部件"/>
</extension>
<extension point="org.eclipse.ui.handlers">
<!-- 2021年9月练习 -->
<handler commandId="com.dgt.hyl.ox.sept.commands.CreateComponenCommand" class="com.dgt.hyl.ox.sept.handlers.CreateComponenHandler"/>
</extension>
<extension point="org.eclipse.ui.menus">
<!-- 主菜单 -->
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu id="Menu_202109" label="2021年九月练习">
<command commandId="com.dgt.hyl.ox.sept.commands.CreateComponenCommand"/>
<visibleWhen>
<and>
<or>
<!-- 我的制造工艺规划器 -->
<reference definitionId="com.teamcenter.rac.cme.mpp.inMainView"/>
</or>
</and>
</visibleWhen>
</menu>
</menuContribution>
</extension>
</plugin>
7、常见的locationURI有:
主菜单栏:menu:org.eclipse.ui.main.menu 主工具栏:toolbar:org.eclipse.ui.main.toolbar 弹出菜单:popup:org.eclipse.ui.popup.any
8、需要继承的类
Handler继承:Handler extends AbstractHandler;
Action继承:Action extends AbstractAIFAction;
Command继承:Command extends AbstractAIFCommand;
Dialog继承:Dialog extends AbstractAIFDialog;
Operation继承:Operation extends AbstractAIFOperation;
9、继承的类
1)AbstractHandler
①handler继承于此类;
②public Object execute(*)方法是程序的执行入口。
2)AbstractAIFAction
①Action一般继承于此类;
②public void run( )是程序的入口,必须实现的方法(可在此初始化Command);
③executeModal( )执行Command。
3)AbstractAIFCommand
①Command的继承于此类;
②setRunnable( )方法可以让来运行初始化对话框。
4)AbstractAIFDialog
①Dialog继承于此类,用来定义对话框;
②此类中的事件监听器中,初始化Operation,即操作。
5)AbstractAIFOperation
①Operation继承于此类,用于定义操作;
②executeOperation( )方法是程序必须执行的方法,里面主要定义具体的操作。
10、Teamcenter类
1)TCComponent
2)TCComponentItem——对应Item
3)TCComponentItemRevision——对应Item Revision
4)TCComponentItemType——对应Item类型
5)TCComponentFolderType——对应文件夹类型
6)TCComponentUser——对应用户
7)TCComponentPerson——对应人员
8)TCComponentGroup——对应组织
9)TCComponentRole——对应角色
10)TCComponentForm——对应表单
11、Teamcenter UI Components:TC页面元素
1)iTextField——文本框
2)JCheckBox——复选框
3)JButton——按钮
4)Jpanel——面板
5)Jlabel——标签
6)Jdialog——对话框
7)DateButton——日历
二、Item零件对象
1、根据零件版本创建视图对象
/**
* 根据零件版本,创建视图对象
* @param tCPBOMItemRevision
*/
public static TCComponentBOMLine createTCPBOMLine(TCComponentItemRevision tCPBOMItemRevision)
{
try {
TCComponentRevisionRuleType revRuleType = (TCComponentRevisionRuleType) session.getTypeComponent("RevisionRule");
TCComponentRevisionRule revRule = revRuleType.getDefaultRule();
TCComponentBOMWindowType bomWindowType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow bomWindow = bomWindowType.create(revRule);
TCComponentBOMLine createBomLine = bomWindow.setWindowTopLine(tCPBOMItemRevision.getItem(), tCPBOMItemRevision, null, null);
return createBomLine;
} catch (Exception e) {
e.printStackTrace();
MessageBox.post(e.getMessage(),"提示",MessageBox.ERROR);
}
return null;
}
2、创建带有必填字段的Item对象
/**
* 创建带有必填字段的Item对象
* @param session
* @param item_type 创建的对象类型
* @param item_property_map 创建的Item需要设置的属性,<属性名,属性值>
* @param itemRev_property_map 创建的ItemRevison需要设置的属性,<属性名,属性值>
*
* 2017-11-28
*/
@SuppressWarnings("rawtypes")
public static TCComponent performCreate_bak(TCSession session,String item_type,Map<String, String> item_property_map,Map<String, String> itemRev_property_map)throws TCException{
IBOCreateDefinition IBOcreateDefinition = BOCreateDefinitionFactory.getInstance().getCreateDefinition(session, item_type);
if (IBOcreateDefinition == null){
MessageBox.post("IBOCreateDefinition获取失败","出错了",MessageBox.INFORMATION);
return null;
}
List<ICreateInstanceInput> m_inputs = new ArrayList<>();
CreateInstanceInput localCreateInstanceInput = new CreateInstanceInput(IBOcreateDefinition);
for(Map.Entry<String, String> entry:item_property_map.entrySet()){
localCreateInstanceInput.add(entry.getKey(), entry.getValue());
}
m_inputs.add(localCreateInstanceInput);
List<IBOCreateDefinition> localList = IBOcreateDefinition.getSecondaryCreateDefinition("revision");
if ((localList != null) && (localList.size() > 0)){
IBOCreateDefinition localIBOCreateDefinition2 = (IBOCreateDefinition)localList.get(0);
if (localIBOCreateDefinition2 != null){
CreateInstanceInput localCreateInstanceInput2 = new CreateInstanceInput(localIBOCreateDefinition2);
// localCreateInstanceInput2.add("item_revision_id", "");
for(Map.Entry<String, String> entry:itemRev_property_map.entrySet()){
// localCreateInstanceInput2.add("ca9_DocumentType", "HJFJGKB");
// localCreateInstanceInput2.add("ca9_CarSeries", bomLine.parent().getItemRevision().getProperty("ca9_CarSeries"));
// localCreateInstanceInput2.add("ca9_Profession", "HJ");
localCreateInstanceInput2.add(entry.getKey(), entry.getValue());
}
m_inputs.add(localCreateInstanceInput2);
}
}
Object localObject1 = null;
List<TCComponent> localList2 = SOAGenericCreateHelper.create(session, IBOcreateDefinition, m_inputs);
Object localObject2;
Object localObject3;
if ((localList2 != null) && (localList2.size() > 0)) {
localObject2 = localList2.iterator();
while (((Iterator)localObject2).hasNext())
{
localObject3 = (TCComponent)((Iterator)localObject2).next();
if ((localObject3 instanceof TCComponentItem))
{
localObject1 = localObject3;
break;
}
}
}
return (TCComponent)localObject1;
}
3、创建ITEM
//1、创建没有必填属性的零件对象
TCSession session =(TCSession)AIFUtility.getDefaultSession();
TCComponentItemType tccomponentItemType = (TCComponentItemType)
session.getTypeComponent("Item");//item、form、folder
TCComponentItem item = tccomponentItemType.create(ITEMID, REV ID, ITEM TYPE, OBJECT NAME, DESC, null);
//2、创建有必填属性的零件对象
/**创建含有必填项的零件*/
public void createItem() {
(TCComponentItemType) itemType = (TCComponentItemType) session.getTypeComponent(ItemType);//根据类型获取类型对象
DGTUtility dgtUtility = new DGTUtility(session);
TCComponentItemRevisionType itemRevType = dgtUtility.getItemRevisionType(ItemType);//根据类型获取版本类型对象
Map<String,Object> item_property_map = getPropertyMap(itemType,itemRev.getItem());//获取可显示输入的零件属性值列表
Map<String,Object> itemRev_property_map = getPropertyMap(itemRevType,itemRev);//获取可显示输入的零件版本属性值列表
Map<String, TCComponent> uomTagObject = getUomTagObject();//获取度量单位对象
String property = itemRev.getItem().getProperty("uom_tag");//获取选中零件的度量单位
item_property_map.put("uom_tag", uomTagObject.get(property));//复制度量单位属性
ID = itemRev.getItem().getProperty("item_id")+"_REF";
item_property_map.put("item_id", ID);//更改继承的ID
//item_property_map.put("object_name", NAME);//更改继承的名称
TCComponentItem docItem = (TCComponentItem) DGTUtility.performCreate_bak3(session, ItemType, item_property_map, itemRev_property_map);
}
4、根据零件类型获取零件版本类型
/**
* 根据零件类型获取零件版本类型
* @param itemType:零件类型
*/
public TCComponentItemRevisionType getItemRevisionType(String itemType) {
TCComponentItemRevisionType tccomponentitemrevisiontype = null;
try {
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent(itemType);
if (typeComponent != null) {
String s2 = typeComponent.getRevisionTypeName(itemType);
tccomponentitemrevisiontype = (TCComponentItemRevisionType) session.getTypeComponent(s2);
}
} catch (TCException e) {
e.printStackTrace();
}
return tccomponentitemrevisiontype;
}
5、获取可显示输入的属性对象列表
/**
* 获取可显示输入的属性对象列表
* @param type:类型对象
* @param item:选中的零件对象*/
public Map<String,Object> getPropertyMap(TCComponentType type,TCComponent item) throws TCException{
Map<String,Object> property_map = new HashMap<>();
//获取获取可显示输入的属性对象
BOCreateDefinition bocreatedefinition3 = (BOCreateDefinition)BOCreateDefinitionFactory.getInstance().getCreateDefinition(type.getSession(), type.getType());
List<BOCreatePropertyDescriptor> createPropertyDescriptors = bocreatedefinition3.getCreatePropertyDescriptors();
for(int i = 0;i<createPropertyDescriptors.size();i++) {
TCPropertyDescriptor propertyDescriptor = createPropertyDescriptors.get(i).getPropertyDescriptor();
String name2 = propertyDescriptor.getName();
String property = item.getProperty(name2);
if(DGTUtility.isEmpty(property)) {//判断选中零件的该属性是否有值
//无值使用属性本身默认值
property_map.put(name2, propertyDescriptor.getDefaultValue());
}else {
//获取属性LOV
TCComponentListOfValues lov = propertyDescriptor.getLOV();
if (lov != null) {//判断是否有LOV
//获取LLOV对象
Map<String, Object> lovObject = getLOVObject(lov);
Object object = lovObject.get(property);
property_map.put(name2, object);//写入LOV对象
}else {
property_map.put(name2, property);
}
}
}
return property_map;
}
6、创建带必填项的零件
/**
* 创建带必填项的零件
* @param session
* @param item_type 创建的对象类型
* @param item_property_map 创建的Item需要设置的属性,<属性名,属性值>
* @param itemRev_property_map 创建的ItemRevison需要设置的属性,<属性名,属性值>
*/
@SuppressWarnings("rawtypes")
public static TCComponent performCreate_bak3(TCSession session, String item_type,
Map<String, Object> item_property_map, Map<String, Object> itemRev_property_map) throws TCException {
IBOCreateDefinition IBOcreateDefinition = BOCreateDefinitionFactory.getInstance().getCreateDefinition(session,item_type);
if (IBOcreateDefinition == null) {
MessageBox.post("IBOCreateDefinition获取失败", "出错了", MessageBox.INFORMATION);
return null;
}
List<ICreateInstanceInput> m_inputs = new ArrayList<>();
CreateInstanceInput localCreateInstanceInput = new CreateInstanceInput(IBOcreateDefinition);
for (Map.Entry<String, Object> entry : item_property_map.entrySet()) {
localCreateInstanceInput.add(entry.getKey(), entry.getValue());
}
m_inputs.add(localCreateInstanceInput);
List<IBOCreateDefinition> localList = IBOcreateDefinition.getSecondaryCreateDefinition("revision");
if ((localList != null) && (localList.size() > 0)) {
IBOCreateDefinition localIBOCreateDefinition2 = (IBOCreateDefinition) localList.get(0);
if (localIBOCreateDefinition2 != null) {
CreateInstanceInput localCreateInstanceInput2 = new CreateInstanceInput(localIBOCreateDefinition2);
for (Map.Entry<String, Object> entry : itemRev_property_map.entrySet()) {
localCreateInstanceInput2.add(entry.getKey(), entry.getValue());
}
m_inputs.add(localCreateInstanceInput2);
}
}
Object localObject1 = null;
List<TCComponent> localList2 = SOAGenericCreateHelper.create(session, IBOcreateDefinition, m_inputs);
Object localObject2;
Object localObject3;
if ((localList2 != null) && (localList2.size() > 0)) {
localObject2 = localList2.iterator();
while (((Iterator) localObject2).hasNext()) {
localObject3 = (TCComponent) ((Iterator) localObject2).next();
if ((localObject3 instanceof TCComponentItem)) {
localObject1 = localObject3;
break;
}
}
}
return (TCComponent) localObject1;
}
7、创建Item、Form、Folder
TCSession session =(TCSession)AIFUtility.getDefaultSession();
TCComponentItemType tccomponentItemType = (TCComponentItemType)
session.getTypeComponent("Item");//item、form、folder
TCComponentItem item = tccomponentItemType.create(ITEMID, REV ID, ITEM TYPE, OBJECT NAME, DESC, null);
8、获取指定规则的零组件最新ID:根据零组件命名规则模式和零组件类型
//包:TcSoaCoreRac
/**
* 根据零组件命名规则模式和零组件类型获取指定规则的零组件最新ID
* @param String pattern:命名规则模式
* @param String type:零组件类型
* @return String 该pattern模式的零组件ID
* huyanling 2021-10-14
* */
@SuppressWarnings({ "rawtypes" })
public String getItemIdByPatternAndType(String pattern,String type) {
String s = null;
try {
Object obj1;
String result = "isTrue:"+type+":item_id:"+pattern;
String as4[] = {result};
TCPreferenceService tcPreferenceService = session.getPreferenceService();//获取当前会话设置模式的服务
tcPreferenceService.setStringArray(1, "TC_LAST_USED_PATTERNS", as4);//根据模式设置最新生成ID的命名规则模式
DataManagementService datamanagementservice = DataManagementService.getService(session);
//创建有几个agenerateitemidsandinitialrevisionidsproperties对象的GenerateItemIdsAndInitialRevisionIdsProperties对象
com.teamcenter.services.rac.core._2006_03.DataManagement.GenerateItemIdsAndInitialRevisionIdsProperties agenerateitemidsandinitialrevisionidsproperties[] = new com.teamcenter.services.rac.core._2006_03.DataManagement.GenerateItemIdsAndInitialRevisionIdsProperties[1];
agenerateitemidsandinitialrevisionidsproperties[0] = new com.teamcenter.services.rac.core._2006_03.DataManagement.GenerateItemIdsAndInitialRevisionIdsProperties();
agenerateitemidsandinitialrevisionidsproperties[0].item = null;
agenerateitemidsandinitialrevisionidsproperties[0].itemType = type;//零组件类型
agenerateitemidsandinitialrevisionidsproperties[0].count = 1;//获取几个最新ID
//获取零组件类型的自增长零组件ID及零组件版本ID
obj1 = datamanagementservice.generateItemIdsAndInitialRevisionIds(agenerateitemidsandinitialrevisionidsproperties);
//获取obj1中的值
Map map = ((com.teamcenter.services.rac.core._2006_03.DataManagement.GenerateItemIdsAndInitialRevisionIdsResponse) (obj1)).outputItemIdsAndInitialRevisionIds;
Iterator iterator = map.entrySet().iterator();
if(iterator.hasNext())//遍历提取出newItemId
{
java.util.Map.Entry entry = (java.util.Map.Entry)iterator.next();
com.teamcenter.services.rac.core._2006_03.DataManagement.ItemIdsAndInitialRevisionIds aitemidsandinitialrevisionids[] = (com.teamcenter.services.rac.core._2006_03.DataManagement.ItemIdsAndInitialRevisionIds[])entry.getValue();
com.teamcenter.services.rac.core._2006_03.DataManagement.ItemIdsAndInitialRevisionIds itemidsandinitialrevisionids = aitemidsandinitialrevisionids[0];
s = itemidsandinitialrevisionids.newItemId;
}
} catch (TCException e) {
e.printStackTrace();
}
return s;
}
9、根据零件类型查询其命名规则模式列表
/**
* 根据零件类型查询其命名规则模式列表
* String ITEMTYPE = "D2_GeneralDesign";
* @param ITEMTYPE:零件类型
* */
public void getPatternsByItemType(String ITEMTYPE)
{
String as[] = {
"item_id", "item_revision_id"
};
String as1[] = {
ITEMTYPE, ITEMTYPE
};
//获取命名规则列表,包括item和itemRevision的命名规则
NamingRule anamingrule[] = NamingRulesHelper.getInstance().getNamingRules(session, as1, as);
String as2[] = anamingrule[0].getPatterns();//item命名规则
String as3[] = anamingrule[1].getPatterns();//itemRevision命名规则
String s1 = anamingrule[0].getPreferredPattern();//当零件未关联命名规则时,默认零件命名规则
String s2 = anamingrule[1].getPreferredPattern();//当零件版本未关联命名规则时,默认版本命名规则
String condition1 = anamingrule[0].getCondition();//命名规则判断条件
String condition2 = anamingrule[1].getCondition();//版本命名规则判断条件
}
10、根据零件类型获取零件版本类型
/**根据零件类型获取零件版本类型
* @param itemType:零件类型*/
public TCComponentItemRevisionType getItemRevisionType(String itemType) {
TCComponentItemRevisionType tccomponentitemrevisiontype = null;
try {
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent(itemType);
if(typeComponent != null){
String s2 = typeComponent.getRevisionTypeName(itemType);
tccomponentitemrevisiontype = (TCComponentItemRevisionType)session.getTypeComponent(s2);
}
} catch (TCException e) {
e.printStackTrace();
}
return tccomponentitemrevisiontype;
}
11、根据零件类型和属性,获取属性的LOV
/**根据零件类型和属性,获取属性的LOV
* @param typeComponent:零件对象类型,如"TCComponentItemType"
* @param properName:属性名称,如"uom_tag":度量单位
* @author huyanling
* 2021-10-20
* */
public Map<Object, Object> getPropLOVMap(TCComponentType typeComponent,String properName){
Map<Object, Object> maps = null;
try {
TCPropertyDescriptor tcpropertydescriptor = typeComponent.getPropertyDescriptor(properName);
TCComponentListOfValues lov = tcpropertydescriptor.getLOV();
if(lov == null) {
MessageBox.post(properName+"属性没有LOV,请配置附加LOV!","提示",MessageBox.INFORMATION);
return null;
}
maps = new HashMap<Object, Object>();
ListOfValuesInfo listOfValues = lov.getListOfValues();
Object[] lovbd1 = listOfValues.getListOfValues();//LOV值
String[] lovs1 = listOfValues.getLOVDisplayValues();//LOV本地化值
for(int i = 0;i<lovbd1.length;i++) {
//真实名称与本地化名称不匹配时直接使用真实名称列表
if(lovbd1.length > lovs1.length) {
maps.put(lovbd1[i], lovbd1[i]);
}else {
maps.put(lovs1[i], lovbd1[i]);
}
}
} catch (TCException e) {
MessageBox.post(e.getMessage(),"提示",MessageBox.INFORMATION);
return null;
}
return maps;
}
12、根据零件类型和属性,获取属性本地化的LOV列表
/**根据零件类型和属性,获取属性本地化的LOV列表
* @param typeComponent:零件对象类型,如"TCComponentItemType"
* @param properName:属性名称,如"uom_tag":度量单位
* @author huyanling
* 2021-10-20
* */
public Object[] getPropLOVDisList(TCComponentType typeComponent,String properName){
try {
TCPropertyDescriptor tcpropertydescriptor = typeComponent.getPropertyDescriptor(properName);
TCComponentListOfValues lov = tcpropertydescriptor.getLOV();
if(lov == null) {
MessageBox.post(properName+"属性没有LOV,配置附加LOV!","提示",MessageBox.INFORMATION);
return null;
}
ListOfValuesInfo listOfValues = lov.getListOfValues();
Object[] lovbd1 = listOfValues.getListOfValues();//LOV值
Object[] lovs1 = listOfValues.getLOVDisplayValues();//LOV本地化值
//真实名称与本地化名称不匹配时直接使用真实名称列表
if(lovbd1.length > lovs1.length) {
lovs1 = lovbd1;
}
return lovs1;
} catch (TCException e) {
MessageBox.post(e.getMessage(),"提示",MessageBox.INFORMATION);
return null;
}
}
三、Folder文件夹对象
1、创建文件夹Folder
TCComponentFolderType folder = (TCComponentFolderType) session.getTypeComponent("Folder");
folder.create("练习0825", "", null);
2、获取home文件夹
TCSession session =(TCSession)AIFUtility.getDefaultSession();
TCComponentFolder homeFolder = session.getUser().getHomeFolder();//获取的home文件夹
TCComponentFolder newStuffFolder = session.getUser().getNewStuffFolder();
homeFolder.add("contents", tcComponentItem);//以“contents”关系将item放入home
3、创建零件、自定义文件夹
TCComponentFolderType folder = (TCComponentFolderType) session.getTypeComponent("Folder");
folder.create("练习0825", "", null);
TCComponentItemType item = (TCComponentItemType) session.getTypeComponent("Item");
//item.create(itemID, revID, 类型, 名称, 描述, null)
TCComponentItem newItem = item.create("10009", "A", "QL2_Change", "test", "", null);
四、Dataset数据集对象
1、创建数据集Dataset
TCComponentDatasetType typeComponent = (TCComponentDatasetType) session.getTypeComponent("Dataset");
//创建数据集typeComponent.create(名称, 描述, 类型);
//TCComponentDataset create1 = typeComponent.create("测试数据集", "", "MSExcel");
//create1.setFiles(new String[]{"D:\\attributenew.xls"}, new String[]{"excel"});
TCComponentDataset create = typeComponent.create("word测试", "", "MSWordX");
create.setFiles(new String[]{"D:\\IP.docx"}, new String[]{"word"});
addDatasetNewstuff(create);
五、Form表单对象
六、BOMline对象
七、EPMTask工作流程任务
1、通过已有的流程模板发起一个流程
/**
* 通过已有的流程模板发起一个流程
* @throws TCException
*/
public void startProcess(TCComponentItemRevision item) throws TCException{
//获取session
TCSession session = getSession();
//获取流程模板类型对象
TCComponentTaskTemplateType TaskTemplateT = (TCComponentTaskTemplateType) session.getTypeComponent("EPMTaskTemplate");
//获取流程模板 arg:流程模板名称
TCComponentTaskTemplate find = TaskTemplateT.find("TCM Release Process", 0);
//获取流程类型对象
TCComponentProcessType procesType = (TCComponentProcessType) session.getTypeComponent("Job");
//获取零件名称
String itemName = item.getProperty("object_name");
//发起流程
procesType.create(itemName, "", find, new TCComponent[]{item}, new int[]{1});
}
八、其它
1、获取选中对象
//方式一:获取选中的多个对象
StructuredSelection str = (StructuredSelection)HandlerUtil.getCurrentSelection(event);
Iterator iterator = str.iterator();//获取所有选择的对象
while (iterator.hasNext()) {//遍历选择对象
AIFComponentContext aif = (AIFComponentContext)iterator.next();}
//方式二:获取选中的多个对象
InterfaceAIFComponent[] targetComponents = application.getTargetComponents();
for (InterfaceAIFComponent interfaceAIFComponent:targetComponents) {
System.out.println("方式二多个对象:"+interfaceAIFComponent);}
//方式三:获取选中的单个对象
InterfaceAIFComponent targetComponent = application.getTargetComponent();
2、查询已存在的用户
TCComponentUserType type = (TCComponentUserType) session.getTypeComponent("User");
TCComponentUser find = type.find(user);
3、设置对象属性
//1)常用
TCComponentItem item = new TCComponentItem();
item.setProperty("object_name", "hello");
item.setProperty("item_id", "122222");
item.getProperty("object_name");
//2)当是大批量的properties要设定值时
TCFormProperty[] ps = f.getAllFormProperties();
ps[0].setStringValueData ( "abc" );
ps[1].setStringValueData ( "def" );
f.setTCProperties(ps); // Now is saved to the db
//3)当properties数量不大时
TCFormProperty p = f.getFormTCProperty("my_prop_name");
p.setStringValue ( "abc" );
4、获取子对象
InterfaceAIFComponent targetComponent = application.getTargetComponent();
if(targetComponent instanceof TCComponentItem){
TCComponentItem item = (TCComponentItem)targetComponent;
//获取子对象:getRelationObject(item);
}
//1)获取所以子对象
AIFComponentContext[] children = item.getChildren();
for(AIFComponentContext aif:children){
System.out.print(aif);
}
//2)根据关系获取最新对象
TCComponent relatedComponent = item.getRelatedComponent("revision_list");
if(relatedComponent instanceof TCComponentItemRevision){
TCComponentItemRevision item1 = (TCComponentItemRevision)relatedComponent;
System.out.print(item1);
}
//3)根据关系获取所有对象
TCComponent[] relatedComponents = item.getRelatedComponents("revision_list");
for(TCComponent tc:relatedComponents){
if(tc instanceof TCComponentItemRevision){
TCComponentItemRevision item2 = (TCComponentItemRevision)tc;
System.out.print(item2);
}
}
5、查看对象被哪个对象所引用
TCComponentDataset dataset = new TCComponentDataset();
AIFComponentContext[] whereReferenced = dataset.whereReferenced();
for (AIFComponentContext aif:whereReferenced) {
System.out.print("数据集被"+aif+"对象引用。");
}
6、上传文件到TC
TCComponentDatasetType typeComponent = (TCComponentDatasetType) session.getTypeComponent("Dataset");
//创建数据集typeComponent.create(名称, 描述, 类型);
//TCComponentDataset create1 = typeComponent.create("测试数据集", "", "MSExcel");
//create1.setFiles(new String[]{"D:\\attributenew.xls"}, new String[]{"excel"});
TCComponentDataset create = typeComponent.create("word测试", "", "MSWordX");
create.setFiles(new String[]{"D:\\IP.docx"}, new String[]{"word"});
addDatasetNewstuff(create);
7、从TC上下载文件
InterfaceAIFComponent targetComponent = application.getTargetComponent();
//运行时判断是否是他的类或者子类
if(targetComponent instanceof TCComponentDataset){
TCComponentDataset dataset = (TCComponentDataset)targetComponent;
//方式一
TCComponentTcFile[] files2 = dataset.getTcFiles();
for (TCComponentTcFile tc:files2) {
tc.getFile("D:\\");
}
//方式二:
dataset.getFiles("excel");//下载进入默认路径C:\\temp
}
8、创建Excel
public void createExcel(){
FileOutputStream fos=null;
//创建工作簿
HSSFWorkbook workbook = new HSSFWorkbook();
//创建sheet
HSSFSheet sheet = workbook.createSheet();
//创建row
HSSFRow row = sheet.createRow(0);
//创建cell
HSSFCell cell = row.createCell(0);
//设置cell的值
cell.setCellValue("hello");
File file=new File("D:\\hello.xlsx");//指定写入路径
try {
fos=new FileOutputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}finally{
try {
workbook.write(fos);
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
9、读取Excel
public void readExcel(){
File f=new File("D:\\hello.xlsx"); //指定写入路径
try {
//创建输入流对象
FileInputStream fileInput = new FileInputStream(f);
//创建工作簿对象
HSSFWorkbook workbook = new HSSFWorkbook(fileInput);
//获取sheet
HSSFSheet sheet = workbook.getSheet("Sheet0");
//HSSFSheet sheetAt = workbook.getSheetAt(0);
//获取row
HSSFRow row = sheet.getRow(0);
//获取cell
HSSFCell cell = row.getCell(0);
//查看cell的值
String stringCellValue = cell.getStringCellValue();
System.out.println(stringCellValue);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
10、java调用查询构建器
public TCComponentDataset findDataBase(String findName){
TCSession session =(TCSession)AIFUtility.getDefaultSession();
try {
TCComponentQueryType typeComponent = (TCComponentQueryType) session.getTypeComponent("ImanQuery");
TCComponentQuery find = (TCComponentQuery) typeComponent.find("数据集...");
if(find == null){
return null;
}
TCQueryClause[] describe = find.describe();
String[] userId = {findName};
String[] strings = {"名称"};
TCComponent[] execute = find.execute(strings, userId);
if(execute.length>0){
System.out.println(execute[0]);
return (TCComponentDataset)execute[0];
}
} catch (TCException e) {
e.printStackTrace();
}
return null;
}
11、开启一个新的线程
session.queueOperation(new ExportFastOperation(session, logger, findData));
12、获取LOV列表
/**
* 获取LOV列表
* @param lov:LOV对象
* */
public Map<String, Object> getLOVObject(TCComponentListOfValues lov) throws TCException {
Map<String, Object> maps = new HashMap<String, Object>();
ListOfValuesInfo listOfValues = lov.getListOfValues();
Object[] lovbd1 = listOfValues.getListOfValues();// LOV值
String[] lovs1 = listOfValues.getLOVDisplayValues();// LOV本地化值
for (int j = 0; j < lovbd1.length; j++) {
// 真实名称与本地化名称不匹配时直接使用真实名称列表
if (lovbd1.length > lovs1.length) {
maps.put(lovbd1[j].toString(), lovbd1[j]);
} else {
maps.put(lovs1[j], lovbd1[j]);
}
}
return maps;
}
13、获取度量单位对象
/**
* 度量单位对象
* */
public Map<String,TCComponent> getUomTagObject() throws TCException {
Map<String,TCComponent> uom_tagMap = new HashMap<String,TCComponent>();
TCComponentUnitOfMeasureType localTCComponentUnitOfMeasureType = (TCComponentUnitOfMeasureType)session.getTypeComponent("UnitOfMeasure");
TCComponent[] arrayOfTCComponents = localTCComponentUnitOfMeasureType.extent();
String uomtagStr = "";
for(TCComponent arrayOfTCComponent:arrayOfTCComponents) {
uomtagStr = arrayOfTCComponent.toString();
uom_tagMap.put(uomtagStr, arrayOfTCComponent);
}
return uom_tagMap;
}
14、创建信封邮件Envelope
//1、使用类型创建信封,需要获取到用户的邮箱文件夹,将信封添加到下面
/**测试创建信封邮件
* @throws Exception */
public void TestNewEnvelope() throws Exception {
TCComponentEnvelopeType tccomponentenvelopetype = (TCComponentEnvelopeType) session.getTypeComponent("Envelope");
TCComponentUserType user = (TCComponentUserType)session.getTypeComponent("User");
TCComponentUser find = user.find("infodba");
TCComponentUser find2 = user.find("huahua");
String subject = "主题";
String message = "邮件";
TCComponent toReceivers[] = {find};
TCComponent ccReceivers[] = {find2};
String toExternalUsers[] = {"infodba"};
String ccExternalUsers[] = {"huahua"};
TCComponentFolder mailBox = find.getMailBox();
TCComponentFolder mailBox2 = find2.getMailBox();
TCComponent atccomponent1[] = validateAttachments();
TCComponentEnvelope envelope = tccomponentenvelopetype.create(subject, message, toReceivers, ccReceivers, toExternalUsers, ccExternalUsers, atccomponent1);
mailBox.add("contents", envelope);
mailBox2.add("contents", envelope);
}
15、信封邮件附件对象解析
/**信封邮件附件对象解析*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public TCComponent[] validateAttachments(){
if(attachmentList == null || attachmentList.length == 0)
return null;
ArrayList arraylist = new ArrayList();
ArrayList arraylist1 = new ArrayList();
Object obj = null;
Registry registry = Registry.getRegistry(this);
for(int i = 0; i < attachmentList.length; i++){
try{
if(attachmentList[i].isTypeOf("BOMLine")){
TCComponentBOMLine tccomponentbomline = (TCComponentBOMLine)attachmentList[i];
arraylist.add(tccomponentbomline.getItemRevision());
} else if(attachmentList[i].isTypeOf("PseudoFolder")) {
TCException tcexception1 = new TCException((new StringBuilder(String.valueOf(attachmentList[i].toString()))).append("-").append(registry.getString("invalidAttach.MESSAGE")).toString());
arraylist1.add(tcexception1);
} else if(attachmentList[i] instanceof TCComponentMECfgLine) {
TCComponentMECfgLine tccomponentmecfgline = (TCComponentMECfgLine)attachmentList[i];
arraylist.add(tccomponentmecfgline.getUnderlyingComponent());
} else {
arraylist.add(attachmentList[i]);
}
}catch(TCException tcexception2){
arraylist1.add(tcexception2);
}
}
if(arraylist1.size() > 0) {
StringBuffer stringbuffer = new StringBuffer();
for(int j = 0; j < arraylist1.size(); j++) {
TCException tcexception = (TCException)arraylist1.get(j);
stringbuffer.append((new StringBuilder(String.valueOf(tcexception.getMessage()))).append("\n").toString());
}
}
TCComponent atccomponent[] = (TCComponent[])arraylist.toArray(new TCComponent[arraylist.size()]);
return atccomponent;
}
//2、调用系统的创建信封程序
/**测试创建信封邮件
* @throws Exception */
public void TestNewEnvelope() throws Exception {
AIFDesktop currentDesktop = AIFDesktop.getActiveDesktop().getDesktopManager().getCurrentDesktop();
//1、传入用户
TCComponentUserType user = (TCComponentUserType)session.getTypeComponent("User");
TCComponentUser find = user.find("infodba");
TCComponentUser find2 = user.find("huahua");
Recipient recipient = new Recipient(find);
Recipient recipient2 = new Recipient(find2);
Recipient[] recipients = {recipient};
Recipient[] recipients2 = {recipient2};
//2、传入组
TCComponentGroupType group = (TCComponentGroupType)session.getTypeComponent("Group");
TCComponent[] extent = group.extent();
TCComponentGroup find3 = group.find("dba");
TCComponentGroup find4 = group.find("test.dba");
Recipient recipient3 = new Recipient(find3);
Recipient recipient4 = new Recipient(find4);
Recipient[] recipients3 = {recipient3};
Recipient[] recipients4 = {recipient4};
String subject = "主题234";
String message = "邮件";
TCComponentEnvelope envelope = null;
NewEnvelopeOperation newEnvelopeOperation = new NewEnvelopeOperation(session, null, recipients3, recipients4, subject, message, attachmentList, 0, envelope);
session.queueOperation(newEnvelopeOperation);
}
16、获取应用ID
/**获取应用ID*/
public void getAppId() {
String applicationId = AIFDesktop.getActiveDesktop().getDesktopManager().getCurrentDesktop().getCurrentApplication() .getApplicationId();
System.out.println(applicationId);
}
17、调用外部dll文件的方法
/**调用外部dll文件的方法
* @throws TCException */
public void callExternalDLLFileMethod() throws TCException {
TCUserService userService = session.getUserService();
InterfaceAIFComponent targetComponent = application.getTargetComponent();
TCComponent tcComponent = (TCComponent) targetComponent;
userService.call("AssignZZItem", new Object[] { tcComponent });
}
18、显示Home树
/**显示Home树
* @throws TCException */
public void showHomeView() throws TCException {
TCComponentFolder homeFolder = session.getUser().getHomeFolder();
final Display display = Display.getDefault();
AIFDesktop aifdesktop = AIFUtility.getActiveDesktop();
Shell shell = aifdesktop.getShell();
final Shell shell = new Shell();
shell.setSize(500, 575);
shell.setText("Home树结构");
//树结构
TreeViewer treeviewer = new TreeViewer(shell, SWT.BORDER|SWT.H_SCROLL);
//带复选框的树结构
//ContainerCheckedTreeViewer treeViewer = new ContainerCheckedTreeViewer(shell, SWT.BORDER|SWT.H_SCROLL);
treeviewer.setLabelProvider(new TCComponentLabelProvider());
treeviewer.setContentProvider(new TCComponentContentProvider());
treeviewer.setInput(new ComponentRootNode(homeFolder));
treeviewer.expandToLevel(2);
shell.open();
shell.setLayout(new FillLayout());
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
19、调用查询构建器
/**
* 调用查询构建器
*
* @param findName:查询值,如查询5开头的零组件则findName=5*
* @param findValue:查询条件真实名称,如object_name
* @param name:查询名称,如"数据集名称"
* @author huyanling
*/
public TCComponent[] findData(String[] findName, String[] findValue, String name) {
try {
if (findName.length > findValue.length) {
MessageBox.post("查询条件与查询值不对应,请检查!", "提示", 2);
return null;
}
TCComponentQueryType typeComponent = (TCComponentQueryType) session.getTypeComponent("ImanQuery");
TCComponentQuery find = (TCComponentQuery) typeComponent.find(name);
if (find == null) {
MessageBox.post("TC中没有【" + name + "】这个查询,请定义该查询后使用!", "提示", 2);
return null;
}
TCQueryClause[] describe = find.describe();
String[] strings = new String[findValue.length];
String[] value = findName;
for (int v = 0; v < findValue.length; v++) {
strings[v] = describe[v].getUserEntryNameDisplay();
}
TCComponent[] execute = find.execute(strings, value);
if (execute.length > 0) {
return execute;
} else {
return execute;
}
} catch (TCException e) {
e.printStackTrace();
}
return null;
}
20、获取当前应用程序对象
//1、
AbstractAIFUIApplication application = AIFUtility.getCurrentApplication();
//2、
AbstractAIFUIApplication application = AIFDesktop.getActiveDesktop().getCurrentApplication();
21、获取对象属性的LOV
/**获取对象属性的LOV*/
public String[] getLOVByItemType(TCComponent find,String PROPERNAME) throws TCException {
TCProperty tcProperty = find.getTCProperty(PROPERNAME);
TCComponentListOfValues lov = tcProperty.getLOV();
ListOfValuesInfo listOfValues = lov.getListOfValues();
Object[] listOfValues2 = listOfValues.getListOfValues();//LOV值
String[] lovDisplayValues = listOfValues.getLOVDisplayValues();//LOV本地化值
return lovDisplayValues;
}
22、获取session服务
//1)第一种方式
ISessionService sessionService = AifrcpPlugin.getSessionService();
TCSession session = (TCSession)sessionService.getSession("com.teamcenter.rac.kernel.TCSession");
//2)第二种方式
AbstractAIFUIApplication application = AIFUtility.getCurrentApplication();
TCSession session = (TCSession)application.getSession();
//3)第三种方式
TCSession session =(TCSession)AIFUtility.getDefaultSession();
23、打开一个或多个对象
//1、
NavigatorOpenService navigatorOpenService = new NavigatorOpenService();
navigatorOpenService.open(aifComponent);
//2、
AifrcpPlugin.getDefault().openComponents("com.teamcenter.rac.ui.perspectives.navigatorPerspective",new InterfaceAIFComponent[] {aifComponent});
//3、
ComponentOpenHelper componentOpenHelper = new ComponentOpenHelper(AifrcpPlugin.getDefault());
componentOpenHelper.openComponents(s, new InterfaceAIFComponent[] {aifComponent});
//4、
SearchOpenService searchOpenService = new SearchOpenService();
InterfaceAIFComponent targetComponent = application.getTargetComponent();
searchOpenService.open(targetComponent);
//5、
AIFDesktop desktop = AIFDesktop.getActiveDesktop().getDesktopManager().getActiveDesktop();
InterfaceAIFComponent[] targetComponent = application.getTargetComponents();
OpenCommand openCommand = new OpenCommand(desktop, targetComponent);
openCommand.executeModal();
九、获取对象
1、获取对象类型对象
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent(itemType);
2、获取对象版本类型对象
String s2 = typeComponent.getRevisionTypeName(itemType);
tccomponentitemrevisiontype = (TCComponentItemRevisionType) session.getTypeComponent(s2);
3、获取属性对象
TCPropertyDescriptor tcpropertydescriptor = typeComponent.getPropertyDescriptor(properName);
4、获取LOV对象
1、获取所有值列表
TCComponentListOfValuesType ListOfValues = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValues");
TCComponent[] extent1 = ListOfValues.extent();
2、获取动态值列表
TCComponentListOfValuesType Dynamic = (TCComponentListOfValuesType) session.getTypeComponent("Fnd0ListOfValuesDynamic");
TCComponent[] extent2 = Dynamic.extent();
3、获取字符型值列表
TCComponentListOfValuesType Char = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValuesChar");
TCComponent[] extent3 = Char.extent();
4、获取日期值型值列表
TCComponentListOfValuesType Date = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValuesDate");
TCComponent[] extent4 = Date.extent();
5、获取双精度数值型值列表
TCComponentListOfValuesType Double = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValuesDouble");
TCComponent[] extent5 = Double.extent();
6、获取过滤器型值列表
TCComponentListOfValuesType Filter = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValuesFilter");
TCComponent[] extent6 = Filter.extent();
7、获取数值型值列表
TCComponentListOfValuesType Integer = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValuesInteger");
TCComponent[] extent7 = Integer.extent();
8、获取字符串型值列表
TCComponentListOfValuesType String = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValuesString");
TCComponent[] extent8 = String.extent();
9、获取标记值列表
TCComponentListOfValuesType Tag = (TCComponentListOfValuesType) session.getTypeComponent("ListOfValuesTag");
TCComponent[] extent9 = Tag.extent();
10、获取属性的值列表
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent(itemType);
TCPropertyDescriptor tcpropertydescriptor = typeComponent.getPropertyDescriptor(properName);
TCComponentListOfValues lov = tcpropertydescriptor.getLOV();
5、命名规则对象
String as[] = { "item_id", "item_revision_id" };
String as1[] = { ITEMTYPE, ITEMTYPE};
//获取命名规则列表,包括item和itemRevision的命名规则
NamingRule anamingrule[] = NamingRulesHelper.getInstance().getNamingRules(session, as1, as);
String as2[] = anamingrule[0].getPatterns();//item命名规则
String as3[] = anamingrule[1].getPatterns();//itemRevision命名规则
6、系统中所有度量单位对象
TCComponentUnitOfMeasureType localTCComponentUnitOfMeasureType = (TCComponentUnitOfMeasureType)session.getTypeComponent("UnitOfMeasure");
TCComponent[] arrayOfTCComponents = localTCComponentUnitOfMeasureType.extent();
7、系统中所有用户对象
TCComponentUserType user = (TCComponentUserType)session.getTypeComponent("User");
TCComponent[] extent = user.extent();
8、系统中所有发布状态对象
TCComponentStatusTypeType status = (TCComponentStatusTypeType)session.getTypeComponent("TaskType");
TCComponent[] extent = status.extent();
9、系统中所有组对象
TCComponentGroupType group = (TCComponentGroupType)session.getTypeComponent("Group");
TCComponent[] extent = group.extent();
10、当前用户所有的工作流程对象
TCComponentProcessType procesType = (TCComponentProcessType) session.getTypeComponent("Job");
11、所有工作流程模板对象
TCComponentTaskTemplateType TaskTemplateT = (TCComponentTaskTemplateType) session.getTypeComponent("EPMTaskTemplate");
12、系统中所有的分类对象
TCComponentICOType icoType = (TCComponentICOType) session.getTypeComponent("icm0");
TCComponent[] ico = icoType.extent();
13、系统中所有工具
TCComponentToolType toolType = (TCComponentToolType) session.getTypeComponent("Tool");
TCComponent[] extent = toolType.extent();
14、系统中所有项目
TCComponentProjectType projectType = (TCComponentProjectType) session.getTypeComponent("TC_Project");
TCComponent[] projects = projectType.extent();
15、系统中所有注释类型列表
TCComponentNoteTypeType noteTypeType = (TCComponentNoteTypeType) session.getTypeComponent("NoteType");
TCComponent[] noteTypes = noteTypeType.extent();
16、系统中所有视图类型列表
TCComponentViewTypeType viewTypeType = (TCComponentViewTypeType) session.getTypeComponent("PSViewType");
TCComponent[] viewTypes = viewTypeType.extent();
17、系统中所有事件类型
TCComponentEventType eventType = (TCComponentEventType) session.getTypeComponent("ImanEventType");
TCComponent[] events = eventType.extent();
//根据零件获取零件对应版本
TCComponentItem item = (TCComponentItem) targetComponent;
//1、Item发布的版本
TCComponentItemRevision[] releasedItemRevisions = item.getReleasedItemRevisions();
//2、Item工作中的版本
TCComponentItemRevision[] workingItemRevisions = item.getWorkingItemRevisions();
//3、Item流程中的版本
TCComponentItemRevision[] inProcessItemRevisions = item.getInProcessItemRevisions();
十、获取属性
1、根据引用属性获取引用属性所属对象
/**根据引用属性获取引用属性所属对象(当属性值不为数组时使用)
* 例:查询选中item对象的所有权项目
* @param property:属性名称 ;例:(owning_project)
* @param tcComponent:当前对象;(TCComponentItem)
* @return TCComponent:引用对象
* @throws TCException
* */
public TCComponent getReferenceTCComponent(String property,TCComponent tcComponent) throws TCException {
TCComponent referenceProperty = tcComponent.getReferenceProperty(property);
return tcComponent;
}
2、根据引用属性获取引用属性所属对象
/**根据引用属性获取引用属性所属对象(当属性值为数组时使用)
* 例:查询选中item对象的项目列表
* @param property:属性名称 ;例:(project_list)
* @param tcComponent:当前对象;(TCComponentItem)
* @return TCComponent[]:引用对象列表(选中零件的项目列表)
* @throws TCException
* */
public TCComponent[] getReferenceTCComponents(String property,TCComponent tcComponent) throws TCException {
//1、直接获取
TCComponent[] referenceListProperty = tcComponent.getReferenceListProperty(property);
//2、根据属性获取
TCProperty tcProperty = tcComponent.getTCProperty(property);
TCComponent[] referenceValues = TCProperty.getReferenceValues(new TCProperty[]{tcProperty});
return referenceValues;
}
十一、BMIDE中的扩展对象类型
1、获取系统中的用户
/**获取系统中的用户*/
public List<String> getUserList() throws TCException {
TCComponentUserType user = (TCComponentUserType)session.getTypeComponent("User");
TCComponent[] extent = user.extent();
List<String> resultList = new ArrayList<String>(extent.length);
resultList.add("");
for(TCComponent tc:extent) {
if (tc instanceof TCComponentUser) {
TCComponentUser user1 = (TCComponentUser) tc;
resultList.add(user1.toString());
//resultList.add(user1.getUserId());
}
}
return resultList;
}
2、获取系统中的组
/**获取系统中的组*/
public List<String> getGroupList() throws TCException {
TCComponentGroupType group = (TCComponentGroupType)session.getTypeComponent("Group");
TCComponent[] extent = group.extent();
List<String> resultList = new ArrayList<String>(extent.length);
resultList.add("");
for(TCComponent tc:extent) {
resultList.add(tc.toString());
}
return resultList;
}
3、获取系统中的发布状态
/**获取系统中的发布状态*/
public List<String> getStatusList() throws TCException {
TCComponentStatusTypeType status = (TCComponentStatusTypeType)session.getTypeComponent("TaskType");
TCComponent[] extent = status.extent();
List<String> resultList = new ArrayList<String>(extent.length);
resultList.add("");
for(TCComponent tc:extent) {
resultList.add(tc.toString());
}
return resultList;
}