创建文档模板

package com.doshine.platform.transfer;


import com.filenet.api.admin.ClassDefinition;
import com.filenet.api.admin.LocalizedString;
import com.filenet.api.collection.LocalizedStringList;
import com.filenet.api.constants.RefreshMode;
import com.filenet.api.core.Factory;
import com.filenet.api.core.Folder;
import com.filenet.api.core.ObjectStore;
import com.filenet.api.util.UserContext;
import com.pde.platform.ddc.searchengine.datasource.filenet.FileNetDataSource;


public class DocDefTransfer {


public void createSubClass(ObjectStore objObjectStore, String parentClassName, String strSubclassDisplayName,String subClassSymbolicName)
{




// Fetch selected class definition from the server
ClassDefinition objClassDef = Factory.ClassDefinition.fetchInstance(objObjectStore, parentClassName, null);
  


// Create subclass of the Folder class
ClassDefinition objClassDefNew = objClassDef.createSubclass();
objClassDefNew.set_SymbolicName(subClassSymbolicName);


// Set up locale
LocalizedString objLocStr = Factory.LocalizedString.createInstance();
objLocStr.set_LocalizedText(strSubclassDisplayName);
objLocStr.set_LocaleName(objObjectStore.get_LocaleName());


// Create LocalizedStringList collection
objClassDefNew.set_DisplayNames(Factory.LocalizedString.createList());
objClassDefNew.get_DisplayNames().add(objLocStr);


// Save new class definition to the server
objClassDefNew.save(RefreshMode.REFRESH);            
}

public static void main(String[] args) {
DocDefTransfer  defTransfer = new DocDefTransfer();
com.pde.platform.ddc.searchengine.datasource.filenet.FileNetDataSource fd =  new FileNetDataSource();
try {
ObjectStore os = fd.getObjectStore();
System.out.println(os.getConnection().getURI());

defTransfer.createSubClass(os, "Document","测试文档" ,"TestClass");
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally{
UserContext.get().popSubject();
}

}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值