Class CalendarDAO

java.lang.Object
org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
org.exoplatform.agenda.dao.CalendarDAO
All Implemented Interfaces:
org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>

public class CalendarDAO extends org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
  • Constructor Details

    • CalendarDAO

      public CalendarDAO()
  • Method Details

    • delete

      public void delete(CalendarEntity entity)
      Specified by:
      delete in interface org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>
      Overrides:
      delete in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
    • create

      public CalendarEntity create(CalendarEntity entity)
      In addition to the generic creation, initializes the creation date and generates a stable synchronization identifier (SYNC_UID) when none was provided, so that every stored calendar carries an environment-independent unique identifier.
      Specified by:
      create in interface org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>
      Overrides:
      create in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
    • update

      public CalendarEntity update(CalendarEntity entity)
      Updates a calendar, giving it a SYNC_UID when it still has none.

      The same guard create(CalendarEntity) applies, for the calendars that predate the column: one restored from an old backup after the migration ran would otherwise carry no anchor and be invisible to every integration that binds by it. This complements the migration rather than replacing it — the calendar that matters most is the system one, which is almost never updated.

      Specified by:
      update in interface org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>
      Overrides:
      update in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
    • getCalendarIdsByOwnerIds

      public List<Long> getCalendarIdsByOwnerIds(int offset, int limit, Long... ownerIds)
    • getAllCalendarIdsByOwnerId

      public List<Long> getAllCalendarIdsByOwnerId(long ownerId)
      Every calendar id of an owner, subscribed calendars included — unlike getCalendarIdsByOwnerIds(int, int, java.lang.Long...), which the owner listings use and which leaves subscriptions out.
      Parameters:
      ownerId - technical identifier of the calendar owner identity
      Returns:
      the ids, ascending, possibly empty
    • getSystemCalendarIdByOwnerId

      public Long getSystemCalendarIdByOwnerId(long ownerId)
      Retrieves the technical identifier of the system (default) calendar of a given owner. When several system calendars exist for the same owner (a data anomaly), the oldest one is returned to keep the result deterministic.
      Parameters:
      ownerId - technical identifier of the calendar owner identity
      Returns:
      technical identifier of the owner's system calendar, or null when the owner has no system calendar
    • countCalendarsByOwnerIds

      public int countCalendarsByOwnerIds(Long... ownerIds)
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>
      Overrides:
      deleteAll in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
    • deleteAll

      public void deleteAll(List<CalendarEntity> entities)
      Specified by:
      deleteAll in interface org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>
      Overrides:
      deleteAll in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
    • createAll

      public void createAll(List<CalendarEntity> entities)
      Specified by:
      createAll in interface org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>
      Overrides:
      createAll in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>
    • updateAll

      public void updateAll(List<CalendarEntity> entities)
      Specified by:
      updateAll in interface org.exoplatform.commons.api.persistence.GenericDAO<CalendarEntity,Long>
      Overrides:
      updateAll in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<CalendarEntity,Long>