Amministrazione avanzata > Adattamento di business object > Amministrazione delle regole di inizializzazione degli oggetti > Understanding Object Initialization Rules > Changing Versioning Schemes > Setting Up a File-based or State-based Versioning Scheme > Setting File-based or State-based Versioning for Objects
  
Setting File-based or State-based Versioning for Objects
The default Harvard series versioning scheme is set at the site level and then used at the organization, product, and library levels unless it is overwritten. One context template that is loaded (the demo Product Design template) sets the versioning for parts, documents, and CAD documents to state-based versioning. Additionally, new context templates that are created can set file-based or state-based versioning; however, PTC recommends that you set the same versioning scheme for all organizations, products, and libraries by setting the scheme at the site level.
In a context template XML file, you can specify the versioning you want used for each object type as an element in the corresponding <TypeBasedRule> tag for the object type. For example, in the Product Design template XML file, the following sample <AttrValue> tag sets the versioning for parts to StateBased (which is the series set in the out-of-the-box versioning XML file that is loaded):
<TypeBasedRule>
<EngineRule isDefault="false" enabled="true">
<ruleName>Part</ruleName>
<ruleSpecification><![CDATA[
<AttributeValues objType="wt.part.WTPart">
:
:
<!-- set the version info to a generated version info -->
<AttrValue id="MBA|versionInfo" algorithm="com.ptc.core.foundation.vc.server.
impl.VersionInfoGenerator">
<Arg>wt.series.HarvardSeries.StateBased</Arg>
</AttrValue>

</AttributeValues>
]]></ruleSpecification>
<ruleType type="INIT"/>
</EngineRule>
<className>wt.part.WTPart</className>
</TypeBasedRule>
In this example, versioning for parts is set to wt.series.HarvardSeries.StateBased. The versioning code checks for wt.series.HarvardSeries.StateBased properties and, when they are not found, it looks in the loaded versioning XML file for a series named StateBased. If you have named the series you want to use something other than StateBased, then use that name in place of StateBased in the argument.
Additionally, you can change versioning to file-based or state-based versioning by using the Object Initialization Rules Administration utility from within the context where you want the change to take place. However, all changes should be made before a product or library is used. Changing values that have already been used can cause unpredictable results when versions are being updated.
The format of the <attrValue> tag that is used for setting file-based or state-based versioning in an object initialization rule is the same as the format shown previously in Defining the Content of XML Documents used for Object Initialization Rules. For more information about using the Object Initialization Rules Administration utility, see Accessing the Object Initialization Rules Administration Utility.