Sitemap

Wednesday, June 10, 2015

UCM: Checkin new content inside a framework folder using RIDC


public class CheckinFrameworkRIDC {

    public static void main(String[] args) {
        IdcClientManager manager = new IdcClientManager();
        try {
            // Creating a new IdcClient Connection using idc protocol
            //IdcClient idcClient = manager.createClient("idc://localhost:4444");
   //IdcContext userContext = new IdcContext("sysadmin");

            // Creating a new IdcClient Connection using HTTP protocol
            IdcClient idcClient = manager.createClient("http://localhost:16200/cs/idcplg");
     IdcContext userContext = new IdcContext("weblogic", "welcome1");
   
            HdaBinderSerializer serializer = new HdaBinderSerializer("UTF-8", idcClient.getDataFactory());
            DataBinder dataBinder = idcClient.createBinder();
            dataBinder.putLocal("IdcService", "CHECKIN_NEW");
            dataBinder.putLocal("dDocTitle", "Framework Folder Testing");
            dataBinder.putLocal("dDocType", "Document");
            dataBinder.putLocal("dSecurityGroup", "Public");
            dataBinder.addFile("primaryFile", new File("C:\\samplefile.txt"));
            dataBinder.putLocal("doFileCopy", "true");
            dataBinder.putLocal("dDocAuthor", "weblogic");
            
            // Either fParentGUID or parentFolderPath/fParentPath needs to be passed. Meatadata defaults are copied from the folder except SecurityGroup and Account
            //dataBinder.putLocal("fParentGUID", "5B0AC7C33BF951078772DFF757535B99");
            dataBinder.putLocal("fParentPath", "/Contribution Folders/ElPiju/Straw Bale/resources");
   
            serializer.serializeBinder(System.out, dataBinder);
            ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
            DataBinder responseData = response.getResponseAsBinder();
            serializer.serializeBinder(System.out, responseData);
        } catch (IdcClientException ice) {
            ice.printStackTrace();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}


1 comment:


  1. Hi I'm trying to checkin file through java code.
    I'm using checkin_universal ridc srvice to checkin file but I'm getting dstatus as Released but instead i want it as Review because documents workflow is not completed from UI.

    ReplyDelete