ECM Filenet API - Create Property Template
I. Giới thiệu
ECM Filenet là một hệ thống content management hữu dụng cho các doanh nghiệp.
Property Template trong ECM Filenet như một nơi tập trung các property cho hệ thống có thể dùng chung cho nhiều document.
Nó giống như một Type được định nghĩa trong Oracle DB.
Một Property Template có thể có trong nhiều Document khác nhau.
Bài dưới đây sẽ hướng dẫn cách tạo một Property Template thông qua api.
II. Chuẩn bị
Chuẩn bị các thư viện theo bài hướng dẫn: ecm filenet dependency
III. Sử dụng
import com.filenet.api.constants.RefreshMode;
import com.filenet.api.core.Factory;
import com.filenet.api.core.ObjectStore;
import com.filenet.api.core.Connection;
import com.filenet.api.core.Domain;
import com.filenet.api.admin.LocalizedString;
import com.filenet.api.admin.PropertyTemplateObject;
import com.filenet.api.admin.PropertyTemplateString;
import com.filenet.api.constants.Cardinality;
public Connection getConnection() {
String uri = "http://ip:port/wsi/FNCEWS40MTOM";
Connection conn = Factory.Connection.getConnection(uri);
return conn;
}
public ObjectStore getObjectStore(Connection conn) {
// Get the default domain
Domain domain = Factory.Domain.getInstance(conn, null);
// Get an object store
ObjectStore os = Factory.ObjectStore.fetchInstance(domain, "ObjectStoreName", null);
return os;
}
public void createPropertyTemplate(){
PropertyTemplateString propertyTemplate = Factory.PropertyTemplateString.createInstance(getObjectStore(getConnection()));
LocalizedString localizedString = Factory.LocalizedString.createInstance();
localizedString.set_LocaleName(objectStore.get_LocaleName());
localizedString.set_LocalizedText("property name");
propertyTemplate.set_DisplayNames(Factory.LocalizedString.createList());
propertyTemplate.get_DisplayNames().add(localizedString);
propertyTemplate.set_SymbolicName("propertySymbolicName");
propertyTemplate.set_Cardinality(Cardinality.SINGLE);
propertyTemplate.save(RefreshMode.NO_REFRESH);
}
Nhận xét
Đăng nhận xét