Customizing the Import and Export of Additional Attributes
By default, Creo Packages imports and exports the metadata attributes of CAD documents, such as file name, life cycle state, location, and version information. You can configure Creo Packages to also import and export additional Windchill attributes. For details, see Export and Import of Additional Attributes.
Customizing the Import and Export of Additional Attributes
Creo Packages provides a server-side delegate that can be used to export and import additional Windchill attributes. The following steps describe the customization process:
1. Create a Java class implementing the interface WPCPDMObjectAttributeHandler. The interface definition is as follows:
/**
* WPCPDMObjectAttributeHandler.java
* Prototype interface used by Additional attribute handlers to do import
export of Additional attributes.
*
*/
public interface WPCPDMObjectAttributeHandler {
/**
* Export Collection of PDMObjectAttributes for a given object
* @param paramObject Object whose PDMObjectAttributes to be set.
* @return
* @throws CWPException
*/
Collection<PDMObjectAttribute> exportPDMObjectAttributes (Object paramObject)
throws CWPException;

/**
* Checks the conflict for a given set of PDMVersion and its object.
* @param cwpSet set of PDMVersion.
* @param identifier2obj Hash map of identifier to object.
* @return
* @throws WTException
* @throws WTPropertyVetoException
*/
Collection<CWPConflictElement> checkConflict(CWPSet cwpSet, HashMap
identifier2obj)
throws CWPConflictException, CWPException;

/**

* Collection API for Updating the PDMObjectAttribute
* @param map
* Map of PDMObjectAttribute to Object.
*
* @throws CWPException
*/
void updatePDMObjectAttributes(Map<Object, Object>attribute2Object) throws
CWPException;
/**
* Indicates whether the implementer is of Master attribute or Object attribute.
* @return
*/
boolean isMastered();

}
Edit this information as follows:
exportPDMObjectAttributes—Used to export a PDMObjectAttribute list for an attribute on a master CAD document. The attribute can be for a master or iteration object. PDMObjectAttribute can be created with the handler, name, type and value.
checkConflict—Checks for conflicts for the attribute being imported and returns a collection of CWPConflictElement that contains conflict information. It accepts the following arguments:
CWPSet of PDMVersion containing PDMObjectAttributes
HashMap of PDMGlobalIdentifier to Object
updatePDMObjectAttributes—Imports the PDMObject attribute. It accepts the attribute-to-object map.
isMastered—Identifies whether the attribute belongs to a master or iteration object.
2. On the server, edit the following file: <Windchill>\Codebase\com\ptc\wpc\wncadapter\server\attributes\wpc-pdmobject-attribute.xconf. Add the following property for each additional attribute:
<Service context="default"
name="com.ptc.wpc.attributes.WPCPDMObjectAttribu
teHandler">
<Option
serviceClass="com.ptc.wpc.wncadapter.server.attr
ibutes.handlers.MasterIBAHandler" requestor="java.
lang.Object" selector="MASTER_IBA" cardinality=
"duplicate"/>
</Service>
Edit this information as follows:
serviceClass—Replace com.ptc.wpc.wncadapter.server.attributes.handlers.MasterIBAHandler with the path to your class.
requestor—Replace java.lang.Object with the attribute type of the attribute.
selector—Replace MASTER_IBA with the handler key of the attribute.
* 
Do not remove any handlers from this file. If you do, the attribute will not be exported.
3. Use the xconfmanager tool to apply the changes to the wpc-pdmobject-attribute.xconf file (run xconfmanager -p).
4. Restart the method server.
Additional Attribute Details
Following are details about each additional attribute:
Name
Delegate—com.ptc.wpc.wncadapter.server.attributes.handlers.NameHandler
Handler key—NAME
Name—name
Type—java.lang.String
Example of export in package.xml file:
<attribute>
<handler>NAME</handler>
<name>name</name>
<value>na_border004.asm</value>
<type>java.lang.String</type>
</attribute>
Number
Delegate—com.ptc.wpc.wncadapter.server.attributes.handlers.NumberHandler
Handler key—NUMBER
Name—number
Type—java.lang.String
Example of export in package.xml file:
<attribute>
<handler>NUMBER</handler>
<name>number</name>
<value>NUM_BORDER003.asm</value>
<type>java.lang.String</type>
</attribute>
Organization ID
Delegate—com.ptc.wpc.wncadapter.server.attributes.handlers.OrgIdHandler
Handler key—ORGID
Name—OrgId
Type—java.lang.String
Example of export in package.xml file:
<attribute>
<handler>ORGID</handler>
<name>OrgId</name>
<value>0141$Demo_Org</value>
<type>java.lang.String</type>
</attribute>
Attribute on a master CAD document (master IBA)
Delegate—com.ptc.wpc.wncadapter.server.attributes.handlers.MasterIBAHandler
Handler key—MASTER_IBA
Name—Defined in Windchill
Type—Defined in Windchill
Example of export in package.xml file:
<attribute>
<handler>MASTER_IBA</handler>
<name>REAL_NUMBER</name>
<value>60.6;PRECISION=3</value>
<type>wt.iba.value.FloatValue</type>
</attribute>
<attribute>
<handler>MASTER_IBA</handler>
<name>IntegerNumber</name>
<value>30</value>
<type>wt.iba.value.IntegerValue</type>
</attribute>
<attribute>
<handler>MASTER_IBA</handler>
<name>StringDescription</name>
<value>Border assembly 003</value>
<type>wt.iba.value.StringValue</type>
</attribute>
<attribute>
<handler>MASTER_IBA</handler>
<name>VALUE1</name>
<value>6</value>
<type>wt.iba.value.IntegerValue</type>
</attribute>
<attribute>
<handler>MASTER_IBA</handler>
<name>ReleaseTime</name>
<value>2013-08-07 02:57:00.0</value>
<type>wt.iba.value.TimestampValue</type>
</attribute>
War dies hilfreich?