public final class EventHelper extends Object implements LogEnabled, Serviceable
Modifier and Type | Field and Description |
---|---|
protected static ContentTypeExtensionPoint |
_contentTypeEP
The extension point for content types
|
private static Logger |
_logger |
protected static AmetysObjectResolver |
_resolver
The Ametys object resolver
|
Constructor and Description |
---|
EventHelper() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
_contains(ZonedDateTime start,
ZonedDateTime end,
ZonedDateTime event)
Test if an event is between 2 dates
|
private static boolean |
_overlaps(ZonedDateTime start1,
ZonedDateTime end1,
ZonedDateTime start2,
ZonedDateTime end2)
Test if 2 period of time overlap
|
void |
enableLogging(Logger logger) |
static boolean |
inMonth(String monthStartStr,
String eventStartStr,
String eventEndStr)
Tests if the given event occurs in the given month.
|
static boolean |
isBetween(String dateStr,
String startStr,
String endStr)
Tests if the given date is either:
- equal to the first, if there is no end date.
|
static boolean |
isDatetime(String contentId,
String metadataName)
Tests if the given metadata for the given content is of type
MetadataType.DATETIME |
static String |
nextDay(String dateStr)
Tests if the given date is either:
|
static String |
nextDay(String dateStr,
String format)
Tests if the given date is either:
|
void |
service(ServiceManager manager) |
protected static AmetysObjectResolver _resolver
protected static ContentTypeExtensionPoint _contentTypeEP
public EventHelper()
public void enableLogging(Logger logger)
enableLogging
in interface LogEnabled
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public static boolean isBetween(String dateStr, String startStr, String endStr)
dateStr
- the date to test.startStr
- start of the interval.endStr
- end of the interval.public static boolean inMonth(String monthStartStr, String eventStartStr, String eventEndStr)
monthStartStr
- The month first day, cannot be null or blank.eventStartStr
- The event start date, can be null or blank only if the end date is set.eventEndStr
- The event end date, can be null or blank only if the end date is set.private static boolean _contains(ZonedDateTime start, ZonedDateTime end, ZonedDateTime event)
start
- start dateend
- end dateevent
- event to checkprivate static boolean _overlaps(ZonedDateTime start1, ZonedDateTime end1, ZonedDateTime start2, ZonedDateTime end2)
start1
- start of 1st periodend1
- end of 1st periodstart2
- start of 2nd periodend2
- end of 2nd periodpublic static String nextDay(String dateStr)
dateStr
- the date to test.public static String nextDay(String dateStr, String format)
dateStr
- the date to test.format
- the format ("date" or "basicDate").public static boolean isDatetime(String contentId, String metadataName)
MetadataType.DATETIME
contentId
- The id of the contentmetadataName
- The metadata nameMetadataType.DATETIME