From 7b2094d63afc7e055663b725935f3370743e9577 Mon Sep 17 00:00:00 2001 From: Nirmala Sundarappa Date: Thu, 13 Apr 2017 00:55:03 -0700 Subject: [PATCH 01/38] Creating HRWebApp --- java/HRWebApp/src/._.DS_Store | Bin 0 -> 210 bytes java/HRWebApp/src/._conf | Bin 0 -> 210 bytes java/HRWebApp/src/._main | Bin 0 -> 210 bytes java/HRWebApp/src/conf/._MANIFEST.MF | Bin 0 -> 210 bytes java/HRWebApp/src/conf/MANIFEST.MF | 2 + java/HRWebApp/src/main/._.DS_Store | Bin 0 -> 210 bytes java/HRWebApp/src/main/._java | Bin 0 -> 210 bytes java/HRWebApp/src/main/._resources | Bin 0 -> 210 bytes java/HRWebApp/src/main/._webapp | Bin 0 -> 210 bytes java/HRWebApp/src/main/java/._com | Bin 0 -> 210 bytes java/HRWebApp/src/main/java/com/._oracle | Bin 0 -> 210 bytes java/HRWebApp/src/main/java/com/oracle/._jdbc | Bin 0 -> 210 bytes .../src/main/java/com/oracle/jdbc/._samples | Bin 0 -> 210 bytes .../main/java/com/oracle/jdbc/samples/._bean | Bin 0 -> 210 bytes .../java/com/oracle/jdbc/samples/._entity | Bin 0 -> 210 bytes .../main/java/com/oracle/jdbc/samples/._web | Bin 0 -> 210 bytes .../oracle/jdbc/samples/bean/JdbcBean.java | 50 +++++ .../jdbc/samples/bean/JdbcBeanImpl.java | 128 +++++++++++ .../jdbc/samples/entity/._Employee.java | Bin 0 -> 210 bytes .../oracle/jdbc/samples/entity/Employee.java | 93 ++++++++ .../com/oracle/jdbc/samples/web/GetRole.java | 69 ++++++ .../jdbc/samples/web/WebController.java | 189 ++++++++++++++++ .../src/main/resources/SalaryHikeSP.java | 211 ++++++++++++++++++ .../src/main/resources/SalaryHikeSP.sql | 70 ++++++ java/HRWebApp/src/main/webapp/._WEB-INF | Bin 0 -> 210 bytes java/HRWebApp/src/main/webapp/._about.html | Bin 0 -> 210 bytes java/HRWebApp/src/main/webapp/._css | Bin 0 -> 210 bytes java/HRWebApp/src/main/webapp/._listAll.html | Bin 0 -> 210 bytes java/HRWebApp/src/main/webapp/._listById.html | Bin 0 -> 210 bytes .../src/main/webapp/._listByName.html | Bin 0 -> 210 bytes java/HRWebApp/src/main/webapp/WEB-INF/web.xml | 52 +++++ java/HRWebApp/src/main/webapp/about.html | 42 ++++ java/HRWebApp/src/main/webapp/css/._app.css | Bin 0 -> 210 bytes java/HRWebApp/src/main/webapp/css/app.css | 67 ++++++ .../src/main/webapp/incrementSalary.html | 70 ++++++ java/HRWebApp/src/main/webapp/index.html | 110 +++++++++ java/HRWebApp/src/main/webapp/listAll.html | 51 +++++ java/HRWebApp/src/main/webapp/listById.html | 133 +++++++++++ java/HRWebApp/src/main/webapp/listByName.html | 191 ++++++++++++++++ .../src/main/webapp/login-failed.html | 12 + java/HRWebApp/src/main/webapp/login.html | 42 ++++ 41 files changed, 1582 insertions(+) create mode 100644 java/HRWebApp/src/._.DS_Store create mode 100755 java/HRWebApp/src/._conf create mode 100755 java/HRWebApp/src/._main create mode 100644 java/HRWebApp/src/conf/._MANIFEST.MF create mode 100644 java/HRWebApp/src/conf/MANIFEST.MF create mode 100644 java/HRWebApp/src/main/._.DS_Store create mode 100755 java/HRWebApp/src/main/._java create mode 100755 java/HRWebApp/src/main/._resources create mode 100755 java/HRWebApp/src/main/._webapp create mode 100755 java/HRWebApp/src/main/java/._com create mode 100755 java/HRWebApp/src/main/java/com/._oracle create mode 100755 java/HRWebApp/src/main/java/com/oracle/._jdbc create mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/._samples create mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._bean create mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._entity create mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._web create mode 100644 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBean.java create mode 100644 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBeanImpl.java create mode 100644 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/._Employee.java create mode 100644 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/Employee.java create mode 100644 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/GetRole.java create mode 100644 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/WebController.java create mode 100755 java/HRWebApp/src/main/resources/SalaryHikeSP.java create mode 100755 java/HRWebApp/src/main/resources/SalaryHikeSP.sql create mode 100755 java/HRWebApp/src/main/webapp/._WEB-INF create mode 100644 java/HRWebApp/src/main/webapp/._about.html create mode 100755 java/HRWebApp/src/main/webapp/._css create mode 100644 java/HRWebApp/src/main/webapp/._listAll.html create mode 100644 java/HRWebApp/src/main/webapp/._listById.html create mode 100644 java/HRWebApp/src/main/webapp/._listByName.html create mode 100644 java/HRWebApp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/HRWebApp/src/main/webapp/about.html create mode 100644 java/HRWebApp/src/main/webapp/css/._app.css create mode 100644 java/HRWebApp/src/main/webapp/css/app.css create mode 100644 java/HRWebApp/src/main/webapp/incrementSalary.html create mode 100644 java/HRWebApp/src/main/webapp/index.html create mode 100644 java/HRWebApp/src/main/webapp/listAll.html create mode 100644 java/HRWebApp/src/main/webapp/listById.html create mode 100644 java/HRWebApp/src/main/webapp/listByName.html create mode 100644 java/HRWebApp/src/main/webapp/login-failed.html create mode 100644 java/HRWebApp/src/main/webapp/login.html diff --git a/java/HRWebApp/src/._.DS_Store b/java/HRWebApp/src/._.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..21cdd54c6c42d641e60cf72a0b7e9e734a0d8f22 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}16+jwh=&b0hJ*w`#X&k| z0I?OCI!1)JXmWn8USdH(PO4sEX<|`gUP)$NDnp^Zfq{XswW+yfYN~~?xwUU%W{$Os orK_o#o3W9ulbMN&u8D=EnXZMKrHihsxwE;Eo3pv4p}8po0Mw)(l>h($ literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/._conf b/java/HRWebApp/src/._conf new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/._main b/java/HRWebApp/src/._main new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/conf/._MANIFEST.MF b/java/HRWebApp/src/conf/._MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/conf/MANIFEST.MF b/java/HRWebApp/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/java/HRWebApp/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/java/HRWebApp/src/main/._.DS_Store b/java/HRWebApp/src/main/._.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..21cdd54c6c42d641e60cf72a0b7e9e734a0d8f22 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}16+jwh=&b0hJ*w`#X&k| z0I?OCI!1)JXmWn8USdH(PO4sEX<|`gUP)$NDnp^Zfq{XswW+yfYN~~?xwUU%W{$Os orK_o#o3W9ulbMN&u8D=EnXZMKrHihsxwE;Eo3pv4p}8po0Mw)(l>h($ literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/._java b/java/HRWebApp/src/main/._java new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/._resources b/java/HRWebApp/src/main/._resources new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/._webapp b/java/HRWebApp/src/main/._webapp new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/._com b/java/HRWebApp/src/main/java/._com new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/._oracle b/java/HRWebApp/src/main/java/com/._oracle new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/oracle/._jdbc b/java/HRWebApp/src/main/java/com/oracle/._jdbc new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/._samples b/java/HRWebApp/src/main/java/com/oracle/jdbc/._samples new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._bean b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._bean new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._entity b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._entity new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._web b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._web new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBean.java b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBean.java new file mode 100644 index 00000000..2dbd4af2 --- /dev/null +++ b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBean.java @@ -0,0 +1,50 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.oracle.jdbc.samples.bean; + +import java.util.List; +import com.oracle.jdbc.samples.entity.Employee; + +/** + * + * @author nirmala.sundarappa@oracle.com + */ +public interface JdbcBean { + /** + * Get a list of Employees + * @return List of employees + */ + public List getEmployees(); + + /** + * Get List of employee based on empId. This will always return one row + * but returning a List to be make signatures consistent. + * @param empId + * @return + */ + public List getEmployee(int empId); + + /** + * Update employee based on employee-id. Returns the updated record. + * @param empId + * @return updated record. + */ + public Employee updateEmployee(int empId); + + /** + * Get List of employees by First Name pattern + * @param fn + * @return List of employees with given beginning pattern + */ + public List getEmployeeByFn(String fn); + + /** + * Increment salary by a percentage + * @param incrementPct percent increase + * @return List of employees with incremented salary + */ + public List incrementSalary(int incrementPct); +} diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBeanImpl.java b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBeanImpl.java new file mode 100644 index 00000000..d7c3be77 --- /dev/null +++ b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/bean/JdbcBeanImpl.java @@ -0,0 +1,128 @@ +package com.oracle.jdbc.samples.bean; + +import java.sql.*; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import com.oracle.jdbc.samples.entity.Employee; +import oracle.jdbc.OracleTypes; + + +import java.sql.PreparedStatement; +import oracle.jdbc.OracleStatement; +import oracle.jdbc.OracleConnection; + +import oracle.jdbc.driver.OracleDriver; + +/** + * + * @author nirmala.sundarappa@oracle.com + */ +public class JdbcBeanImpl implements JdbcBean { + + public static Connection getConnection() throws SQLException { + DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); + Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@//myorclhost:1521/myorcldbservice", "hr", "hr"); + + return connection; + } + + @Override + public List getEmployees() { + List returnValue = new ArrayList<>(); + try (Connection connection = getConnection()) { + try (Statement statement = connection.createStatement()) { + try (ResultSet resultSet = statement.executeQuery("SELECT Employee_Id, First_Name, Last_Name, Email, Phone_Number, Job_Id, Salary FROM EMPLOYEES")) { + while(resultSet.next()) { + returnValue.add(new Employee(resultSet)); + } + } + } + } catch (SQLException ex) { + logger.log(Level.SEVERE, null, ex); + ex.printStackTrace(); + } + + return returnValue; + } + + /** + * Returns the employee object for the given empId. Returns + * @param empId + * @return + */ + @Override + public List getEmployee(int empId) { + List returnValue = new ArrayList<>(); + + try (Connection connection = getConnection()) { + try (PreparedStatement preparedStatement = connection.prepareStatement( + "SELECT Employee_Id, First_Name, Last_Name, Email, Phone_Number, Job_Id, Salary FROM EMPLOYEES WHERE Employee_Id = ?")) { + preparedStatement.setInt(1, empId); + try (ResultSet resultSet = preparedStatement.executeQuery()) { + if(resultSet.next()) { + returnValue.add(new Employee(resultSet)); + } + } + } + } catch (SQLException ex) { + logger.log(Level.SEVERE, null, ex); + ex.printStackTrace(); + } + + return returnValue; + } + + @Override + public Employee updateEmployee(int empId) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public List getEmployeeByFn(String fn) { + List returnValue = new ArrayList<>(); + + try (Connection connection = getConnection()) { + try (PreparedStatement preparedStatement = connection.prepareStatement( + "SELECT Employee_Id, First_Name, Last_Name, Email, Phone_Number, Job_Id, Salary FROM EMPLOYEES WHERE First_Name LIKE ?")) { + preparedStatement.setString(1, fn + '%'); + try (ResultSet resultSet = preparedStatement.executeQuery()) { + while(resultSet.next()) { + returnValue.add(new Employee(resultSet)); + } + } + } + } catch (SQLException ex) { + logger.log(Level.SEVERE, null, ex); + ex.printStackTrace(); + } + + return returnValue; + } + + @Override + public List incrementSalary (int incrementPct) { + List returnValue = new ArrayList<>(); + + try (Connection connection = getConnection()) { + try (CallableStatement callableStatement = connection.prepareCall("begin ? := refcur_pkg.incrementsalary(?); end;")) { + callableStatement.registerOutParameter(1, OracleTypes.CURSOR); + callableStatement.setInt(2, incrementPct); + callableStatement.execute(); + try (ResultSet resultSet = (ResultSet) callableStatement.getObject(1)) { + while (resultSet.next()) { + returnValue.add(new Employee(resultSet)); + } + } + } + } catch (SQLException ex) { + logger.log(Level.SEVERE, null, ex); + ex.printStackTrace(); + } + + return returnValue; + } + + static final Logger logger = Logger.getLogger("com.oracle.jdbc.samples.bean.JdbcBeanImpl"); +} diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/._Employee.java b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/._Employee.java new file mode 100644 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/Employee.java b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/Employee.java new file mode 100644 index 00000000..170a7b91 --- /dev/null +++ b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/Employee.java @@ -0,0 +1,93 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.oracle.jdbc.samples.entity; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; + +/** + * + * @author nirmala.sundarappa@oracle.com + */ +public class Employee { + + private int Employee_Id; + private String First_Name; + private String Last_Name; + private String Email; + private String Phone_Number; + private String Job_Id; + private int Salary; + + public Employee(ResultSet resultSet) throws SQLException { + this.Employee_Id = resultSet.getInt(1); + this.First_Name = resultSet.getString(2); + this.Last_Name = resultSet.getString(3); + this.Email = resultSet.getString(4); + this.Phone_Number = resultSet.getString(5); + this.Job_Id = resultSet.getString(6); + this.Salary = resultSet.getInt(7); + } + + public int getEmployee_Id() { + return Employee_Id; + } + + public void setEmployee_Id(int Employee_Id) { + this.Employee_Id = Employee_Id; + } + + public String getFirst_Name() { + return First_Name; + } + + public void setFirst_Name(String First_Name) { + this.First_Name = First_Name; + } + + public String getLast_Name() { + return Last_Name; + } + + public void setLast_Name(String Last_Name) { + this.Last_Name = Last_Name; + } + + public String getEmail() { + return Email; + } + + public void setEmail(String Email) { + this.Email = Email; + } + + public String getPhone_Number() { + return Phone_Number; + } + + public void setPhone_Number(String Phone_Number) { + this.Phone_Number = Phone_Number; + } + + public String getJob_Id() { + return Job_Id; + } + + public void setJob_Id(String Job_Id) { + this.Job_Id = Job_Id; + } + + public int getSalary() { + return Salary; + } + + public void setSalary(int Salary) { + this.Salary = Salary; + } + + +} diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/GetRole.java b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/GetRole.java new file mode 100644 index 00000000..289a1792 --- /dev/null +++ b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/GetRole.java @@ -0,0 +1,69 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.oracle.jdbc.samples.web; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * + * @author nirmala.sundarappa@oracle.com + */ +@WebServlet(name = "GetRole", urlPatterns = {"/getrole"}) +/* +@ServletSecurity( + httpMethodConstraints = { + @HttpMethodConstraint(value = "GET", rolesAllowed = "staff"), + @HttpMethodConstraint(value = "GET", rolesAllowed = "manager"), + @HttpMethodConstraint(value = "POST", rolesAllowed = "manager", + transportGuarantee = NONE), + } +) +*/ +public class GetRole extends HttpServlet { + + private static final String[] ROLES = {"manager", "staff" }; + + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + response.setContentType("text/css"); + String returnValue = "anonymous"; + for (String role : ROLES) { + if(request.isUserInRole(role)) { + returnValue = role; + break; + } + } + + response.getWriter().print(returnValue); + } + + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "JdbcWebServlet: Reading Employees table using JDBC and transforming it as a JSON.\n Author: nirmala.sundarapp@oracle.com"; + }// + +} diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/WebController.java b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/WebController.java new file mode 100644 index 00000000..447cd723 --- /dev/null +++ b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/web/WebController.java @@ -0,0 +1,189 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.oracle.jdbc.samples.web; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.oracle.jdbc.samples.bean.JdbcBean; +import com.oracle.jdbc.samples.bean.JdbcBeanImpl; +import com.oracle.jdbc.samples.entity.Employee; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.*; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + + +/** + * + * @author nirmala.sundarappa@oracle.com + */ +@WebServlet(name = "WebController", urlPatterns = {"/WebController"}) +/* +@ServletSecurity( + httpMethodConstraints = { + @HttpMethodConstraint(value = "GET", rolesAllowed = "staff"), + @HttpMethodConstraint(value = "GET", rolesAllowed = "manager"), + @HttpMethodConstraint(value = "POST", rolesAllowed = "manager", + transportGuarantee = NONE), + } +) +*/ +public class WebController extends HttpServlet { + + private static final String INCREMENT_PCT = "incrementPct" ; + private static final String ID_KEY = "id"; + private static final String FN_KEY = "firstName"; + private static final String LOGOUT = "logout"; + + JdbcBean jdbcBean = new JdbcBeanImpl(); + + private void reportError(HttpServletResponse response, String message) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet WebController"); + out.println(""); + out.println(""); + out.println("

" + message + "

"); + out.println(""); + out.println(""); + } + } + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + Gson gson = new Gson(); + + String value = null; + List employeeList = null; + if ((value = request.getParameter(ID_KEY)) != null) { + int empId = Integer.valueOf(value).intValue(); + employeeList = jdbcBean.getEmployee(empId); + } + else if ((value = request.getParameter(FN_KEY)) != null) { + employeeList = jdbcBean.getEmployeeByFn(value); + } + else if ((value = request.getParameter(LOGOUT)) != null) { + // faking logoff + // response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + // return; + /* Getting session and then invalidating it */ + + HttpSession session = request.getSession(false); + if (request.isRequestedSessionIdValid() && session != null) { + session.invalidate(); + } + handleLogOutResponse(request,response); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + } + else { + employeeList = jdbcBean.getEmployees(); + } + + if(employeeList != null) { + response.setContentType("application/json"); + gson.toJson(employeeList, + new TypeToken>() { + }.getType(), + response.getWriter()); + } + else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } + + } + + + /** + * This method would edit the cookie information and make JSESSIONID empty + * while responding to logout. This would further help in order to. This would help + * to avoid same cookie ID each time a person logs in. + * @param response + * @param request + */ + private void handleLogOutResponse(HttpServletRequest request, HttpServletResponse response) { + Cookie[] cookies = request.getCookies(); + for (Cookie cookie : cookies) { + cookie.setMaxAge(0); + cookie.setValue(null); + cookie.setPath("/"); + response.addCookie(cookie); + + } + + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + Map x = request.getParameterMap(); + String value = null; + if ((value = request.getParameter(INCREMENT_PCT)) != null) { + Gson gson = new Gson(); + response.setContentType("application/json"); + List employeeList = jdbcBean.incrementSalary(Integer.valueOf(value)); + gson.toJson(employeeList, + new TypeToken>() { + }.getType(), + response.getWriter()); + } + else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "JdbcWebServlet: Reading Employees table using JDBC and transforming it as a JSON.\n Author: nirmala.sundarapp@oracle.com"; + }// + +} diff --git a/java/HRWebApp/src/main/resources/SalaryHikeSP.java b/java/HRWebApp/src/main/resources/SalaryHikeSP.java new file mode 100755 index 00000000..973ff719 --- /dev/null +++ b/java/HRWebApp/src/main/resources/SalaryHikeSP.java @@ -0,0 +1,211 @@ +/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.*/ +/* + DESCRIPTION + The server-side Type 2 (T2S) driver (aka KPRB driver) is for Java in the + database. Java running in the database session uses the KPRB driver or + T2S driver to access data, locally. + We furnish the server-side thin JDBC (aka Type 4 server driver) for + accessing data in other session in the same database or a remote Oracle + database. + + Step 1: Connect to SQLPLUS using the database USER/PASSWORD. + Make sure to have SalaryHikeSP.sql accessible on the + client side to execute. + Step 2: Run the SQL file after connecting to DB "@SalaryHikeSP.sql" + + NOTES + Use JDK 1.6 and above + + MODIFIED (MM/DD/YY) + nbsundar 03/23/15 - Creation (kmensah - Contributor) + */ +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.PreparedStatement; +import oracle.jdbc.OracleStatement; +import oracle.jdbc.OracleConnection; + +import oracle.jdbc.driver.OracleDriver; +import oracle.jdbc.pool.OracleDataSource; + + +public class SalaryHikeSP { + /* + * Increment the Salary + */ + public static ResultSet incrementSalary (int percentIncrease) throws SQLException { + int updateCount = 0; + int totalemployees = 0; + int tier3emp = 0; + int tier2emp = 0; + int tier1emp = 0; + float totalsalary = 0.0f; + float minsalary = 0.0f; + float maxsalary = 0.0f; + float totalbudget = 0.0f; + float tier3hike = 0.0f; + float tier2hike = 0.0f; + float tier1hike = 0.0f; + + + // Percentage to divide the salary hike budget into + // three tiers based on the salary range + // Tier 1 salary range is 15,001 to 25,000 + float tier1percent = 0.10f; + // Tier 2 salary range is 7,001 to 15,000 + float tier2percent = 0.30f; + // Tier 3 salary range is 0 to 7,000 + float tier3percent = 0.60f; + + Connection connection = null; + ResultSet resultSet = null; + Statement statement = null; + PreparedStatement preparedStatement; + ResultSet rset = null; + + System.out.println("==== Here ===== "); + String TOTAL_EMP = "SELECT count(EMPLOYEE_ID) from EMPLOYEES"; + String TOTAL_SALARY = "SELECT sum(salary) from EMPLOYEES"; + String MIN_SALARY = "SELECT min(salary) from EMPLOYEES"; + String MAX_SALARY = "SELECT max(salary) from EMPLOYEES"; + String UPDATE_SQL = + "UPDATE EMPLOYEES SET SALARY = 20000 WHERE EMPLOYEE_ID=100"; + String TIER3_EMP = "SELECT COUNT(EMPLOYEE_ID) from EMPLOYEES WHERE " + + "salary >= ? and salary < 7000.00"; + String TIER2_EMP = "SELECT count(EMPLOYEE_ID) from EMPLOYEES " + + " WHERE SALARY > 7001.00 and SALARY < 15000.00"; + String TIER1_EMP ="SELECT count(EMPLOYEE_ID) from EMPLOYEES " + + " WHERE SALARY >15001.00 AND SALARY < ?"; + + String TIER3_UPDATE ="UPDATE EMPLOYEES SET SALARY = (SALARY + ?)" + + " WHERE salary > ? " + + " and salary < 7000.00"; + String TIER2_UPDATE = "UPDATE EMPLOYEES SET SALARY = (SALARY + ? )" + + " WHERE SALARY > 7001.00 and SALARY < 15000.00 "; + String TIER1_UPDATE = "UPDATE EMPLOYEES SET SALARY = (SALARY + ?)" + + " WHERE SALARY > 15001.00 and SALARY < ? "; + if (percentIncrease <= 0) { + throw new + IllegalArgumentException("Invalid percentage provided: " +percentIncrease); + } + try { + connection = new OracleDriver().defaultConnection(); + // Get the total number of employees + statement = connection.createStatement(); + resultSet = statement.executeQuery(TOTAL_EMP); + while (resultSet.next()) { + totalemployees = resultSet.getInt(1); + System.out.println("Number of employees" + totalemployees); + } + // Get the total salary of all employees + resultSet = statement.executeQuery(TOTAL_SALARY); + while (resultSet.next()) { + totalsalary = resultSet.getFloat(1); + System.out.println("Total salary of all employees: " + totalsalary); + } + // Get the minimum salary of all employees + resultSet = statement.executeQuery(MIN_SALARY); + while (resultSet.next()) { + minsalary = resultSet.getFloat(1); + System.out.println("Minimum salary of all employees: " + minsalary); + } + // Get the maximum salary of all employees + resultSet = statement.executeQuery(MAX_SALARY); + while (resultSet.next()) { + maxsalary = resultSet.getFloat(1); + System.out.println("Maximum salary of all employees: " + maxsalary); + } + // Get the budget for the salary rise + totalbudget = (totalsalary * percentIncrease )/100; + System.out.println("Total budget for the rise: " + totalbudget); + + // Get the salary increase for the tier3 employees + // 60% of the total budget is for tier3 employees + preparedStatement = connection.prepareStatement(TIER3_EMP); + preparedStatement.setFloat(1,minsalary); + resultSet = preparedStatement.executeQuery(); + + while (resultSet.next()) { + tier3emp = resultSet.getInt(1); + if ( tier3emp != 0 ) { + tier3hike = (float) Math.ceil(((totalbudget * tier3percent)/tier3emp)); + } + System.out.println("Number of tier3 employees: " + tier3emp); + System.out.println("Hike for tier3 employees: " + tier3hike); + } + + // Get the salary increase for the tier2 employees + // 30% of the total budget is for tier2 employees + statement = connection.createStatement(); + resultSet = statement.executeQuery(TIER2_EMP); + while (resultSet.next()) { + tier2emp = resultSet.getInt(1); + if ( tier2emp != 0 ) { + tier2hike = (float) Math.ceil(((totalbudget * tier2percent)/tier2emp)); + } + System.out.println("Number of tier2 employees: " + tier2emp); + System.out.println("Hike for tier2 employees: " + tier2hike); + } + + // Get the salary increase for the tier1 employees + // 10% of the total budget is for tier1 employees + preparedStatement = connection.prepareStatement(TIER1_EMP); + preparedStatement.setFloat(1,maxsalary); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + tier1emp = resultSet.getInt(1); + if ( tier1emp != 0 ) { + tier1hike = (float) Math.ceil(((totalbudget * tier1percent)/tier1emp)); + } + System.out.println("Number of tier1 employees: " + tier1emp); + System.out.println("Hike for tier1 employees: " + tier1hike); + } + + // Give a salary hike to tier3 employees + + preparedStatement = connection.prepareStatement(TIER3_UPDATE); + preparedStatement.setFloat(1, tier3hike); + preparedStatement.setFloat(2,minsalary); + preparedStatement.executeUpdate(); + + // Give a salary hike to tier2 employees + preparedStatement = connection.prepareStatement(TIER2_UPDATE); + preparedStatement.setFloat(1, tier2hike); + updateCount = preparedStatement.executeUpdate(); + + // Give a salary hike to tier1 employees + preparedStatement = connection.prepareStatement(TIER1_UPDATE); + preparedStatement.setFloat(1, tier1hike); + preparedStatement.setFloat(2,maxsalary); + preparedStatement.executeUpdate(); + + // Verifying if the update was successful. + // Get the salary of all employees using a ref cursor and print it. + ((OracleConnection)connection).setCreateStatementAsRefCursor(true); + Statement stmt = connection.createStatement(); + ((OracleStatement)stmt).setRowPrefetch(1); + rset = stmt.executeQuery("SELECT Employee_Id, First_Name, Last_Name, Email, Phone_Number, Job_Id, Salary FROM EMPLOYEES"); + // fetch one row + if (rset.next()) { + System.out.println("Ename = " + rset.getObject("FIRST_NAME") + + "-- Salary = " + rset.getObject("salary")); + } + + // Verifying if the update was successful. + // Get the total salary of all employees after the salary increase + resultSet = statement.executeQuery(TOTAL_SALARY); + while (resultSet.next()) { + totalsalary = resultSet.getFloat(1); + System.out.println("Total salary of all employees after the"+ + " salary increase: " + totalsalary); + } + } catch (Exception e) { + e.printStackTrace(); + } + return rset; + } +} + + diff --git a/java/HRWebApp/src/main/resources/SalaryHikeSP.sql b/java/HRWebApp/src/main/resources/SalaryHikeSP.sql new file mode 100755 index 00000000..84ce2b11 --- /dev/null +++ b/java/HRWebApp/src/main/resources/SalaryHikeSP.sql @@ -0,0 +1,70 @@ +Rem SalaryHikeSP.sql +Rem +Rem Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +Rem +Rem NAME +Rem SalaryHikeSP.sql +Rem +Rem DESCRIPTION +Rem SQL for invoking the method which gets a server side connection to +Rem internal T2 Driver +Rem +Rem MODIFIED (MM/DD/YY) +Rem nbsundar 03/23/15 - Created +Rem kmensah 03/23/15 - Contributor + +REM Reads the content of the Java source from SalaryHikeSP.java +REM then compiles it +connect hr/hr + +CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED SalaryHikeSP_src AS +@SalaryHikeSP.java +/ + +REM Check for errors +show error + +REM Create a PL/SQL wrapper +create or replace package refcur_pkg as + TYPE EmpCurTyp IS REF CURSOR; + function incrementsalary(percent IN NUMBER) return EmpCurTyp; +end refcur_pkg; +/ +show errors; + +create or replace package body refcur_pkg as +function incrementsalary(percent IN NUMBER) return EmpCurTyp + as language java + name 'SalaryHikeSP.incrementSalary(int) returns java.sql.ResultSet'; + +end refcur_pkg; +/ + +show error + +/ + +-- Running the sample +--- connect hr/hr +--- set serveroutput on +--- call dbms_java.set_output(50000); + +---declare + ---type EmpCur IS REF CURSOR; + ---rc EmpCur; + --employee employees%ROWTYPE; +--begin + --rc := refcur_pkg.incrementsalary(5); + --LOOP + --fetch rc into employee; + --exit when rc%notfound; + --dbms_output.put_line(' Name = ' || employee.FIRST_NAME || ' Salary = ' || employee.SALARY); + --end loop; +--close rc; +--end; +--/ +--show error; +--/ + + + diff --git a/java/HRWebApp/src/main/webapp/._WEB-INF b/java/HRWebApp/src/main/webapp/._WEB-INF new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/webapp/._about.html b/java/HRWebApp/src/main/webapp/._about.html new file mode 100644 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/webapp/._css b/java/HRWebApp/src/main/webapp/._css new file mode 100755 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/webapp/._listAll.html b/java/HRWebApp/src/main/webapp/._listAll.html new file mode 100644 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/webapp/._listById.html b/java/HRWebApp/src/main/webapp/._listById.html new file mode 100644 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/webapp/._listByName.html b/java/HRWebApp/src/main/webapp/._listByName.html new file mode 100644 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/webapp/WEB-INF/web.xml b/java/HRWebApp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..87670ca7 --- /dev/null +++ b/java/HRWebApp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,52 @@ + + + + Jdbc Web Sample + + + manager + + + staff + + + + + Wildcard means whole app requires authentication + /* + GET + POST + + + manager + + + NONE + + + + + + Wildcard means whole app requires authentication + /* + GET + + + staff + + + + NONE + + + + + FORM + + /login.html + /login-failed.html + + + diff --git a/java/HRWebApp/src/main/webapp/about.html b/java/HRWebApp/src/main/webapp/about.html new file mode 100644 index 00000000..f0aca087 --- /dev/null +++ b/java/HRWebApp/src/main/webapp/about.html @@ -0,0 +1,42 @@ + + + + + About + + +

HR Application for AnyCo Corporation

+ +HR Application for the company AnyCo Corporation is designed to show the various scenarios of using an HR application.

+ +HR Application is an web application that provides access to information of all employees in AnyCo Corporation. +HRStaff and HRAdmin are the two users of this application with different roles and privileges. +
+ + HRAdmin is an admin user who has all kinds of access i.e., read, write, and delete access to records of employees.
+Some of the functionalities accessible to HRAdmin are:
+
    +
  • List All Employees : This functionality is primarily used to retrieve all employees information. Employee information such as +Employee_id, First_Name, Last_Name, Email, Phone_Number, Job_Id and Salary are displayed.
  • +
  • Search By Employee Id : Employee records can be searched using the primary key of employee Id.
  • +
  • Update Employee Record : This functionality is used by HRAdmin to update the employee records. HRAdmin can search based on the name of the employee and the results will get displayed on the screen. Later, HRAdmin can choose an employee record to either UPDATE or DELETE. UPDATE functionality offers to update any fields such as First_name, last_name, Email, Phone_number, Job_ID, and salary of an Employee record. DELETE will delete the entire employee record from the database.
  • +
  • Increment Salary :This functionality is designed to showcase the usage of "Java in the database". HRAdmin will input the percentage for the salary hike. The Salary Hike algorithm calculates the budget for the salary hike based on the input percentage. This salary hike budget is later used to provide a salary increase to employees based on the salary tier that they belong. Please refer to the Java 2 Day Developer's Guide for detailed explanation of the salary hike algorithm.
  • +
  • About : This page provides an overview of the HR Application and explains the functionalities that it offers.
  • +
+ +
+ HRStaff is a staff user who has only read only access. HRStaff can only view the employee records and he can search the records based on the employee Id. However, HRStaff does not have any update or delete access and hence, any update/delete functionalities are hidden to this user.
+ +Some of the functionalities accessible to HRStaff are:
+
    +
  • List All Employees : This functionality is primarily used to retrieve all employees information. Employee information such as Employee_id, First_Name, Last_Name, Email, Phone_Number, and Job_Id are displayed.
  • +
  • Search By Employee Id : Employee records can be searched using the primary key of employee Id.
  • +
  • About : This page provides an overview of the HR Application and explains the functionalities that it offers.
  • +
+ + + + + + + \ No newline at end of file diff --git a/java/HRWebApp/src/main/webapp/css/._app.css b/java/HRWebApp/src/main/webapp/css/._app.css new file mode 100644 index 0000000000000000000000000000000000000000..e94c3a2f8462a57f5a05c51825755d4c16c743f3 GIT binary patch literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn literal 0 HcmV?d00001 diff --git a/java/HRWebApp/src/main/webapp/css/app.css b/java/HRWebApp/src/main/webapp/css/app.css new file mode 100644 index 00000000..896365fc --- /dev/null +++ b/java/HRWebApp/src/main/webapp/css/app.css @@ -0,0 +1,67 @@ +table { + border-collapse: collapse; + width: 100%; +} + +th, td { + text-align: left; + padding: 8px; +} + +tr:nth-child(even){background-color: #f2f2f2} + +th { + background-color: #4CAF50; + color: white; +}h { + background-color: #4CAF50; + color: white; +} + +body { +font-family: "Lato", sans-serif; +} + +.sidenav { + height: 100%; + width: 0; + position: fixed; + z-index: 1; + top: 0; + left: 0; + background-color: #FF0000; + overflow-x: hidden; + transition: 0.5s; + padding-top: 60px; +} + +.sidenav a { + padding: 8px 8px 8px 32px; + text-decoration: none; + font-size: 25px; + color: black; + display: block; + transition: 0.3s +} + +.sidenav a:hover, .offcanvas a:focus{ +color: #f1f1f1; +} + +.closebtn { + position: absolute; + top: 0; + right: 25px; + font-size: 36px !important; + margin-left: 50px; +} + +#main { + transition: margin-left .5s; + padding: 16px; +} + +@media screen and (max-height: 450px) { + .sidenav {padding-top: 15px;} + .sidenav a {font-size: 18px;} +} diff --git a/java/HRWebApp/src/main/webapp/incrementSalary.html b/java/HRWebApp/src/main/webapp/incrementSalary.html new file mode 100644 index 00000000..ba6f0fde --- /dev/null +++ b/java/HRWebApp/src/main/webapp/incrementSalary.html @@ -0,0 +1,70 @@ + + + + + Increment Salary + + + + + +
+ Enter the percentage increase in salary% +
+
+ +
+ + + + + \ No newline at end of file diff --git a/java/HRWebApp/src/main/webapp/index.html b/java/HRWebApp/src/main/webapp/index.html new file mode 100644 index 00000000..4aea8597 --- /dev/null +++ b/java/HRWebApp/src/main/webapp/index.html @@ -0,0 +1,110 @@ + + + + + + Employee table listing + + + + + + + + + +
+
+
myrole
+ Logout +
+
+ ☰ Java 2 Days HR Web Application + +
+
+ +
+
+ + + + + diff --git a/java/HRWebApp/src/main/webapp/listAll.html b/java/HRWebApp/src/main/webapp/listAll.html new file mode 100644 index 00000000..2dd12571 --- /dev/null +++ b/java/HRWebApp/src/main/webapp/listAll.html @@ -0,0 +1,51 @@ + + + + + List all Employees + + + + +
+ + + + + \ No newline at end of file diff --git a/java/HRWebApp/src/main/webapp/listById.html b/java/HRWebApp/src/main/webapp/listById.html new file mode 100644 index 00000000..4fb1e47b --- /dev/null +++ b/java/HRWebApp/src/main/webapp/listById.html @@ -0,0 +1,133 @@ + + + + + List Employee by Id + + + + +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/java/HRWebApp/src/main/webapp/listByName.html b/java/HRWebApp/src/main/webapp/listByName.html new file mode 100644 index 00000000..9c3433ec --- /dev/null +++ b/java/HRWebApp/src/main/webapp/listByName.html @@ -0,0 +1,191 @@ + + + + + List Employee by Name + + + + + + +
+ wildcard % is included at the end automatically.
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/java/HRWebApp/src/main/webapp/login-failed.html b/java/HRWebApp/src/main/webapp/login-failed.html new file mode 100644 index 00000000..8be502f1 --- /dev/null +++ b/java/HRWebApp/src/main/webapp/login-failed.html @@ -0,0 +1,12 @@ + + + + + Title + + +

+ Sorry, login failed! +

+ + \ No newline at end of file diff --git a/java/HRWebApp/src/main/webapp/login.html b/java/HRWebApp/src/main/webapp/login.html new file mode 100644 index 00000000..374a140e --- /dev/null +++ b/java/HRWebApp/src/main/webapp/login.html @@ -0,0 +1,42 @@ + + + + + Login to Jdbc Web Sample application + + + + +
+
+ + + + + + + + + + + + + + + +
Login to the Jdbc Web Sample application:
Name:
Password:
+
+
+ + \ No newline at end of file From 9460fa31d639c4f70b6b16ec6cd23bb547f3e9fa Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:37:20 -0700 Subject: [PATCH 02/38] Create Readme.md --- java/HRWebApp/src/Readme.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 java/HRWebApp/src/Readme.md diff --git a/java/HRWebApp/src/Readme.md b/java/HRWebApp/src/Readme.md new file mode 100644 index 00000000..5b490c95 --- /dev/null +++ b/java/HRWebApp/src/Readme.md @@ -0,0 +1,7 @@ +# Overview of the HR Web Application +“HR Web Application” is the Java application that uses Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. + +This Java applications leverages HR schema and Employees table of the Oracle Database. It is a intended to help the HR team of AnyCo Corporation with a few functionalities. +The application has the following functionalities. +##to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. +The goal of this guide is to help build a web application using all the latest tools and technologies, JDBC driver, UCP, Java in the database, and Oracle Database 12c Release 2. From 1a862f02a54e3fc37e67fed27abfd0cdeaa96511 Mon Sep 17 00:00:00 2001 From: Nirmala Sundarappa Date: Thu, 13 Apr 2017 02:39:34 -0700 Subject: [PATCH 03/38] Creating Readme.md --- java/HRWebApp/pom.xml | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 java/HRWebApp/pom.xml diff --git a/java/HRWebApp/pom.xml b/java/HRWebApp/pom.xml new file mode 100644 index 00000000..9a7e02e9 --- /dev/null +++ b/java/HRWebApp/pom.xml @@ -0,0 +1,72 @@ + + 4.0.0 + com.oracle.jdbc + HRWebSamples + war + 1.0-SNAPSHOT + HR WebSamples Maven Webapp + http://maven.apache.org + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + + + com.google.code.gson + gson + 2.5 + + + + + junit + junit + 3.8.1 + test + + + com.oracle.jdbc + ojdbc8 + 12.2.0.1 + + + + HRWebSamples + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + + + + + + repos-artifactory + + true + + + + oracle-artifactory + https://artifactory.oraclecorp.com/artifactory/bigdata-dev-local + + true + + + + + + + From e4e464b544ed908f793d0992e9b4a4752859aa84 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:41:14 -0700 Subject: [PATCH 04/38] Delete Readme.md --- java/HRWebApp/src/Readme.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 java/HRWebApp/src/Readme.md diff --git a/java/HRWebApp/src/Readme.md b/java/HRWebApp/src/Readme.md deleted file mode 100644 index 5b490c95..00000000 --- a/java/HRWebApp/src/Readme.md +++ /dev/null @@ -1,7 +0,0 @@ -# Overview of the HR Web Application -“HR Web Application” is the Java application that uses Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. - -This Java applications leverages HR schema and Employees table of the Oracle Database. It is a intended to help the HR team of AnyCo Corporation with a few functionalities. -The application has the following functionalities. -##to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. -The goal of this guide is to help build a web application using all the latest tools and technologies, JDBC driver, UCP, Java in the database, and Oracle Database 12c Release 2. From 53acc81a95a4e01b1d2f0970450466f8a8ef6b1a Mon Sep 17 00:00:00 2001 From: Nirmala Sundarappa Date: Thu, 13 Apr 2017 02:41:42 -0700 Subject: [PATCH 05/38] Creating Readme.md --- java/HRWebApp/Readme.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 java/HRWebApp/Readme.md diff --git a/java/HRWebApp/Readme.md b/java/HRWebApp/Readme.md new file mode 100644 index 00000000..5b490c95 --- /dev/null +++ b/java/HRWebApp/Readme.md @@ -0,0 +1,7 @@ +# Overview of the HR Web Application +“HR Web Application” is the Java application that uses Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. + +This Java applications leverages HR schema and Employees table of the Oracle Database. It is a intended to help the HR team of AnyCo Corporation with a few functionalities. +The application has the following functionalities. +##to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. +The goal of this guide is to help build a web application using all the latest tools and technologies, JDBC driver, UCP, Java in the database, and Oracle Database 12c Release 2. From 66138ec8ad0f4839e8aff5442cfdfac0710c02f0 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:44:34 -0700 Subject: [PATCH 06/38] Create Readme.md --- java/HRWebApp/Readme.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 java/HRWebApp/Readme.md diff --git a/java/HRWebApp/Readme.md b/java/HRWebApp/Readme.md new file mode 100644 index 00000000..5b490c95 --- /dev/null +++ b/java/HRWebApp/Readme.md @@ -0,0 +1,7 @@ +# Overview of the HR Web Application +“HR Web Application” is the Java application that uses Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. + +This Java applications leverages HR schema and Employees table of the Oracle Database. It is a intended to help the HR team of AnyCo Corporation with a few functionalities. +The application has the following functionalities. +##to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. +The goal of this guide is to help build a web application using all the latest tools and technologies, JDBC driver, UCP, Java in the database, and Oracle Database 12c Release 2. From f37654f4875603be22346130b51fd2675ebc3a9f Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:47:00 -0700 Subject: [PATCH 07/38] Delete ._.DS_Store --- java/HRWebApp/src/._.DS_Store | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/._.DS_Store diff --git a/java/HRWebApp/src/._.DS_Store b/java/HRWebApp/src/._.DS_Store deleted file mode 100644 index 21cdd54c6c42d641e60cf72a0b7e9e734a0d8f22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}16+jwh=&b0hJ*w`#X&k| z0I?OCI!1)JXmWn8USdH(PO4sEX<|`gUP)$NDnp^Zfq{XswW+yfYN~~?xwUU%W{$Os orK_o#o3W9ulbMN&u8D=EnXZMKrHihsxwE;Eo3pv4p}8po0Mw)(l>h($ From 481d32cb03c4c0b6a6e6f5494f2f8d469a26289d Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:47:11 -0700 Subject: [PATCH 08/38] Delete ._conf --- java/HRWebApp/src/._conf | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/._conf diff --git a/java/HRWebApp/src/._conf b/java/HRWebApp/src/._conf deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From be046097ac901b070129ae8c83da4b469af4d389 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:47:18 -0700 Subject: [PATCH 09/38] Delete ._main --- java/HRWebApp/src/._main | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/._main diff --git a/java/HRWebApp/src/._main b/java/HRWebApp/src/._main deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 53c719b1a2b334ab199338a2717750f42ee04705 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:47:36 -0700 Subject: [PATCH 10/38] Delete ._MANIFEST.MF --- java/HRWebApp/src/conf/._MANIFEST.MF | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/conf/._MANIFEST.MF diff --git a/java/HRWebApp/src/conf/._MANIFEST.MF b/java/HRWebApp/src/conf/._MANIFEST.MF deleted file mode 100644 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 53569cc9566452068b6a5669f8261bd2163af337 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:47:54 -0700 Subject: [PATCH 11/38] Delete ._.DS_Store --- java/HRWebApp/src/main/._.DS_Store | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/main/._.DS_Store diff --git a/java/HRWebApp/src/main/._.DS_Store b/java/HRWebApp/src/main/._.DS_Store deleted file mode 100644 index 21cdd54c6c42d641e60cf72a0b7e9e734a0d8f22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}16+jwh=&b0hJ*w`#X&k| z0I?OCI!1)JXmWn8USdH(PO4sEX<|`gUP)$NDnp^Zfq{XswW+yfYN~~?xwUU%W{$Os orK_o#o3W9ulbMN&u8D=EnXZMKrHihsxwE;Eo3pv4p}8po0Mw)(l>h($ From d5acfc7d2a77f696c0db5ca12cc1ddf836672b30 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:48:03 -0700 Subject: [PATCH 12/38] Delete ._java --- java/HRWebApp/src/main/._java | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/._java diff --git a/java/HRWebApp/src/main/._java b/java/HRWebApp/src/main/._java deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 2314e41f16b1c398e2b25a592e77de913d2862f2 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:48:13 -0700 Subject: [PATCH 13/38] Delete ._resources --- java/HRWebApp/src/main/._resources | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/._resources diff --git a/java/HRWebApp/src/main/._resources b/java/HRWebApp/src/main/._resources deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 9c4b5a352f0cfe84e94363aaf783bcc80c864315 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:48:27 -0700 Subject: [PATCH 14/38] Delete ._webapp --- java/HRWebApp/src/main/._webapp | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/._webapp diff --git a/java/HRWebApp/src/main/._webapp b/java/HRWebApp/src/main/._webapp deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From f43283a38d25f3470413feafb4bc9ee603d111b9 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:52:01 -0700 Subject: [PATCH 15/38] Update Readme.md --- java/HRWebApp/Readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/HRWebApp/Readme.md b/java/HRWebApp/Readme.md index 5b490c95..b1679bea 100644 --- a/java/HRWebApp/Readme.md +++ b/java/HRWebApp/Readme.md @@ -3,5 +3,7 @@ This Java applications leverages HR schema and Employees table of the Oracle Database. It is a intended to help the HR team of AnyCo Corporation with a few functionalities. The application has the following functionalities. -##to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. + +**to store the details of all the employees, +** add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. The goal of this guide is to help build a web application using all the latest tools and technologies, JDBC driver, UCP, Java in the database, and Oracle Database 12c Release 2. From befc4d94bceb619a67ac8b711ed93e9d4cd19b79 Mon Sep 17 00:00:00 2001 From: nsundara Date: Thu, 13 Apr 2017 02:55:14 -0700 Subject: [PATCH 16/38] Update Readme.md --- java/HRWebApp/Readme.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java/HRWebApp/Readme.md b/java/HRWebApp/Readme.md index b1679bea..16917c40 100644 --- a/java/HRWebApp/Readme.md +++ b/java/HRWebApp/Readme.md @@ -1,9 +1,10 @@ # Overview of the HR Web Application -“HR Web Application” is the Java application that uses Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. +**“HR Web Application”** is the Java application that showcases Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. + +This Java application leverages HR schema and Employees table of the Oracle Database. The purpose of the application is to help the HR team of AnyCo Corporation to manage the employees information. -This Java applications leverages HR schema and Employees table of the Oracle Database. It is a intended to help the HR team of AnyCo Corporation with a few functionalities. The application has the following functionalities. -**to store the details of all the employees, +* **List All Employees** : ** add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. The goal of this guide is to help build a web application using all the latest tools and technologies, JDBC driver, UCP, Java in the database, and Oracle Database 12c Release 2. From 13cb1539a9e681a658a51bb4466b46ad8d6bc97d Mon Sep 17 00:00:00 2001 From: nsundara Date: Mon, 17 Apr 2017 08:22:57 -0700 Subject: [PATCH 17/38] Delete ._WEB-INF --- java/HRWebApp/src/main/webapp/._WEB-INF | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/webapp/._WEB-INF diff --git a/java/HRWebApp/src/main/webapp/._WEB-INF b/java/HRWebApp/src/main/webapp/._WEB-INF deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 98e01299c54b07435b297509816665ca65326c79 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:15:23 -0700 Subject: [PATCH 18/38] Delete ._bean --- .../src/main/java/com/oracle/jdbc/samples/._bean | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._bean diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._bean b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._bean deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 1f264cd7525dda411a7bca5bf6e6eebeac50661b Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:15:29 -0700 Subject: [PATCH 19/38] Delete ._entity --- .../main/java/com/oracle/jdbc/samples/._entity | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._entity diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._entity b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._entity deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 888513317949cde66b15075da946e988b44224a7 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:15:35 -0700 Subject: [PATCH 20/38] Delete ._web --- .../src/main/java/com/oracle/jdbc/samples/._web | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._web diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._web b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/._web deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 28b687603a779bed7a5d3833bf7cedcbaeadbb00 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:15:48 -0700 Subject: [PATCH 21/38] Delete ._Employee.java --- .../oracle/jdbc/samples/entity/._Employee.java | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/._Employee.java diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/._Employee.java b/java/HRWebApp/src/main/java/com/oracle/jdbc/samples/entity/._Employee.java deleted file mode 100644 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 7cf1c4dd48e9783cf24b0f9133551a3b08b22a9b Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:16:04 -0700 Subject: [PATCH 22/38] Delete ._samples --- .../src/main/java/com/oracle/jdbc/._samples | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/java/com/oracle/jdbc/._samples diff --git a/java/HRWebApp/src/main/java/com/oracle/jdbc/._samples b/java/HRWebApp/src/main/java/com/oracle/jdbc/._samples deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 51cc0970b8a22b4d8c2b0c7cc800a893c6484024 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:16:15 -0700 Subject: [PATCH 23/38] Delete ._jdbc --- java/HRWebApp/src/main/java/com/oracle/._jdbc | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/java/com/oracle/._jdbc diff --git a/java/HRWebApp/src/main/java/com/oracle/._jdbc b/java/HRWebApp/src/main/java/com/oracle/._jdbc deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From c811d4e78c09d7074252702b9e53cc3d220edb9d Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:16:36 -0700 Subject: [PATCH 24/38] Delete ._com --- java/HRWebApp/src/main/java/._com | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/java/._com diff --git a/java/HRWebApp/src/main/java/._com b/java/HRWebApp/src/main/java/._com deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 6283143c7d55b4c9d83ef2e619659cf2c3ad9426 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:16:43 -0700 Subject: [PATCH 25/38] Delete ._oracle --- java/HRWebApp/src/main/java/com/._oracle | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/java/com/._oracle diff --git a/java/HRWebApp/src/main/java/com/._oracle b/java/HRWebApp/src/main/java/com/._oracle deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 66a11aba5816befb91ed83835ce6f8589a34c451 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:17:14 -0700 Subject: [PATCH 26/38] Delete ._about.html --- java/HRWebApp/src/main/webapp/._about.html | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/main/webapp/._about.html diff --git a/java/HRWebApp/src/main/webapp/._about.html b/java/HRWebApp/src/main/webapp/._about.html deleted file mode 100644 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From b53876067749de31bd3639cd6b711f480147ec50 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:17:21 -0700 Subject: [PATCH 27/38] Delete ._css --- java/HRWebApp/src/main/webapp/._css | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 java/HRWebApp/src/main/webapp/._css diff --git a/java/HRWebApp/src/main/webapp/._css b/java/HRWebApp/src/main/webapp/._css deleted file mode 100755 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 2cd121b89244acffe674609b4962a7f82f33f123 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:17:27 -0700 Subject: [PATCH 28/38] Delete ._listAll.html --- java/HRWebApp/src/main/webapp/._listAll.html | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/main/webapp/._listAll.html diff --git a/java/HRWebApp/src/main/webapp/._listAll.html b/java/HRWebApp/src/main/webapp/._listAll.html deleted file mode 100644 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 1bc449c7e9916b2d8f295fc7d29be952d9ff0a9f Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:17:33 -0700 Subject: [PATCH 29/38] Delete ._listById.html --- java/HRWebApp/src/main/webapp/._listById.html | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/main/webapp/._listById.html diff --git a/java/HRWebApp/src/main/webapp/._listById.html b/java/HRWebApp/src/main/webapp/._listById.html deleted file mode 100644 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From abf7f6da486bf3485a983e7d842974c68f9a1344 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:17:39 -0700 Subject: [PATCH 30/38] Delete ._listByName.html --- java/HRWebApp/src/main/webapp/._listByName.html | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/main/webapp/._listByName.html diff --git a/java/HRWebApp/src/main/webapp/._listByName.html b/java/HRWebApp/src/main/webapp/._listByName.html deleted file mode 100644 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 48de2719287e37b9b79c07dcf8730b14080fb8c1 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:17:50 -0700 Subject: [PATCH 31/38] Delete ._app.css --- java/HRWebApp/src/main/webapp/css/._app.css | Bin 210 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/HRWebApp/src/main/webapp/css/._app.css diff --git a/java/HRWebApp/src/main/webapp/css/._app.css b/java/HRWebApp/src/main/webapp/css/._app.css deleted file mode 100644 index e94c3a2f8462a57f5a05c51825755d4c16c743f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDI}@d6+Q@h<@}5x_AdBnYYuq+J^qI7A5ADWagzZ6zUro7#Lfdnp>u(S{R#K`zB`QSi4xdnwq&8 j8|gZknYiehSXi3rTDV!d=(?Ian;W?~n_C*1n=$|ZF0>wn From 9e3145e52c30dae3b3119a5249ade4e1c349a9d5 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 11:26:43 -0700 Subject: [PATCH 32/38] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e87e1c64..fd610ab8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.class *.jar classes/ +.* From 60f2108179fbcaca52ae99e9ce46d14f7214217e Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 15:14:44 -0700 Subject: [PATCH 33/38] Update Readme.md --- java/HRWebApp/Readme.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/java/HRWebApp/Readme.md b/java/HRWebApp/Readme.md index 767cb934..9f52c075 100644 --- a/java/HRWebApp/Readme.md +++ b/java/HRWebApp/Readme.md @@ -1,18 +1,18 @@ # Overview of the HR Web Application -<<<<<<< HEAD -“HR Web Application” is the Java application that uses Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. + +**HR Web Application** is the Java application that uses Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. + +It is a light weight web application that uses the MVC (Model, View, Controller) architecture and all the latest tools and technologies. The presentation layer uses HTML that internally uses JavaScript, JQuery, and CSS to display the results. The controller will be a servlet that talks to the Oracle Database through the Java Beans. Maven is used for building the application. + +![Architecture of the HR Web Application] (/Users/nbsundar/Desktop/C/Nirmala/Java2DayGuide/java2d-guide-architecture-diagramv2.jpg) + +This Java application leverages HR schema and Employees table of the Oracle Database 12c Release 2. It is intended to help the HR team of AnyCo Corporation to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. It has two users **HRStaff** and **HRAdmin** who have different roles and access to the application. -This Java applications leverages HR schema and Employees table of the Oracle Database. It is a intended to help the HR team of AnyCo Corporation with a few functionalities. -The application has the following functionalities. -##to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. -======= -**“HR Web Application”** is the Java application that showcases Oracle Java Database Connectivity (JDBC), Universal Connection Pool (UCP), and Oracle Java in the Database (OJVM) with Oracle Database 12c Release 2. -This Java application leverages HR schema and Employees table of the Oracle Database. The purpose of the application is to help the HR team of AnyCo Corporation to manage the employees information. The application has the following functionalities. * **List All Employees** : ** add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. ->>>>>>> 13cb1539a9e681a658a51bb4466b46ad8d6bc97d -The goal of this guide is to help build a web application using all the latest tools and technologies, JDBC driver, UCP, Java in the database, and Oracle Database 12c Release 2. + + From c98b7247e8b28adb52bf8d870d04d033aa91d0a4 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 15:38:08 -0700 Subject: [PATCH 34/38] Update Readme.md --- java/HRWebApp/Readme.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/java/HRWebApp/Readme.md b/java/HRWebApp/Readme.md index 9f52c075..3f473b24 100644 --- a/java/HRWebApp/Readme.md +++ b/java/HRWebApp/Readme.md @@ -4,15 +4,30 @@ It is a light weight web application that uses the MVC (Model, View, Controller) architecture and all the latest tools and technologies. The presentation layer uses HTML that internally uses JavaScript, JQuery, and CSS to display the results. The controller will be a servlet that talks to the Oracle Database through the Java Beans. Maven is used for building the application. -![Architecture of the HR Web Application] (/Users/nbsundar/Desktop/C/Nirmala/Java2DayGuide/java2d-guide-architecture-diagramv2.jpg) - This Java application leverages HR schema and Employees table of the Oracle Database 12c Release 2. It is intended to help the HR team of AnyCo Corporation to store the details of all the employees, add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. It has two users **HRStaff** and **HRAdmin** who have different roles and access to the application. - - The application has the following functionalities. * **List All Employees** : -** add any new employee, update the employee details, delete any employee, or provide a salary hike to all employees. The application will have two users “HRStaff” and “HRAdmin” who have different roles and access to the application. +Use this functionality to retrieve employees information. It lists the employee information such as Employee_ID, First_Name, Last_Name, Email, Phone_Number, Job_Id, and Salary. + +* **Search By Employee ID:** : +Use Employee ID that is the primary key of Employees table to search for a particular employee. + +* **Update Employee Record:** : +Search for a particular employee based on the name of the employee. You can then update employee details in the record, such as first_name, last_name, email, phone_number, job_id and salary using this function. + +* **Delete an Employee Record:** : +Search for a particular employee record to be deleted using **Search by Employee ID** functionality and then, use the DELETE function to the delete the entire employee record. + +* **Increment Salary:** : +Through this functionality, you can alter (increase or decrease) the percentage of the salary hike. A business logic to distribute this salary hike is executed through a stored procedure using Java in the database. + + + + + + + From 0d5a7784560d5c8172364eb59f137e2b7261a201 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 15:38:56 -0700 Subject: [PATCH 35/38] Update Readme.md --- java/HRWebApp/Readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/HRWebApp/Readme.md b/java/HRWebApp/Readme.md index 3f473b24..f603a356 100644 --- a/java/HRWebApp/Readme.md +++ b/java/HRWebApp/Readme.md @@ -8,6 +8,10 @@ This Java application leverages HR schema and Employees table of the Oracle Data The application has the following functionalities. + +* **About** : +This page provides an overview of the HR Application and explains the various functionalities it offers. + * **List All Employees** : Use this functionality to retrieve employees information. It lists the employee information such as Employee_ID, First_Name, Last_Name, Email, Phone_Number, Job_Id, and Salary. From afdddf47504ce2e36be2cd7c6f9910f5403b2927 Mon Sep 17 00:00:00 2001 From: nsundara Date: Wed, 19 Apr 2017 16:08:46 -0700 Subject: [PATCH 36/38] Update SalaryHikeSP.java --- java/HRWebApp/src/main/resources/SalaryHikeSP.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/java/HRWebApp/src/main/resources/SalaryHikeSP.java b/java/HRWebApp/src/main/resources/SalaryHikeSP.java index 973ff719..80b5dc2f 100755 --- a/java/HRWebApp/src/main/resources/SalaryHikeSP.java +++ b/java/HRWebApp/src/main/resources/SalaryHikeSP.java @@ -1,12 +1,7 @@ /* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.*/ /* DESCRIPTION - The server-side Type 2 (T2S) driver (aka KPRB driver) is for Java in the - database. Java running in the database session uses the KPRB driver or - T2S driver to access data, locally. - We furnish the server-side thin JDBC (aka Type 4 server driver) for - accessing data in other session in the same database or a remote Oracle - database. + This is a Java class that invokes the SalaryHikeSP stored procedure. Step 1: Connect to SQLPLUS using the database USER/PASSWORD. Make sure to have SalaryHikeSP.sql accessible on the From 1704138ef1a86e6c0dc7e0ce3f49ef0135d72999 Mon Sep 17 00:00:00 2001 From: Nirmala Sundarappa Date: Fri, 21 Apr 2017 16:15:56 -0700 Subject: [PATCH 37/38] Modified pom.xml --- java/HRWebApp/pom.xml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/java/HRWebApp/pom.xml b/java/HRWebApp/pom.xml index 9a7e02e9..794b434b 100644 --- a/java/HRWebApp/pom.xml +++ b/java/HRWebApp/pom.xml @@ -50,23 +50,4 @@ - - - - repos-artifactory - - true - - - - oracle-artifactory - https://artifactory.oraclecorp.com/artifactory/bigdata-dev-local - - true - - - - - - From bb682ae8df455d46a78661899779436c20f75a80 Mon Sep 17 00:00:00 2001 From: Nirmala Sundarappa Date: Fri, 21 Apr 2017 16:30:22 -0700 Subject: [PATCH 38/38] Updating pom.xml with Oracle maven repo --- java/HRWebApp/pom.xml | 32 +++++++++++++++++++--- java/HRWebApp/settings-security.xml | 3 +++ java/HRWebApp/settings.xml | 42 +++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 java/HRWebApp/settings-security.xml create mode 100644 java/HRWebApp/settings.xml diff --git a/java/HRWebApp/pom.xml b/java/HRWebApp/pom.xml index 794b434b..26e4d6a5 100644 --- a/java/HRWebApp/pom.xml +++ b/java/HRWebApp/pom.xml @@ -2,10 +2,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.oracle.jdbc - HRWebSamples + JdbcWebSamples war 1.0-SNAPSHOT - HR WebSamples Maven Webapp + JdbcWebSamples Maven Webapp http://maven.apache.org @@ -36,7 +36,7 @@ - HRWebSamples + JdbcWebSamples org.apache.maven.plugins @@ -50,4 +50,30 @@ + + + maven.oracle.com + oracle-maven-repo + https://maven.oracle.com + default + + true + always + + + + + + + maven.oracle.com + oracle-maven-repo + https://maven.oracle.com + default + + true + always + + + + diff --git a/java/HRWebApp/settings-security.xml b/java/HRWebApp/settings-security.xml new file mode 100644 index 00000000..7fee036a --- /dev/null +++ b/java/HRWebApp/settings-security.xml @@ -0,0 +1,3 @@ + + {generate_master_password_and_add_here} + diff --git a/java/HRWebApp/settings.xml b/java/HRWebApp/settings.xml new file mode 100644 index 00000000..0a924f16 --- /dev/null +++ b/java/HRWebApp/settings.xml @@ -0,0 +1,42 @@ + + + + + + + maven.oracle.com + {Username registered on maven.oracle.com} + {Add_registered_password_here} + + + ANY + ANY + OAM 11g + + + + + + http.protocol.allow-circular-redirects + %b,true + + + + + + + + +