001: /*--------------------------------------------------------------------------*
002: | Copyright (C) 2006 Gereon Fassbender, Christopher Kohlhaas |
003: | |
004: | This program is free software; you can redistribute it and/or modify |
005: | it under the terms of the GNU General Public License as published by the |
006: | Free Software Foundation. A copy of the license has been included with |
007: | these distribution in the COPYING file, if not go to www.fsf.org |
008: | |
009: | As a special exception, you are granted the permissions to link this |
010: | program with every library, which license fulfills the Open Source |
011: | Definition as published by the Open Source Initiative (OSI). |
012: *--------------------------------------------------------------------------*/
013: package org.rapla.facade;
014:
015: import java.util.Date;
016:
017: import org.rapla.entities.Category;
018: import org.rapla.entities.User;
019: import org.rapla.entities.configuration.Preferences;
020: import org.rapla.entities.domain.Allocatable;
021: import org.rapla.entities.domain.Appointment;
022: import org.rapla.entities.domain.Period;
023: import org.rapla.entities.domain.Reservation;
024: import org.rapla.entities.dynamictype.ClassificationFilter;
025: import org.rapla.entities.dynamictype.DynamicType;
026: import org.rapla.framework.RaplaException;
027:
028: /** Methods for quering the various entities of the backend
029: * @version CVS $Revision: 1.59 $ $Date: 2006/01/25 22:48:37 $
030: */
031:
032: public interface QueryModule {
033: /** returns all DynamicTypes matching the specified classification
034: possible keys are reservation, person and resource.
035: @see org.rapla.entities.dynamictype.DynamicTypeAnnotations
036: */
037: DynamicType[] getDynamicTypes(String classificationType)
038: throws RaplaException;
039:
040: /** returns the DynamicType with the passed elementKey */
041: DynamicType getDynamicType(String elementKey) throws RaplaException;
042:
043: /** returns The root category. */
044: Category getSuperCategory();
045:
046: /** returns The category that contains the all user-groups of rapla */
047: Category getUserGroupsCategory() throws RaplaException;
048:
049: /** returns all users */
050: User[] getUsers() throws RaplaException;
051:
052: /** returns the user with the specified username */
053: User getUser(String username) throws RaplaException;
054:
055: /** returns all allocatables that match the passed ClassificationFilter. If null all readable allocatables are returned*/
056: Allocatable[] getAllocatables(ClassificationFilter[] filters)
057: throws RaplaException;
058:
059: /** returns all readable allocatables, same as getAllocatables(null)*/
060: Allocatable[] getAllocatables() throws RaplaException;
061:
062: /** returns the reservations of the specified user in the specified interval
063: @param user A user-object or null for all users
064: @param start only reservations beginning after the start-date will be returned (can be null).
065: @param end only reservations beginning before the end-date will be returned (can be null).
066: @param filters you can specify classificationfilters or null for all reservations .
067: */
068: Reservation[] getReservations(User user, Date start, Date end,
069: ClassificationFilter[] filters) throws RaplaException;
070:
071: /**returns all reservations that have allocated at least one Resource or Person that is part of the allocatables array.
072: @param allocatables only reservations that allocate at least on element of this array will be returned.
073: @param start only reservations beginning after the start-date will be returned (can be null).
074: @param end only reservations beginning before the end-date will be returned (can be null).
075:
076: **/
077: Reservation[] getReservations(Allocatable[] allocatables,
078: Date start, Date end) throws RaplaException;
079:
080: /** returns all available periods */
081: Period[] getPeriods() throws RaplaException;
082:
083: /** returns an Interface for accessing the periods
084: * @throws RaplaException */
085: PeriodModel getPeriodModel() throws RaplaException;
086:
087: /** returns the current date in GMT+0 Timezone. If rapla operates
088: in multi-user mode, the date should be calculated from the
089: server date.
090: */
091: Date today();
092:
093: /** returns all allocatables, that are already allocated by different parallel reservations at the time-slices, that are described by the appointment */
094: Allocatable[] getAllocatableBindings(Appointment appointment)
095: throws RaplaException;
096:
097: /** returns all existing conflicts with the reservation */
098: Conflict[] getConflicts(Reservation reservation)
099: throws RaplaException;
100:
101: /** returns all existing conflicts that are visible for the user
102: conflicts, since the passed Date. If startDate is null all
103: conflicts are shown.
104: */
105: Conflict[] getConflicts(Date startDate) throws RaplaException;
106:
107: /** returns if the user has the permissions to change/create an
108: allocation on the passed appointment. Changes of an
109: existing appointment that are in an permisable
110: timeframe are allowed. Example: The extension of an exisiting appointment,
111: doesn't affect allocations in the past and should not create a
112: conflict with the permissions.
113: */
114: boolean hasPermissionToAllocate(Appointment appointment,
115: Allocatable allocatable);
116:
117: /** returns the preferences for the passed user, must be admin todo this.*/
118: Preferences getPreferences(User user) throws RaplaException;
119:
120: /** returns the preferences for the login user */
121: Preferences getPreferences() throws RaplaException;
122:
123: /** returns if the user is allowed to exchange the allocatables of this reservation. A user can do it if he has
124: * at least admin privileges for one allocatable. He can only exchange or remove or insert allocatables he has admin privileges on.
125: * The User cannot change appointments.*/
126: boolean canExchangeAllocatables(Reservation reservation);
127: }
|