Customization > Customizing Object Initialization Rules
Customizing Object Initialization Rules
Solution Elements
Element
Type
Description
Your load file set
XML
Custom loader file to add entries of custom OIR XML files.
Location in module: <customizationRootDirectory>/configurations/loadfiles/acme
Your OIR load file
XML
Custom XML file for OIR of your object type
Location in module: <customizationRootDirectory>/configurations/loadfiles/acme
Java class for custom OIR algorithm
JAVA
To define custom OIR algorithm
Location in module: <customizationRootDirectory>/module1/main/src
BAC package
zip
After the OIR is loaded by uploading from UI or using loadFiles, you can choose to export via BAC UI and submit the zip as customization artifact instead of loadFiles.
Location in module: <customizationRootDirectory>/generated/BAC
Modular Structure for Customization
<customizationRootDirectory>
├── configurations
│ ├── deploy.xml
│ ├── loadFiles
│ └── acme
│ └── oirLoadSet
│ ├── acmeLoadSet.xml
│ └── oirLoadFiles
│ └── acmeOIR.xml
└── OIRPackage
├── descriptor.xml
└── main
└── src
└── com
└── acme
└── algorithm
└── AcmePartMyCustomOIRAlgorithm.java
Procedure
1. Download the OIR XML file.
2. Create a loader to load the OIR file.
Refer to the sample XML file given for Change Request object type and create a similar file for the required object type. Depending upon the object type, include the OIR XML in the CDATA section.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE OrganizationConfig SYSTEM "standard13_0.dtd">
<OrganizationConfig>

<TypeBasedRule>
<EngineRule isDefault="false" enabled="true">
<ruleName>Change Request Load</ruleName>
<ruleSpecification><![CDATA[
<AttributeValues objType="wt.change2.WTChangeRequest2">

<!-- set the folder -->
<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">
<Arg>/Default</Arg>
</AttrValue>

<!-- set the lifecycle -->
<AttrValue id="lifeCycle.id" algorithm="com.ptc.core.foundation.lifecycle.server.impl.LifeCycleTemplateAttributeAlgorithm">
<Arg>Change Request Life Cycle</Arg>
</AttrValue>

<!-- set the team template -->
<AttrValue id="teamTemplate.id" algorithm="com.ptc.core.foundation.team.server.impl.TeamTemplateAttributeAlgorithm">
<Arg>Change Request Team</Arg>
</AttrValue>

<!-- set the number to a generated number -->
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTCHANGEREQUESTID_seq:5:0}</Arg>
</AttrValue>

</AttributeValues>
]]>
</ruleSpecification>
<ruleType type="INIT"/>
</EngineRule>
<className>wt.change2.WTChangeRequest2</className>
</TypeBasedRule>

</OrganizationConfig>
3. Copy the loader to the following path: <customizationRootDirectory>/configurations/loadFiles/<customFolder>.
4. Add an entry of this load file in the configurations/loadFiles/custom/loadFileSet.xml file with the desired container. Ensure that an entry for this XML is added in configurations/deploy.xml if you want to load the OIRs that are not already loaded.
* 
The load action will fail if there is an existing OIR for the type in the context. The existing OIR must be deleted first.
5. Define custom algorithm as given in Step 2 and add it to the following path: <customizationRootDirectory>/<module>/main/src/. You need to compile and deploy this algorithm, and use it in the OIR as per the container level.
* 
It is recommended that all load files are located in the custom folder. For more information, see CCD Package Structure.
Deploy Customization on Development Environment
For information on the CCD process for deployment, see Deploy Your Customizations on Your Development Environment.
Prepare CCD Package for Promotion
Export TypeBasedRule (OIR) from BAC UI and add it to the CCD package. For more information, see CCD Package Structure.
Ensure that the corresponding loader is removed from the CCD package structure.
For information on the CCD process for promotion, see Deploying Code and Configuration Package.
Was this helpful?