Quite often customers want a quick and easy way to publish a Word document and display it as HTML in a Portal. Dynamic Converter and RIDC comes handy in such situations. After you have setup the Dynamic Converter and tested the dynamic conversion from within the Content Server, you can use simple RIDC code snippet to display the content in a WebCenter Portal page.

First you need to import “oracle.ucm.ridc.jdev-11.1.1.zip” file manually into your JDeveloper. Then you can use the following code to build a bean to pass the content id and get the content.

This bean takes two parameters – the first is the Content ID, the second is a boolean value indicating if the content is dynamically converted or not. If all you need is to display a regular content, pass false as the second parameter.

package view;

import java.io.IOException;

import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.protocol.ServiceResponse;

public class RIDCBean {

    private String content;

    public RIDCBean(String dDocName, boolean dynamicConversion) throws 
                                     IdcClientException, IOException {
        // Arguments needed to connect to UCM
        String idcConnectionURL;
        idcConnectionURL = "idc://mycontentserver.com:4444";
        String username;
        username = "myappid";
        String password;
        password = "myapppwd";

        // Create the IdcClient
        IdcClientManager clientManager = new IdcClientManager ();
        IdcClient client = clientManager.createClient (idcConnectionURL);
        IdcContext userContext = new IdcContext(username, password);

        // Create a new binder
        DataBinder dataBinder = client.createBinder ();

        // Retrieve the file
        if (dynamicConversion) {
          dataBinder.putLocal ("IdcService", "GET_DYNAMIC_CONVERSION");
          dataBinder.putLocal("IsJava","0");
        } else {
          dataBinder.putLocal ("IdcService", "GET_FILE");
        }

        dataBinder.putLocal ("dDocName", dDocName);
        dataBinder.putLocal("RevisionSelectionMethod", "LatestReleased");
        ServiceResponse ridc_response;
        ridc_response = client.sendRequest (userContext, dataBinder);

        // Get the response as a string
        content = ridc_response.getResponseAsString ();
    }

    public String getContent() {
        return content;
    }
}

Note: If the Dynamically Converted Word document had images, they will be checked-into the content server automatically by the Dynamic Converter. Based on your Dynamic Converter template, IMG tags will be generated. The IMG tags will use a URL to load these images in the converted content. This will work fine as long as your Content Server is accessible by end users. If you have your Content Server locked behind a firewall, you will have issues and need to convince the customer to have a consumption UCM server (read only) that can be opened up to users access by punching a hole in the firewall.