Class ConflictManagerImpl
java.lang.Object
ch.tocco.nice2.optional.conflict.impl.ConflictManagerImpl
- All Implemented Interfaces:
ConflictManager
-
Constructor Summary
ConstructorsConstructorDescriptionConflictManagerImpl(CalendarManager calendarManager, ConflictDao conflictDao, QueryBuilderFactory queryBuilderFactory, NiceDataModel niceDataModel) -
Method Summary
Modifier and TypeMethodDescriptioncreateConflict(CalendarEvent event1, CalendarEvent event2, ConflictType type) findConflicts(List<PrimaryKey> targets, String relationName, Context context) Returns all conflicts from the database that are linked toCalendarEvents which are linked to the specified target entity using the specified relationName.findConflicts(List<PrimaryKey> targets, String relationName, Context context, String... existingRelations) Returns all conflicts that are linked toCalendarEvents which are in turn linked to the specifiedtargetentity with the givenrelationName, and where at least one of the givenexistingRelationsexist -- resolved from either one of theCalendarEvents participating in the conflict.findConflictsForCalendarEvent(Entity calendarEventEnttiy) findConflictsForCalendarEvent(UUID calendarEventId, Context context) getOfftimeCalendars(String entityModel, EntityFilter calendarEventEntityFilter, @Nullable Context ctx) Gets the offtime calendars for the specified entity model.loadConflict(String id, @Nullable Context context) mapConflictEntity(Entity conflictEntity) Creates aConflictobject from the given entity.voidremoveConflicts(Entity calendarEvent) This removes conflicts that are related to the specified calendar event, but without removing the calendar events itself!voidsetConflictSetting(String list)
-
Constructor Details
-
ConflictManagerImpl
public ConflictManagerImpl(CalendarManager calendarManager, ConflictDao conflictDao, QueryBuilderFactory queryBuilderFactory, NiceDataModel niceDataModel)
-
-
Method Details
-
setConflictSetting
-
loadConflict
public Optional<Conflict> loadConflict(String id, @Nullable @Nullable Context context) throws PersistException - Specified by:
loadConflictin interfaceConflictManager- Throws:
PersistException
-
createConflict
public Optional<Conflict> createConflict(CalendarEvent event1, CalendarEvent event2, ConflictType type) - Specified by:
createConflictin interfaceConflictManager
-
getOfftimeCalendars
public List<Calendar> getOfftimeCalendars(String entityModel, EntityFilter calendarEventEntityFilter, @Nullable @Nullable Context ctx) Description copied from interface:ConflictManagerGets the offtime calendars for the specified entity model. The relation name for the offtime calendar will be the same as in the main calendar of the entity model.- Specified by:
getOfftimeCalendarsin interfaceConflictManager- Parameters:
entityModel- the entity model for the offtime calendarcalendarEventEntityFilter- when the calendar is loaded from db, this filter specifies what events are fetched with the calendarctx- an optional context to use- Returns:
- the list of offtime calendars
-
findConflicts
public EntityList findConflicts(List<PrimaryKey> targets, String relationName, Context context) throws PersistException Description copied from interface:ConflictManagerReturns all conflicts from the database that are linked to
CalendarEvents which are linked to the specified target entity using the specified relationName.The resulting conflict's
CalendarEvents have itsCalendarattached but without any events.- Specified by:
findConflictsin interfaceConflictManager- Throws:
PersistException
-
findConflicts
public EntityList findConflicts(List<PrimaryKey> targets, String relationName, Context context, String... existingRelations) throws PersistException Description copied from interface:ConflictManagerReturns all conflicts that are linked toCalendarEvents which are in turn linked to the specifiedtargetentity with the givenrelationName, and where at least one of the givenexistingRelationsexist -- resolved from either one of theCalendarEvents participating in the conflict. This is the same asConflictManager.findConflicts(java.util.List, String, ch.tocco.nice2.persist.core.api.Context)but additionally filters only those conflicts that have targets at the givenexistingRelations. Example:
Finds all conflicts to the given reservation entity where the calendar events have an existing relation "relReservation_registration". In other words, it finds all registration conflicts for the given reservation.conflictManager.findConflicts(reservationEntity, "relReservation", "relReservation_registration")- Specified by:
findConflictsin interfaceConflictManager- Throws:
PersistException
-
findConflictsForCalendarEvent
public EntityList findConflictsForCalendarEvent(UUID calendarEventId, Context context) throws PersistException - Specified by:
findConflictsForCalendarEventin interfaceConflictManager- Throws:
PersistException
-
findConflictsForCalendarEvent
- Specified by:
findConflictsForCalendarEventin interfaceConflictManager- Throws:
PersistException
-
removeConflicts
Description copied from interface:ConflictManagerThis removes conflicts that are related to the specified calendar event, but without removing the calendar events itself!- Specified by:
removeConflictsin interfaceConflictManager- Parameters:
calendarEvent- the calendar event that is a source of conflicts
-
mapConflictEntity
Description copied from interface:ConflictManagerCreates aConflictobject from the given entity. The entity must be of modelConflict.- Specified by:
mapConflictEntityin interfaceConflictManager- Throws:
PersistException
-