Specifying Rules
The specification of a rule is done through an XML document. The document must be formatted according to the object initialization rules DTD.
Using the AttributeValues tag, the XML document must identify the type of object.
Nested inside the AttributeValues tag must be at least one of the following:
An AttrValue tag that identifies an attribute for which a default value is being calculated and specifies the algorithm that is used to calculate the default value.
An AttrConstraint tag that identifies an attribute for which constraints are being defined and specifies the algorithms that are used to identify the constraints being defined.
A VarDef tag that defines a variable that can be referenced in a VarRef tag.
Use these tags to define the content of a rule. For example, the wt.doc.WTDocument rule specification that defines the doc_number variable and uses it for the number attribute, defines a default folder path, and displays the folder path value as a pregenerated value that can be manually changed is as follows:
<AttributeValues objType="wt.doc.WTDocument">
<VarDef id="doc_number"
algorithm=”com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator”>
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTDOCUMENTID_seq:10:0}</Arg>
</VarDef>
<AttrValue id="number">
<VarRef id="doc_number"/>
</AttrValue>
<AttrValue id="folder.id"
algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">
<Arg>/Default</Arg>
</AttrValue>
<AttrConstraint id="folder.id"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>
</AttrConstraint>
</AttributeValues>
Isto foi útil?