DataHandler updated
[staff/due1/sed-hs15-srs-purple.git] / src / main / java / ch / bfh / ti / srs / controller / ResourceManagerController.java
CommitLineData
5fca88b4
MT
1/*\r
2 * Copyright (c) 2015 Berner Fachhochschule, Switzerland.\r
3 *\r
4 * Project Smart Reservation System.\r
5 *\r
6 * Distributable under GPL license. See terms of license at gnu.org.\r
7 */\r
8package ch.bfh.ti.srs.controller;\r
9\r
10import ch.bfh.ti.srs.datahandler.DataHandler;\r
11import ch.bfh.ti.srs.dataschema.Resource;\r
12\r
13\r
14public class ResourceManagerController extends Controller {\r
15\r
16 public ResourceManagerController(DataHandler dh, SessionController sc) {\r
17 super(dh, sc);\r
18 }\r
19 \r
20 public boolean addResource(Resource resource) throws Exception {\r
21 if (dh == null)\r
22 throw new Exception("No DataHandler set");\r
23 if (resource == null)\r
24 throw new IllegalArgumentException("Resource must be defined");\r
25 return dh.addResource(resource);\r
26 }\r
27 \r
28 public boolean changeResource(Resource resource) throws Exception{\r
29 if (dh == null)\r
30 throw new Exception("No DataHandler set");\r
31 if (resource == null)\r
32 throw new IllegalArgumentException("Resource must be defined");\r
33 return dh.editResource(resource);\r
34 }\r
35 \r
36 public boolean deleteResource(Resource resource) throws Exception {\r
37 if (dh == null)\r
38 throw new Exception("No DataHandler set");\r
39 if (resource == null)\r
40 throw new IllegalArgumentException("Resource must be defined");\r
41 return dh.deleteResource(resource);\r
42 }\r
43}\r