-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11ad2a6
commit 874f94f
Showing
37 changed files
with
247 additions
and
119 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_12_9.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_12_9.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
romane_robb_java/src/com/robb/banking/services/UserServices.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.robb.banking.daos; | ||
|
||
public class Account_infoDao { | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
src/main/java/com/robb/banking/services/Account_infoServices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.robb.banking.services; | ||
|
||
public class Account_infoServices { | ||
} |
102 changes: 102 additions & 0 deletions
102
src/main/java/com/robb/banking/services/Customer_infoServices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.robb.banking.services; | ||
import com.robb.banking.exceptions.AuthenticationException; | ||
import com.robb.banking.exceptions.InvalidRequestException; | ||
import com.robb.banking.models.Customer_info; | ||
import com.robb.banking.daos.Customer_infoDao; | ||
import com.robb.banking.exceptions.ResourcePersistanceException; | ||
import com.robb.banking.util.logging.Logger; | ||
|
||
import java.io.IOException; | ||
|
||
public class Customer_infoServices implements Serviceable<Customer_info> { | ||
|
||
private Customer_infoDao customer_infoDao; | ||
|
||
private Logger logger = Logger.getLogger(); | ||
|
||
public Customer_info[] readAll() { | ||
logger.info("Begin reading customers in our file database."); | ||
|
||
try { | ||
Customer_info[] customer_infos = Customer_infoDao.findAll(); | ||
logger.info("All customers have been found and here are the results: \n"); | ||
|
||
return customer_infos; | ||
|
||
} catch (IOException | NullPointerException e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public Customer_info readById(String id) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Customer_info update(Customer_info updateObject) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean delete(String id) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean validateInput(Customer_info object) { | ||
return false; | ||
} | ||
|
||
public boolean validateEmailNotUsed(String email) { | ||
return customer_infoDao.checkEmail(email); | ||
} | ||
|
||
public Customer_info create(Customer_info newCustomer_info) { | ||
logger.info("Customer trying to be registered: " + newCustomer_info); | ||
if (!validateInput(newCustomer_info)) { | ||
throw new InvalidRequestException("Customer input was not validated. This could be due to an empty String or null values"); | ||
} | ||
|
||
Customer_info persistedCustomer_info = customer_infoDao.create(newCustomer_info); | ||
|
||
if (persistedCustomer_info == null) { | ||
throw new ResourcePersistanceException("Customer was not persisted to the database upon registration."); | ||
} | ||
logger.info("Customer has been persisted: " + newCustomer_info); | ||
return persistedCustomer_info; | ||
} | ||
|
||
|
||
public boolean validateUserInput(Customer_info newCustomer_info) { | ||
System.out.println("Validating Customer: " + newCustomer_info); | ||
if (newCustomer_info == null) return false; | ||
if (newCustomer_info.getFirst_name() == null || newCustomer_info.getFirst_name().trim().equals("")) | ||
return false; | ||
if (newCustomer_info.getLast_name() == null || newCustomer_info.getLast_name().trim().equals("")) return false; | ||
if (newCustomer_info.getEmail_address() == null || newCustomer_info.getEmail_address().trim().equals("")) | ||
return false; | ||
if (newCustomer_info.getUserpassword() == null || newCustomer_info.getUserpassword().trim().equals("")) | ||
return false; | ||
return newCustomer_info.getDate_of_birth() != null || !newCustomer_info.getDate_of_birth().trim().equals(""); | ||
} | ||
|
||
public Customer_info authenticateCustomer_info(String email, String password) { | ||
|
||
if (password == null || password.trim().equals("") || password == null || password.trim().equals("")) { | ||
throw new InvalidRequestException("Either the username or the password is an invalid entry. Please try logging in again."); | ||
} | ||
|
||
Customer_info authenticatedCustomer_info = customer_infoDao.authenticateCustomer_info(email, password); | ||
|
||
|
||
if (authenticatedCustomer_info == null) { | ||
throw new AuthenticationException("Unauthenticated user. The information provided was not consistent with our database."); | ||
} | ||
|
||
|
||
return authenticatedCustomer_info; | ||
|
||
} | ||
} |
File renamed without changes.
1 change: 0 additions & 1 deletion
1
.../robb/banking/util/ConnectionFactory.java → .../robb/banking/util/ConnectionFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
src/main/java/com/robb/banking/web/servlets/Account_infoServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.robb.banking.web.servlets; | ||
|
||
public class Account_infoServlet { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.