Liferay 6.1.2-ce-ga3

com.liferay.portlet.journal.lar
Interface JournalCreationStrategy

All Known Implementing Classes:
JournalCreationStrategyImpl

public interface JournalCreationStrategy

An interface defining how newly created content should be added to the Journal when imported from a LAR file. A class implementing this interface should be specified in portal.properties under the journal.lar.creation.strategy property.


Field Summary
static String ARTICLE_CONTENT_UNCHANGED
          Constant returned by getTransformedContent() to indicate that the article text should remained unchanged.
static long USE_DEFAULT_USER_ID_STRATEGY
          Constant returned by getAuthorUserId() that indicates the default portlet data import user ID strategy that should be used to determine the user ID.
 
Method Summary
 boolean addGroupPermissions(PortletDataContext context, Object journalObj)
          Returns true if the default group permissions should be added when the specified journalObj is created.
 boolean addGuestPermissions(PortletDataContext context, Object journalObj)
          Returns true if the default guest permissions should be added when the specified journalObj is created.
 long getAuthorUserId(PortletDataContext context, Object journalObj)
          Returns the author's user ID to assign to newly created content.
 String getTransformedContent(PortletDataContext context, JournalArticle newArticle)
          Gives the content creation strategy an opportunity to transform the content before the new article is saved to the database.
 

Field Detail

ARTICLE_CONTENT_UNCHANGED

static final String ARTICLE_CONTENT_UNCHANGED
Constant returned by getTransformedContent() to indicate that the article text should remained unchanged.


USE_DEFAULT_USER_ID_STRATEGY

static final long USE_DEFAULT_USER_ID_STRATEGY
Constant returned by getAuthorUserId() that indicates the default portlet data import user ID strategy that should be used to determine the user ID.

See Also:
Constant Field Values
Method Detail

addGroupPermissions

boolean addGroupPermissions(PortletDataContext context,
                            Object journalObj)
                            throws Exception
Returns true if the default group permissions should be added when the specified journalObj is created.

Parameters:
context - the portlet data context
journalObj - the journal object
Returns:
true if default group permissions should be added to the specified journalObj
Throws:
Exception - if an exception occurred

addGuestPermissions

boolean addGuestPermissions(PortletDataContext context,
                            Object journalObj)
                            throws Exception
Returns true if the default guest permissions should be added when the specified journalObj is created.

Parameters:
context - the portlet data context
journalObj - the journal object
Returns:
true if default guest permissions should be added to the specified journalObj
Throws:
Exception - if an exception occurred

getAuthorUserId

long getAuthorUserId(PortletDataContext context,
                     Object journalObj)
                     throws Exception
Returns the author's user ID to assign to newly created content. If zero is returned, the default user ID import strategy will determine the author ID.

Parameters:
context - the portlet data context
journalObj - the journal object
Returns:
the author's user ID or USE_DEFAULT_USER_ID_STRATEGY to use the default user ID strategy
Throws:
Exception - if an exception occurred

getTransformedContent

String getTransformedContent(PortletDataContext context,
                             JournalArticle newArticle)
                             throws Exception
Gives the content creation strategy an opportunity to transform the content before the new article is saved to the database. Possible use cases include using Velocity to merge in group specific values into the text. Returns the new content to assign to the article. If null is returned, the article content will be added unchanged.

Parameters:
context - the portlet data context
newArticle - the new journal article
Returns:
the transformed content to save in the database or ARTICLE_CONTENT_UNCHANGED if the content should be added unchanged
Throws:
Exception - if an exception occurred

Liferay 6.1.2-ce-ga3