Web Content Importer

This application allows a liferay user administrator to import journal articles and ddm structures using a generic defined Xml.

The import processment will show a report with details about imported data.

-> Why using it?

It can be beneficial when an insert of many journal articles or structures is required or for migration purpose getting web content data from whatever source.

In this last scenario tools might be created to generate the given Xml.

It can be in general used as an alternative to the "add new web content/ddm structure" offered by liferay (Web Content section).

-> How to use it?

Once installed a portlet will be accessible from "configuration" item of control panel with name "Web Content Importer", therefore allowed to be viewed/used by an Administrator role.
When it is opened the app will let you import whenever the Xml to upload and the liferay site (site in which the web content is saved) are selected.

-> Creating the Xml

In order to create the Xml please refer to the xsd file residing in the service module: webcontent-importer-service under "resources" folder at the path "\it\keybiz\liferay\globalimp\service\webcontent\xml\impl" with name webcontent.xsd

When uploading the file xml is parsed and validated against the xsd,in case displaying an error message describing which element is defined incorrectly.

ps: beware of the order of the element and the number minimum occurrences (almost all attributes element are optional) as they are main source of validation issues.

-> Defining DDM Structure, xml element example

<ddmstructure>
       <name>Example</name>
       <structurekey>ExampleKey</structurekey>
       <dateformfield>
           <label>date</label>
           <tip></tip>
           <showlabel>true</showlabel>
       </dateformfield>
</ddmstructure>

-> Defining Journal Article, xml element example

<journalarticle>
   <title>Example</title>
   <description>Example</description>
   <defaultlocale>it_IT</defaultlocale>
   <ddmstructurekey>ExampleKey</ddmstructurekey>
   <dateformfield>
           <data>2016-03-02</data>
   </dateformfield>
</journalarticle>

The xml above will create a ddmstructure and than a journal article associated to it (see ddmstructurekey equals to the structurekey of the ddmstructure element).

Mandatory form field elements like dateformfield or checkboxformfield in the journalarticle element let you insert content data.

p.s: To check required or not elements please refer to the webcontent.xsd file.

-> What About DDM Template of a structure ?

The template associated with the structure can't be defined at this stage of development.

At the moment a default one is created with a default freemarker script which will display data of structure form fields,in display mode.

-> What if I don't define a structure Key for the journal article ?

the journal article will be created with the Liferay default DDM Structure/template (BASIC WEB CONTENT)

-> Which format in the input xml for formfields element of a journalarticles ?

the <data> element should be filled respecting the following format,
respectively for each field:

1. radioformfield should be one of the possible value defined in the related formfield of the ddmstructure
-> for options: value1,value2,value3 for instance could be value1
-> for the default ddmstructure (value 1,2,3 are the default)
2. separatorformfield: it is just a graphic separator filling data element is useless
3. selectformfield should be one of the possible value defined in the related formfield of the ddmstructure
-> for options: value1,value2,value3 for instance could be value1
-> for the default ddmstructure (value 1,2,3 are the default)
4. journalarticleformfield
must be a json object like -> {"className":"com.liferay.journal.model.JournalArticle","classPK":"116602"}
5. imageformfield and documentlibraryformfield
must be a url referencing a resource image or document -> /documents/20147/0/Chrysanthemum.jpg/9fff10be-dc64-d8fa-bbcd-25be3555bb94?t=1475668603495
6. dataformfield -> 2016-10-30 = YYYY-mm-dd
7. htmlformfield -> must be wrapped in a CDDATA -> <![CDATA[<h1>test444</h1><div>ciaooone</div><script>alert("ciao");</script>]]>
8. textformfield whatever string representing a text
9. textareaformfield -> see 8

All of the above are validated during import, in case data is in the incorrect format(date in the wrong format) content won't be created for that formfield.

Later feature will contemplate a failed import and error messages to be displayed in the report table.

-> Report Result table

After processement a table with import result will be presented:

  • it will contain details of each web content (can be type ddm structure or journal article) import operation.
  • in case an insert operation goes wrong error a message will be displayed in the error message column.
  • the title column can be clicked to access the detail page of the imported journal article (at the moment this is not enabled for a ddm structure)
  • the id and structure key gives you an insight of the entites created in the database

I clienti che hanno visto questo hanno inoltre acquistato