How to create an "empty" magazine article programmatically in liferay

Using Liferay 6.1 CE, is there an easy way to create an โ€œemptyโ€ journalistic article based on a well-known ID structure?

The following code:

ja = JournalArticleLocalServiceUtil.addArticle( themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), 0, 0, //classNameId, classPK, "test-article", //articleId, false, //autoArticleId, JournalArticleConstants.VERSION_DEFAULT, titleMap, null, //descriptionMap, content, "general", // type, BamboostConstants.SINGLE_CONTENT_STRUCTURE_ID, null, // templateId, StringPool.BLANK, //layoutUuid, 1, 1, 1970, 0, 0, // displayDateMonth, displayDateDay, displayDateYear, // displayDateHour, displayDateMinute, 0, 0, 0, 0, 0, true, // expirationDateMonth, expirationDateDay, // expirationDateYear, expirationDateHour, //expirationDateMinute, neverExpire, 0, 0, 0, 0, 0, true, // reviewDateMonth, reviewDateDay, reviewDateYear, //reviewDateHour, reviewDateMinute, neverReview, true, // indexable, false, StringPool.BLANK, null, // smallImage, smallImageURL, smallImageFile, null, StringPool.BLANK, // images, articleURL, serviceContext ); 

works if content is valid xml for a given structure, but not if content is empty or empty.

Is there a method that returns the "minimum" xml for a given structure but cannot find it.

Regards, Alain

+4
source share
1 answer

I do not know any method for this, but this xml should be sufficient

 <?xml version="1.0"?> <root available-locales="en_US" default-locale="en_US"> <static-content language-id="en_US"><![CDATA[ ]]></static-content> </root> 
+1
source

All Articles