E - public class DefaultEventsService<E extends AbstractEvent> extends Object implements EventsService<E>
EventsService| Constructor and Description |
|---|
DefaultEventsService() |
| Modifier and Type | Method and Description |
|---|---|
List<DateRange> |
compliment(DateRange e1,
DateRange e2)
|
boolean |
contains(DateRange e1,
DateRange e2)
Check if e1 contains e2 completely
|
Long |
count(Query<E> query)
|
long |
daysDiff(DateRange range,
boolean normalizeTime,
boolean factorDayStartNotMidNight)
Calculate number of days difference.
Note on Time Zone : It is very important to note that both the date should have the same JVM Time-Zone set in the Date. |
void |
delete(E event) |
Long |
delete(Long id)
A special Delete operation on the entity that will remove the entity and related entities based on id.
|
<ED extends EventsDao<E>> |
getDao() |
float |
getDayStartHours()
Like Check in time
|
E |
getEntityInstance()
The entity instance maybe an extension of the Base ensure Queries work for extensions
derive the exact instance required for the Query.
|
DateRange |
intersection(DateRange e1,
DateRange e2)
Get the intersection (as an Event) between 2 Events.
|
E |
load(Object objectId) |
E |
load(Object objectId,
Class entityClass)
In some situations the DAO represents an Interface or perhaps a parent of the actual Entity./
The exact type of the entity would have to be Supplied.
|
boolean |
overlaps(DateRange e1,
DateRange e2)
Check if 2 Date Ranges Overlap
|
List<E> |
query(Query<E> query)
|
<SUB_T> List<SUB_T> |
query(Query<E> query,
Class<SUB_T> claz)
Derive a SubSet (claz) of T only as an queried entity.
|
List |
query(String ql,
String dialect,
Object... params)
Execute a raw Query in the native implementation language.
|
Page |
query(String ql,
String dialect,
PageInfo pageInfo,
Object... params)
Execute a raw Query in the native implementation language.
|
Page<E> |
queryPage(Query<E> query)
|
<S> Page<S> |
queryPage(Query<E> query,
Class<S> claz)
Derive a SubSet (claz) of T only as an queried entity.
|
E |
save(E event) |
void |
setDao(EventsDao<E> dao) |
int |
update(String query,
boolean isNative,
Object... params)
An Update query with optional params
|
protected EventsDao<E extends AbstractEvent> dao
public float getDayStartHours()
public long daysDiff(DateRange range, boolean normalizeTime, boolean factorDayStartNotMidNight)
daysDiff in interface EventsService<E extends AbstractEvent>range - as DateRangenormalizeTime - as boolean, if true will ignore any time settings.factorDayStartNotMidNight - as boolean, if true will factor in getDayStartHours()
If the day is not to be considered from midnight. Depends on getDayStartHours(). Useful like check-in time in Hotel situations.public DateRange intersection(DateRange e1, DateRange e2)
|e1S<-----x--------->e1E|
|e2S<---------y----->e2E|
This function will calculate (x,y) in the above scenario.intersection in interface EventsService<E extends AbstractEvent>e1 - as DateRangee2 - as DateRangeAbstractEvent part. If e1 is not overlapping with e2 at all, it will throw an IllegalArgumentException.public boolean overlaps(DateRange e1, DateRange e2)
overlaps in interface EventsService<E extends AbstractEvent>e1 - as DateRangee2 - as DateRangepublic boolean contains(DateRange e1, DateRange e2)
contains in interface EventsService<E extends AbstractEvent>e1 - as DateRangee2 - as DateRangepublic List<DateRange> compliment(DateRange e1, DateRange e2)
compliment in interface EventsService<E extends AbstractEvent>e1 - as DateRangee2 - as DateRangepublic List<E> query(Query<E> query) throws Exception
QueryableDaoQuery and on Queryable fields only.
Queryable fields will face problems.query in interface QueryableDao<E extends AbstractEvent>query - as QueryableExceptionpublic Page<E> queryPage(Query<E> query) throws Exception
QueryableDaoQuery and on Queryable fields only.
Query.setNullSet(Set)
Queryable fields will face problems.queryPage in interface QueryableDao<E extends AbstractEvent>query - as QueryableExceptionpublic Long count(Query<E> query) throws Exception
QueryableDaoQuery and on Queryable fields only.
Query.setNullSet(Set)
Queryable fields will face problems.count in interface QueryableDao<E extends AbstractEvent>query - as QueryableExceptionpublic <SUB_T> List<SUB_T> query(Query<E> query, Class<SUB_T> claz) throws Exception
QueryableDaoquery in interface QueryableDao<E extends AbstractEvent>query - as Queryclaz - as ClassExceptionpublic <S> Page<S> queryPage(Query<E> query, Class<S> claz) throws Exception
QueryableDaoqueryPage in interface QueryableDao<E extends AbstractEvent>query - as Queryclaz - as ClassExceptionpublic E getEntityInstance()
QueryableDaogetEntityInstance in interface QueryableDao<E extends AbstractEvent>public E save(E event)
save in interface GenericDao<E extends AbstractEvent>public void delete(E event)
delete in interface GenericDao<E extends AbstractEvent>public Long delete(Long id)
GenericDaodelete in interface GenericDao<E extends AbstractEvent>Longpublic E load(Object objectId, Class entityClass)
GenericDaoload in interface GenericDao<E extends AbstractEvent>objectId - as Id for EntityentityClass - as Class of entitypublic E load(Object objectId)
load in interface GenericDao<E extends AbstractEvent>public List query(String ql, String dialect, Object... params) throws Exception
FreeQueryquery in interface FreeQueryql - as String in native Schema languagedialect - as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.params - as Query parameters to the string.
ListExceptionpublic Page query(String ql, String dialect, PageInfo pageInfo, Object... params) throws Exception
FreeQueryquery in interface FreeQueryql - as String in native Schema languagedialect - as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.pageInfo - as PageInfo for pagination of resultparams - as Query parameters to the string
PageExceptionpublic int update(String query, boolean isNative, Object... params)
FreeQuerypublic <ED extends EventsDao<E>> ED getDao()
getDao in interface EventsService<E extends AbstractEvent>public void setDao(EventsDao<E> dao)
setDao in interface EventsService<E extends AbstractEvent>Copyright © 2018. All rights reserved.