com.teamcenter.rac.aifrcp
teamcenter基礎客戶化插件,一些主要的藉口以及抽象類,入口類等都在改插件中進行了定義
- AbstractAIFApplication
- AbstractAIFCommand
- AbstractAIFDialog
- AbstractAIFOperation
- AIFDesktop
- AIFPortal
- AbstractAIFAction
com.teamcenter.rac.common
teamcenter的一些動作和菜單都在該插件包中進行了定義,如菜單欄,工具欄,以及右鍵菜單等。首先要說的是,界面上所有菜單,以及一些公共組件及Form的頂級實現。一般的菜單動作都在rac.common.actions中進行了定義
com.teamcenter.rac.external
Teamcenter中引用的第三方包 用於自己的功能模塊的使用
com.teamcenter.rac.kernal
teamcenter核心插件包,下圖是會話的獲取方式
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
TCSession session = (TCSession) app.getSession();
基本上就是系統中的每一個業務對象都在改插件中有相應的類去實現。比如Folder對象
1、TCComponentFolder該類繼承了TCComponent類。擴展定義了Folder的獲取以及和屬性的修改方法,基本上所有的業務對象都繼承於TCComponent類。
2.一個業務類對象對應的組件類相應的也會對應一個業務類型類,如Folder對應的業務類型組件類爲TCComponentFolderType。該類繼承於TCComponentType類。該類主要擴展定義了相應的業務對象的創建以及另存爲等方法。
TCComponentFolderType fodlerType = (TCComponentFolderType)session.getTypeComponent("Folder");
TCComponentFolder folder = folderType.create("My Folder Name","My Folder Description","My Folder Type");
com.teamcenter.rac.tcapps
teamcenter中部分應用的基礎實現都是在該類中進行了實現,這個主要是遺留問題,雖然現在的應用的大部分都是以相應的插件進行了區別與分類,但是大部分應用的業務邏輯都是在該插件中進行實現的,還有一些公共組件等:
- com.teamcenter.rac.cme.mpp:對MSE應用進行了實現
- com.teamcernter.rac.pse:對結構管理器進行了實現
- com.teamcenter.rac.querybuilder:對查詢構建器進行了實現
- com.teamcenter.rac.explorer:對MyTeamcenter進行了實現
com.teamcenter.rac.util
該插件是Teamcenter對大部分Swing組件進行了繼承和重寫:如iTextField繼承於JTextField
該插件中定義了一些公共工具類,如:TcLogger日誌控制類,Registry註冊控制類等
Folder的創建:
TCComponentFolderType fodlerType = (TCComponentFolderType)session.getTypeComponent("Folder");
TCComponentFolder folder = folderType.create("My Folder Name","My Folder Description","My Folder Type");
Form的創建:
TCComponentFormType tccomponentFormType=(TCComponentFormType)session.getTypeComponent("Form");
TCComponentForm tccomponentForm = tccomponentFormType.create("MyForm","MyFromDescription","MyForm");
Item的創建
item的創建相對來說比前兩個都複雜點
先根據系統類型從系統中獲取編碼和版本編碼,然後創建
ItemId,ItemRev
//ItemID和ItemRev獲取方法
TCComponentItemType tccomponentItemType = (TCComponentItemType)session.getTypeComponent("Item");
String itemId = tccomponentItemType.getNewID();
String itemRev= tccomponentItemType.getNewRev(null);
//Item單位獲取方法
TCComponentType uom = session.getTypeComponent("UnitOfMeasure");
TCCompont[] uoms = uom.extent();
//Item的創建方法
TCComponentItem item = tccomponentItemType.create(itemId,itemRev,"My Item Name","My Item Description",uoms[0]);
DataSet的創建方法
數據集的創建涉及到命名引用,所以創建過程是先創建一個類型的數據集合,然後把命名引用添加上去:
String as1[] = {url};
String as2[] = {"Text"};
String as3[] = {"Text"};
String as4[] = {"Plain"};
TCComponentDataSetType dataSetType = (TCComponentDataSetType)session.getTypeComponent("Text");
TCComponentDataSet dataSet = dataSetType.create("My DataSet Name","Text","Text");
dataSet.setFiles(as1,as2,as3,as4);
查詢構建器的調用
Teamcenter中有專門的查詢構建器模塊,我們可以通過配置查詢構建器然後通過代碼對系統中的對象進行搜索:
TCTextService tcTextService = session.getTextService();
String asKey[] = {tcTextService.getTextValue("item_id")};
String asValue[] = {"000001"};
InterfaceAIFComponent interfaceAifComponent[] = session.serach("ItemId...",asKey,asValue);
Teamcenter中BOM結構的構建
1.創建BOMWindow對象
2.得到BOMLine對象
3.分別在BOMLine上添加就好了
TCComponentRevisionRuleType revisionRuleType = (TCComponentRevisionRuleType)session.getTypeComponent("RevisionRule");
TCComponentRevisionRule revisionRule = revisionRuleType.getDefaultRule();
TCComponentBOMWindowType bomWindowType = (TCComponentBOMWindowType)session.getTypeComponent("BOMWindow");
TCComponentBOMWindow bomWindow = bomWindowType.create(revisionRule);
TCComponentBOMLine bomLine = bomWindow.setWindowTopLine(item,itemRevision,component,XXX);
TCComponentBOMLine bomLine = bomWindow.setWindowTopLine(itemRev.getItem(),itemRev,revView,null);