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 TypeMethodDescriptionintcleanOldEvents(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.voiddelete(long id, int code) intdeleteOccurrences(long parentId, boolean remindedOnly) Deletes all the occurrences of a given event, but not the event itelf.find(EventSearchCriteria searchCriteria) Finder method for events.findByParticipant(long participantId, Date startDate) Retrieves the events associated to the given participantfindIdsByParticipantAndDocument(Long participantId, Long documentId, Date startDate, Date endDate) Retrieves the identifiers of the events that have a given participant.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 eventvoidinit()voidinitialize(Event event) voidscheduleEvent(Event event) Schedules the job for all the reminders.voidsetJobManager(com.logicaldoc.core.job.JobManager jobManager) voidvoidunscheduleEvent(long eventId) Unschedules the jobs of the given events and it's occurrencies.intupdateOccurrences(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, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString, setSessionFactoryMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString
-
Method Details
-
findByParticipant
Description copied from interface:EventDAORetrieves the events associated to the given participant- Specified by:
findByParticipantin interfaceEventDAO- Parameters:
participantId- The id of one or the participantstartDate- oldest date for the events- Returns:
- list of vents ordered by startDate asc
-
find
Description copied from interface:EventDAOFinder method for events. -
findIdsByParticipantAndDocument
public List<Long> findIdsByParticipantAndDocument(Long participantId, Long documentId, Date startDate, Date endDate) Description copied from interface:EventDAORetrieves the identifiers of the events that have a given participant.- Specified by:
findIdsByParticipantAndDocumentin interfaceEventDAO- Parameters:
participantId- The id of one or the participantdocumentId- The id of one of the documentsstartDate- oldest date for the eventendDate- latest date for the event- Returns:
- list of event Ids
-
initialize
-
store
-
scheduleEvent
Description copied from interface:EventDAOSchedules the job for all the reminders. Do not invoke this directly it is used by the DAO itself.- Specified by:
scheduleEventin interfaceEventDAO- Parameters:
event- the event to elaborate
-
unscheduleEvent
public void unscheduleEvent(long eventId) Description copied from interface:EventDAOUnschedules the jobs of the given events and it's occurrencies. Do not invoke this directly it is used by the DAO itself.- Specified by:
unscheduleEventin interfaceEventDAO- Parameters:
eventId- the event to elaborate
-
updateOccurrences
Description copied from interface:EventDAOThis will update all existing occurrences with the master's properties.
Attention: the collections are not propagated nor the timing attributes.- Specified by:
updateOccurrencesin 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:EventDAOThis 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:
createOccurrencesin 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:EventDAODeletes all the occurrences of a given event, but not the event itelf.- Specified by:
deleteOccurrencesin 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:EventDAORetrieves the occurrences of a master event- Specified by:
findOccurrencesin interfaceEventDAO- Parameters:
masterId- identifier of the master eventbegin- Oldest date, optionalend- Latest date, optional- Returns:
- list of events ordered by startDate asc
-
findIdsToNotify
Description copied from interface:EventDAOFinds 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:
findIdsToNotifyin interfaceEventDAO- Parameters:
currentDate- date to consider, if null the current date will be used- Returns:
- List of ids to be notified
-
cleanOldEvents
public int cleanOldEvents(int ttl) Description copied from interface:EventDAOThis method deletes all the events oldest than the given days from now. Ifttlis 0 or -1, the cancellation is not made.
Attention: Master events with a frequency will not be deleted.- Specified by:
cleanOldEventsin interfaceEventDAO- Parameters:
ttl- The maximum number of days over which the event is considered old- Returns:
- Number of deleted events
-
init
public void init() -
setJobManager
public void setJobManager(com.logicaldoc.core.job.JobManager jobManager)
-