From 3491212fbc2557a7c3fb8588a6fad10a884947fa Mon Sep 17 00:00:00 2001 From: IvanaE Date: Tue, 30 Oct 2018 11:08:08 -0400 Subject: [PATCH] refactored user to homeowner --- OlympusServices/.idea/misc.xml | 2 +- .../uottawa/olympus/olympusservices/DBHelper.java | 2 +- .../uottawa/olympus/olympusservices/HomeOwner.java | 12 ++++++++++++ .../com/uottawa/olympus/olympusservices/SignUp.java | 8 ++++---- .../com/uottawa/olympus/olympusservices/User.java | 12 ------------ .../uottawa/olympus/olympusservices/UsersList.java | 2 +- .../olympus/olympusservices/DBIntegrationTest.java | 12 ++++++------ 7 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwner.java delete mode 100644 OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/User.java diff --git a/OlympusServices/.idea/misc.xml b/OlympusServices/.idea/misc.xml index dc34569..cc51e58 100644 --- a/OlympusServices/.idea/misc.xml +++ b/OlympusServices/.idea/misc.xml @@ -25,7 +25,7 @@ - + diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java index cd9346e..5f7d3c2 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java @@ -155,7 +155,7 @@ public class DBHelper extends SQLiteOpenHelper { .equals("ServiceProvider")){ usertype = new ServiceProvider(username, password, firstname, lastname); } else { - usertype = new User(username, password, firstname, lastname); + usertype = new HomeOwner(username, password, firstname, lastname); } } else { usertype = null; diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwner.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwner.java new file mode 100644 index 0000000..4807fa2 --- /dev/null +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwner.java @@ -0,0 +1,12 @@ +package com.uottawa.olympus.olympusservices; + + +public class HomeOwner extends UserType { + + HomeOwner(String username, String password, String firstname, String lastname){ + super(username, password, firstname, lastname); + } + + public String getRole(){ return "HomeOwner"; } + +} diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUp.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUp.java index 11d52cc..bedc52c 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUp.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUp.java @@ -15,7 +15,7 @@ public class SignUp extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_up); MaterialSpinner spinner = findViewById(R.id.RoleInput); - spinner.setItems("User", "Service Provider"); + spinner.setItems("HomeOwner", "Service Provider"); spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() { @Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) { @@ -36,14 +36,14 @@ public class SignUp extends AppCompatActivity { if(username.length()>=5 && password.length()>5 && firstname.length()>0 && lastname.length()>0 && username.matches("[a-zA-Z0-9]*") && password.matches("[a-zA-Z0-9]*") && firstname.matches("[a-zA-Z]*") && lastname.matches("[a-zA-Z]*")){ switch(spinner.getText().toString()){ - case "User": - newUser = new User(username,password,firstname,lastname); + case "HomeOwner": + newUser = new HomeOwner(username,password,firstname,lastname); break; case "Service Provider": newUser = new ServiceProvider(username,password,firstname,lastname); break; default: - newUser = new User(username,password,firstname,lastname); //if nothing is enter then defaults to user role. + newUser = new HomeOwner(username,password,firstname,lastname); //if nothing is enter then defaults to user role. break; } diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/User.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/User.java deleted file mode 100644 index 6cf1570..0000000 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/User.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.uottawa.olympus.olympusservices; - - -public class User extends UserType { - - User(String username, String password, String firstname, String lastname){ - super(username, password, firstname, lastname); - } - - public String getRole(){ return "User"; } - -} diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UsersList.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UsersList.java index e7bbff4..2a31846 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UsersList.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UsersList.java @@ -19,7 +19,7 @@ public class UsersList extends AppCompatActivity { List users = dbHelper.getAllUsers(); String[] usernames = new String[(users.size()+1)*2]; usernames[0] = "Username"; - usernames[1] = "User Type"; + usernames[1] = "HomeOwner Type"; Iterator iter = users.iterator(); for (int i=0; i allUsers = dbHelper.getAllUsers();