Package com.logicaldoc.calendar
Class HibernateEventDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Event>
com.logicaldoc.calendar.HibernateEventDAO
public class HibernateEventDAO
extends com.logicaldoc.core.HibernatePersistentObjectDAO<Event>
implements EventDAO
Hibernate implementation of the EventDAO.
- Since:
- 6.7
- Author:
- Marco Meschieri - LogicalDOC
-
Field Summary
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY
-
Method Summary
Modifier and TypeMethodDescriptionint
cleanOldEvents
(int ttl) This method deletes all the events oldest than the given days from now.createOccurrences
(Event master, Date start, Date end) This will create all the occurrences of a recurrent master event in a given time range.
Attention: the collections are not propagated.void
delete
(long id, int code) int
deleteOccurrences
(long parentId, boolean remindedOnly) Deletes all the occurrences of a given event, but not the event itelf.find
(EventSearchCriteria searchCriteria) Finder method for events.findByAttendee
(long attendeeId, Date start) Retrieves the events associated to the given attendeefindIdsByAttendeeAndDocument
(Long attendeeId, Long documentId, Date start, Date end) Retrieves the identifiers of the events that have a given attendee.findIdsToNotify
(Date currentDate) Finds all the events that have to be notified.findOccurrences
(long masterId, Date begin, Date end) Retrieves the occurrences of a master eventfindUpcomingEvents
(long attendeeId) Retrieves the even that will happen in the futurevoid
init()
void
initialize
(Event event) void
scheduleEvent
(Event event) Schedules the job for all the reminders.void
Schedules the missfired events, used during the bootstrap.void
setJobManager
(com.logicaldoc.core.job.JobManager jobManager) void
setUserDAO
(com.logicaldoc.core.security.user.UserDAO userDAO) void
void
unscheduleEvent
(long eventId) Unschedules the jobs of the given events and it's occurrencies.int
updateOccurrences
(Event master) This will update all existing occurrences with the master's properties.Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, getSessionFactory, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString, setSessionFactory
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString
-
Method Details
-
setJobManager
public void setJobManager(com.logicaldoc.core.job.JobManager jobManager) -
setUserDAO
public void setUserDAO(com.logicaldoc.core.security.user.UserDAO userDAO) -
findByAttendee
public List<Event> findByAttendee(long attendeeId, Date start) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAO
Retrieves the events associated to the given attendee- Specified by:
findByAttendee
in interfaceEventDAO
- Parameters:
attendeeId
- The id of one or the attendeestart
- oldest date for the events- Returns:
- list of vents ordered by start asc
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database
-
find
public List<Event> find(EventSearchCriteria searchCriteria) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAO
Finder method for events. -
findIdsByAttendeeAndDocument
public List<Long> findIdsByAttendeeAndDocument(Long attendeeId, Long documentId, Date start, Date end) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAO
Retrieves the identifiers of the events that have a given attendee.- Specified by:
findIdsByAttendeeAndDocument
in interfaceEventDAO
- Parameters:
attendeeId
- The id of one or the attendeedocumentId
- The id of one of the documentsstart
- oldest date for the eventend
- latest date for the event- Returns:
- list of event Ids
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database
-
initialize
-
store
-
scheduleEvent
Description copied from interface:EventDAO
Schedules the job for all the reminders. Do not invoke this directly it is used by the DAO itself.- Specified by:
scheduleEvent
in interfaceEventDAO
- Parameters:
event
- the event to elaborate
-
unscheduleEvent
public void unscheduleEvent(long eventId) Description copied from interface:EventDAO
Unschedules the jobs of the given events and it's occurrencies. Do not invoke this directly it is used by the DAO itself.- Specified by:
unscheduleEvent
in interfaceEventDAO
- Parameters:
eventId
- the event to elaborate
-
updateOccurrences
Description copied from interface:EventDAO
This will update all existing occurrences with the master's properties.
Attention: the collections are not propagated nor the timing attributes.- Specified by:
updateOccurrences
in interfaceEventDAO
- Parameters:
master
- The parent event- Returns:
- The number of updated records
- Throws:
com.logicaldoc.core.PersistenceException
- error at data layer
-
createOccurrences
public List<Long> createOccurrences(Event master, Date start, Date end) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAO
This will create all the occurrences of a recurrent master event in a given time range.
Attention: the collections are not propagated. All already reminded occurrences are left untouched.- Specified by:
createOccurrences
in interfaceEventDAO
- Parameters:
master
- The starting point eventstart
- Oldest date, optionalend
- Latest date, mandatory- Returns:
- The list of ids of the newly created events
- Throws:
com.logicaldoc.core.PersistenceException
- error at data layer
-
deleteOccurrences
public int deleteOccurrences(long parentId, boolean remindedOnly) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAO
Deletes all the occurrences of a given event, but not the event itelf.- Specified by:
deleteOccurrences
in interfaceEventDAO
- Parameters:
parentId
- identifier of the parent eventremindedOnly
- Delete the reminded occurrences only- Returns:
- Number of deleted events
- Throws:
com.logicaldoc.core.PersistenceException
- error at data layer
-
delete
public void delete(long id, int code) throws com.logicaldoc.core.PersistenceException -
findOccurrences
Description copied from interface:EventDAO
Retrieves the occurrences of a master event- Specified by:
findOccurrences
in interfaceEventDAO
- Parameters:
masterId
- identifier of the master eventbegin
- Oldest date, optionalend
- Latest date, optional- Returns:
- list of events ordered by start asc
-
findIdsToNotify
Description copied from interface:EventDAO
Finds all the events that have to be notified. That are all those events with at least a reminder not already notified and after the passed date.- Specified by:
findIdsToNotify
in interfaceEventDAO
- Parameters:
currentDate
- date to consider, if null the current date will be used- Returns:
- List of ids to be notified
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database
-
cleanOldEvents
public int cleanOldEvents(int ttl) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAO
This method deletes all the events oldest than the given days from now. Ifttl
is 0 or -1, the cancellation is not made.
Attention: Master events with a frequency will not be deleted.- Specified by:
cleanOldEvents
in interfaceEventDAO
- Parameters:
ttl
- The maximum number of days over which the event is considered old- Returns:
- Number of deleted events
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database
-
init
public void init() -
scheduleMissfiredEvents
public void scheduleMissfiredEvents() throws com.logicaldoc.core.PersistenceExceptionDescription copied from interface:EventDAO
Schedules the missfired events, used during the bootstrap. Do not invoke this directly it is used by the DAO itself.- Specified by:
scheduleMissfiredEvents
in interfaceEventDAO
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database
-
findUpcomingEvents
public List<Event> findUpcomingEvents(long attendeeId) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAO
Retrieves the even that will happen in the future- Specified by:
findUpcomingEvents
in interfaceEventDAO
- Parameters:
attendeeId
- identifier of the user that will have to attend to the events- Returns:
- the future events order by descending start date
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database
-