//Retrieving all documents and objects in Folder (FileNet CE API)
public void FetchCEObjectsInFolder(Connection conn) { //FileNet CE Connection
try {
Domain domain = Factory.Domain.fetchInstance(conn, null, null);
ObjectStore objStore = Factory.ObjectStore.fetchInstance(domain,"OSNAME", null);
System.out.println("Object Store ="+ objStore.get_DisplayName() );
String folder= "/Test"; // Folder name
com.filenet.api.core.Folder folderOj= Factory.Folder.fetchInstance(objStore,folder, null);
System.out.println("del"+folderOj.get_Name());
DocumentSet documents = folderOj.get_ContainedDocuments(); //For documents
ReferentialContainmentRelationshipSet refConRelSet= folderOj.get_Containees(); // for objects
Iterator it = documents.iterator();
while(it.hasNext())
{
//Retrieving documents
Document retrieveDoc= (Document)it.next();
String name = retrieveDoc.get_Name();
System.out.println("Document Name :: "+ name);
//Retrieving Objects
ReferentialContainmentRelationship retrieveObj=(ReferentialContainmentRelationship)it.next();
IndependentObject containee=retrieveObj.get_Head();
String className= containee.getClassName();
String displayName= retrieveObj.get_Name();
System.out.println("Class Name = "+ className);
System.out.println("Display Name = "+ displayName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void FetchCEObjectsInFolder(Connection conn) { //FileNet CE Connection
try {
Domain domain = Factory.Domain.fetchInstance(conn, null, null);
ObjectStore objStore = Factory.ObjectStore.fetchInstance(domain,"OSNAME", null);
System.out.println("Object Store ="+ objStore.get_DisplayName() );
String folder= "/Test"; // Folder name
com.filenet.api.core.Folder folderOj= Factory.Folder.fetchInstance(objStore,folder, null);
System.out.println("del"+folderOj.get_Name());
DocumentSet documents = folderOj.get_ContainedDocuments(); //For documents
ReferentialContainmentRelationshipSet refConRelSet= folderOj.get_Containees(); // for objects
Iterator it = documents.iterator();
while(it.hasNext())
{
//Retrieving documents
Document retrieveDoc= (Document)it.next();
String name = retrieveDoc.get_Name();
System.out.println("Document Name :: "+ name);
//Retrieving Objects
ReferentialContainmentRelationship retrieveObj=(ReferentialContainmentRelationship)it.next();
IndependentObject containee=retrieveObj.get_Head();
String className= containee.getClassName();
String displayName= retrieveObj.get_Name();
System.out.println("Class Name = "+ className);
System.out.println("Display Name = "+ displayName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
No comments:
Post a Comment