01: /*--------------------------------------------------------------------------*
02: | Copyright (C) 2006 Gereon Fassbender, Christopher Kohlhaas |
03: | |
04: | This program is free software; you can redistribute it and/or modify |
05: | it under the terms of the GNU General Public License as published by the |
06: | Free Software Foundation. A copy of the license has been included with |
07: | these distribution in the COPYING file, if not go to www.fsf.org . |
08: | |
09: | As a special exception, you are granted the permissions to link this |
10: | program with every library, which license fulfills the Open Source |
11: | Definition as published by the Open Source Initiative (OSI). |
12: *--------------------------------------------------------------------------*/
13:
14: package org.rapla.entities.domain;
15:
16: import org.rapla.entities.Entity;
17: import org.rapla.entities.Named;
18: import org.rapla.entities.Ownable;
19: import org.rapla.entities.RaplaObject;
20: import org.rapla.entities.RaplaType;
21: import org.rapla.entities.Timestamp;
22: import org.rapla.entities.dynamictype.Classifiable;
23:
24: /** The <code>Reservation</code> interface is the central interface of
25: * Rapla. Objects implementing this interface are the courses or
26: * events to be scheduled. A <code>Reservation</code> consist
27: * of a group of appointments and a set of allocated
28: * resources (rooms, notebooks, ..) and persons.
29: * By default all resources and persons are allocated on every appointment.
30: * If you want to associate allocatable objects to special appointments
31: * use Restrictions.
32: *
33: * @see Classifiable
34: * @see Appointment
35: * @see Allocatable
36: */
37: public interface Reservation extends Entity, RaplaObject, Classifiable,
38: Named, Ownable, Timestamp {
39: final RaplaType TYPE = new RaplaType(Reservation.class,
40: "reservation");
41:
42: public final int MAX_RESERVATION_LENGTH = 100;
43:
44: void addAppointment(Appointment appointment);
45:
46: void removeAppointment(Appointment appointment);
47:
48: /** returns all appointments that are part off the reservation.*/
49: Appointment[] getAppointments();
50:
51: /** Restrict an allocation to one ore more appointments.
52: * By default all objects of a reservation are allocated
53: * on every appointment. Restrictions allow to model
54: * relations between allocatables and appointments.
55: * A resource or person is restricted if its connected to
56: * one or more appointments instead the whole reservation.
57: */
58: void setRestriction(Allocatable alloc, Appointment[] appointments);
59:
60: Appointment[] getRestriction(Allocatable alloc);
61:
62: /** returns all appointments for an allocatable. This are either the restrictions, if there are any or all appointments
63: * @see #getRestriction
64: * @see #getAppointments*/
65: Appointment[] getAppointmentsFor(Allocatable alloc);
66:
67: /** find an appointment in the reservation that equals the specified appointment. This is usefull if you have the
68: * persistant version of an appointment and want to discover the editable appointment in the working copy of a reservation */
69: Appointment findAppointment(Appointment appointment);
70:
71: void addAllocatable(Allocatable allocatable);
72:
73: void removeAllocatable(Allocatable allocatable);
74:
75: Allocatable[] getAllocatables();
76:
77: Allocatable[] getRestrictedAllocatables(Appointment appointment);
78:
79: /** returns if an the reservation has allocated the specified object. */
80: boolean hasAllocated(Allocatable alloc);
81:
82: /** returns if the allocatable is reserved on the specified appointment. */
83: boolean hasAllocated(Allocatable alloc, Appointment appointment);
84:
85: /** returns all persons that are associated with the reservation.
86: Need not necessarily to be users of the System.
87: */
88: Allocatable[] getPersons();
89:
90: /** returns all resources that are associated with the reservation. */
91: Allocatable[] getResources();
92:
93: public static final Reservation[] RESERVATION_ARRAY = new Reservation[0];
94: }
|