You are on page 1of 5

Steps to getFolderIDFromPath when using Framework folders in UCM

Please let me know whether you have migrated from folder_g to FF and if yes,let me know
whether you have followed all the steps mentioned in the below document.

H Migrating Folders_g to FrameworkFolders


https://docs.oracle.com/middleware/11119/wcp/admin/wcadm_folders_g_migration.htm#WCAD
M14592

Note that ddCollectionID, the identifier used in Folders_g to uniquely identify a folder and
for FrameworkFolders identifier fFolderGUID.

You need to run the migrateFoldersGDataToFrameworkFolders wlst command and this


 Creates a mapping file that maps the Folders_g identifier dCollectionID to the FrameworkFolders
identifier fFolderGUID. The mapping file is available
here:Migration_Directory/POST_MIgration/MigrationMap.csv.
 Using the mapping file, replaces the value of dCollectionID with the fFolderGUID value in the
MDS documents generated by theexportFoldersGData WLST command.

Have tried WebCenter Content data control approach to get the folder Id. I created an UCM
connection and created a data control for the same. I defined the below metadata field for folder
id in data control. But i am getting Null for folder id from data control, where as I am getting
correct value for other data like Name, URL from data control.

Name: folderID
Type: long
JCR Path: jcr:content/idc:metadata/idc:fFolderGUID

On Webcenter Content PS5 and higher , with Framework Folders installed , it is


possible to list the total number of Content items and Sub-Folders present under a
specific parent Folder . This is achieved by listing the values present under LocalData
section .

This article provides details on how to achieve it using RIDC API

IdcService FLD_BROWSE provides data on the number of conten items and sub-
folders present under a specific folder . It can be used to have a list of (or tracking)
purposes for specific folders which are used most by end-users as a means of data
tracking .

Code snippet to achieve the above requirement is as follows :

/ Databinder for initial request


DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "FLD_BROWSE");
dataBinder.putLocal("fFolderGUID","<fFolderGUID>"); // use the fFolderGUID of the
folder for which details have to be retrieved

To list the details from the service call , code snippet is :

// Retrieve the LocalData from the data binder-DataObject being used since this the
values are part of LocalData
DataObject localData = responseData.getLocalData();

//Printing the value which is required to be displayed


System.out.println ("Total number of sub-folders is : " +
responseData.getLocal("TotalChildFoldersCount"));
System.out.println ("Total number of files in this folder is : " +
responseData.getLocal("TotalChildFilesCount"));

This will show the details (in numbers) for the Folder which is specified in request .

Sample Code:

File Name: TestRIDCFrameworkSubCount.java


import java.io.*;
import oracle.stellent.ridc.*;
import oracle.stellent.ridc.model.*;
import oracle.stellent.ridc.protocol.*;
import oracle.stellent.ridc.protocol.intradoc.*;
import oracle.stellent.ridc.common.log.*;
import oracle.stellent.ridc.model.serialize.*;
import oracle.stellent.ridc.protocol.http.*;
import java.util.List;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;

/*
* @author Srinath Menon - Oracle Inc
*
* This is a class used to list the total number of files and sub-folders which are present under a
given Framework Folder .
* It uses FLD_BROWSE service call , then iterate LocalData section to list the details .
*/

public class TestRIDCFrameworkSubCount{

/**
* @param args
*/
public static void main(String[] args) {
// Create a new IdcClientManager
IdcClientManager manager = new IdcClientManager ();
try{
// Create a new IdcClient Connection using idc protocol (i.e. socket
connection to Content Server)
IdcClient idcClient = manager.createClient ("idc://<ucm host
name>:<intradocserver port>");
//for using the web connection - start
// IdcClient idcClient = manager.createClient("http://<ucmhost>:<web
port>/cs/idcplg");
// IdcContext userContext = new IdcContext("weblogic", "<password as
set>");
//for using web connection - end

// Create new context using the 'sysadmin' user


IdcContext userContext = new IdcContext ("weblogic");

// Create an HdaBinderSerializer; this is not necessary, but it allows us to


serialize the request and response data binders
HdaBinderSerializer serializer = new HdaBinderSerializer ("UTF-8",
idcClient.getDataFactory ());

// Databinder for initial request


DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "FLD_BROWSE");
dataBinder.putLocal("fFolderGUID","<fFolderGUID>"); // use the fFolderGUID of the
folder for which details have to be retrieved

// Write the data binder for the request to stdout


serializer.serializeBinder (System.out, dataBinder);
// Send the request to Content Server
ServiceResponse response = idcClient.sendRequest(userContext,dataBinder);
// Get the data binder for the response from Content Server
DataBinder responseData = response.getResponseAsBinder();
// Write the response data binder to stdout
serializer.serializeBinder (System.out, responseData);

// Retrieve the LocalData from the data binder-DataObject being used since this the
values are part of LocalData
DataObject localData = responseData.getLocalData();

//Printing the value which is required to be displayed


System.out.println ("Total number of sub-folders is : " +
responseData.getLocal("TotalChildFoldersCount"));
System.out.println ("Total number of files in this folder is : " +
responseData.getLocal("TotalChildFilesCount"));

} catch (IdcClientException ice){


ice.printStackTrace();
} catch (IOException ioe){
ioe.printStackTrace();
}
}

}
I am able to get the folder id using path.
Below is the code i used.

public static String getFolderId(String path) throws Exception {

String fId = null;


// Create a new IdcClientManager
IdcClientManager manager = new IdcClientManager();
try {

IdcClient idcClient = UCMConnection.getIdcClient();


IdcContext idcContext = UCMConnection.getIdcContext();
// Create an HdaBinderSerializer; this is not necessary, but it allows us to serialize the
request and response data binders
HdaBinderSerializer serializer =
new HdaBinderSerializer("UTF-8", idcClient.getDataFactory());
// Databinder for initial request
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "FLD_INFO");
dataBinder.putLocal("path", path); // use the fFolderGUID of the folder for which details
have to be retrieved
// Write the data binder for the request to stdout
serializer.serializeBinder(System.out, dataBinder);
// Send the request to Content Server
ServiceResponse response =
idcClient.sendRequest(idcContext, dataBinder);
// Get the data binder for the response from Content Server
DataBinder responseData = response.getResponseAsBinder();
// Write the response data binder to stdout
serializer.serializeBinder(System.out, responseData);
DataResultSet myDataResultSet =
responseData.getResultSet("FolderInfo");
for (DataObject dataObject : myDataResultSet.getRows ()) {
System.out.println (" fFolderGUID is : " + dataObject.get ("fFolderGUID") );
fId = dataObject.get ("fFolderGUID");
}
} catch (IdcClientException ice) {
ice.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
return fId;
}

How Export Files from UCM via a Web Service

A) download using UCM download tool as mentioned in UCM_download_tool.doc file.


B) apply as below :
STEPS TO DOWNLOAD EXPORT FILE FROM UCM ::
1) Execute getAttachmentsForBatch(batch_Id) web method exposed under
http://:/crmCommonBulkExport/BulkExportService
◦ Example SOAP :
(batch_id)

2) SOAP Response would be similar to:


◦ SOAP Response
<ns1:Filename>ActivityAssigneeExpVO.csv</ns1:Filename>
<ns1:Size>492</ns1:Size>
<ns1:URL>/content/conn/FusionAppsContentRepository/uuid/dDocName%3aUCMFA
001926?XFND_SCHEME_ID=1&XFND_CERT_FP=7BEBDBA4E82216E20CE0541BEEC8
EC1BC18F3FA6&XFND_RANDOM=4791870370786509250&XFND_EXPIRES=1384848
657611&XFND_SIGNATURE=U4Uif0bAVdMrR6h-
jhqccAQWwEUdPMxFtNmH3Y9SyFEpP8Z3V6-Oga3Acxpqp2uDT-TGwIyxPeJ1m-7SCP-
KYR5BnXqWI681NRudJATK572-
81nv672c6aPZPl~nmzeWfyol41DxTLevlKO4RqlxZRa1O9mjBAJrshKTjCGiVgg_&Id=31
07</ns1:URL>
<ns1:creationDate>2013-11-18T23:42:52.906-08:00</ns1:creationDate>
<ns1:ContentId>UCMFA001926 </ns1:ContentId>

3) Download latest ucm download tool from below link :


http://download.oracle.com/otn/content_management/ucm11g/oracle.ucm.fa_client
_11.1.1.zip
Extract oracle.ucm.fa_client_11.1.1.jar from above ZIP.

4) Execute below command to download to specific location mentioned in outputFile


in below command
Update below command with params from above URL.

java -classpath "oracle.ucm.fa_client_11.1.1.jar" oracle.ucm.client.DownloadTool --


https://(POD).fs.(countryID).oraclecloud.com/cs/idcplg. This points to the Content
Server URL.--username=scampb --password=Welcome1 --
dDocName=UCMFA001926 --k0=XFND_SCHEME_ID --v0=1 --k1=XFND_CERT_FP --
v1=7BEBDBA4E82216E20CE0541BEEC8EC1BC18F3FA6 --k2=XFND_RANDOM --
v2=4791870370786509250 --k3=XFND_EXPIRES --v3=1384848657611 --
k4=XFND_SIGNATURE --v4="U4Uif0bAVdMrR6h-
jhqccAQWwEUdPMxFtNmH3Y9SyFEpP8Z3V6-Oga3Acxpqp2uDT-TGwIyxPeJ1m-7SCP-
KYR5BnXqWI681NRudJATK572-
81nv672c6aPZPl~nmzeWfyol41DxTLevlKO4RqlxZRa1O9mjBAJrshKTjCGiVgg_" --
simpleRIDCLogging --verbose --outputFile="/tmp/aa_output_d1.csv"

You might also like