Run Forrest Run!
"Run Forrest Run" – do you remember that scene from the movie Forrest Gump? Well, that seems to be the trend nowadays with government agencies running away from costly entreprise solutions towards more open source software because it is, well, free. Luckily, Forrest Gump unshackles himself from his polio braces and breaks free; and so so did many government agencies. In my prior blog on open source Web Content Management (WCM) systems, I mentioned Drupal as a strong open source replacement candidate for WebCenter Interaction (WCI). And today, I’d like to help you run away from WCI Publisher as seamlessly as possible to whatever WCM solution you choose to implement; and hopefully it is an open source one :-)
As we all know, WCI Publisher is a proprietary content management software as it has its unique templates for data and presentation that are difficult to map and replicate on any target WCM solution but what we care about most here is the content since odds are you will re-skin your website. In Publisher, you might have hundreds of content types with different data entry templates, so let’s take an example. Say you have a content type of type employee linked to its respective data entry template. For such a content item we might have the following Publisher properties defined in the data entry template
- First name
- Last name
- Date of birth
- Zip code
Obviously, to export these content items out of Publisher, we can write a custom Java or .Net module that utilizes the Publisher APIs and output the result in XML format for subsequent import in whatever WCM software. But, instead, we can leverage Publisher’s PCS Tags (funny the page still caries the “BEA” logo) as an easier alternative to perform that export functionality. The steps are as follows:
- Create a presentation template and define its publishing name as '.XML'
- Don’t link it to any data entry templates.
- In the code section we will use the conditional, value, and iterator tags; the syntax is:
<?xml version="1.0" encoding="UTF-8" ?> <employees> <pcs:foreach var="employee" expr="filter(folderByPath('employees'), 'filtered.published !=null ∧ !filtered.hidden')"> <employee> <first_name> <pcs:if expr="employee.first_name != NULL ∧ employee.first_name != ''"> <![CDATA[<pcs:value expr="employee.first_name"></pcs:value>]]> </pcs:if> </first_name> <last_name> <pcs:if expr="employee.last_name != NULL ∧ employee.last_name != ''"> <![CDATA[<pcs:value expr="employee.last_name"></pcs:value>]]> </pcs:if> </last_name> <birth_date> <pcs:if expr="employee.birth_date != NULL ∧ employee.birth_date != ''"> <![CDATA[<pcs:value expr="employee.birth_date"></pcs:value>]]> </pcs:if> </birth_date> <!--- add same syntax for the other employee properties -- > </employee> </pcs:foreach> </employees>
- Save and publish the presentation template.
- The output should be an XML formatted output of all the content items of type “employee” stored in the “employees” publisher folder; e.g.
<?xml version="1.0" encoding="UTF-8" ?> <employees> <employee> <last_name>Doe</last_name> <first_name>John</last_name> <birth_date>01/01/1980</birth_date> <email>firstname.lastname@example.org</email> <telephone>77-777-7777</telephone> <gender>male</gender> <address>1600 Pennsylvania Avenue</address> <city>Washington</city> <state>DC</state> <zipcode>20005</zipcode> </employee> </employees>
We can apply the same technique for the any other content type. The above example was for straight data entry templates property types, if you got a multi-selection property; for example skillset where en employee can have one more or skills; the <pcs> syntax would be:
<skills> <pcs:foreach var="condition" expr="employee.skillt"> <skill> <pcs:if expr="employee.skill > 1"></pcs:if><pcs:value expr="font-size: small; skill"></pcs:value> </skill> </pcs:foreach> </skills>
and the output XML would be
<skills> <skill>Java</skill> <skill>PHP</skill> <skill>C#</skill> <skill>Oracle</skill> <skill>Linux</skill> </skills>
Now that we got an XML output of the different Publisher content items, we should be able to migrate this content into any WCM solution. In the case of Drupal, we have a custom solution to import this XML data as new content.