Thursday, April 19, 2012

Webcenter Content folders: how to get Folder ID (Collection ID)

The JCR standard uses a hierarchical data model based on extensible node types and content properties. 
In Java JCR repositories nt:folder node type represents a structured collection of nodes. It is closely related to the directory or folder concept found in many file systems and is the node type that is normally used when mapping file system directories to a content repository.

Generally UCM Folder concept is functionally similar, but really Webcenter Content Folder is more virtual. Phisically it is an additional document type, and folder name is mapped to metadata represented by long integer value.

Returning to our problem. You can find help in Oracle® WebCenter Content Services Reference Guide, chapter 7.2.40 COLLECTION_INFO :) But if you need sample, you have one bellow.

 try{
    DataBinder request = idcClient.createBinder();
    request.putLocal("IdcService", "COLLECTION_INFO");
    request.putLocal("hasCollectionPath", "true");
    request.putLocal("dCollectionPath", path);
    
    ServiceResponse response = idcClient.sendRequest(userContext, request);
    DataBinder binder = response.getResponseAsBinder();
    DataResultSet rs = binder.getResultSet("PATH");
    DataObject da = rs.getRows().get(rs.getRows().size() - 1);
    Long folderID = new Long(da.get("dCollectionID"));
    return folderID;
    }
    catch...

1 comment: