Question

Using Liferay 6.1 CE, is there an easy way to create an 'empty' journalarticle based on a known structureId ?

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 a valid xml for the given structure, but doesn't if content is null or blank.

Is there is a method that returns the 'minimal' xml for a given structure, but can't find it.

Best regards, Alain

Was it helpful?

Solution

I don't know of any method to do this , but this xml should suffice

<?xml version="1.0"?>

<root available-locales="en_US" default-locale="en_US">
    <static-content language-id="en_US"><![CDATA[ ]]></static-content>
</root>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top