Interface EventDAO

  • All Superinterfaces:
    com.logicaldoc.core.PersistentObjectDAO<Event>
    All Known Implementing Classes:
    HibernateEventDAO

    public interface EventDAO
    extends com.logicaldoc.core.PersistentObjectDAO<Event>
    DAO for events handling.
    Since:
    6.7
    Author:
    Marco Meschieri - LogicalDOC
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int cleanOldEvents​(int ttl)
      This method deletes all the events oldest than the given days from now.
      List<Long> 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.
      int deleteOccurrences​(long parentId, boolean remindedOnly)
      Deletes all the occurrences of a given event, but not the event itelf.
      List<Event> find​(Date startDate, Date endDate, Date deadLineFrom, Date deadLineTo, Integer frequency, String title, String type, String subtype, Integer status, Long tenantId, Integer maxRecords)
      Finder method for events.
      List<Event> findByParticipant​(long participantId, Date startDate)
      Retrieves the events associated to the given participant
      List<Long> findIdsByParticipantAndDocument​(Long participantId, Long documentId, Date startDate, Date endDate)
      Retrieves the identifiers of the events that have a given participant.
      List<Long> findIdsToNotify​(Date startDate)
      Finds all the events that have to be notified.
      List<Event> findOccurrences​(long masterId, Date start, Date end)
      Retrieves the occurrences of a master event
      void scheduleEvent​(Event event)
      Schedules the job for all the reminders.
      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 interface com.logicaldoc.core.PersistentObjectDAO

        bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, store
    • Method Detail

      • findByParticipant

        List<Event> findByParticipant​(long participantId,
                                      Date startDate)
        Retrieves the events associated to the given participant
        Parameters:
        participantId - The id of one or the participant
        startDate - oldest date for the events
        Returns:
        list of vents ordered by startDate asc
      • findIdsByParticipantAndDocument

        List<Long> findIdsByParticipantAndDocument​(Long participantId,
                                                   Long documentId,
                                                   Date startDate,
                                                   Date endDate)
        Retrieves the identifiers of the events that have a given participant.
        Parameters:
        participantId - The id of one or the participant
        documentId - The id of one of the documents
        startDate - oldest date for the event
        endDate - latest date for the event
        Returns:
        list of event Ids
      • find

        List<Event> find​(Date startDate,
                         Date endDate,
                         Date deadLineFrom,
                         Date deadLineTo,
                         Integer frequency,
                         String title,
                         String type,
                         String subtype,
                         Integer status,
                         Long tenantId,
                         Integer maxRecords)
        Finder method for events.
        Parameters:
        startDate - Start date (optional)
        endDate - End date (optional)
        deadLineFrom - (optional)
        deadLineTo - (optional)
        frequency - The frequency of the event (1,15, 30 ... optional)
        title - The title (used with like operator, optional)
        type - The type (used with like operator, optional)
        subtype - The subtype (used with like operator, optional)
        status - The status of the events to find (optional)
        tenantId - identifier of the tenant (optional)
        maxRecords - Maximum number of records (optional)
        Returns:
        The list of events ordered by ascending date
      • findIdsToNotify

        List<Long> findIdsToNotify​(Date startDate)
        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.
        Parameters:
        startDate - date to consider, if null the current date will be used
        Returns:
        List of ids to be notified
      • findOccurrences

        List<Event> findOccurrences​(long masterId,
                                    Date start,
                                    Date end)
        Retrieves the occurrences of a master event
        Parameters:
        masterId - identifier of the master event
        start - Oldest date, optional
        end - Latest date, optional
        Returns:
        list of events ordered by startDate asc
      • createOccurrences

        List<Long> createOccurrences​(Event master,
                                     Date start,
                                     Date end)
                              throws com.logicaldoc.core.PersistenceException
        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.
        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 in the database
      • updateOccurrences

        int updateOccurrences​(Event master)
                       throws com.logicaldoc.core.PersistenceException
        This will update all existing occurrences with the master's properties.
        Attention: the collections are not propagated nor the timing attributes.
        Parameters:
        master - The parent event
        Returns:
        The number of updated records
        Throws:
        com.logicaldoc.core.PersistenceException - error in the database
      • deleteOccurrences

        int deleteOccurrences​(long parentId,
                              boolean remindedOnly)
                       throws com.logicaldoc.core.PersistenceException
        Deletes all the occurrences of a given event, but not the event itelf.
        Parameters:
        parentId - identifier of the parent event
        remindedOnly - Delete the reminded occurrences only
        Returns:
        Number of deleted events
        Throws:
        com.logicaldoc.core.PersistenceException - error in the database
      • cleanOldEvents

        int cleanOldEvents​(int ttl)
        This method deletes all the events oldest than the given days from now. If ttl is 0 or -1, the cancellation is not made.
        Attention: Master events with a frequency will not be deleted.
        Parameters:
        ttl - The maximum number of days over which the event is considered old
        Returns:
        Number of deleted events
      • scheduleEvent

        void scheduleEvent​(Event event)
        Schedules the job for all the reminders. Do not invoke this directly it is used by the DAO itself.
        Parameters:
        event - the event to elaborate
      • unscheduleEvent

        void unscheduleEvent​(long eventId)
        Unschedules the jobs of the given events and it's occurrencies. Do not invoke this directly it is used by the DAO itself.
        Parameters:
        eventId - the event to elaborate