Viewing content in the content management system

You can view content in a content management system through the view feature for any external content reference type attribute. Viewing content in the content management system enables you to see whether there is a valid content reference that is stored in any one attribute.

Before you begin

  1. Install and configure IBM® Content Integrator.
  2. Configure the content management system by using the configuration file.
  3. Define a spec.
  4. Add an external content reference type attribute to the spec.

Procedure

View content in the content management system. Use either of the following methods: user interface or Java™ API.
Option Description
User interface
  1. Open an item or category in the Single Edit screen using one of the following ways:
    1. Click an item or category in the pane navigation.
    2. Open an item to edit from the Item View screen.
    3. Select a step from the collaboration area.
  2. Click the view icon next to an external content reference type attribute. If there is a valid content reference that is stored in the attribute, the content is displayed in a separate window.
Java API The following sample Java API code enables you to view a text content in the console by using the CMSManager and CMSInstance Java interfaces.
Context ctx = null;
try
{

    	ctx = PIMContextFactory.getContext("Admin", "xxx", "MyCompany");
    	CMSManager CMSMgr = ctx.getCMSManager();
    	CMSInstance CMSInst = CMSMgr.getCMSInstance();
	// login to all the repositories through single sign on
        CMSInst.logon();

        InputStream fileinputstream = null;
        String urnOfContent = "vbr:/DB2PAL/firstItemType1.A1001001A09E13B41353D75338.A09E13B41353D75338.1028/1/CONTENT";

        // create CMSContentURN for a specific URN
        CMSContentURN urnObj = CMSInst.getCMSContentURN(urnOfContent);

        // get the inputstream of the contents of the CMS Content object
        fileinputstream = CMSInst.getURNContentAsStream(urnObj);

        byte buf[] = new byte[bufferSize];

        for (int len = -1; (len = fileinputstream.read(buf)) != -1;)
        {
            System.out.write(buf, 0, len);
        }

        // get the Content Integrator Content object
        Content content = CMSInst.getContentIntegratorContent(urnObj);
        // get the actual file name of the content
        String defaultFileName = content.getDefaultFileName();
        System.out.println("File name of the content retrieved or viewed is : " + defaultFileName);

        System.out.println("\n\n ------------ Viewing the content from CMS End------------ ");

    }