Interface DataController added
authorMichael <Michael@Michael-LT.bfh.ch>
Tue, 27 Oct 2015 12:16:53 +0000 (13:16 +0100)
committerMichael <Michael@Michael-LT.bfh.ch>
Tue, 27 Oct 2015 12:16:53 +0000 (13:16 +0100)
ExcelController added
UserController added

src/main/java/ch/bfh/ti/srs/core/DataController.java [copied from src/main/java/ch/bfh/ti/srs/core/package-info.java with 70% similarity]
src/main/java/ch/bfh/ti/srs/core/ExcelController.java [new file with mode: 0644]
src/main/java/ch/bfh/ti/srs/core/User.java
src/main/java/ch/bfh/ti/srs/core/UserController.java [new file with mode: 0644]
src/main/java/ch/bfh/ti/srs/extern/package-info.java [copied from src/main/java/ch/bfh/ti/srs/core/package-info.java with 83% similarity]

@@ -1,8 +1,12 @@
-/*
- * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
- *
- * Project Smart Reservation System.
- *
- * Distributable under GPL license. See terms of license at gnu.org.
- */
-package ch.bfh.ti.srs.core;
+/*\r
+ * Copyright (c) 2015 Berner Fachhochschule, Switzerland.\r
+ *\r
+ * Project Smart Reservation System.\r
+ *\r
+ * Distributable under GPL license. See terms of license at gnu.org.\r
+ */\r
+package ch.bfh.ti.srs.core;\r
+\r
+public interface DataController {\r
+       public User findUser(String Name);\r
+}\r
diff --git a/src/main/java/ch/bfh/ti/srs/core/ExcelController.java b/src/main/java/ch/bfh/ti/srs/core/ExcelController.java
new file mode 100644 (file)
index 0000000..dfe2fee
--- /dev/null
@@ -0,0 +1,16 @@
+package ch.bfh.ti.srs.core;\r
+\r
+public class ExcelController implements DataController{\r
+       String filePath;\r
+       \r
+       public ExcelController(String filePath){\r
+               this.filePath = filePath;\r
+       }\r
+       \r
+       @Override\r
+       public User findUser(String Name) {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+}\r
index 0c438c2..444ef15 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
+ *
+ * Project Smart Reservation System.
+ *
+ * Distributable under GPL license. See terms of license at gnu.org.
+ */
 package ch.bfh.ti.srs.core;
 
 import ch.bfh.ti.srs.extern.Password;
diff --git a/src/main/java/ch/bfh/ti/srs/core/UserController.java b/src/main/java/ch/bfh/ti/srs/core/UserController.java
new file mode 100644 (file)
index 0000000..8b542eb
--- /dev/null
@@ -0,0 +1,29 @@
+/*\r
+ * Copyright (c) 2015 Berner Fachhochschule, Switzerland.\r
+ *\r
+ * Project Smart Reservation System.\r
+ *\r
+ * Distributable under GPL license. See terms of license at gnu.org.\r
+ */\r
+package ch.bfh.ti.srs.core;\r
+\r
+public class UserController {\r
+       User LoggedUser;\r
+       DataController dc;\r
+       \r
+       public UserController() {\r
+               dc = new ExcelController("test.xls");\r
+       }\r
+       \r
+       public boolean logIn(String userName, String password) throws Exception{\r
+               User tempUser = dc.findUser(userName);\r
+               if(tempUser == null) return false;\r
+               if(tempUser.checkPassword(password)){\r
+                       LoggedUser = tempUser;\r
+                       return true;\r
+               }\r
+               else return false;\r
+       }\r
+       \r
+       \r
+}\r
@@ -1,8 +1,8 @@
-/*
- * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
- *
- * Project Smart Reservation System.
- *
- * Distributable under GPL license. See terms of license at gnu.org.
- */
-package ch.bfh.ti.srs.core;
+/*\r
+ * Copyright (c) 2015 Berner Fachhochschule, Switzerland.\r
+ *\r
+ * Project Smart Reservation System.\r
+ *\r
+ * Distributable under GPL license. See terms of license at gnu.org.\r
+ */\r
+package ch.bfh.ti.srs.extern;
\ No newline at end of file