WindChill ext 对象初始化规则

OOTB的对象初始化规则
可以对数据类型,目标文件夹,生命周期模板,编号规则进行定义

<!DOCTYPE OrganizationConfig SYSTEM "standardX10.dtd">

<OrganizationConfig>
    <TypeBasedRule>
        <EngineRule isDefault="false" enabled="true">
            <ruleName>标准件</ruleName>
            <ruleSpecification><![CDATA[ 
            <AttributeValues objType="wt.part.WTPart|com.custom.BZJ">

               <!-- 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>
                    customBZJ
                  </Arg>
               </AttrValue>

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

               <!-- set the number to a generated number -->
               <AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator"> 
                  <!-- add a V prefix for variant parts -->
                  <Value algorithm="wt.rule.algorithm.BooleanBranch">
                     <Value algorithm="wt.rule.algorithm.EqualsTest">
                        <Attr id="genericType"/>
                        <Arg>variant</Arg>	
                     </Value>
                     <Arg>V</Arg>
                     <Arg></Arg>
                  </Value>
                  <!-- the sequence -->
                  <Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}</Arg>
               </AttrValue>
               
               <!-- 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</Arg>
               </AttrValue>
               
               <!-- name of variant parts -->
               <AttrValue id="name" algorithm="wt.rule.algorithm.BooleanBranch">
                  <Value algorithm="wt.rule.algorithm.EqualsTest">
                     <Attr id="genericType"/>
                     <Arg>variant</Arg> 
                  </Value>
                  <!-- assign a name only for variant parts. for others return null. 
                       name should be assigned by the client -->
                  <Value algorithm="wt.generic.rule.VariantNameGenerator">
                     <Arg>{GEN:wt.enterprise.SequenceGenerator:variantnameseq:10:0}</Arg>
                  </Value>
                  <Value algorithm="wt.rule.algorithm.StringConstant">
                     <Arg/>
                  </Value>
               </AttrValue>
              
               <!-- specify AttrConstraint tag -->
               <AttrConstraint id="name" algorithm="wt.rule.algorithm.BooleanBranch">
                  <Value algorithm="wt.rule.algorithm.EqualsTest">
                     <Attr id="genericType"/>
                     <Arg>variant</Arg> 
                  </Value>
                  <Value 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"/>
                  </Value>
                  <Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
                  </Value>
               </AttrConstraint>
               <AttrConstraint id="lifeCycle.id" 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"/>
	           </AttrConstraint>
	           <AttrConstraint id="lifeCycle" 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"/>
	           </AttrConstraint>
	           <AttrConstraint id="folder.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
	       	      <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>	      
	           </AttrConstraint>
	           <!-- Add handling for ProjectLink and PdmLink differently OOTB for wt.part.WTPart object number field
	                For end items in PDMLink context, turn the autonumbering off -->
                   <AttrConstraint id="number" algorithm="wt.rule.algorithm.BooleanBranch">        
                      <Value algorithm="com.ptc.core.rule.server.impl.IfContainerTypeEqualsProjectTest"/>       
                      
                      <Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
                         <Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>                              
                      </Value>        
                      
                      <Value algorithm="wt.rule.algorithm.BooleanBranch">  
                           <Value algorithm="wt.rule.algorithm.StringEqualsTest">
                              <Attr id="endItem"/>
                              <Arg>true</Arg> 
                           </Value>
                           
                           <Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints"/>
                           
                           <Value 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"/>        
                           </Value>        
                       </Value>       
                   </AttrConstraint>  
        
	           <AttrConstraint id="teamTemplate.id" 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"/>
	           </AttrConstraint>
	           <AttrConstraint id="teamTemplate" 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"/>
	           </AttrConstraint>  
               <AttrConstraint id="organization.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
	       	    <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"> 
	       	     <Value algorithm="com.ptc.windchill.enterprise.org.server.impl.OwningOrgDefaultAlgorithm"/> 
	       	    </Value> 
	       </AttrConstraint>
            </AttributeValues>
			]]>
			 </ruleSpecification>
            <ruleType type="INIT"></ruleType>
        </EngineRule>
        <className>wt.part.WTPart|com.custom.BZJ</className>
    </TypeBasedRule>
</OrganizationConfig> 

在这里插入图片描述
在这里插入图片描述

单个xml文件导入
导入命令:windchill wt.load.LoadFromFile -d loadFiles/ext/initRule/JSDoc_IR.xml -Unattended -NoServerStop -u wcadmin -p  wcadmin

批量多个初始化规则xml文件导入
loadSet.xml
导入命令
windchill wt.load.LoadFileSet -file loadFiles/ext/loadSet.xml -Unattended -NoServerStop -u wcadmin -p  wcadmin

在这里插入图片描述loadSet.xml
在这里插入图片描述

发布了16 篇原创文章 · 获赞 1 · 访问量 298

猜你喜欢

转载自blog.csdn.net/xiguasweet/article/details/104495513
ext
今日推荐