Дополнительные возможности Windchill > Управление производственным процессом > Настройка редактора структуры изделия (PSE) > Создание вкладки требований
  
Создание вкладки требований
Этот раздел содержит инструкции по отображению в PSE вкладки требований. При выполнении этих инструкций создается вкладка требований, которая отображается в PSE и будет включена только в том случае, если в дереве структуры выбрана деталь указанного типа. Вкладка покажет объекты Requirement, связанные с выбранным объектом, а также предоставит некоторые операции для работы с Requirements.
Эта документация описывает изменения в существующих файлах. Предполагается, что создан отдельный клиентский файл, в котором содержатся все новые созданные элементы.
Доступны следующие инструкции:
Обновление элемента <TabSet> для включения вкладки Requirements
Определите элемент <Tab> для вкладки Requirements
Определить элемент <AssociationTable> для вкладки Requirements
Определить элемент <StructureAuthorDefinition> для таблицы связей
Определить элемент <StructureDefinitionSimple> для детали в связи требования
Определить элемент <Table> для типа Requirement
Определить меню для вкладки Requirements
Определить метки, всплывающие подсказки и мнемонические правила для вкладки Requirements
Определить элементы <ActionDefinition>, на которые ссылаются элементы <MenuItem>
Реализация класса EnabledDecider для управления условиями включения вкладки
Обновление элемента <TabSet> для включения вкладки Requirements
Добавляет в определенный элемент TabSet ссылку на вкладку Requirements.
1. Откройте файл PDMLinkExplorerMain.xml в следующем расположении:
<Windchill>/codebase/config/logicrepository/xml/explorer/product
structure
2. Найдите элемент <TabSet>, добавьте импорт для новой вкладки Requirements и поместите его в требуемое расположение:
<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> для вкладки Requirements
Это определит вкладку Requirements.
1. Откройте файл PDMLinkExplorerMain.xml в следующем расположении:
<Windchill>/codebase/config/logicrepository/xml/explorer/product
structure
2. После элемента <TabSet> определите элемент <Tab> для вкладки Requirements:
<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>
* 
Атрибут ID для элемента Tab должен соответствовать ID, указанному в подэлементе импорта элемента <TabSet>, определенного выше.
Класс, определенный для атрибута enabledDeciderClass элемента Tab, управляет тем, для каких типов включается вкладка, когда детали выбираются в дереве структуры. Это должно быть реализовано клиентом.
Атрибут imageName подэлемента <Label> определяет значок, отображаемый на вкладке.
Подэлемент <Resource> в <Label> ссылается на определенную текстовую метку для вкладки.
Элемент <Panel> содержит импорт в определенную таблицу, которая будет показана.
Определить элемент <AssociationTable> для вкладки Requirements
Это определит элемент AssociationTable, используемый вкладкой Requirements.
1. Откройте файл PDMLinkExplorerMain.xml в следующем расположении:
<Windchill>/codebase/config/logicrepository/xml/explorer/product
structure
2. После определения элемента <Tab> для вкладки Requirements определите элемент <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>
* 
Атрибут ID для <AssociationTable> должен соответствовать ID, определенному в подэлементе импорта элемента <Tab>, который определен выше.
Подэлемент <Resource> элемента <Label> ссылается на текстовую метку, определенную в файле ресурсов, который будет использоваться для таблицы.
Определить элемент <StructureAuthorDefinition> для таблицы связей
Это определит элемент StructureAuthorDefinition, используемый объектом AssociationTable.
1. Откройте файл ExplorerStructures.xml в следующем расположении:
<Windchill>/codebase/config/logicrepository/xml/explorer/struct
ureexplorer
2. Найдите раздел в файле, где декларируются определения автора структуры. После последнего элемента <StructureAuthorDefinition> добавьте следующее определение для Requirements:
<StructureAuthorDefinition id="mycom.wnc.exp.RequirementSAD">
<Import id="mycom.wnc.exp.PartToRequirementSD"/>
</StructureAuthorDefinition>
* 
Атрибут ID для <StructureAuthorDefinition> должен соответствовать ID, указанному в подэлементе импорта элемента <AssociationTable>, определенного выше.
Определить элемент <StructureDefinitionSimple> для детали в связи требования
Это определяет элемент StructureDefinitionSimple, используемый элементом StructureAuthorDefinition.
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>
* 
Атрибут ID для <StructureDefinitionSimple> должен соответствовать ID, указанному в подэлементе импорта элемента <StructureAuthorDefinition>, определенного выше.
Определить элемент <Table> для типа Requirement
Это определит таблицу для отображения объектов Requirements (действия по изменению), связанных с выбранной деталью в дереве структуры. В столбцах будут показаны следующие данные:
Номер объекта Requirement
Диапазон ограничения применимости объекта Requirement
Статус объекта Requirement
Номер объекта ChangeDirective, владеющего данным требованием
Идентификатор детали, реализующей данный объект Requirement
Номер объекта Requirement, предшественника данного объекта Requirement
Как определить элемент <Table> для типа Requirement
1. Откройте файл PDMLinkExplorerForTablesAndPanels.xml в следующем расположении:
<Windchill>/codebase/config/logicrepository/xml/explorer/produc
tstructure
2. В конце файла сделайте следующее:
a. Создайте следующий элемент <ExplorerElementGroup> как подэлемент элемента <LogicRepository>.
b. Определите для <ExplorerElementGroup> подэлемент <LogicContext> с типом данных Requirement.
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>
* 
Атрибут dataType элемента <LogicContext> определяет тип детали, которая будет показана в определенной таблице.
Атрибут ID для элемента <Table> должен соответствовать ID, указанному в подэлементе импорта элемента <AssociationTable>, определенного выше.
Атрибут attributeId элемента <CellDefinition> определяет квалифицированные данные атрибута, которые будут показаны в данной ячейке.
Атрибут rendererClass элемента <CellDefinition> является дополнительным и переопределяет для ячейки средство рендеринга по умолчанию.
Подэлемент <Resource> элемента <Label> ссылается на текстовую метку, определенную в файле ресурсов, который будет использоваться для заголовка столбца.
Определить меню для вкладки Requirements
Это определит меню и панель инструментов для вкладки Requirements. Панель инструментов будет определена со следующей структурой:
Стандартная кнопка "Информация"
Кнопка "Генерировать требования". Эта кнопка инициирует действие по созданию требований для детали, выбранной в структуре.
Кнопка "Привести в соответствие требованиям". Эта кнопка представит пользователю список деталей для выбора и назначения кандидатов на выполнение текущего выбранного объекта Requirement.
Кнопка "Показать журнал применимости". Эта кнопка откроет окно навигатора и отобразит журнал ограничения применимости для текущего выбранного объекта Requirement.
Стандартная кнопка "Возврат"
Стандартная кнопка "Комментарий"
Стандартная кнопка "Возврат"
Стандартная кнопка "Комментарий"
Для таблицы также определены всплывающие меню, которые содержат пункты меню для трех новых операций:
Генерировать требования
Привести в соответствие требованиям
Показать журнал применимости
Чтобы определить меню для вкладки Requirements
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>
* 
Атрибут ID для элемента <ActionAccess> должен соответствовать ID, указанному в подэлементе импорта элемента <AssociationTable>, определенного выше.
Подэлемент <Resource> элементов <Label> и <Tooltip> ссылаются на текстовую метку, определенную в файле ресурсов, который будет использоваться для заголовка столбца.
Определить метки, всплывающие подсказки и мнемонические правила для вкладки Requirements
Определите текст для меток, всплывающих подсказок и мнемонических правил, используемых на вкладке Requirements.
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, должно соответствовать ключевому атрибуту элемента <Resource> в конфигурационных XML-файлах.
Определить элементы <ActionDefinition>, на которые ссылаются элементы <MenuItem>
Это инструкции для представления действий на вкладке Requirements в PSE. Эти инструкции предоставят действие, соответствующее записям элементов меню и панели инструментов для действия "Привести в соответствие требованиям", определенного в инструкциях пользовательской настройки вкладки Requirements.
1. Откройте файл PDMLinkExplorerActions.xml в следующем расположении:
<Windchill>/codebase/config/logicrepository/xml/explorer/produc
tstructure
2. Найдите элемент <ExplorerElementGroup> с подэлементом <LogicContext>, для которого значение атрибута приложения равно 'ptc.pdm. ProductStructureExplorer'. Элементы ActionDefinition будут добавлены после элемента LogicContext.
3. Определите соответствующий элемент с помощью шагов, найденных в следующих разделах.
Определить элемент ActionDefinition для действия "Привести в соответствие требованиям"
Это определит элемент определения действия для действия "Привести в соответствие требованиям".
Как подробно описано выше, найдите элемент <ExplorerElementGroup> с подэлементом <LogicContext>, для которого значение атрибута приложения равно 'ptc.pdm. ProductStructureExplorer'. После элемента 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>
* 
Атрибут ID, определенный в <ActionDefinition>, должен соответствовать ID импорта, указанному для пункта меню FulfillReqMI, определенного в PDMLinkExplorerMenusForRequirementsTab.xml.
Атрибут actionClass будет определен с учетом структуры узла для элементов изменения и конструкторских решений. Если набор конструкторских решений находится непосредственно в узле элемента изменения, то необходимо указать следующий класс: com.ptc.windchill.explorer.structureexplorer.panel.actions.FulfillChangeActionAction. Если набор конструкторских решений находится на два уровня ниже соответствующего узла элемента изменения, то необходимо указать следующий класс: com.ptc.windchill.explorer.structureexplorer.panel.actions.FulfillChangeActionForStruc tureWithIntermediateNodeAction.
ID импорта в элементе <StructureAuthorAction> должен соответствовать ID определения структуры, указанному в файле ExplorerStructures.xml.
Все детали, расположенные на уровне, определенном в actionClass, считаются потенциальными конструкторскими решениями для выполнения и будут представлены пользователю в выпадающем списке.
Определить элемент ActionDefinition для действия "Генерировать действия по изменению"
Это определит элемент определения действия для действия "Генерировать действия по изменению".
Как подробно описано выше, найдите элемент <ExplorerElementGroup> с подэлементом <LogicContext>, для которого значение атрибута приложения равно 'ptc.pdm. ProductStructureExplorer'. После элемента 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>
* 
Атрибут ID, определенный в <ActionDefinition>, должен соответствовать ID импорта, указанному для пункта меню GenerateReqsMI, определенного в файле PDMLinkExplorerMenusForRequirementsTab.xml.
Определить элемент ActionDefinition для действия "Показать журнал применимости"
Это определит элемент определения действия для действия "Показать журнал применимости".
Как подробно описано выше, найдите элемент <ExplorerElementGroup> с подэлементом <LogicContext>, для которого значение атрибута приложения равно 'ptc.pdm. ProductStructureExplorer'. После элемента 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>
Атрибут ID, определенный в <ActionDefinition>, должен соответствовать ID импорта, указанному для пункта меню ViewEffLogMI, определенного в PDMLinkExplorerMenusForRequirementsTab.xml.
Реализация класса EnabledDecider для управления условиями включения вкладки
Следующее создает новый класс, который будет управлять условиями включения и отключения вкладки Requirements. Вкладка Requirements будет включена и функциональна только в случае, если в дереве структуры выбрана деталь, соответствующая одному из типов, определенных в классе EnabledDecider.
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;
}
}