ECM Filenet API - Create ChoiceList
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.
ChoiceList trong ECM Filenet như một table lưu giữ danh mục có chứa cặp giá trị key - value thường sử dụng cho dropdown list
Bài dưới đây sẽ hướng dẫn cách tạo mới một choiceList 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.Choice;
import com.filenet.api.admin.ChoiceList;
import com.filenet.api.constants.ChoiceType;
import com.filenet.api.constants.TypeID;
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 createChoiceList(){
ChoiceList choiceList = Factory.ChoiceList.createInstance(getObjectStore(getConnection()));
choiceList.set_DataType(TypeID.STRING);
choiceList.set_DisplayName("choiceListTest");
com.filenet.api.collection.ChoiceList choiceValues = Factory.Choice.createList();
Choice choice = Factory.Choice.createInstance();
choice.set_ChoiceType(ChoiceType.STRING);
choice.set_DisplayName("name1");
choice.set_ChoiceStringValue("val1");
choiceValues.add(choice);
choiceList.set_ChoiceValues(choiceValues);
choiceList.save(RefreshMode.NO_REFRESH);
}
Nhận xét
Đăng nhận xét