com.liferay.portlet.journal.lar
Interface JournalCreationStrategy

All Known Implementing Classes:
JournalCreationStrategyImpl

public interface JournalCreationStrategy

View Source

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.

Author:
Joel Kozikowski

Field Summary
static java.lang.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() and/or getApprovalUserId() that indicates the default portlet data import user id strategy that should be used to determine the user id.
 
Method Summary
 boolean addCommunityPermissions(com.liferay.portal.lar.PortletDataContext context, java.lang.Object journalObj)
          Returns true if the default community permissions should be added when the specified journalObj is created.
 boolean addGuestPermissions(com.liferay.portal.lar.PortletDataContext context, java.lang.Object journalObj)
          Returns true if the default guest permissions should be added when the specified journalObj is created.
 long getApprovalUserId(com.liferay.portal.lar.PortletDataContext context, java.lang.Object journalObj)
          Returns the approver's user id to assign to newly created content.
 long getAuthorUserId(com.liferay.portal.lar.PortletDataContext context, java.lang.Object journalObj)
          Returns the author's user id to assign to newly created content.
 java.lang.String getTransformedContent(com.liferay.portal.lar.PortletDataContext context, com.liferay.portlet.journal.model.JournalArticle newArticle)
          Gives the content creation strategy an opportunity to transform the content before the new article is saved to the database.
 

Field Detail

USE_DEFAULT_USER_ID_STRATEGY

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

See Also:
Constant Field Values

ARTICLE_CONTENT_UNCHANGED

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

Method Detail

getAuthorUserId

long getAuthorUserId(com.liferay.portal.lar.PortletDataContext context,
                     java.lang.Object journalObj)
                     throws java.lang.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 context of the data import
journalObj - the new object must be an instance of JournalArticle, JournalStructure, or JournalTemplate
Returns:
the author's user id or USE_DEFAULT_USER_ID_STRATEGY to use the default user id strategy
Throws:
java.lang.Exception

getApprovalUserId

long getApprovalUserId(com.liferay.portal.lar.PortletDataContext context,
                       java.lang.Object journalObj)
                       throws java.lang.Exception
Returns the approver'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 context of the data import
journalObj - the new object must be an instance of JournalArticle, JournalStructure, or JournalTemplate
Returns:
the approver's user id or USE_DEFAULT_USER_ID_STRATEGY to use the default user id strategy
Throws:
java.lang.Exception

getTransformedContent

java.lang.String getTransformedContent(com.liferay.portal.lar.PortletDataContext context,
                                       com.liferay.portlet.journal.model.JournalArticle newArticle)
                                       throws java.lang.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 community 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 context of the data import
newArticle - the new article being created
Returns:
the transformed content to save in the database or ARTICLE_CONTENT_UNCHANGED if the content should be added unchanged
Throws:
java.lang.Exception

addCommunityPermissions

boolean addCommunityPermissions(com.liferay.portal.lar.PortletDataContext context,
                                java.lang.Object journalObj)
                                throws java.lang.Exception
Returns true if the default community permissions should be added when the specified journalObj is created.

Parameters:
context - the context of the data import
journalObj - the new object must be an instance of JournalArticle, JournalStructure, or JournalTemplate
Returns:
true if default community permissions should be added to the specified journalObj
Throws:
java.lang.Exception

addGuestPermissions

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

Parameters:
context - the context of the data import
journalObj - the new object must be an instance of JournalArticle, JournalStructure, or JournalTemplate
Returns:
true if default guest permissions should be added to the specified journalObj
Throws:
java.lang.Exception