Thursday, September 20, 2012

Search File in UCM using RIDC client

public void searchFile(String docTitle) {
   try {
        IdcClientManager manager = new IdcClientManager();                    
        AdfConnectionFacade facade = new AdfConnectionFacade("UcmConnection");
        IdcClient idcClient = facade.getIdcClient();
                           
        IdcContext userContext;
                            
        if(adfCtx.getSessionScope().get("IdcContext")==null) {
           userContext = new IdcContext(facade.getUserCredentials("user"));
           adfCtx.getSessionScope().put("IdcContext",userContext);
          }
        else {
           userContext=(IdcContext)adfCtx.getSessionScope().get("IdcContext");
        }
         
        DataBinder dataBinder = idcClient.createBinder();
        dataBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
        dataBinder.putLocal("QueryText", "dDocTitle <matches> `" + docTitle + "`");
        dataBinder.putLocal("ResultCount", "1");          
  
        ServiceResponse response =idcClient.sendRequest(userContext, dataBinder);
        DataBinder responseData = response.getResponseAsBinder();
        String count = responseData.getLocal("TotalRows");
        DataResultSet resultSet = responseData.getResultSet("SearchResults");
       
       if (count.equals("0")) {
                 log.severe("Document Not Found in UCM Server");
            } else {           
                    for (DataObject dataObject : resultSet.getRows()) {
                         docID = dataObject.get("dID");
                         log.info("UCM Doc ID: " + docID); 
                      }
             }                       
         } catch (IdcClientException ice) {
                log.severe("IDC Client Exception occured. Exception message: " + ice.getMessage());
         } catch (Exception ex) {
                log.severe("Exception message: " + ex.getMessage() );
    }

1 comment:

  1. Hi Lakshmipathi,

    Nice Article!

    I am trying to integrate UCM (via RIDC) in the webcenter portal application using the above approach suggested by you through AdfConnectionFacade, instead of referencing the conn details in db or managed bean or text file. However, the test to the connection server fails everytime with the follwong exception:

    IdcClientExceptionweblogic: Failed: IdcService='', cause='oracle.vcr.jam.JamRepository cannot be cast to oracle.stellent.ridc.convenience.adf.connection.RidcConnection'

    I have actually, deployed the webcenter portal app to a standalone webcenter domain and I ensured the connections.xml to be deployed to the server.

    Could you please take a moment and through some points on where I might be going wrong.

    Thanks,
    SriVyas

    ReplyDelete

Provide your thoughts !