特定管理 > 訂做企業物件 > 物件初始化規則管理 > 瞭解物件初始化規則 > 定義用於物件初始化規則的 XML 文件內容 > 與 AttrConstraint 搭配使用的演算法範例 > 使用 GetServerAssignedConstraint 與 GetImmutableConstraint 的範例 > 生命週期條件約束範例
  
生命週期條件約束範例
下列範例 XML 顯示了為與文件關聯的生命週期範本設定屬性顯示條件約束的現成 XML。
此範例被格式化為依頁面顯示。請始終在一行中輸入每個標籤:
<AttributeValues objType="wt.doc.WTDocument">
<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>
</AttributeValues>
為下列兩個屬性提供了條件約束:
lifeCycle.id (適用於使用者可從中搜尋生命週期範本的欄位)
lifeCycle (適用於不提供搜尋能力的生命週期範本欄位)
使用範例中的條件約束,「新建文件」視窗包含下列內容:
在這一介面中,指派的生命週期範本是由伺服器設定的 (在 AttrValue 規則中),使用者無法變更使用的範本。