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.
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