DataHandler angepasst
[staff/due1/sed-hs15-srs-purple.git] / src / main / java / ch / bfh / ti / srs / datahandler / DataHandler.java
CommitLineData
7903e50e
M
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 */
8package ch.bfh.ti.srs.datahandler;
9
be594ada
M
10import java.util.HashSet;
11import java.util.List;
12import java.util.UUID;
13
7903e50e
M
14import ch.bfh.ti.daterange.DateRange;
15import ch.bfh.ti.srs.dataschema.Reservation;
16import ch.bfh.ti.srs.dataschema.Resource;
17import ch.bfh.ti.srs.dataschema.User;
18
19/**
20 * @author Michael Grossen
21 */
22public 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 /**
be594ada 59 * Finds the reservation by the id param in the Datacontext and returns the Reservation object or null if not found
7903e50e 60 *
be594ada
M
61 * @param id id of the Reservation you are looking for
62 *
7903e50e
M
63 * @return <code>Reservation</code>reservation object
64 * <code>null</code>if no reservation found with this resource and this daterange
65 */
be594ada
M
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);
7903e50e
M
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}