Get Image Data from Oracle WebCenter Content using RIDC API

Prerequisites: Oracle WebCenter Content, RIDC, JDeveloper, MVCADF, Java, XML, DOM

Oracle WebCenter Content (previous Oracle ECM) offers integrated content services, including document management, records management, imaging and digital assets management, etc.

My previous client wanted to get the image data information from content server (UCM) and utilize it on imagedatacustomized portal. This has been implemented as an ADF taskflow and deployed as part of the ADF Library Jar in order to be reused in the customized portal environment.

Image data includes lots of raw information from an image file as illustrated at right. These information can be seen from the Web UI of content server. Now we need retrieve them from content server programmably.

Remote Intradoc Client (RIDC)  provides a thin communication API for communication with Oracle WebCenter Content Server. Let’s see how we reach our goal with RIDC API.

First, we need to build up a MVC (Model-View-Controller) framework using JDeveloper. In model layer, we need create ImageInfo class; In controller layer, we need an ImageInfoDC class as a data wrapper; In view layer, we need an image-info.jsff as the fragment which is wrapped by a taskflow called image-info-flow.

Second, we need create a backing bean ImageInfoBean so that the retrieved data can be bound to image-info.jsff. In ImageInfoBean, we may use RIDC API to access content server in order to get image data. Please note below highlighted lines.

    public void getImageInfoByID(String dID) throws IdcClientException, Exception {
        ServiceResponse seveviceResponseInfo = null;
        IdcClient idcClient = getIdcClient();
        IdcContext userContext = getUserContext();
        DataBinder dataBinderInfo = idcClient.createBinder();
        //Set up RIDC GET_FILE service
        dataBinderInfo.putLocal("IdcService", "GET_FILE");
        dataBinderInfo.putLocal("dID", dID);
        dataBinderInfo.putLocal("RevisionSelectionMethod", "specific");
        dataBinderInfo.putLocal("Rendition", "indexData");
        //Retrieve image file info from content repository
        seveviceResponseInfo = idcClient.sendRequest(userContext, dataBinderInfo);
        //Parse image file info into inputStream
        InputStream response = seveviceResponseInfo.getResponseStream();
        //Parse inputStream into document object in order to do tree traversal
        Document imageDoc = XMLParser.InputStream2DOM(response);
        imageDoc.getDocumentElement().normalize();
        logger.info("Root element :" + imageDoc.getDocumentElement().getNodeName());
        //Get image data from doc_property
        NodeList nodeList = imageDoc.getElementsByTagName("doc_property");

        String elementType;
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node nNode = nodeList.item(i);
            logger.info("\nCurrent Element :" + nNode.getNodeName());
            if (nNode.getNodeType() == Node.ELEMENT_NODE) {
                Element eElement = (Element)nNode;
                if (eElement.getAttribute("type").compareTo("Make") == 0)
                    equipmentMake.setValue(eElement.getTextContent());
                else if (eElement.getAttribute("type").compareTo("Model") == 0)
                    equipmentModel.setValue(eElement.getTextContent());
                else if (eElement.getAttribute("type").compareTo("TIFF_274") == 0)
                    orientation.setValue(eElement.getTextContent());
        ......

Here’s zipped XMLParser class which is invoked at line 16.

Third, once we have done all above work, we may create a jspx file to wrap up the taskflow in order to test or debug our code.

Have fun with RIDC!