5ccef0b9946df44edc67f620657c16f48dc5c456
[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 object or null if not found
26 *
27 * @param userName userName of the user you are looking for
28 * @return <code>User</code>user object
29 * <code>null</code>if no user found with this userName
30 */
31 public User findUser(String userName);
32
33 /**
34 * Adds a user to the Datacontext from a given User object
35 *
36 * @param user User object
37 * @throws Exception
38 */
39 public void addUser(User user) throws Exception;
40
41 /**
42 * Finds the resourceName in the Datacontext and returns the Resource object or null if not found
43 *
44 * @param resourceName resource name of the recource you are looking for
45 * @return <code>Resource</code>resource object
46 * <code>null</code>if no resource found with this recourceName
47 */
48 public Resource findResource(String resourceName);
49
50 /**
51 * Adds a resource to the Datacontext from a given Recource object
52 *
53 * @param resource Resource object
54 * @throws Exception
55 */
56 public void addResource(Resource resource) throws Exception;
57
58 /**
59 * Finds the reservation by the id param in the Datacontext and returns the Reservation object or null if not found
60 *
61 * @param id id of the Reservation you are looking for
62 *
63 * @return <code>Reservation</code>reservation object
64 * <code>null</code>if no reservation found with this resource and this daterange
65 */
66 public Reservation findReservation(UUID id);
67
68 /**
69 * Finds a group of reservations by their GroupID param in the Datacontext and returns the Reservation object or null if not found
70 *
71 * @param groupID id of the Group Reservations you are looking for
72 *
73 * @return <code>Reservation</code>reservation object
74 * <code>null</code>if no reservation found with this resource and this daterange
75 */
76 public List<Reservation> findGroupReservations(UUID groupID);
77
78
79 public List<Reservation> overlaps(DateRange range);
80
81 /**
82 * Adds a reservation to the Datacontext from a given Reservation object
83 *
84 * @param reservation Reservation object
85 * @throws Exception
86 */
87 public void addReservation(Reservation reservation)throws Exception;
88 }