Package lumis.content.core
Class ContentPublicationActivityGenerationTransactionObserver
- java.lang.Object
-
- lumis.portal.transaction.AbstractTransactionObserver
-
- lumis.content.core.ContentPublicationActivityGenerationTransactionObserver
-
- All Implemented Interfaces:
ITransactionObserver
public class ContentPublicationActivityGenerationTransactionObserver extends AbstractTransactionObserver
Transaction observer that generatesactivities
when aContentLocale
becomes published.- Since:
- 8.2.0
- Version:
- $Revision: 19963 $ $Date: 2017-02-21 19:28:29 -0300 (Tue, 21 Feb 2017) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
ContentPublicationActivityGenerationTransactionObserver.IObserverBuilder<T extends ITransactionObserver>
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
contentLocaleId
Identifier of theContentLocale
this observer will generateActivity
for.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ContentPublicationActivityGenerationTransactionObserver(java.lang.String contentLocaleId)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
attachToTransactionIfNecessary(ContentLocale contentLocale, boolean checkWasNotPublished)
If necessary, attach to the transaction an observer that will generate the activity if the content locale becomes published.protected static void
attachToTransactionIfNecessary(ContentLocale contentLocale, boolean checkWasNotPublished, boolean checkActivityStreamisEnabled, java.lang.String transactionAttributePreffix, ContentPublicationActivityGenerationTransactionObserver.IObserverBuilder<ITransactionObserver> observerBuilder)
If necessary, attach to the transaction an observer that will generate the activity if the content locale becomes published.boolean
beforeCommit()
Called by the observed transaction just before the commit operation.protected Activity
createActivity(ContentLocale contentLocale)
Creates an activity for the content locale being persistedprotected static boolean
isContentVersionPublished(ContentVersion publishedVersion)
Checks if aContentVersion
has been published or not.-
Methods inherited from class lumis.portal.transaction.AbstractTransactionObserver
afterCommit, afterRollback, beforeRollback
-
-
-
-
Field Detail
-
contentLocaleId
protected final java.lang.String contentLocaleId
Identifier of theContentLocale
this observer will generateActivity
for.- Since:
- 8.2.0
-
-
Method Detail
-
attachToTransactionIfNecessary
public static void attachToTransactionIfNecessary(ContentLocale contentLocale, boolean checkWasNotPublished)
If necessary, attach to the transaction an observer that will generate the activity if the content locale becomes published.- Parameters:
contentLocale
- the content locale.- Since:
- 8.2.0
-
attachToTransactionIfNecessary
protected static void attachToTransactionIfNecessary(ContentLocale contentLocale, boolean checkWasNotPublished, boolean checkActivityStreamisEnabled, java.lang.String transactionAttributePreffix, ContentPublicationActivityGenerationTransactionObserver.IObserverBuilder<ITransactionObserver> observerBuilder)
If necessary, attach to the transaction an observer that will generate the activity if the content locale becomes published.- Parameters:
contentLocale
- the content locale.checkWasNotPublished
- if it is necessary to check if the content locale was not already published. This parameter isfalse
when it is previously known the content locale was not published, for example when it is being added.checkActivityStreamisEnabled
- if it is necessary to check if this content's service and source have the automatic generation of activities by the activity stream framework enabled with a specific scope. This parameter isfalse
when it is previously known this content's service and source have not the automatic generation of activities by the activity stream framework enabled.transactionAttributePreffix
- prefix for name of attribute used to mark when an observer need not to be added to a transactionobserverBuilder
- builder for transaction observer being attached.- Since:
- 8.2.0
-
beforeCommit
public boolean beforeCommit() throws PortalException
Description copied from interface:ITransactionObserver
Called by the observed transaction just before the commit operation.- Specified by:
beforeCommit
in interfaceITransactionObserver
- Overrides:
beforeCommit
in classAbstractTransactionObserver
- Returns:
- true to indicate success; false to indicate fail, and cause the transaction to cancel commiting.
- Throws:
PortalException
-
createActivity
protected Activity createActivity(ContentLocale contentLocale) throws ManagerException, PortalException
Creates an activity for the content locale being persisted- Parameters:
contentLocale
- the content locale which activity is being created.- Returns:
- The activity created.
- Throws:
ManagerException
PortalException
- Since:
- 10.1.0
-
isContentVersionPublished
protected static boolean isContentVersionPublished(ContentVersion publishedVersion)
Checks if aContentVersion
has been published or not.- Parameters:
publishedVersion
- theContentVersion
to test.- Returns:
- true if it has been published
false otherwise - Since:
- 8.2.0
-
-