1

I am new to accessing FileNet CE from Java.

From my test program, I can connect, create folders, upload files and retrieve the list.

Now, I need to find a folder within the ObjectStore. That is to say, given a hierarchy of folders within folders: Folder1 -- Folder1a -- Folder1b ---- Folder1b1 ---- Folder1b2 -- Folder1c ---- Folder1c1 ---- Folder1c2 Folder2 ...

How do I search for a folder given its name? It could be N levels deep.

Similarly, how do I search using wildcards in the name?

Similarly, I created a sub-class of a folder (PersonnelFolder) and gave it some attributes (Personnel ID, Department, etc.). How do I search for a Personnel ID? i.e. Search in properties within objects of a given class?

Hussain Akbar
  • 646
  • 8
  • 25

1 Answers1

2

Searching on the Documentation, there are no examples about it, just snippet of code that address specific paths. Like this:

Get the parent folder of a subpath:

String childFolderPath = "/Loans/MyLoans";
Folder currentFolder = Factory.Folder.fetchInstance(os, childFolderPath, null);
Folder parent = currentFolder.get_Parent();

Get the folders directly contained in a path

String folderPath = "/Loans";
Folder currentFolder = Factory.Folder.fetchInstance(os, folderPath, null);
FolderSet childFolders = currentFolder.get_SubFolders();

By the way, doing a research via FEM, it's easy to build a sql that addresses only part of the name. Like this:

SELECT * FROM [Folder] WHERE ([FolderName] like '%Folder1a%')

Similarly with a custom metadata:

SELECT * FROM [YourFolderSubType] WHERE ([YourCustomAttribute] = 'yourValue')

Then, accessing the attribute PathName gives you the complete path. Or, alternatively, you could just retrieve its ID in order to fetch the Folder object from it.

You could try to execute a query like these from the APIs, then cast each result as a Folder object in order to work on it.

An example (untested):

SearchSQL sqlObject = new SearchSQL(sqlStatement);
RepositoryRowSet rowSet = searchScope.fetchRows(sqlObject, null, null, new Boolean(true));
Iterator iter = myRows.iterator();
while (iter.hasNext()) {
    RepositoryRow row = (RepositoryRow) iter.next();
    row.getProperties().getStringValue("ID");
    com.filenet.api.core.Folder folder = Factory.Folder.fetchInstance(os, id, null);
}

Hope this helps.

Andrea
  • 6,032
  • 2
  • 28
  • 55
  • Thank you. Got the code to work. The "Folder" table finds folders that are nested as well as custom folders. I'll try your custom metadata code too. Question: Which columns does the "Folder" table have? Do you have a link to the docs? Question: From your code I see that a custom folder class has its own table. Correct? So such a folder would appear in the "Folder" table as well as the "CustomFolder" table? Also, a link to the "Document" table? – Hussain Akbar May 17 '19 at 18:17
  • Glad to help. Here's the documentation for Folder: https://www.ibm.com/support/knowledgecenter/en/SSNW2F_5.5.0/com.ibm.p8.ce.dev.java.doc/com/filenet/api/core/Folder.html. Note that if you install FEM or ACCE you can test your queries and view objects beforehand. To your questions: Yes, custom folders are independent classes, but they inherits from Folder (they are subclasses of it); so yes, search on "Folders" will retrieve them too; and no, "Document" is separated from "Folder". – Andrea May 20 '19 at 07:20
  • Test them beforehand? That would be a great time-saver. How? No, of course I know that Document & Folder are different classes. I meant, do you have a link showing the structure of the Folder and Document classes. – Hussain Akbar May 21 '19 at 11:12
  • No, unfortunately I don't have the structure as example. But, regarding the UI I was talking about, you can usually access ACCE with server_address:port/acce (where server address and port are CE ones) and FEM is a (now deprecated) client that you can install on Windows. Search for "Filenet Enterprise Manager". – Andrea May 21 '19 at 11:50