Class Period
java.lang.Object
org.alfresco.service.cmr.repository.Period
- All Implemented Interfaces:
Serializable
Implementation for the period data type "d:period" A period is specified by the period type and an optional
expression. The string value is periodType|expression Examples are: none day - one day day|3 - 3 days week - one week
week|1 - one week week|2 - two weeks month year monthend quarterend The period type specifies a period
implementation. This is registered with this class and is used to when adding the period to a date, handles any
processing of the expression, reports if the expression is not required, optional or mandatory.
The period data type can be also passed as a Map of keys: periodType and expression.
- Author:
- andyh
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getNextDate
(Date date) Calculate the next date for this period given the a start date.static PeriodProvider
getProvider
(String periodType) Find a providerGet the set of registered providersint
hashCode()
static void
registerProvider
(PeriodProvider periodProvider) Register a providertoString()
-
Constructor Details
-
Period
Create a period without an accompanying expression.- Parameters:
period
- String
-
Period
Create a period using key-value- Parameters:
source
-
-
-
Method Details
-
registerProvider
Register a provider- Parameters:
periodProvider
- PeriodProvider
-
getProvider
Find a provider- Parameters:
periodType
- String- Returns:
- the provider
- Throws:
IllegalStateException
- of there is no implementation
-
getProviderNames
Get the set of registered providers- Returns:
- - the set of registered providers
-
getPeriodType
- Returns:
- the periodType
-
getExpression
- Returns:
- the expression
-
getNextDate
Calculate the next date for this period given the a start date.- Parameters:
date
- Date- Returns:
- the next date.
-
hashCode
public int hashCode() -
equals
-
toString
-