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

Method Summary
 boolean addCommunityPermissions(long companyId, long groupId, java.lang.Object journalObj)
          Returns true if the default community permissions should be added when the specified journalObj is created.
 boolean addGuestPermissions(long companyId, long groupId, java.lang.Object journalObj)
          Returns true if the default guest permissions should be added when the specified journalObj is created.
 long getApprovalUserId(long companyId, long groupId, java.lang.Object journalObj)
          Returns the approver's user id to assign to newly created content.
 java.lang.String getApprovalUserName(long companyId, long groupId, java.lang.Object journalObj)
          Returns the approver's user name.
 long getAuthorUserId(long companyId, long groupId, java.lang.Object journalObj)
          Returns the author's user id to assign to newly created content.
 java.lang.String getAuthorUserName(long companyId, long groupId, java.lang.Object journalObj)
          Returns the author's user name.
 java.lang.String getTransformedContent(long companyId, long groupId, 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.
 

Method Detail

getAuthorUserId

public long getAuthorUserId(long companyId,
                            long groupId,
                            java.lang.Object journalObj)
                     throws java.lang.Exception
Returns the author's user id to assign to newly created content. If null is returned, the original author of the exported content will be used.

Parameters:
companyId - the company id of the layout
groupId - the group id of the layout
journalObj - the new object must be an instance of JournalArticle, JournalStructure or JournalTemplate
Returns:
the author's user id, or 0 to use the original author
Throws:
java.lang.Exception

getAuthorUserName

public java.lang.String getAuthorUserName(long companyId,
                                          long groupId,
                                          java.lang.Object journalObj)
                                   throws java.lang.Exception
Returns the author's user name. This method should be ignored if getAuthorUserId() returns null.

Parameters:
companyId - the company id of the layout
groupId - the group id of the layout
journalObj - the new object must be an instance of JournalArticle, JournalStructure or JournalTemplate
Returns:
the author's user name must not be null if getAuthorUserId() does not return null
Throws:
java.lang.Exception

getApprovalUserId

public long getApprovalUserId(long companyId,
                              long groupId,
                              java.lang.Object journalObj)
                       throws java.lang.Exception
Returns the approver's user id to assign to newly created content. If null is returned, the article will not be marked as approved.

Parameters:
companyId - the company id of the layout
groupId - the group id of the layout
journalObj - the new object must be an instance of JournalArticle, JournalStructure or JournalTemplate
Returns:
the approver's user id, or 0 if the article should not be approved
Throws:
java.lang.Exception

getApprovalUserName

public java.lang.String getApprovalUserName(long companyId,
                                            long groupId,
                                            java.lang.Object journalObj)
                                     throws java.lang.Exception
Returns the approver's user name. This method should be ignored if getApprovalUserId() returns null.

Parameters:
companyId - the company id of the layout
groupId - the group id of the layout
journalObj - the new object must be an instance of JournalArticle, JournalStructure or JournalTemplate
Returns:
the approver's user name must not be null if getApprovalUserId() does not return null
Throws:
java.lang.Exception

getTransformedContent

public java.lang.String getTransformedContent(long companyId,
                                              long groupId,
                                              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:
companyId - the company id of the layout
groupId - the group id of the layout
newArticle - the new article being created
Returns:
the transformed content to save in the database or null if the content should be added unchanged
Throws:
java.lang.Exception

addCommunityPermissions

public boolean addCommunityPermissions(long companyId,
                                       long groupId,
                                       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:
companyId - the company id of the layout
groupId - the group id of the layout
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(long companyId,
                                   long groupId,
                                   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:
companyId - the company id of the layout
groupId - the group id of the layout
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