2
String mySQLString = "select * from document where documentTitle like '%test%' ";
SearchSQL sql = new SearchSQL(mySQLString);
IndependentObjectSet s = search.fetchObjects(sql, 10, null, true);
Document doc;
PageIterator iterator = s.pageIterator();
iterator.nextPage();

for (Object object : iterator.getCurrentPage()) {
    doc = (Document) object;
    Properties properties = doc.getProperties();
    //I am trying to get an absolute or relative path here for every document.
    // for eg: /objectstorename/foldername/filename like this.
}

I have tried searching propeties and class descriptions in document . but can't able to find the path. ?

2
  • There is no such thing as "path of a document". Document can be filed in multiple folders or could not be filed at all. You shoud examine corresponding ReferentialContainmentRelationship objects.
    – ᄂ ᄀ
    Commented Feb 22, 2020 at 17:40
  • 1
    Alternatively, you can use FoldersFiledIn property and accompanying get_FoldersFiledIn() method.
    – ᄂ ᄀ
    Commented Feb 22, 2020 at 18:01

3 Answers 3

4

To do it all in one single query (as you are trying to do in your code) you can create a join with the ReferentialContainmentRelationship table. The property Head of this table points to the document, the property Tail points to the folder the document is filled in and the property ContainmentName is the name the document has in the folder. Use the following code to construct the document path:

SearchSQL searchSQL = new SearchSQL("SELECT R.ContainmentName, R.Tail, D.This FROM Document AS D WITH INCLUDESUBCLASSES INNER JOIN ReferentialContainmentRelationship AS R WITH INCLUDESUBCLASSES ON D.This = R.Head WHERE DocumentTitle like '%test%'");
SearchScope searchScope = new SearchScope(objectStore);
RepositoryRowSet objects = searchScope.fetchRows(searchSQL, null, null, null);
Iterator<RepositoryRow> iterator = objects.iterator();

while (iterator.hasNext()) {
    RepositoryRow repositoryRow = iterator.next();
    Properties properties = repositoryRow.getProperties();
    Folder folder = (Folder) properties.get("Tail").getEngineObjectValue();
    String containmentName = properties.get("ContainmentName").getStringValue();

    System.out.println(folder.get_PathName() + "/" + containmentName);
}

Paths constructed this way can also be used to fetch the object from the object store. The query code can be optimized by using a property filter as the third argument of the fetchRows() method. Don't know how this behaves if the document is filed in multiple folders.

1

I suggest you explore the "Creating DynamicReferentialContainmentRelationship Objects" section of FileNet documentation:

https://www.ibm.com/support/knowledgecenter/SSNW2F_5.5.0/com.ibm.p8.ce.dev.ce.doc/containment_procedures.htm#containment_procedures__fldr_creating_a_drcr

A FileNet Ddocument can be assigned to multiple Folders, so you can have several logical "Paths" for a given document.

At end, you should get something like "Folder.get_PathName() + DynamicReferentialContainmentRelationship.get_Name()" to display the full pathname.

As described by samples in FileNet documentation, a relationship object (e.g. DynamicReferentialContainmentRelationship) controls the relation of document/folder:

myRelationshipObject.set_Head(myDocument);

myRelationshipObject.set_Tail(myFolder);

Also, keep in mind that a FileNet Document can be also a "unfiled" document, so there is no actual "pathname" or folder "relationship" to be retrieved.

-1

tl;dr from FileNet Content Engine - Database Table for Physical path

Documents are stored among the directories at the leaf level using a hashing algorithm to evenly distribute files among these leaf directories.

Not the answer you're looking for? Browse other questions tagged or ask your own question.