// Java Sample Code for Creating Custom Object in FileNet
public void CreateCustomObject(Connection conn) {
try {
Domain domain = Factory.Domain.fetchInstance(conn, null, null);
ObjectStore objStore = Factory.ObjectStore.fetchInstance(domain,"OSNAME", null);
System.out.println("del"+folderOj.get_Name());
//Creaing Custome Object and setting properties
CustomObject myObject= Factory.CustomObject.createInstance(objStore,"Student"); //Object store, Costome Object Class Name
com.filenet.api.property.Properties props = myObject.getProperties();
props.putValue("TitleName","stuInfo022");
props.putValue("StuID", "RK1234");
props.putValue("StuMailID", "p8@filenet.com");
props.putValue("age", 13);
DateFormat date = new SimpleDateFormat("dd/MM/yyyy");
Date memeberDate= date.parse("20/12/2015");
props.putValue("JoiningDate", memeberDate);
myObject.save(RefreshMode.REFRESH);
System.out.println("Customobject " + myObject.get_Name() + " created");
//Saving the Custome Object into folder
String folder= "/Test";
com.filenet.api.core.Folder folderOj= Factory.Folder.fetchInstance(objStore,folder, null);
ReferentialContainmentRelationship rel = folderOj.file(myObject,AutoUniqueName.AUTO_UNIQUE,null,DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
rel.save(RefreshMode.REFRESH);
} catch (Exception e) {
e.printStackTrace();
}
}
public void CreateCustomObject(Connection conn) {
try {
Domain domain = Factory.Domain.fetchInstance(conn, null, null);
ObjectStore objStore = Factory.ObjectStore.fetchInstance(domain,"OSNAME", null);
System.out.println("del"+folderOj.get_Name());
//Creaing Custome Object and setting properties
CustomObject myObject= Factory.CustomObject.createInstance(objStore,"Student"); //Object store, Costome Object Class Name
com.filenet.api.property.Properties props = myObject.getProperties();
props.putValue("TitleName","stuInfo022");
props.putValue("StuID", "RK1234");
props.putValue("StuMailID", "p8@filenet.com");
props.putValue("age", 13);
DateFormat date = new SimpleDateFormat("dd/MM/yyyy");
Date memeberDate= date.parse("20/12/2015");
props.putValue("JoiningDate", memeberDate);
myObject.save(RefreshMode.REFRESH);
System.out.println("Customobject " + myObject.get_Name() + " created");
//Saving the Custome Object into folder
String folder= "/Test";
com.filenet.api.core.Folder folderOj= Factory.Folder.fetchInstance(objStore,folder, null);
ReferentialContainmentRelationship rel = folderOj.file(myObject,AutoUniqueName.AUTO_UNIQUE,null,DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
rel.save(RefreshMode.REFRESH);
} catch (Exception e) {
e.printStackTrace();
}
}
No comments:
Post a Comment