Package com.logicaldoc.calendar
Class HibernateEventDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Event>
com.logicaldoc.calendar.HibernateEventDAO
@Repository("eventDAO")
public class HibernateEventDAO
extends com.logicaldoc.core.HibernatePersistentObjectDAO<Event>
implements EventDAO
Hibernate implementation of the EventDAO.
- Since:
- 6.7
- Author:
- Marco Meschieri - LogicalDOC
- 
Field SummaryFields inherited from interface com.logicaldoc.core.PersistentObjectDAOENTITY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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) voidDeletes an eventintdeleteOccurrences(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 futurevoidinit()voidinitialize(Event event) voidscheduleEvent(Event event) Schedules the job for all the reminders or cancelations.voidSchedules the missfired events, used during the bootstrap.voidsetJobManager(com.logicaldoc.core.job.JobManager jobManager) voidsetUserDAO(com.logicaldoc.core.security.user.UserDAO userDAO) 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.HibernatePersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, setSessionFactoryMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString
- 
Constructor Details- 
HibernateEventDAOpublic HibernateEventDAO()
 
- 
- 
Method Details- 
setJobManagerpublic void setJobManager(com.logicaldoc.core.job.JobManager jobManager) 
- 
setUserDAOpublic void setUserDAO(com.logicaldoc.core.security.user.UserDAO userDAO) 
- 
findByAttendeepublic List<Event> findByAttendee(long attendeeId, Date start) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAORetrieves the events associated to the given attendee- Specified by:
- findByAttendeein interface- EventDAO
- Parameters:
- attendeeId- The id of one or the attendee
- start- oldest date for the events
- Returns:
- list of vents ordered by start asc
- Throws:
- com.logicaldoc.core.PersistenceException- Error in the database
 
- 
findpublic List<Event> find(EventSearchCriteria searchCriteria) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAOFinder method for events.
- 
findIdsByAttendeeAndDocumentpublic List<Long> findIdsByAttendeeAndDocument(Long attendeeId, Long documentId, Date start, Date end) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAORetrieves the identifiers of the events that have a given attendee.- Specified by:
- findIdsByAttendeeAndDocumentin interface- EventDAO
- Parameters:
- attendeeId- The id of one or the attendee
- documentId- The id of one of the documents
- start- oldest date for the event
- end- latest date for the event
- Returns:
- list of event Ids
- Throws:
- com.logicaldoc.core.PersistenceException- Error in the database
 
- 
initialize
- 
store
- 
scheduleEventDescription copied from interface:EventDAOSchedules the job for all the reminders or cancelations. Do not invoke this directly it is used by the DAO itself.- Specified by:
- scheduleEventin interface- EventDAO
- Parameters:
- event- the event to elaborate
 
- 
unscheduleEventpublic 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 interface- EventDAO
- Parameters:
- eventId- the event to elaborate
 
- 
updateOccurrencesDescription 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 interface- EventDAO
- Parameters:
- master- The parent event
- Returns:
- The number of updated records
- Throws:
- com.logicaldoc.core.PersistenceException- error at data layer
 
- 
createOccurrencespublic 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 interface- EventDAO
- Parameters:
- master- The starting point event
- start- Oldest date, optional
- end- Latest date, mandatory
- Returns:
- The list of ids of the newly created events
- Throws:
- com.logicaldoc.core.PersistenceException- error at data layer
 
- 
deleteOccurrencespublic 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 interface- EventDAO
- Parameters:
- parentId- identifier of the parent event
- remindedOnly- Delete the reminded occurrences only
- Returns:
- Number of deleted events
- Throws:
- com.logicaldoc.core.PersistenceException- error at data layer
 
- 
deleteDescription copied from interface:EventDAODeletes an event
- 
deletepublic void delete(long id, int code) throws com.logicaldoc.core.PersistenceException 
- 
findOccurrencesDescription copied from interface:EventDAORetrieves the occurrences of a master event- Specified by:
- findOccurrencesin interface- EventDAO
- Parameters:
- masterId- identifier of the master event
- begin- Oldest date, optional
- end- Latest date, optional
- Returns:
- list of events ordered by start asc
 
- 
findIdsToNotifyDescription 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 interface- EventDAO
- 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
 
- 
cleanOldEventspublic int cleanOldEvents(int ttl) throws com.logicaldoc.core.PersistenceException 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 interface- EventDAO
- 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@PostConstruct public void init()
- 
scheduleMissfiredEventspublic void scheduleMissfiredEvents() throws com.logicaldoc.core.PersistenceExceptionDescription copied from interface:EventDAOSchedules the missfired events, used during the bootstrap. Do not invoke this directly it is used by the DAO itself.- Specified by:
- scheduleMissfiredEventsin interface- EventDAO
- Throws:
- com.logicaldoc.core.PersistenceException- Error in the database
 
- 
findUpcomingEventspublic List<Event> findUpcomingEvents(long attendeeId) throws com.logicaldoc.core.PersistenceException Description copied from interface:EventDAORetrieves the even that will happen in the future- Specified by:
- findUpcomingEventsin interface- EventDAO
- 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
 
 
-