com.liferay.portlet.journal.lar
Class JournalCreationStrategyImpl

java.lang.Object
  extended by com.liferay.portlet.journal.lar.JournalCreationStrategyImpl
All Implemented Interfaces:
JournalCreationStrategy

public class JournalCreationStrategyImpl
extends java.lang.Object
implements JournalCreationStrategy

View Source

Provides the strategy for creating new content when new Journal content is imported into a layout set from a LAR. The default strategy implemented by this class is to return zero for the author and approval user ids, which causes the default user id import strategy to be used. Content will be added as is with no transformations.

Author:
Joel Kozikowski
See Also:
JournalContentPortletDataHandlerImpl, JournalPortletDataHandlerImpl

Field Summary
 
Fields inherited from interface com.liferay.portlet.journal.lar.JournalCreationStrategy
ARTICLE_CONTENT_UNCHANGED, USE_DEFAULT_USER_ID_STRATEGY
 
Constructor Summary
JournalCreationStrategyImpl()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JournalCreationStrategyImpl

public JournalCreationStrategyImpl()
Method Detail

getAuthorUserId

public long getAuthorUserId(com.liferay.portal.lar.PortletDataContext context,
                            java.lang.Object journalObj)
                     throws java.lang.Exception
Description copied from interface: JournalCreationStrategy
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.

Specified by:
getAuthorUserId in interface JournalCreationStrategy
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

public long getApprovalUserId(com.liferay.portal.lar.PortletDataContext context,
                              java.lang.Object journalObj)
                       throws java.lang.Exception
Description copied from interface: JournalCreationStrategy
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.

Specified by:
getApprovalUserId in interface JournalCreationStrategy
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

public java.lang.String getTransformedContent(com.liferay.portal.lar.PortletDataContext context,
                                              com.liferay.portlet.journal.model.JournalArticle newArticle)
                                       throws java.lang.Exception
Description copied from interface: JournalCreationStrategy
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.

Specified by:
getTransformedContent in interface JournalCreationStrategy
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

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

Specified by:
addCommunityPermissions in interface JournalCreationStrategy
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

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

Specified by:
addGuestPermissions in interface JournalCreationStrategy
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