Import Content into Publisher
These are exciting times with Aqualogic (ALI) and its direction as a Portal technology after Oracle's acquisition of BEA Systems. Some of our ALI clients have decided to migrate off ALI's Content Management System (CMS), Publisher, and adopt a different platform; e.g. Adobe Contribute. While others are embracing the new Portal CMS Web Center Interaction stack, more specifically, Universal Content Management (UCM) as a Publisher alternative as they migrate from their existing CMS; e.g. Dynamic Site Framework. Each organization has its unique set of requirements and IT governance that define its decision. But, under any circumstances, the task of migrating content into Publisher or out of Publisher doesn't have to be a manual or laborious task.
Since the Portal's inception during Plumtree days, a set of APIs were provided to programmatically interact with the underlying Portal objects. The API's name might have changed through the product's evolution - Enterprise Development Kit 5.x (EDK) during Plumtree days, Interaction Development Kit (IDK) 6.x during the portal's short lived years with BEA and it seems that Oracle will retain the IDK name as it just prefixed it with "Oracle WebCenter" and just changed the version numbering to 10.x Yet, the concept remains unchanged: a set of interfaces for Portal objects - portlets, documents, projects, folders, communities, security groups, etc.)
With that said, we compiled a high level example of how to programmatically import content items from an external CMS to UCM/Publisher. In a subsequent example we will address how to export content items from Publisher/UCM to HTML and then load these to a target CMS while leveraging its intrinsic API set.
//initially we want to establish a remote session to the portal where soapConnectionURL is web service end point
IRemoteSession remoteSession = RemoteSessionFactory.getExplicitLoginContext(
new URL("http://YourPortalserver/ptapi/services/QueryInterfaceAPI"), yourUserName, yourPassword);
IContentFactory contentFactory = remoteSession.getContentFactory();
// get the required publisher object managers from IContentFactory
folderManager = contentFactory.getFolderManager();
contentItemManager = contentFactory.getContentItemManager();
propertyManager = contentFactory.getPropertyManager();
presentationTemplateManager = contentFactory.getPresentationTemplateManager();
dataEntryEntryTemplateManager = contentFactory.getDataEntryTemplateManager();
// create a text property to store HTML content
ITextBlockProperty textBlockProperty = propertyManager.createTextBlockProperty("htmlTextProperty", "htmlText");
IFolder folder = folderManager.getFolderByPath(targetFolderPath");
// create a presentation template that would use the html property
String templateText = "htmlTextProperty=<pcs:value expr="htmlTextProperty">unset</pcs:value>n";
IPresentationTemplate presentationTemplate = presentationTemplateManager.createPresentationTemplate(folder, "Presentation Template", templateText);
presentationTemplate.store();
// create a data entry template and attach the newly created presentation template
IDataEntryTemplate dataEntryTemplate = dataEntryTemplateManager.createDataEntryTemplate(folder, "Data Entry Template");
dataEntryTemplate.addProperty(textBlockProperty);
dataEntryTemplate.attachPresentationTemplate(presentationTemplate);
dataEntryTemplate.store();
//create a content item and set the rich/block text property with the HTML from the source CMS
IContentItem contentItem = contentItemManager.createContentItem(folder, "contentItemNameGoesHere", dataEntryTemplate);
textBlockProperty.setTextBlockProperty("Hello <strong><font color="#000000">World</font></strong>");
contentItemManager.checkInItem(contentItem, "Initial checkin.");
// publish the content item
contentItemManager.publishContentItem(contentItem);
The above code sample is a draft for how you can upload an HTML string from a separete CMS into Publisher as a content item, some of these method calls should be refactored outside the main method since, more likely, you'll be looping through the source CMS content repository. Feel free to ping us if you have any questions.
Thanks.
- Log in to post comments
Comments
Geoff Garcia on April 23, 2009
Hani on April 28, 2009
DK on May 01, 2009
Hani on May 04, 2009
DK on May 06, 2009
Hani on May 08, 2009
DK on May 08, 2009