com.silverpeas.subscribe.util
Class SubscriptionManagementContext

java.lang.Object
  extended by com.silverpeas.subscribe.util.SubscriptionManagementContext

public class SubscriptionManagementContext
extends Object

This class permits to specify a context into which the subscriptions have to be managed. For example, it permits to define the context on the save action of a WYSIWYG of contribution from kmelia component.

Author:
Yohann Chastagnier

Method Summary
 SubscriptionManagementContext forPersistenceAction(ContributionStatus entityStatusBeforePersistenceAction, ActionType entityPersistenceAction, ContributionStatus entityStatusAfterPersistenceAction)
          Sets the context of persistence action performed on the entity.
 String getEntityId()
          Gets the identifier of the entity on which the persistence (or validation) action is performed.
 ActionType getEntityPersistenceAction()
          Gets the persistence (or validation) action that is performed on the entity.
 ContributionStatus getEntityStatusAfterPersistAction()
          Gets the status of the entity after the persistence (or validation) action is performed.
 ContributionStatus getEntityStatusBeforePersistAction()
          Gets the status of the entity before the persistence (or validation) action is performed.
 SubscriptionResource getLinkedSubscriptionResource()
          Gets the finest subscription resource linked to the current managed entity.
static SubscriptionManagementContext on(SubscriptionResource linkedSubscriptionResource, String andEntityId)
          Initializes a context by specifying the finest subscription resource linked to the entity that is handled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

on

public static SubscriptionManagementContext on(SubscriptionResource linkedSubscriptionResource,
                                               String andEntityId)
Initializes a context by specifying the finest subscription resource linked to the entity that is handled.

Parameters:
linkedSubscriptionResource - the finest subscription resource (the resource on which subscriptions are registered) linked to the entity that is handled.
andEntityId - the identifier of the entity on which the persistence (or validation) action is performed.
Returns:
a new instance of SubscriptionManagementContext initialized with the given subscription resource.

getLinkedSubscriptionResource

public SubscriptionResource getLinkedSubscriptionResource()
Gets the finest subscription resource linked to the current managed entity.

Returns:
the finest subscription resource linked to the current managed entity.

forPersistenceAction

public SubscriptionManagementContext forPersistenceAction(ContributionStatus entityStatusBeforePersistenceAction,
                                                          ActionType entityPersistenceAction,
                                                          ContributionStatus entityStatusAfterPersistenceAction)
Sets the context of persistence action performed on the entity.

Parameters:
entityStatusBeforePersistenceAction - the status of the entity before its persistence (or validation).
entityPersistenceAction - the type of persistence action performed on the persisted entity.
entityStatusAfterPersistenceAction - the status of the entity after a successful persist operation (or validation).
Returns:
the instance of the current completed context.

getEntityId

public String getEntityId()
Gets the identifier of the entity on which the persistence (or validation) action is performed.

Returns:
the identifier of the entity on which the persistence (or validation) action is performed.

getEntityPersistenceAction

public ActionType getEntityPersistenceAction()
Gets the persistence (or validation) action that is performed on the entity.

Returns:
the persistence (or validation) action that is performed on the entity.

getEntityStatusBeforePersistAction

public ContributionStatus getEntityStatusBeforePersistAction()
Gets the status of the entity before the persistence (or validation) action is performed.

Returns:
the status of the entity before the persistence (or validation) action is performed.

getEntityStatusAfterPersistAction

public ContributionStatus getEntityStatusAfterPersistAction()
Gets the status of the entity after the persistence (or validation) action is performed.

Returns:
the status of the entity after the persistence (or validation) action is performed.


Copyright © 2016 Silverpeas. All Rights Reserved.