Defining Attribute Sets
AttributeSet Configuration Files
The markup definition for the AttributeSet supports the ability to define the default include or exclude behavior for each attribute class. The AttributeSet configuration files are located in:
<Windchill-path>\codebase\com\ptc\arbortext\windchill\siscore\attset\xml
When defining a set of attributes in a configuration file, make sure to group all the attributes of single type together.
There are several configuration files available:
• localizable_attset.xml
Defines the set of attributes to send in an XLIFF file for translation. For example, two sections of the file identify the name attribute:
<Type name="com.ptc.sis.Base">
<Attribute action="include" name="name"/>
<Attribute action="include" name="organizationName"/>
<Attribute action="include" name="number"/>
</Type>
<Type name="com.ptc.arbortext.windchill.partlist.PartList">
<Attribute action="include" name="name"/>
</Type>
• manifest_attset.xml
Defines a set of attributes to send as metadata in the manifest. For example, one section of the file identifies the attributes for Parts Lists:
<Type name="com.ptc.arbortext.windchill.partlist.PartList">
<Attribute action="include" name="name" />
<Attribute action="include" name="organizationName" />
<Attribute action="include" name="number" />
<Attribute action="include" name="versionIdentifer.versionId" />
<Attribute action="include" name="iteration" />
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<Attribute action="include" name="thePersistInfo.createStamp" />
<Attribute action="include" name="type" />
</Type>
• publishable_attset.xml
Defines the set of attributes to send to Arbortext Publishing Engine as metadata for publishing. For example, one section of the file identifies the attributes for a publication structure:
<Type name="com.ptc.sis.PsRoot">
<Attribute action="include" name="lifeCycleState" type="enum"
token="wt.lifecycle.State">
</Attribute>
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<Attribute action="include" name="orgid" />
<Attribute action="exclude" name="securityLabels.internalValue" />
<Attribute action="exclude" name="view" />
<Attribute action="include" name="name" />
<Attribute action="exclude" name="lineNumber" />
<Attribute action="exclude" name="quantityAmount" />
<Attribute action="exclude" name="quantityUnit" />
<Attribute action="exclude" name="traceCode" />
<Attribute action="exclude" name="state.state" />
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<!-- don't remove. It is used in downstream -->
<Attribute action="include" name="thePersistInfo.updateStamp" />
<!-- don't remove. It is used in downstream -->
</Type>
Enumerated type attributes from Windchill are published as metadata for the object. In the following example, the enumerated type is the key ”INWORK”, while the value In Work is the name:
<Property token="lifeCycleState">
<Value key="INWORK">In Work</Value>
</Property>
In the file excerpt, the identifying Attribute reflects both the name and the enumerated type for lifeCycleState, where the associated token attribute actually specifies the full Java class name for the enumerated type (in this case, wt.lifecycle.State).
You can specify Part classification category attributes. If you do so, child classification attributes are automatically included or excluded. You can exclude the primary classification attribute itself to exclude all the child attributes associated with the classification. For more information on classification attributes, refer to
Classifying Parts in Windchill.
|
In the publishable_attset.xml, do not change or remove any attribute include actions for thePersistInfo.modifyStamp and thePersistInfo.updateStamp. These are specified throughout the file, and are used in bundles for Arbortext Content Delivery.
If you implement a custom subtype, you need to add these statements to your specification.
|
• referencedObjects_attset.xml
Defines the set of attributes that reference other objects in Windchill to be included in the referencedObjects.xml in a bundle. For example, one section of the file identifies the attributes for Dynamic Documents (a subtype of EPMDocuments):
<Type name="wt.epm.EPMDocument">
<Attribute action="include" name="missingDependents" />
<Attribute action="include" name="placeHolder" />
<Attribute action="include" name="revisionNumber" />
<Attribute action="include" name="derived" />
<Attribute action="include" name="name" />
<Attribute action="include" name="number" />
<Attribute action="include" name="CADName" />
<Attribute action="include" name="docType" />
<Attribute action="include" name="docSubType" />
<Attribute action="include" name="authoringApplication" />
<Attribute action="include" name="versionIdentifer.versionId" />
<Attribute action="include" name="thePersistInfo.modifyStamp" />
<Attribute action="include" name="thePersistInfo.createStamp" />
<Attribute action="include" name="iteration" />
<Attribute action="include" name="type" />/Type>
An attribute which references another object must be explicitly defined to be treated as a reference attribute.
• publishinfo_attset.xml
Defines a set of attributes that will be included or excluded in the payload file publishinfo.xml pertaining to the service structure being published. For example, by default, the file defines that publication structures and information structures (identified by their type) will include the name, number, and organization name for the structure being published:
Type name="com.ptc.sis.PsRoot">
<Attribute action="include" name="name" />
<Attribute action="include" name="number" />
<Attribute action="include" name="orgName" />
</Type>
<Type name="com.ptc.sis.IsRoot">
<Attribute action="include" name="name" />
<Attribute action="include" name="number" />
<Attribute action="include" name="orgName" />
</Type>
AttributeSet Update Command
Changes made to an attribute set file may not load immediately, for example, if you are waiting for an updated publishing job to run. After making changes to an attribute set configuration file, perform a server restart in the Windchill shell to have the changes take effect.
If a Windchill restart is not immediately possible, you can clear the cache manually instead:
1. Open a Windchill shell.
2. Enter the following command:
windchill com.ptc.arbortext.windchill.publisher.cmdline.
CleanCacheAttibuteSet
The command will clear the cache, and the changes will be processed more quickly.
Windchill Attribute Categories
• LWCIBAAttDefinition – Instance Based Attributes or IBAs
• LWCHardAttDefinition – Modeled or Hard Attributes
• LWCLogicalAttDefinition – Logical Attributes
• LWCNonPersistedAttDefinition – Non Persisted Attributes
• LWCFlexAttDefinition – Soft Attributes (previously know as Flex Attributes)
• LWCAttributeSetAttDefinition – Attribute Sets
Type Attributes Applicable to Structures
The following table displays a list of type attributes that can be customized:
Name and Type
|
Logical Form (not full type name)
|
Description
|
Part, structure node
|
wt.part.WTPart
|
Part (modeled)
|
Information Base, structure node
|
com.ptc.sis.Base
|
Abstract base type derived from WTPart for all publication structure and information structure objects.
|
Division Base, structure node
|
com.ptc.sis.BaseDiv
|
Abstract base class for division types used in the publication structure and information structure.
|
Publication Structure, structure node
|
com.ptc.sis.PsRoot
|
Publication structure root object.
|
Publication Section, structure node
|
com.ptc.sis.PsSection
|
Divisions or sections in a publication structure.
|
Information Structure, structure node
|
com.ptc.sis.IsRoot
|
Information structure root object.
|
Information Group, structure node
|
com.ptc.sis.IsGroup
|
A division or section in the information structure.
|
Content Base, structure node
|
com.ptc.arbortext.sis.Content
|
Abstract base for content references and special nodes.
|
Content Holder, referencing node
|
com.ptc.sis.ContentRef
|
Generic reference to content files.
|
Illustration Holder, referencing node
|
com.ptc.sis.IllustrationRef
|
Reference to a graphical Dynamic Document.
|
Parts List Holder, referencing node
|
com.ptc.sis.PartsListRef
|
Reference to Part List object.
|
Textual Content Holder, referencing node
|
com.ptc.sis.TextualContentRef
|
Reference to a Dynamic Document (XML, PDF, text, and so on).
|
Special Base, structure node
|
com.ptc.sis.PsSpecial
|
Abstract base that represents generated text markers.
|
Table of Contents, structure node
|
com.ptc.sis.PsToc
|
A marker in a publication structure indicating where a TOC would appear.
|
Index, structure node
|
com.ptc.sis.PsIndex
|
A marker in a publication structure indicating where an Index would appear.
|
Information Usage Link, referenced object
|
com.ptc.sis.BaseUsageLink
|
Link between two Base nodes used to create Windchill Service Information Manager structures (modeled).
|
Part Usage Link, referenced object
|
wt.part.WTPartUsageLink
|
Link between two WTPart nodes used to create structures (modeled).
|
Part List, referenced object
|
com.ptc.arbortext.windchill.partlist.PartList
|
Part List container for Part List Items (modeled).
|
Part List Item, referenced object
|
com.ptc.arbortext.windchill.partlist.PartListItem
|
Part List Item that links to an actual part (modeled).
|
EPMDocument, referenced object
|
wt.epm.EPMDocument
|
Any EPMDocument. Base type of DynamicDocument (modeled).
|
DynamicDocument, referenced object
|
com.ptc.ptcnet.DynamicDocument
|
Arbortext Dynamic Document holding textual or graphical content.
|
Xliff Link, referenced object
|
com.ptc.sis.XliffLink
|
Link to translation document.
|
AttributeSet Element
Defines the default action for all object attributes or specific classes of attributes. Child Type elements allow overrides of the default behavior of Persistable types.
<!ELEMENT AttributeSet ( Type* )>
<!ATTLIST AttributeSet
default (include | exclude) #IMPLIED
hard (include | exclude) #IMPLIED
soft (include | exclude) #IMPLIED
iba (include | exclude) #IMPLIED
logical (include | exclude) #IMPLIED
classification (include | exclude) #IMPLIED
nonPersisted (include | exclude) #IMPLIED
set (include | exclude) #IMPLIED
>
The attributes of the AttributeSet element are defined as follows:
• default
The default action for all attributes not included or excluded by more specific tests.
• hard
The default action for all hard (LWCHardAttDefinition) attributes not included or excluded by more specific tests.
• soft
The default action for all soft (LWCFlexAttDefinition ) attributes not included or excluded by more specific tests.
• iba
The default action for all iba (LWCIBAAttDefinition) attributes not included or excluded by more specific tests.
• logical
The default action for all logical (LWCLogicalAttDefinition ) attributes not included or excluded by more specific tests.
• classification
The default action for all
classification attributes not included or excluded by more specific tests. When not present, the value of the
iba attribute is used. Refer to
Classification Attributes for more information on these attributes.
• nonPersisted
The default action for all nonPersisted (LWCNonPersistedAttDefinition ) attributes not included or excluded by more specific tests.
• set
The default action for all set (LWCAttributeSetAttDefinition) attributes not included or excluded by more specific tests.
For example:
<AttributeSet xmlns="http://www.ptc.com" default="exclude"
iba="include" soft="include" logical="include">
Type Element
The Type element allows you to specify Windchill attributes to include or exclude for any object that implements the Persistable interface, which allows objects to be read and written from the database. Types are either modeled (hard) types or they are subtypes based on a modeled type or another subtype. Subtypes are created and managed using the Type and Attribute Manager or loader files.
<!ELEMENT Type ( Attribute* )>
<!ATTLIST Type
name CDATA #REQUIRED
token NMTOKENS #IMPLIED
default (include | exclude) #IMPLIED
>
The attributes of the Type element are defined as follows.
• name
The logical form of a soft or modeled type. Classification attributes are identified with name values beginning with “@”.
• token
An optional name or collection of names that can be used to map semantics to this type.
• default
The default action to exclude or include all attributes of this type that lack a more specific setting.
All types are identified by a type name string called the Logical Form (also known as the LogicalID). The logical form has to be unique at the site level as it uniquely identifies the type. For example (ignore the line break):
com.ptc.ptcnet.DynamicDocument =>
WCTYPE|wt.epm.EPMDocument|com.ptc.ptcnet.DynamicDocument
wt.part.WTPart => WCTYPE|wt.part.WTPart
The first example is the name of the DynamicDocument subtype of EPMDocument, while the second is the name of the modeled type wt.part.WTPart. The logical forms are mapped to the external form of the type. In the case of a modeled type, the object's java class name is prefixed by WCTYPE|. In the case of a subtype, the name is the name of the base type (soft or hard) followed by a vertical bar |, followed by the user-defined type name. The logical form is usually the same as the last segment of the external form. However, you can define your own logical form, provided it is unique.
For example:
<Type name="com.ptc.sis.PsRoot">
Attribute Element
The Attribute element primarily specifies whether to include or exclude a specific Windchill attribute in the attribute set. It is also used to define semantics for an attribute or its values.
<!ELEMENT Attribute ( Choice* )>
<!ATTLIST Attribute
name CDATA #REQUIRED
token NMTOKENS #IMPLIED
type CDATA #IMPLIED
action (include | exclude) #REQUIRED
>
The attributes of the Attribute element are defined as follows.
• name
the attribute name in logical form.
• token
An optional name or collection of names that can be used to map semantics to this attribute.
• type
A string that specifies the type of attribute to include or exclude. The only value supported for type is reference.
Specifying the name of the attribute and its type as reference defines the attribute value as a referenced object.
• action
The action to perform for this attribute.
The action, if specified, is the highest precedence setting for this attribute. It is possible to omit action and allow the next higher precedence setting control the inclusion of this attribute in the attribute set.
Attributes are either modeled (hard) types or they are soft attributes. Soft attributes are created and managed using the Type and Attribute Manager or loader files. All attributes are identified by an attribute name string called the Logical Form. The logical form has to be unique to the object type as it uniquely identifies the attribute for that type. For example, the following map the logical form of an attribute to its external form:
name => MBA|masterReference^WCTYPE|wt.part.WTPartMaster~MBA|name
name => MBA|masterReference^WCTYPE|wt.doc.WTDocumentMaster~MBA|name
filename => MBA|masterReference^WCTYPE|wt.epm.EPMDocumentMaster~MBA|CADName
fileName => NPA|filename
The string name on a given type uniquely identifies only one attribute. The first example identifies a Model Based Attribute (MBA) of the wt.part.WTPart type. The second example identifies an attribute of wt.doc.WTDocument. The third example is the filename attribute of the wt.epm.EPMDocument type. The last example declares an alias for the previous attribute. The object types are not included in the external form of the attribute.
For example:
<Attribute action="include" name="lifeCycleState" token="STATE">
By specifying the name of the attribute and its type as reference, the attribute value is defined as a referenced object and its URI is transformed in the payload so that the object can be found in Arbortext Content Delivery.
Attribute action="include" name="PartListVersionRef" type=”reference”
Choice Element
The Choice element defines a possible value for an attribute. It does not affect inclusion or exclusion of the attribute in the attribute set being created. It defines a range of values for downstream processing. In addition, a token or list of tokens can be associated with a value to give that value special semantics in a downstream process. The content of the Choice element is a string representing a possible value for the parent Attribute element.
<!ELEMENT Choice (#PCDATA) >
<!ATTLIST Choice
token NMTOKENS #IMPLIED
>
The token attribute of the Choice element is defined as an optional name or collection of names that can be used to map semantics to this value.
For example, to extend the Attribute example:
<Attribute action="include" name="lifeCycleState" token="STATE">
<Choice name="Accepted" />
<Choice name="Approved" />
<Choice name="Closed" />
<Choice name="In Work" token="INWORK" />
<Choice name="Obsolete" token="OBSOLETE" />
<Choice name="Open" token="OPEN" />
</Attribute>
Calculating Attribute Set Inclusion
The AttributeSet configuration file is designed to define the attribute set using explicit actions at varying levels. The form is Element.attribute_of_element. The supported levels are as follows, in decreasing order or precedence.
• Attribute.action: a specific attribute (Attribute.name) of a specific object type (Type.name)
• Type.default: all value attributes of an object type (Type.name)
• AttributeSet.hard, AttributeSet.soft, AttributeSet.iba, and so on: all attributes of a certain class
• AttributeSet.default: all value attributes
In general, the more specific a setting, the higher the order of precedence is given to that action setting. Omitting an action for an attribute at a particular level means that the next highest level of precedence must be examined to see if an explicit action is provided for that attribute. The search for an explicit action stops when one is found. If no explicit action is found, then the default behavior is used.
The system default behavior depends on the context. For example, the default attribute set for localization is different than the default set for serialization. The included hard attributes for publication structures are:
• name
• state.state
• versionIdentifier.versionId
For example, when serializing the publication structure or information structure to a payload, the default behavior is to include all soft, iba, and logical attributes as well as the hard attributes.
Serializing Attributes that Reference Other Objects
To specify the metadata for references to objects in the payload, you must specify the name and type attribute of the Attribute element. For example:
<Type default="include"
name="com.ptc.arbortext.windchill.siscore.serviceeff.ServiceEffectivity">
<Attribute action="include" name="effContextRef" type="reference" />
</Type>
The referenced objects attributes are put into a referencedObjects.xml in the payload. The form of the reference is changed from its Windchill identifier to a URI that can be used to find the object after it’s published to Arbortext Content Delivery.
The attribute that references an object is represented in the payload in a Property element, using the token attribute to identify it. The Value element has a ref attribute that transforms the object reference into a URI for the payload being published to a bundle. Multiple attributes have multiple Value entries in the payload.
AttributeSet API
An AttributeSet configuration file identifies a set of attributes for a Windchill object. The set varies depending on the selected object. Not all objects of the same type have values defined for all attributes of the set, but the set is the same. Configurations are context-specific. For example, you would need to configure both localizable and publishable attributes using different XML files.
The AttributeSet class is the API for one or more AttributeSet configuration files. The factory method getAttributeSet loads files that match the context name plus an .xml file extension as defined in the list of AttributeSet configuration files.
public class AttributeSet {
// Load one or more configuration files for a named context
and return an AttributeSet object
public static AttributeSet getAttributeSet(String context);
// Get the context for this AttributeSet
public String getContext();
// Test if a type/attribute is a member of this AttributeSet
public boolean isMember(String typeLogicalForm, String logicalForm);
public boolean isMember(TypeIdentifier type, AttributeTypeIdentifier att);
// Get the set of attributes and their types for an persistable object type.
public Map<String, AttributeTypeIdentifier> getAttributes
(String typeLogicalForm);
public Map<String, AttributeTypeIdentifier> getAttributes
(TypeIdentifier type);
// Get attribute values for a Persistable. Mapped object may be an array.
public Map<String, Object> getAttributeValues(Persistable wtobject);
}