Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

OIR- Object Initialization Rules (OIR) can be used to set the initial

value of an object’s attributes when it is created, and specify how an


object’s attributes are displayed in the UI when it is created. For
example, you can change the folder.id initialization rule for an
object such as a Content Holder, to change the location in Windchill
where it is stored.

Object Initialization Rules

By using object initialization rules, an administrator can:


• Specify default values for attributes of an object type.
The default values are then used when the Windchill solution creates objects
of that type but only when the user does not set a value for the attribute
through the user interface.
• Specify constraints that determine whether the user interface used to create a
particular type of object has special display characteristics for any of the
attributes associated with the object. Applying a constraint on an attribute
can provide the user interface with the following characteristics:
◦ Immutable -- User cannot change the attribute value that is being displayed.
◦ Server assigned -- User interface does not display a value for the attribute;
the value is generated and assigned when the object is saved.
◦ Pregenerated -- User interface displays a value for the attribute. The value is
generated before the attribute is presented in the user interface.
◦ Hidden -- User interface does not display a value or label for the attribute.
◦ Discrete set -- User interface is constrained to picking from a discrete set of
values. This is also known as an enumerated list.
The display characteristics that are available for attributes using object
initialization rules provide a capability similar to specifying constraints on
attributes from within the Type and Attribute Managemen.

 Folder- et the default folder location via Object Initialization Rules (OIR)
1. Navigate to appropriate context such as Site / Organization / Product
/ Library > Utilities > Object Initialization Rules
2. Download OIR of the appropriate object type such as Part, Document,
Change Notice etc.
3. Open XML file in a text editor such as Notepad etc.
4. Modify <AttrValue id="folder.id"> element, add the name of the
desired folder after /Default, for example:

<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.


folder.server.impl.FolderPathAttributeAlgorithm">

<Arg>/Default/Folder_Name</Arg>
</AttrValue

 TEAM TE
How to select a different Team Template using drop-down menu while creating new objects
using Create New wizard?
 Team Template attribute always displays as (Generated) by default

 ******** Team template selection can be exposed by editing the OIR for
appropriate object types
 The com.ptc.core.foundation.team.server.impl.DiscreteTeamTemplateSe
tAlgorithm allows to select one from a list of discrete team template values
for the teamTemplate.id attribute
 To display specific Team Templates in selection drop-down menu, you can
provide arguments to the DiscreteTeamTemplateSetAlgorithm as shown
below

o <AttrConstraint id="teamTemplate.id" algorithm="com.ptc.


core.rule.server.impl.GatherAttributeConstraints">

o <Value algorithm="com.ptc.core.foundation.team.server.im
pl.DiscreteTeamTemplateSetAlgorithm">

o <Arg>Change Activity Team</Arg>

o <Arg>Change Notice Team</Arg>

o </Value>

o </AttrConstraint>

 Refer to Windchill Help Center topic Example of Displaying a Discrete List for
more information.

NOTES-------

Notes
 Edit the Team Template names specified in the XML to match to your
installation or create new team templates as per requirements
 Make sure that all Team Template names used in the XML are Checked
In and Enabled
 Advanced Life Cycle (LC) Templates must be used for object types where a
drop-down menu configuration is required for Team Template attribute
o Basic LC templates does not allow association of Team
Templates or Workflows hence value for Team Template attribute
will not be displayed when this configuration is being used for objects
using Basic life cycle
 It is not possible to get rid of the the empty line generated by
the DiscreteTeamTemplateSetAlgorithm
 Make sure that Team Template Attribute is added in the Create New Layout
of the Object Type using Type And Attribute Management Utility in order to
select the Team Template during object creation :

Life Cycle -----

 Changing the Lifecycle for an object requires its Object Initialization


Rule(OIR) to be updated
 Change the argument value in the associated OIR and enter the name of the
new Lifecycle Template to be used:
1. Navigate to Utilities > Object Initialization Rules Administration in
the Context (Site, Organization or Product/Library) where you want
to specify the new Lifecycle Template
2. Download the OIR for the object type or soft type(the OIR file is
an XML file called rule.xml)
3. Open the file in a text editor and change only the word Basic to the
name of the new Lifecycle Template
 (This is an excerpt from the OIR for a Document object which is using
the Out-of-the-box Basic Lifecycle Template)

 <!-- set the lifecycle -->

 <AttrValue id="lifeCycle.id" algorithm=

 "com.ptc.core.foundation.lifecycle.server.impl.LifeCycleTe
mplateAttributeAlgorithm">

 <Arg>

 <!-- Translation of the word "Basic" must be the same as t


he translation -->

 <!-- done in commonLifeCycles.xml -->

 <?loc-begin key="BASIC_LIFECYCLE_NAME" maxlen="30"?>Basic<


?loc-end?>

 </Arg>

 </AttrValue>

</AttributeValues>
Note: The Life Cycle name should be exactly the same as the name of
the Template defined in the Life Cycle Administrator
4. Save the rule.xml file and upload it using the Edit option, for examples
and additional information about the Object Initialization Rules
 Newly created objects will use the new Lifecycle Template
 Existing objects will continue to use the Lifecycle Template they were
created with. Use the Reassign Life Cycle action to assign existing objects to
the new Lifecycle, refer to topic in WHC for more information

Numbering -
Removing the XML element that defines a numbering scheme from a rule in a specific context
causes the numbering scheme established in the parent context to be used. If you remove the
elements defining the numbering scheme in all contexts in the hierarchy, then manual numbering
occurs.

Additionally if a parent context has autonumbering turned on, you can turn off autonumbering in
a specific application context or organization context by including only an empty constraints list
for the number attribute in the context for which you want autonumbering turned off. For
example, the out-of-the-box rules for WTPart set in the site context autogenerates the number of a
part. To turn off the autonumbering in a specific application context or organization context,
replace any existing XML elements used for constraining the number attribute in that context
with the following or add a new rule for WTPart including the following elements if none exist

o turn off auto-numbering of object types in Windchill, edit the OOTB rule.xml file.

If GatherAttributeConstraints is not present in rule.xml for number attribute, then add the below
code snippet.

<AttributeValues objType="ext.part.CustomPart">
<AttrConstraint id="number"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
</AttrConstraint>
</AttributeValues>

But, if GatherAttributeConstraints is already present in the rule.xml file with some additional
constraints, then comment out the other constraints within GatherAttributeConstraints as shown
in the code snippet below:

<AttrConstraint id="number"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<!--
<Value
algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>
-->
<!-- Other algorithms -->
</AttrConstraint>

After doing this, upload the rule.xml file for that object type. Now while creating a new
object, the user will be asked to enter the number manually.

Version Series -----

 To retrieve the versioning file that is currently loaded, enter the following in a
Windchill Shell:

 java wt.series.LoadFileBasedSeries <XML_file> -read

 where <XML_file> is the absolute file path of the file in which the loaded
content is placed.
 Edit the XML file and add the new revisions as needed
 To load the file-based or state-based versioning XML file, enter the following
in a Windchill Shell:

 java wt.series.LoadFileBasedSeries <XML_file> -load

 where <XML_file> is the absolute file path to the existing XML file
 The new revisions will be active once the new file is loaded.

You might also like