IBM Filenet Content&nb…

Java Example

Task instances can only be created from subclasses of the base  CmTask  class. The following Java™ example show how to create a  CmTask  subclass. Two of the system property definitions of the subclass are set with default values, and a custom property definition is added.

// Fetch base task class definition from the server.
ClassDefinition objClassDef = Factory.ClassDefinition.fetchInstance(store, ClassNames.CM_TASK, null);
       
// Create subclass of the CmTask class.
ClassDefinition objSubClassDef = objClassDef.createSubclass();

// Set up locale and name subclass.
LocalizedString objLocStr = Factory.LocalizedString.createInstance();
objLocStr.set_LocalizedText("Flood Claim Task Subclass");
objLocStr.set_LocaleName(store.get_LocaleName());
objSubClassDef.set_DisplayNames(Factory.LocalizedString.createList());
objSubClassDef.get_DisplayNames().add(objLocStr);
objSubClassDef.set_SymbolicName("fcTaskSubclass");
   
// Set default values on PreCondition and PostCondition property definitions.
PropertyDefinitionList objPropDefs = objSubClassDef.get_PropertyDefinitions(); 
ListIterator iter = objPropDefs.listIterator();
PropertyDefinitionString objPropDef = null;
String objPropDefSymbolicName = null;

// Iterate property definitions until PreCondition and PostCondition found.
for (int i=0; i < objPropDefs.size(); i++)
{
    objPropDefSymbolicName = ((PropertyDefinition) objPropDefs.get(i)).get_SymbolicName();
    if (objPropDefSymbolicName.equalsIgnoreCase("PreCondition"))
    {
      objPropDef = (PropertyDefinitionString ) objPropDefs.get(i);
      Property prop = objPropDef.getProperties().get("PropertyDefaultString");
      prop.setObjectValue("Coordinator SATISFIES (VersionStatus=1)" );
    }
    if (objPropDefSymbolicName.equalsIgnoreCase("PostCondition"))
    {
      objPropDef = (PropertyDefinitionString ) objPropDefs.get(i);
      Property prop = objPropDef.getProperties().get("PropertyDefaultString");
      prop.setObjectValue("Coordinator SATISFIES (ClaimStatus='CLOSED')" );
    }
}

PropertyTemplateString objPropTemplate = Factory.PropertyTemplateString.fetchInstance
    (store, new Id("{7C6FF644-285F-44DD-B7B7-5A6080CE1291}"), null);
// Create property definition from property template.
objPropDef = (PropertyDefinitionString )objPropTemplate.createClassProperty();
// Add new property definition to subclass.
objPropDefs.add(objPropDef);

// Save task subclass to the server.
objSubClassDef.save(RefreshMode.REFRESH); 

http://blog.sina.com.cn/u/2003329161
原IBM网址:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ma_xs

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值