Package org.silverpeas.core.contribution
Class DefaultContributionVisibility
- java.lang.Object
-
- org.silverpeas.core.contribution.DefaultContributionVisibility
-
- All Implemented Interfaces:
Serializable
,ContributionVisibility
- Direct Known Subclasses:
Visibility
public class DefaultContributionVisibility extends Object implements ContributionVisibility
The default contribution visibility is a smart one that wraps the contribution in order to know dynamically the date of the last contribution update as it can be change in the time.- Author:
- silveryocha
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultContributionVisibility(Contribution contribution, Period specificPeriod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Period
getPeriod()
Gets the actual period of visibility of a contribution.Optional<Period>
getSpecificPeriod()
Gets the period of visibility which has been specifically set.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.contribution.ContributionVisibility
hasBeenActive, isActive, willBeActive
-
-
-
-
Constructor Detail
-
DefaultContributionVisibility
protected DefaultContributionVisibility(Contribution contribution, Period specificPeriod)
-
-
Method Detail
-
getSpecificPeriod
public Optional<Period> getSpecificPeriod()
Description copied from interface:ContributionVisibility
Gets the period of visibility which has been specifically set.- Specified by:
getSpecificPeriod
in interfaceContributionVisibility
- Returns:
- an optional
Period
, filled if a period has been specifically set. If no specific period has been set, otherwise if it is default visibility period of the contribution that is taken, then returns nothing (empty optional).
-
getPeriod
public Period getPeriod()
Description copied from interface:ContributionVisibility
Gets the actual period of visibility of a contribution.If no specific period is set, by default the period taken into account is the never ending duration starting at the date of the last contribution update.
If a period has been specifically set, so
ContributionVisibility.getSpecificPeriod()
returns a not empty result, then the period is taken into account.
If the last update date of theContribution
is greater than the begin date of the specific period, then the start date of returned period is overridden with the last update date ofContribution
.- Specified by:
getPeriod
in interfaceContributionVisibility
- Returns:
- a period instance.
-
-