This discussion is archived
3 Replies Latest reply: Oct 24, 2013 7:40 PM by Srinath Menon RSS

creation of folder structure using RIDC code

826240 Newbie
Currently Being Moderated
Hi,

Can anyone help me out in creating a folder structure in UCM using RIDC code by using IDC services.

When i am trying to create folder in UCM i am getting this error :oracle.stellent.ridc.protocol.ServiceException: Unable to display virtual folder information. Unable to open folder.

my snippet is given below:

public boolean createSubmission(String journalName,
String submissionID) throws Exception {
IdcClientManager manager = new IdcClientManager();
IdcClient idcClient;
try {
idcClient = manager.createClient("idc://localhost:4444");
IdcContext userContext = new IdcContext("weblogic", "welcome1");
String PATH="/Contribution Folders";
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "COLLECTION_NEW");
dataBinder.putLocal("hasParentCollectionID", "true");
dataBinder.putLocal("dCollectionName", submissionID);
dataBinder.putLocal("dParentCollectionID",this.getFolderIdFromPath(idcClient,userContext,PATH +"/"+journalName));
dataBinder.putLocal("dCollectionOwner", "sysadmin");
ServiceResponse response =idcClient.sendRequest(userContext, dataBinder);
DataBinder serverBinder = response.getResponseAsBinder();
System.out.println("dCollectionID.... "+serverBinder.getLocal("dCollectionID"));
} catch (IdcClientException e) {
e.printStackTrace();
}

return false;
}
private String getFolderIdFromPath(IdcClient idcClient,
IdcContext userContext, String path) {
String folderId = null;
// Long folderId =0L;
try {
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "COLLECTION_INFO");
dataBinder.putLocal("hasCollectionPath", "true");
dataBinder.putLocal("dCollectionPath", path);
ServiceResponse response =
idcClient.sendRequest(userContext, dataBinder);
DataBinder serverBinder = response.getResponseAsBinder();
DataResultSet resultSet = serverBinder.getResultSet("PATH");
DataObject dataObject =
resultSet.getRows().get(resultSet.getRows().size() - 1);
folderId = dataObject.get("dCollectionID");
System.out.println("folderId... "+folderId);
} catch (IdcClientException e) {
e.printStackTrace();
}

return folderId;
}

Thanks in advance.
  • 1. Re: creation of folder structure using RIDC code
    Yannick Ongena Employee ACE
    Currently Being Moderated
    I suggest you do a system.out.println for the complete path:
    String PATH="/Contribution Folders" +"/"+journalName;
    system.out.println(PATH);
    String id = this.getFolderIdFromPath(idcClient,userContext,PATH);
    System.out.println("ID: " + id);
    dataBinder.putLocal("dParentCollectionID",id);
    See what these values give...
  • 2. Re: creation of folder structure using RIDC code
    926312 Newbie
    Currently Being Moderated

    Hi,

    Is your problem solved??

     

    please share solution..

     

    I am facing same issue..

    While running custom code for creating virtual folder.

     

     


    public class createFolders
    {
        public createFolders ()
        {
            super();
          
        }
        storedValue obj=new storedValue();
        public String name=null;

      private String getFolderIdFromPath(IdcClient idcClient,
       IdcContext userContext, String path) {
       String folderId = null;
       // Long folderId =0L;
       try {
       DataBinder dataBinder = idcClient.createBinder();
       dataBinder.putLocal("IdcService", "COLLECTION_INFO");
       dataBinder.putLocal("hasCollectionPath", "true");
       dataBinder.putLocal("dCollectionPath", path);
       ServiceResponse response =
       idcClient.sendRequest(userContext, dataBinder);
       DataBinder serverBinder = response.getResponseAsBinder();
       DataResultSet resultSet = serverBinder.getResultSet("PATH");
       DataObject dataObject =
       resultSet.getRows().get(resultSet.getRows().size() - 1);
       folderId = dataObject.get("dCollectionID");
       System.out.println("folderId... "+folderId);
       } catch (IdcClientException e) {
       e.printStackTrace();
       }
      
      return folderId;
       } 

     

     

      public void createchild1(String folderName)
        {
           try
           {
               if(!(obj.getProject()==null))
               {
               IdcClientManager clientManager1 = new IdcClientManager();
               IdcClient client1 =clientManager1.createClient("idc://localhost:4444");
               IdcContext userContext1 = new IdcContext("weblogic", "welcome1");

               if (!(userContext1 == null))
               {
                   DataBinder binder1 = client1.createBinder();
                   client1.sendRequest(userContext1 , binder1);
              String PATH;
              PATH = "/Contribution Folders/IDFC" +"/"+folderName;
              System.out.println(PATH);
                   binder1.putLocal("dSecurityGroup", "Public");
                   binder1.putLocal("dOwner", "weblogic");
                   binder1.putLocal("IdcService", "COLLECTION_ADD");
                 binder1.putLocal("HAS_COLLECTION_PATH", "true");
                 binder1.putLocal("hasParentCollectionID", "true");
                 //binder.putLocal("dCollectionInherit","0");
                 String id = this.getFolderIdFromPath(client1,userContext1,PATH);
                 System.out.println("ID: " + id);
                 binder1.putLocal("dParentCollectionID", this.getFolderIdFromPath(client1,userContext1,PATH)); 
                   binder1.putLocal("DCOLLECTIONNAME", obj.getProject());
                   System.out.println("FolderName" + obj.getProject());
                   System.out.println("userContext is:" + userContext1);
                   System.out.println("dataBinder is:" + binder1);
                   ServiceResponse resp1 = client1.sendRequest(userContext1, binder1);
                   System.out.println("response is:" + resp1);
                   DataBinder serverBinder = resp1.getResponseAsBinder();
                  
               
               }
         }
                }
               catch (Exception ex)
           {
               ex.printStackTrace();
           }
        }


          

     

    I am getting following error..

     

    !csUserEventMessage,weblogic,CIS!$!csCollectionUnableToCreateCollection!csCollectionFolderHasNoName
    intradoc.common.ServiceException: !csCollectionUnableToCreateCollection!csCollectionFolderHasNoName
    *ScriptStack COLLECTION_ADD
    3:addCollectionInCollection,**no captured values**
            at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:2115)
            at intradoc.server.Service.buildServiceException(Service.java:2326)
            at intradoc.server.Service.createServiceExceptionEx(Service.java:2320)
            at collections.CollectionUserHandler.addCollectionInCollection(CollectionUserHandler.java:638)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
            at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:324)
            at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
            at intradoc.server.Service.doCodeEx(Service.java:603)
            at intradoc.server.Service.doCode(Service.java:575)
            at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1643)
            at intradoc.server.Service.doAction(Service.java:547)
            at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1458)
            at intradoc.server.Service.doActions(Service.java:542)
            at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1391)
            at intradoc.server.Service.executeActions(Service.java:528)
            at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:737)
            at intradoc.server.Service.doRequest(Service.java:1956)
            at intradoc.server.ServiceManager.processCommand(ServiceManager.java:437)
            at intradoc.server.IdcServerThread.processRequest(IdcServerThread.java:265)
            at intradoc.server.IdcServerThread.run(IdcServerThread.java:160)
            at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

     

    Any help is appreciated...

     

    Thanks in advance

  • 3. Re: creation of folder structure using RIDC code
    Srinath Menon Guru
    Currently Being Moderated

    Hi ,

     

    I think the dCollectionName is not getting set in your code which is a mandatory parameter and that is why the code is failing .

     

    Try setting a value to the variable rather and then test .

     

    Service details can be read from the following link : http://docs.oracle.com/cd/E21764_01/doc.1111/e11011/c08_folders.htm#i1082567

     

    More RIDC samples are available in the following MoS Article :

     

    Doc ID 1558212.1 - Remote Intradoc Client (RIDC) Master Note for Sample Code

     

    Thanks,

    Srinath   

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points