其他 Windchill 功能 > 製造流程管理 > 自訂產品結構總管 (PSE) > 建立「要求」標籤
  
建立「要求」標籤
本節包含在 PSE 中顯示「要求」標籤的指示。遵照這些指示可建立將顯示在 PSE 內的「要求」標籤,此標籤將會在使用者於結構樹中選取指定類型的零件時啟用。此標籤會顯示與所選物件相關聯的「要求」物件,並提供一些用於處理「要求」的操作。
此文件集描述既有檔案的變更。建議您建立單獨的客戶檔案,以納入所有新建立的元素。
提供的指示如下:
更新 <TabSet> 元素,以納入「要求」標籤
定義「要求」標籤的 <Tab> 元素
定義「要求」標籤的 <AssociationTable> 元素
定義關聯表的 <StructureAuthorDefinition> 元素
定義零件與要求關聯的 <StructureDefinitionSimple> 元素
定義「要求」類型的 <Table> 元素
定義「要求」標籤的選單
定義「要求」標籤的標籤、工具提示及助記憶碼
定義 <MenuItem> 元素中參照的 <ActionDefinition> 元素
實行 'enabled decider' 類別,以控制何時啟用此標籤
更新 <TabSet> 元素,以納入「要求」標籤
如此可將「要求」標籤的參照新增至已定義的 TabSet。
1. 從下列位置開啟 PDMLinkExplorerMain.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/product
structure
2. 找出 <TabSet> 元素,並針對新「要求」標籤新增匯入項,然後將之放置在所需位置:
<TabSet id="ptc.pdm.pse.ExplorerTaskTabSet" tabPlacement="top"
tabIdWithFocus="ptc.wnc.exp.PropertiesTab">
<Import id="ptc.wnc.exp.PropertiesTab"/>
<Import id="ptc.wnc.exp.StructureChildrenTab"/>
<Import id="mycom.wnc.exp.RequirementsTab"/>
<Import id="ptc.wnc.exp.GpsParamTab"/>
<Import id="ptc.wnc.exp.GpsConstraintsTab"/>
<Import id="ptc.wnc.exp.ViewTab"/>
<Import id="ptc.wnc.exp.DocTab"/>
<Import id="ptc.wnc.exp.ReplacementsTab"/>
<Import id="ptc.wnc.exp.UsedByTab"/>
</TabSet>
定義「要求」標籤的 <Tab> 元素
如此可定義「要求」標籤元素。
1. 從下列位置開啟 PDMLinkExplorerMain.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/product
structure
2. <TabSet> 元素之後,定義「要求」標籤的 <Tab> 元素:
<TabSet id="ptc.pdm.pse.ExplorerTaskTabSet" ... >
...
</TabSet>
<Tab id="mycom.wnc.exp.RequirementsTab"
tabClass="com.ptc.windchill.explorer.structureexplorer.explorer
.tabs.ShowTablesTab"
enabledDeciderClass="com.mycom.windchill.explorer.structureexpl
orer.deciders.RequirementsEnabledDecider">
<Label imageName="wtcore/images/change_action.gif">
<Resource key="requirementsTabLabel"/>
</Label>
<Panel>
<Import id="mycom.pdm.pse.RequirementAssocTable"/>
</Panel>
</Tab>
* 
Tab 元素的 ID 屬性必須與上面定義的 <TabSet> 元素的匯入子元素內所指定的 ID 相符。
針對 Tab 元素的 enabledDeciderClass 屬性定義的類別可控制使用者在結構樹中選取零件時,將啟用的此標籤的類型。此動作必須由客戶實行。
<Label> 子元素的 imageName 屬性可定義將顯示在標籤上的圖示。
<Label> 的 <Resource> 子元素係指標籤的已定義文字標籤。
<Panel> 元素包含待顯示的已定義表格匯入項。
定義「要求」標籤的 <AssociationTable> 元素
如此可定義「要求」標籤所用的 AssociationTable 元素。
1. 從下列位置開啟 PDMLinkExplorerMain.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/product
structure
2. 完成「要求」標籤的 <Tab> 元素定義後,定義 <AssociationTable> 元素。
<Tab id="mycom.wnc.exp.RequirementsTab" ... >
...
</Tab>
<AssociationTable
id="mycom.pdm.pse.mycom.pdm.pse.RequirementAssocTable">
<Label>
<Resource key="requirementsLabel"/>
</Label>
<Import id="mycom.wnc.exp.RequirementSAD"/>
<Import id="mycom.wnc.exp.ChangeActionTabTable"/>
<Import id="mycom.wnc.exp.ChangeActionAssocTableAA"/>
</AssociationTable>
* 
<AssociationTable> 的 ID 屬性必須與上列定義的 <Tab> 元素的匯入子元素內所指定的 ID 相符。
<Label> 元素的 <Resource> 子元素係指在將用於表格的資源檔案中所定義的文字標籤。
定義關聯表的 <StructureAuthorDefinition> 元素
如此可定義 AssociationTable 所用的 StructureAuthorDefinition 元素。
1. 從下列位置開啟 ExplorerStructures.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/struct
ureexplorer
2. 在檔案中尋找定義結構編寫者定義所在的部份。在最後一個 <StructureAuthorDefinition> 元素之後,新增下列「要求」定義:
<StructureAuthorDefinition id="mycom.wnc.exp.RequirementSAD">
<Import id="mycom.wnc.exp.PartToRequirementSD"/>
</StructureAuthorDefinition>
* 
<StructureAuthorDefinition> 的 ID 屬性必須與上列定義的 <AssociationTable> 元素的匯入子元素內所指定的 ID 相符。
定義零件與要求關聯的 <StructureDefinitionSimple> 元素
如此可定義 StructureAuthorDefinition 元素所用的 StructureDefinitionSimple 元素。
1. 從下列位置開啟 ExplorerStructures.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/struct
ureexplorer
2. 在檔案中尋找定義結構定義所在的部份。在最後一個 <StructureDefinition> 元素之後,新增下列定義:
<StructureDefinitionSimple
id="mycom.wnc.exp.PartToRequirementSD"
parentToChild="addressedPartMasterReference"
childDisplayId="number">
<Import id="ptc.wnc.exp.WTPartTD"/>
</StructureDefinitionSimple>
* 
<StructureDefinitionSimple> 的 ID 屬性必須與上列定義的 <StructureAuthorDefinition> 元素的匯入子元素內所指定的 ID 相符。
定義「要求」類型的 <Table> 元素
如此可定義表格,以便在結構樹中顯示與所選零件相關聯的「要求」(「變更動作」)。下列資料將會顯示在欄中:
「要求」的數目
「要求」的生失效範圍
「要求」的狀況
擁有此要求的 ChangeDirective 的數目
達成此「要求」的零件識別元
此「要求」的前置任務「要求」數目
欲定義「要求」類型的 <Table> 元素
1. 從下列位置開啟 PDMLinkExplorerForTablesAndPanels.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/produc
tstructure
2. 在檔案結尾:
a. 將下列 <ExplorerElementGroup> 建立為 <LogicRepository> 元素的子元素。
b. 以「要求」的資料類型定義 <ExplorerElementGroup> 的 <LogicContext> 子元素。
c. 定義將顯示在表格中的 <Table> 元素和欄以及 <CellDefinition> 元素。
<LogicRepository>
...
<ExplorerElementGroup>
<LogicContext
application="ptc.pdm.ProductStructureExplorer"
dataType="wt.change2.ChangeAction"/>

<Table id="airbus.wnc.exp.ChangeActionTabTable"
selectionMode="multi-non-contiguous" displayMode="view">
<CellDefinition id="number" mandatory="true" \
pinned="true">
<Label>
<Resource key="reqNumberLabel"/>
</Label>
<AttributeDefinition attributeId="number"/>
</CellDefinition>
<CellDefinition id="effVector" mandatory="true">
<Label>
<Resource key="reqValidityLabel"/>
</Label>
<AttributeDefinition attributeId="displayEffectivity"/>
</CellDefinition>
<CellDefinition id="theActionState"
mandatory="true">
<Label>
<Resource key="reqStatusLabel"/>
</Label>
<AttributeDefinition attributeId="theActionState"/>
</CellDefinition>
<CellDefinition id="owningChangeDirective"
mandatory="true">
<Label>
<Resource key="relatedCINLabel"/>
</Label>
<AttributeDefinition attributeId="MBA|
owningChangeDirectiveReference^WCTYPE|
wt.change2.WTChangeDirective~MBA|number"
rendererClass="com.ptc.windchill.explorer.structureexplorer.ren
derer.component.TypeIconifiedStringComponent"/>
</CellDefinition>
<CellDefinition id="satisfyPartMaster"
mandatory="true">
<Label>
<Resource key="fulfillingDSLabel"/>
</Label>
<AttributeDefinition attributeId="MBA|
satisfyPartMasterReference^WCTYPE|wt.part.WTPartMaster~MBA|
masterReference@WCTYPE|wt.part.WTPart~SCA|displayIdentifier"
rendererClass="com.ptc.windchill.explorer.structureexplorer.ren
derer.component.TypeIconifiedStringComponent"/>
</CellDefinition>
<CellDefinition id="oldActionReference"
displayWhenNoPreferenceSet="false">
<Label>
<Resource key="reqPredecessorLabel"/>
</Label>
<AttributeDefinition attributeId="MBA|
oldActionReference^WCTYPE|wt.change2.ChangeAction~MBA|number"
rendererClass="com.ptc.windchill.explorer.structureexplorer.ren
derer.component.TypeIconifiedStringComponent"/>
</CellDefinition>
</Table>
</ExplorerElementGroup>
</LogicRepository>
* 
<LogicContext> 元素的 dataType 屬性可定義將顯示在所定義表格中的零件類型。
<Table> 的 ID 屬性必須與上列定義的 <AssociationTable> 元素的匯入子元素內所指定的 ID 相符。
<CellDefinition> 元素的 attributeId 屬性可定義將顯示在該儲存格中的合格屬性資料。
<CellDefinition> 元素的 rendererClass 屬性為選用性質,可取代該儲存格的預設顯示程式。
<Label> 元素的 <Resource>子元素係指在將用於欄標題的資源檔案中所定義的文字標籤。
定義「要求」標籤的選單
如此可定義「要求」標籤的選單和工具列。將以下列結構定義工具列:
標準「資訊」按鈕
「生成要求」按鈕。此按鈕將觸發一個動作,以便為結構中目前所選的零件生成要求。
「達成要求」按鈕。此按鈕會顯示一份可從中選取並指定為達成目前所選要求的候選零件清單。
「檢視生失效記錄檔」按鈕。此按鈕可開啟瀏覽器視窗,並顯示目前所選要求的生失效記錄檔。
標準「反轉」按鈕
標準「註解」按鈕
標準「反轉」按鈕
標準「註解」按鈕
也會針對內含選單項目的表格定義快顯選單,以便執行下列三項新操作:
生成要求
達成要求
檢視生失效記錄檔
欲定義「要求」標籤的選單
1. 從下列位置開啟 PDMLinkExplorerMenusForRequirementsTab.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/produc
tstructure
2. 將下列內容新增至檔案:
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE LogicRepository SYSTEM
"/config/logicrepository/dtd/LogicRepository.dtd">
<LogicRepository>
<ExplorerElementGroup>
<LogicContext
application="ptc.pdm.ProductStructureExplorer"/>
<ActionAccess id="mycom.wnc.exp.ChangeActionAssocTableAA">
<MenuBar id="MenuBar">
<Menu id="Menu">
<Import id="ptc.wnc.exp.InfoPageAssocMI"/>
<Separator/>
<MenuItem id="GenerateReqsMI">
<Label
imageName="com/ptc/windchill/explorer/config/images/child_creat
e.gif">
<Resource key="generateReqsLabel"/>
</Label>
<ToolTip>
<Resource key="generateReqsToolTip"/>
</ToolTip>
<Import
id="mycom.wnc.exp.GenerateRequirementsAction"/>
</MenuItem>
<MenuItem id="FulfillReqMI">
<Label
imageName="com/ptc/windchill/explorer/config/images/child_add.g
if">
<Resource key="fulfillReqLabel"/>
</Label>
<ToolTip>
<Resource key="fulfillReqToolTip"/>
</ToolTip>
<Import
id="mycom.wnc.exp.FulfillRequirementAction"/>
</MenuItem>
<MenuItem id="ViewEffLogMI">
<Label
imageName="com/ptc/windchill/explorer/config/images/child_repor
t.gif">
<Resource key="viewEffLogLabel"/>
</Label>
<ToolTip>
<Resource key="viewEffLogToolTip"/>
</ToolTip>
<Import
id="mycom.wnc.exp.ViewEffectivityLogAction"/>
</MenuItem>
<Separator/>
<MenuItem id="RevertMI">
<Label
imageName="com/ptc/windchill/explorer/config/images/revert.gif"
>
<Resource key="revertLabel"/>
</Label>
<ToolTip>
<Resource key="revertToolTip"/>
</ToolTip>
<Import
id="ptc.wnc.exp.RevertForAltAssocAction"/>
</MenuItem>
<Import id="ptc.wnc.exp.CommentAssocMI"/>
</Menu>
</MenuBar>
<ModeToolBar id="ToolBarA">
<Import id="ptc.wnc.exp.EditAppMode"/>
<MenuItemIdentifier
id="ptc.wnc.exp.InfoPageAssocMI"/>
<Separator/>
<MenuItemIdentifier id="GenerateReqsMI"/>
<MenuItemIdentifier id="FulfillReqMI"/>
<MenuItemIdentifier id="ViewEffLogMI"/>
</ModeToolBar>
<ModeToolBar id="ToolBarB">
<Import id="ptc.wnc.exp.DraftAppMode"/>
<Import id="ptc.wnc.exp.AnnotateAppMode"/>
<Import id="ptc.wnc.exp.ReadOnlyAppMode"/>
<MenuItemIdentifier
id="ptc.wnc.exp.InfoPageAssocMI"/>
<Separator/>
<MenuItemIdentifier id="GenerateReqsMI"/>
<MenuItemIdentifier id="FulfillReqMI"/>
<MenuItemIdentifier id="ViewEffLogMI"/>
<Separator/>
<MenuItemIdentifier id="RevertMI"/>
<MenuItemIdentifier
id="ptc.wnc.exp.CommentAssocMI"/>
</ModeToolBar>
<ModePopupMenu id="PopupMenuA">
<Import id="ptc.wnc.exp.EditAppMode"/>
<MenuItemIdentifier id="GenerateReqsMI"/>
<MenuItemIdentifier id="FulfillReqMI"/>
<MenuItemIdentifier id="ViewEffLogMI"/>
</ModePopupMenu>
<ModePopupMenu id="PopupMenuB">
<Import id="ptc.wnc.exp.DraftAppMode"/>
<Import id="ptc.wnc.exp.AnnotateAppMode"/>
<MenuItemIdentifier id="GenerateReqsMI"/>
<MenuItemIdentifier id="FulfillReqMI"/>
<MenuItemIdentifier id="ViewEffLogMI"/>
<Separator/>
<MenuItemIdentifier id="RevertMI"/>
<MenuItemIdentifier
id="ptc.wnc.exp.CommentAssocMI"/>
</ModePopupMenu>
</ActionAccess>
</ExplorerElementGroup>
</LogicRepository>
* 
<ActionAccess> 元素的 ID 屬性必須與上列定義的 <AssociationTable> 元素的匯入子元素內所指定的 ID 相符。
<Label> 和 <Tooltip> 元素的 <Resource> 子元素係指在將用於欄標題的資源檔案中所定義的文字標籤。
定義「要求」標籤的標籤、工具提示及助記憶碼
定義「要求」標籤中所用的標籤、工具提示及助記憶碼文字。
1. 從下列位置開啟 ConfigurationResource.rbInfo 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/produc
tstructure
2. 將下列內容新增至檔案結尾:
#
# Tabbed Pane - Requirements
#
requirementsTabLabel.value=Requirements
# Change Item to Requirements table
requirementsLabel.value=Requirements
reqNumberLabel.value=Number
reqValidityLabel.value=Effectivity
reqStatusLabel.value=Status
relatedCINLabel.value=Originating From
fulfillingDSLabel.value=Fulfilled By
reqPredecessorLabel.value=Predecessor
generateReqsLabel.value=Generate Requirements
generateReqsToolTip.value=Generate Requirements
fulfillReqLabel.value=Fulfill Requirement
fulfillReqToolTip.value=Fulfill Requirement
viewEffLogLabel.value=View Effectivity Calculation Log
viewEffLogToolTip.value=View Effectivity Calculation Log
* 
在檔案中定義的屬性名稱 (例如 <property name>.value) 必須與 XML 組態檔案中 <Resource> 元素的索引鍵屬性相符。
定義 <MenuItem> 元素中參照的 <ActionDefinition> 元素
這些是在 PSE 的「要求」標籤上顯示動作的指示。這些指示將針對設定「要求」標籤的自訂指示中所定義的「達成要求」動作提供與選單及工具列項目輸入項相對應的動作。
1. 從下列位置開啟 PDMLinkExplorerActions.xml 檔案:
<Windchill>/codebase/config/logicrepository/xml/explorer/produc
tstructure
2. 以 'ptc.pdm.ProductStructureExplorer' 的應用程式屬性值找到子元素為 <LogicContext> 的 <ExplorerElementGroup> 元素。ActionDefinition 元素會被新增到 LogicContext 元素之後。
3. 使用下列各節所述的步驟定義相應的元素。
定義「達成要求」動作的 ActionDefinition 元素
此舉將定義「達成要求」動作的 ActionDefinition 元素。
如上所述,以 'ptc.pdm.ProductStructureExplorer' 的應用程式屬性值找到子元素為 <LogicContext> 的 <ExplorerElementGroup> 元素。在 LogicContext 元素之後新增如下所列的 ActionDefinition 元素:
<ActionDefinition id="mycom.wnc.exp.FulfillRequirementAction"
actionClass="com.ptc.windchill.explorer.structureexplorer.panel
.actions.FulfillChangeActionForStructureWithIntermediateNodeAct
ion">
<StructureAuthorAction>
<Import id="mycom.wnc.exp.PartToRequirementSD"/>
</StructureAuthorAction>
<Import id="ptc.wnc.exp.IsValidInAllWithReadVAL"/>
</ActionDefinition>
* 
在 <ActionDefinition> 中定義的 ID 屬性必須與 PDMLinkExplorerMenusForRequirementsTab.xml 中所定義的 FulfillReqMI 選單項目的已定義匯入 ID 相符。
actionClass 屬性將依據「變更項目」及「設計解決方案」的節點結構來定義。如果將「設計解決方案」設定在「變更項目」節點正下方,則應指定以下類別︰com.ptc.windchill.explorer.structureexplorer.panel.actions.FulfillChangeActionAction。如果將「設計解決方案」設定在其「變更項目」節點以下兩個層級,則應指定以下類別:com.ptc.windchill.explorer.structureexplorer.panel.actions.FulfillChangeActionForStruc tureWithIntermediateNodeAction。
<StructureAuthorAction> 元素中的匯入 ID 必須與 ExplorerStructures.xml 檔案中定義的結構定義 ID 相符。
位於 actionClass 所定義層級中的所有零件均會被視為達成要求的可能「設計解決方案」,並顯示在挑選清單中供使用者檢視。
定義「產生變更動作」動作的 ActionDefinition 元素
此舉可定義「產生變更動作」動作的 ActionDefinition 元素。
如上所述,以 'ptc.pdm.ProductStructureExplorer' 的應用程式屬性值找到子元素為 <LogicContext> 的 <ExplorerElementGroup> 元素。在 LogicContext 元素之後新增如下所列的 ActionDefinition 元素:
<ActionDefinition id="mycom.wnc.exp.GenerateRequirementsAction"
actionClass="com.ptc.windchill.explorer.structureexplorer.panel
.actions.GenerateChangeActionsAction">
<Action/>
<Import id="ptc.wnc.exp.IsValidInAllVAL"/>
</ActionDefinition>
* 
在 <ActionDefinition> 中定義的 ID 屬性必須與 PDMLinkExplorerMenusForRequirementsTab.xml 中所定義的 GenerateReqsMI 選單項目的已定義匯入 ID 相符。
定義「檢視生失效記錄檔」動作的 ActionDefinition 元素
此舉可定義「檢視生失效記錄檔」動作的「動作定義」元素。
如上所述,以 'ptc.pdm.ProductStructureExplorer' 的應用程式屬性值找到子元素為 <LogicContext> 的 <ExplorerElementGroup> 元素。在 LogicContext 元素之後新增如下所列的 ActionDefinition 元素:
<ActionDefinition id="mycom.wnc.exp.ViewEffectivityLogAction"
actionClass="com.ptc.windchill.explorer.structureexplorer.panel
.actions.AssociationUrlAction">
<UrlAction selectionMode="single"
urlBaseName="servlet/TypeBasedIncludeServlet?">
<UrlParameter value="oid={selected_oid}"/>
</UrlAction>
<Import id="ptc.wnc.exp.IsValidForHTMLLaunchMasterOkVAL"/>
</ActionDefinition>
在 <ActionDefinition> 中定義的 ID 屬性必須與 PDMLinkExplorerMenusForRequirementsTab.xml 中所定義的 ViewEffLogMI 選單項目的已定義匯入 ID 相符。
實行 'enabled decider' 類別,以控制何時啟用此標籤
此舉會建立一個可控制何時啟用與停用「要求」標籤的新類別。僅當在結構樹中選取一個零件 (與 enabled decider 類別中指定的其中一種類型相符) 時,才會啟用「要求」標籤並加以操作。
1. 從下列位置建立 RequirementsEnabledDecider.java 檔案:
<Windchill>/codebase/com/mycom/windchill/explorer/structureexpl
orer/deciders
2. 必要時,修改下列實行內容:
修改 common_ancestry 字串,使其符合欲檢視「要求」的零件的父項類型階層。
在靜態程式碼區塊中,將輸入項新增至欲檢視「要求」的每一種零件類型的 type_id_list
package
com.mycom.windchill.explorer.structureexplorer.deciders;
import java.util.ArrayList;
import java.util.List;
import
wt.services.applicationcontext.implementation.DefaultServicePro
vider;
import
com.ptc.core.foundation.struct.common.StructureConstants;
import com.ptc.core.meta.common.AssociationIdentifier;
import com.ptc.core.meta.common.AssociationTypeIdentifier;
import com.ptc.core.meta.common.AttributeTypeIdentifier;
import com.ptc.core.meta.common.IdentifierFactory;
import com.ptc.core.meta.common.TypeIdentifier;
import com.ptc.core.meta.common.TypeInstanceIdentifier;
import com.ptc.core.meta.type.common.TypeInstance;
import
com.ptc.windchill.explorer.structureexplorer.config.AbstractCon
fig;
import
com.ptc.windchill.explorer.structureexplorer.deciders.EnabledDe
cider;
import
com.ptc.windchill.explorer.structureexplorer.utility.CommonData
;
public class RequirementsEnabledDecider implements
EnabledDecider
{
private static IdentifierFactory identifierFactory =
(IdentifierFactory)
DefaultServiceProvider.getService(IdentifierFactory.class,
"logical"); //$NON-NLS-1$
private static List<TypeIdentifier> type_id_list = new
ArrayList<TypeIdentifier>();
private static String common_ancestry = "WCTYPE|
wt.part.WTPart|com.mycom.MyPart|"; //$NON-NLS-1$
static {
try
{
type_id_list.add(
(TypeIdentifier)identifierFactory.get(common_ancestry +
"com.mycom.CustomPartA")); //$NON-NLS-1$
type_id_list.add(
(TypeIdentifier)identifierFactory.get(common_ancestry +
"com.mycom.CustomPartB")); //$NON-NLS-1$
type_id_list.add(
(TypeIdentifier)identifierFactory.get(common_ancestry +
"com.mycom.CustomPartC")); //$NON-NLS-1$
type_id_list.add(
(TypeIdentifier)identifierFactory.get(common_ancestry +
"com.mycom.CustomPartD")); //$NON-NLS-1$
}
catch(Exception e)
{
e.printStackTrace();
}
}

public boolean isItemEnabled(TypeInstance node_ti,
TypeInstance parent_node_ti, AbstractConfig item_config,
CommonData common_data)
{
boolean enabled = true
if (node_ti !=null)
{
enabled = isValidPart(node_ti);
}
return enabled;
}
/**
* is this node a generice part or a configurable generic
part?
**/
public static boolean isValidPart(TypeInstance node_ti)
{
if (node_ti ==null)
{
return false;
}
TypeInstanceIdentifier node_tii = (TypeInstanceIdentifier)
node_ti.getIdentifier();
if (node_tii ==null)
{
return false;
}
try
{
if (IsMasterd(node_ti))
{
return false;
}
TypeIdentifier type_id = trimTypeId((TypeIdentifier)
node_tii.getDefinitionIdentifier());
for(TypeIdentifier spec_type_id : type_id_list)
{
if(type_id.isDescendedFrom(spec_type_id))
(
return true;
}
}
return false;
}
catch (Exception e)
{
return false;
}
}

/**
* Assumes an iteration...
*
* isMastered is an unpersisted Iteration and a persisted
Master.
*@param ti
*@return
*
*/
private static boolean IsMastered(TypeInstance ti)
{
try
{
TypeInstanceIdentifier tii = (TypeInstanceIdentifier)
ti.getIdentifier();
if (tii instanceod AssociationIdentifier)
{
tii = ((AssociationIdentifier) tii).getTail();
}
if (!tii.isInitialized())
{
AttributeTypeIdentifier master_ati =
(AttributeTypeIdentifier)
identifierFactory.get(StructureConstants.MASTER_REFERENCE_ID_ST
R, tii.getDefinitionIdentifier());
Object object = ti.getSingle(master_ati);
TypeInstanceIdentifier master_tii = null;
if (object instanceof TypeInstanceIdentifier)
{
master_tii = (TypeInstanceIdentifier) object;
}
if (master_tii.isIntialized())
{
return true;
}
}
}
catch (Exception ex)
{
return false;
}

return false;
)
private static TypeIdentifier trimTypeId(TypeIdentifier
type_id)
{
if (type_id instanceof AssociationTypeIdentifier)
{
return ((AssociationTypeIdentifier) type_id).getTail();
}
return teyp_id;
}
}