Defining New Business Rules
You can define your own business rules by creating and loading XML files using the businessRules.dtd definition.
The following example shows how to define a business rule (wt.businessRules.BusinessRule:45346), a business rule set (wt.businessRules.BusinessRuleSet:45345), and a business rule link (wt.businessRules.BusinessRuleLink:356747) that associates the business rule with the business rule set.
|
The numbers in the example above are IDs used in the XML to differentiate each object.
|
1. Define the business rule.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE BusinessRule SYSTEM "standardX20.dtd">
<BusinessRule>
<ObjectID><localId>wt.businessRules.BusinessRule:45346</localId>
</ObjectID>
<objectContainerPath>/</objectContainerPath>
<key>IXBBusinessRule1_key</key>
<name>
com.ptc.windchill.enterprise.change2.change2ClientResource:
CHECK_OUT_VALIDATOR_RULE_NAME</name>
<description>
com.ptc.windchill.enterprise.change2.change2ClientResource:
CHECK_OUT_VALIDATOR_RULE_DESC</description>
<enabled>true</enabled>
<configs>
<config name="key1" value="value1"></config>
<config name="key2" value="value1"></config>
<config name="key1" value="value2"></config>
</configs>
</BusinessRule>
2. Define the business rule set.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE BusinessRuleSet SYSTEM "standardX20.dtd">
<BusinessRuleSet>
<ObjectID><localId>wt.businessRules.BusinessRuleSet:45345</localId>
</ObjectID>
<objectContainerPath>/wt.inf.container.OrgContainer=PTC/wt.pdmlink.
PDMLinkProduct=GOLF_CART>
</objectContainerPath>
<key>IXBBusinessRuleSet1_key</key>
<name>
com.ptc.windchill.enterprise.change2.change2ClientResource:
CHANGE_PRE_RELEASE_RULESET_NAME</name>
<description>
com.ptc.windchill.enterprise.change2.change2ClientResource:
CHANGE_PRE_RELEASE_RULESET_DESC</description>
<enabled>true</enabled>
<overridable>true</overridable>
</BusinessRuleSet>
3. Define the business rule link.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE BusinessRuleLink SYSTEM "standardX20.dtd">
<BusinessRuleLink>
<ObjectID><localId>wt.businessRules.BusinessRuleLink:356747</localId>
</ObjectID>
<ruleSet><ObjectReference><localId>wt.businessRules.BusinessRuleSet:
45345</localId></ObjectReference></ruleSet>
<rule><ObjectReference><localId>wt.businessRules.BusinessRule:45346
</localId></ObjectReference></rule>
<blockNumber>10</blockNumber>
</BusinessRuleLink>