Pages

Wednesday, February 17, 2016

How to search old revisions of the contents in UCM or WCC server?

How to search old revisions of the contents in UCM or WCC server? 

OR 

How to search for dID in WCC instead of dDocName ?

By default GET_SEARCH_RESULT search only the active revision of the content

 .

Like Revision 1 of content having Comment as '123'
Revision 2 of content having Comment as '456'

GET_SEARCH_RESULT with xComments=456 will show the content . But xComment=123 wont show any content .

This is working as expected from UCM side .

Work around : IdcService GET_DATARESULTSET can be used here . But this service wont have any dynamic Html page is associated with it . So you need some customization to use it

Append &IsSoap=1 will show the DataResultSet in xml format .

Paramete to pass:

IdcService=GET_DATARESULTSET
dataSource=Documents
whereClause=(xComments='123')
resultName=DOCUMENTS
IsSoap=1 (or Is Java=1 , IsJson=1)


RIDC code for this

config.properties
url=http://IP:16200/cs/idcplg
#url=idc://IP:IDCPORT
user=weblogic
password=welcome1
primaryFile=/tmp/sterin

java class



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 java.util.Properties;

/*
* @author Sterin- Oracle Inc
*
* This is a class used to test the basic functionality
* of submitting a search to Content Server using RIDC.
* The response is then used to retrieve metadata about
* the content items.
*/

public class SearchfordID {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
IdcClientManager manager = new IdcClientManager ();

Properties prop = new Properties();
InputStream input = null;

try{

input = new FileInputStream("config.properties");
// load a properties file
prop.load(input);


// Create a new IdcClient Connection using idc protocol (i.e. socket connection to Content Server)
IdcClient idcClient = manager.createClient (prop.getProperty("url"));

IdcContext userContext = new IdcContext (prop.getProperty("user"),prop.getProperty("password"));

// 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 ());
// Create a new binder for submitting a search
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "GET_DATARESULTSET");
dataBinder.putLocal("dataSource", "Documents");
dataBinder.putLocal("whereClause", "xComments='123'");
dataBinder.putLocal("resultName", "DOCUMENTS");

ServiceResponse response = idcClient.sendRequest(userContext,dataBinder);

DataBinder responseData = response.getResponseAsBinder();
DataResultSet resultSet = responseData.getResultSet("DOCUMENTS");



for (DataObject dataObject : resultSet.getRows ())

{
System.out.println("dID "+ dataObject.get("dID")+" dDocName "+dataObject.get("dDocName") + " Revision " +dataObject.get("dRevLabel") );


}



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

}

Example of Output


java SearchfordID

dID 1335 dDocName SOURCEFF001325 Revision 1
dID 802 dDocName SOURCEFF000802 Revision 1
dID 1337 dDocName SOURCEFF001325 Revision 3


No comments:

Post a Comment