Merge branch 'development' of git@git.bfh.ch:/staff/due1/sed-hs15-srs-purple.git...
[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
10import ch.bfh.ti.daterange.DateRange;
11import ch.bfh.ti.srs.dataschema.Reservation;
12import ch.bfh.ti.srs.dataschema.Resource;
13import ch.bfh.ti.srs.dataschema.User;
14
15/**
16 * @author Michael Grossen
17 */
18public interface DataHandler {
19
20 /**
21 * Finds the user by userName param in the Datacontext and returns the User object or null if not found
22 *
23 * @param userName userName of the user you are looking for
24 * @return <code>User</code>user object
25 * <code>null</code>if no user found with this userName
26 */
27 public User findUser(String userName);
28
29 /**
30 * Adds a user to the Datacontext from a given User object
31 *
32 * @param user User object
33 * @throws Exception
34 */
35 public void addUser(User user) throws Exception;
36
37 /**
38 * Finds the resourceName in the Datacontext and returns the Resource object or null if not found
39 *
40 * @param resourceName resource name of the recource you are looking for
41 * @return <code>Resource</code>resource object
42 * <code>null</code>if no resource found with this recourceName
43 */
44 public Resource findResource(String resourceName);
45
46 /**
47 * Adds a resource to the Datacontext from a given Recource object
48 *
49 * @param resource Resource object
50 * @throws Exception
51 */
52 public void addResource(Resource resource) throws Exception;
53
54 /**
55 * Finds the reservation by resource and daterange param in the Datacontext and returns the Reservation object or null if not found
56 *
57 * @param resource resource of the Reservation you are looking for
58 * daterange daterange of the Reservation you are looking for
59 * @return <code>Reservation</code>reservation object
60 * <code>null</code>if no reservation found with this resource and this daterange
61 */
62 public Reservation findReservation(Resource resource, DateRange daterange);
63
64 /**
65 * Adds a reservation to the Datacontext from a given Reservation object
66 *
67 * @param reservation Reservation object
68 * @throws Exception
69 */
70 public void addReservation(Reservation reservation)throws Exception;
71}