Class ContributionManagementContext
- java.lang.Object
-
- org.silverpeas.core.contribution.util.ContributionManagementContext
-
public class ContributionManagementContext extends Object
This class permits to specify a context into which a contribution has to be managed. For example, it permits to define the context on the save action of a WYSIWYG of a contribution from kmelia component.- Author:
- Yohann Chastagnier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ContributionManagementContext
aboutSubscriptionResource(SubscriptionResource linkedSubscriptionResource)
Setup the finest subscription resource linked to the entity that is handled.static ContributionManagementContext
atComponentInstanceId(String id)
Initializes a context by specifying the contribution handled by this context.ContributionManagementContext
atLocation(Location location)
Setup the location at which the subscription resource is aimed.ContributionManagementContext
forPersistenceAction(ContributionStatus entityStatusBeforePersistenceAction, ActionType entityPersistenceAction, ContributionStatus entityStatusAfterPersistenceAction)
Sets the context of persistence action performed on the entity.ContributionIdentifier
getContributionId()
Gets theContributionIdentifier
of the managed contribution.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.Location
getLocation()
Gets the optional location of the contribution from which it is managed.static ContributionManagementContext
on(Contribution contribution)
Initializes a context by specifying the contribution handled by this context.
-
-
-
Method Detail
-
atComponentInstanceId
public static ContributionManagementContext atComponentInstanceId(String id)
Initializes a context by specifying the contribution handled by this context.- Parameters:
id
- a component instance identifier as string.- Returns:
- a new instance of
ContributionManagementContext
.
-
on
public static ContributionManagementContext on(Contribution contribution)
Initializes a context by specifying the contribution handled by this context.- Parameters:
contribution
- aContribution
instance.- Returns:
- a new instance of
ContributionManagementContext
.
-
aboutSubscriptionResource
public ContributionManagementContext aboutSubscriptionResource(SubscriptionResource linkedSubscriptionResource)
Setup 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.- Returns:
- itself.
-
atLocation
public ContributionManagementContext atLocation(Location location)
Setup the location at which the subscription resource is aimed.- Parameters:
location
- aLocation
instance from which MUST contribution is handled.- Returns:
- itself.
-
getContributionId
public ContributionIdentifier getContributionId()
Gets theContributionIdentifier
of the managed contribution.- Returns:
- the handled contribution identifier handled into the context.
-
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 ContributionManagementContext 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.
-
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.
-
-