checkstyle adapted in Datahandler interface
[staff/due1/sed-hs15-srs-purple.git] / src / main / java / ch / bfh / ti / srs / datahandler / DataHandler.java
1 /*
2 * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
3 *
4 * Project Smart Reservation System.
5 *
6 * Distributable under GPL license. See terms of license at gnu.org.
7 */
8 package ch.bfh.ti.srs.datahandler;
9
10 import java.util.HashSet;
11 import java.util.List;
12 import java.util.UUID;
13
14 import ch.bfh.ti.daterange.DateRange;
15 import ch.bfh.ti.srs.dataschema.Reservation;
16 import ch.bfh.ti.srs.dataschema.Resource;
17 import ch.bfh.ti.srs.dataschema.User;
18
19 /**
20 * @author Michael Grossen
21 */
22 public interface DataHandler {
23
24 /**
25 * Finds the user by userName param in the Datacontext and returns the User
26 * object or null if not found
27 * @param userName
28 * userName of the user you are looking for
29 * @return <code>User</code>user object <code>null</code>if no user found
30 * with this userName
31 */
32 public User findUser(String userName);
33
34 /**
35 * Adds a user to the Datacontext from a given User object
36 * @param user
37 * User object
38 * @throws Exception
39 */
40 public void addUser(User user) throws Exception;
41
42 /**
43 * Finds the resourceName in the Datacontext and returns the Resource object
44 * or null if not found
45 * @param resourceName
46 * resource name of the recource you are looking for
47 * @return <code>Resource</code>resource object <code>null</code>if no
48 * resource found with this recourceName
49 */
50 public Resource findResource(String resourceName);
51
52 /**
53 * Adds a resource to the Datacontext from a given Recource object
54 * @param resource
55 * Resource object
56 * @throws Exception
57 */
58 public void addResource(Resource resource) throws Exception;
59
60 /**
61 * Finds the reservation by the id param in the Datacontext and returns the
62 * Reservation object or null if not found
63 * @param id
64 * id of the Reservation you are looking for
65 * @return <code>Reservation</code>reservation object <code>null</code>if no
66 * reservation found with this resource and this daterange
67 */
68 public Reservation findReservation(UUID id);
69
70 /**
71 * Finds a group of reservations by their GroupID param in the Datacontext
72 * and returns the Reservation object or null if not found
73 * @param groupID
74 * id of the Group Reservations you are looking for
75 * @return <code>Reservation</code>reservation object <code>null</code>if no
76 * reservation found with this resource and this daterange
77 */
78 public List<Reservation> findGroupReservations(UUID groupID);
79
80 public List<Reservation> overlaps(DateRange range);
81
82 /**
83 * Adds a reservation to the Datacontext from a given Reservation object
84 * @param reservation
85 * Reservation object
86 * @throws Exception
87 */
88 public void addReservation(Reservation reservation) throws Exception;
89 }