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: package org.rapla.entities.domain;
14:
15: import java.util.Date;
16:
17: import org.rapla.entities.Entity;
18: import org.rapla.entities.Named;
19: import org.rapla.entities.RaplaObject;
20: import org.rapla.entities.RaplaType;
21: import org.rapla.entities.User;
22: import org.rapla.entities.dynamictype.Classifiable;
23:
24: /** Objects that implement allocatable can be allocated by reservations.
25: @see Reservation
26: */
27: public interface Allocatable extends Entity, RaplaObject, Named,
28: Classifiable {
29: final RaplaType TYPE = new RaplaType(Allocatable.class, "resource");
30:
31: /** Conflicts for this allocatable should be ignored, if this flag is enabled.*/
32: void setHoldBackConflicts(boolean enable);
33:
34: boolean isHoldBackConflicts();
35:
36: /** Static empty dummy Array. Mainly for using the toArray() method of the collection interface */
37: Allocatable[] ALLOCATABLE_ARRAY = new Allocatable[0];
38:
39: void addPermission(Permission permission);
40:
41: boolean removePermission(Permission permission);
42:
43: /** returns if the user has the permission to allocate the resource in the given
44: time. It returns <code>true</code> if for at least one permission calling
45: <code>permission.covers()</code>
46: and <code>permission.affectsUser</code> yields <code>true</code>.
47: */
48: boolean canAllocate(User user, Date start, Date end, Date today);
49:
50: /** returns if the user has the permission to create a conflict for the resource.*/
51: boolean canCreateConflicts(User user);
52:
53: /** returns if the user has the permission to modify the allocatable (and also its permission-table).*/
54: boolean canModify(User user);
55:
56: /** returns if the user has the permission to read the allocations of this resource.*/
57: boolean canRead(User user);
58:
59: Permission[] getPermissions();
60:
61: Permission newPermission();
62:
63: boolean isPerson();
64:
65: }
|