3

I need to migrate static content website to IBM Web Content Manager. Basically we have a large number of HTML pages. Also there a lot of Word and PDF documents referenced from HTML pages.

We would need to extract content with crawlers and then integrate than import that data to IBM Web Content Manager.

What would be the best practices to successfully accomplish this migration?

Is there bulk import feature in IBM WCM?

Is it possible to automate process of creating pages and components via some API or service?

How to bulk import Word Documents and PDFs, store them as a components that can be referenced from migrated pages. Regards.

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
svlada
  • 3,218
  • 2
  • 25
  • 36

1 Answers1

2

To import content you can try two options:

  • IBM Web Content Integrator In a nutshell you need create feed source on your existing site regarding rules that portal defines. After that you need create consumer feed on Portal site and grab content to WCM.

  • Create Portal application using WCM api and grab content from any source you have - feed, database, files etc

To create portal pages/components(like images,files,html) you also able to use Portal/WCM api. But before import content make sure that you undestand difference between content and compoentns, and decide what you wanna create - conent or compoentns like content source. Also there is less info about creating page programmaticaly, but it possible.

If you plan to use JSR 286 portlet to display contnet, take a look on XML Import tool. This way you can automate your configuration and avoid manual confing for every page. Page confuguration - it just xml file, you always can modify this file with java and apply updated file for particular page.

UPDATE

Create portal pages programmatically

import com.ibm.portal.ModifiableMetaDataProvider;
import com.ibm.portal.content.*;
import com.ibm.portal.model.ContentModelHome;
import com.ibm.portal.model.ContentModelProvider;
import com.ibm.portal.model.controller.ContentModelControllerHome;
import com.ibm.portal.model.controller.CreationContextBuilderFactory;
import com.ibm.portal.model.controller.exceptions.CannotInstantiateControllerException;
import com.ibm.workplace.wcm.services.addressability.FriendlyURLFactoryImpl;
import com.ibm.wps.pe.pc.std.core.PortletUtils;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.portlet.*;

/**
 * @author : Georgy Gobozov
 * @created : 12.03.13
 */
public class PageUtil {

    private static final String PREF_PARENT_PAGE = "parent.page.unique.name";
    private static final String PREF_UNIQUE_PREFIX = "pages.unique.name.prefix";

    public static boolean createPortalPage(String title, ActionRequest request, ActionResponse response) {

        PortletPreferences prefs = request.getPreferences();

        String parentPageUniqueName =  prefs.getValue(PREF_PARENT_PAGE, "wps.content.root");
        String uniqueNamePrefix = prefs.getValue(PREF_UNIQUE_PREFIX, "study.portal.pages.");

        ContentModelController ctrl = null;
        CreationContextBuilderFactory factory = null;
        ContentPageCreationContext ctx = null;
        ModifiableContentPage newPage = null;
        ContentNode parent = null;
        try {
            ctrl = getController(request, response);
            factory = CreationContextBuilderFactory.getInstance();

            // Use the context to create the private page
            ctx = factory.newContentPageCreationContext(true);
            newPage = (ModifiableContentPage) ctrl.create(ContentPage.class, ctx);
            newPage.setTitle(request.getLocale(), title);
            // set page unique name
            newPage.getModifiableObjectID().setUniqueName(uniqueNamePrefix + title);
            parent = (ContentNode) ctrl.getLocator().findByUniqueName(parentPageUniqueName);
            if (parent != null) {
                ctrl.insert(newPage, parent, null);
                // set friendly name
                ModifiableMetaDataProvider mmdp = (ModifiableMetaDataProvider)ctrl.getModifiableNode(newPage);
                mmdp.getModifiableMetaData().setValue("com.ibm.portal.friendly.name", title);
                // Commit, i. e. persist the changes.
                ctrl.commit();
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (null != ctrl)
                // Dispose the Controller.
                ctrl.dispose();

        }
        return true;
    }


    public static ContentModelController getController(PortletRequest request, PortletResponse response) {
        ContentModel aContentmodel = null;
        ContentModelController ctrl = null;
        ContentModelControllerHome home = null;
        try {
            Context ictx = new InitialContext();
            ContentModelHome homea = (ContentModelHome) ictx.lookup("portal:service/model/ContentModel");
            if (homea != null) {
                ContentModelProvider provider = homea.getContentModelProvider();
                PortletUtils.getInternalRequest(request).getHttpServletRequest();
                //aContentmodel = provider.getContentModel((ServletRequest) request, (ServletResponse) response);
                aContentmodel = provider.getContentModel(PortletUtils.getInternalRequest(request).getHttpServletRequest(), PortletUtils.getInternalResponse(response).getHttpServletResponse());
            }
            home = (ContentModelControllerHome) ictx.lookup(ContentModelControllerHome.JNDI_NAME);
            if (home != null) {
                try {
                    ctrl = home.getContentModelControllerProvider().createContentModelController(aContentmodel);
                } catch (CannotInstantiateControllerException e) {
                    e.printStackTrace();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ctrl;

    }

}

More useful class here

Georgy Gobozov
  • 13,633
  • 8
  • 72
  • 78
  • Georgy, thanks for your detailed answer. IBM Web Content Integrator is option that I am considering to use. My main concern is if WCM can create new page and store content recieved from RSS in local WCM database. Do you have any reference on how RSS Feed API can be used? I couldn't find any usable resource on how RSS can be used to import content to WCM. – svlada May 29 '14 at 15:15
  • 1
    @svlada, before doing/trying import your content you should understand how you want keep and orginize your content in WCM. This is important thing. Do you wanna use different content types with different fields, different locations, any categories, components? Or you ok with plain html only? Waht is content source for existing site? Any database? – Georgy Gobozov May 29 '14 at 21:06
  • Content source will be fetched with crawlers and placed in sqllite database. This morning I have managed to configure RSS Feed Consumer on WCM and create simple Site Area. However I see that there is no "Portal Page" type that can be imported. Supported item types are siteArea, content, component, category. Is it possible to create Portal Page? – svlada May 30 '14 at 13:16
  • 1
    Yes, you cannot create pages with contnet integrator, If you want I can provide some code how to create pages programmatically. – Georgy Gobozov May 30 '14 at 16:20
  • That would be great. Could you provide code here on Stackoverflow so that I can accept that as a answer? – svlada May 30 '14 at 18:28
  • 1
    Updated my answer, hope it would be helpful for you. – Georgy Gobozov May 30 '14 at 20:02