diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/Assignment 1 Servlets-1.pdf b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/Assignment 1 Servlets-1.pdf new file mode 100644 index 00000000..dde4b45c Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/Assignment 1 Servlets-1.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1.zip b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1.zip new file mode 100644 index 00000000..b5ae7fcc Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1.zip differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.classpath b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.classpath new file mode 100644 index 00000000..8c458320 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.classpath @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.project b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.project new file mode 100644 index 00000000..b39d38f2 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.project @@ -0,0 +1,34 @@ + + + assignment1 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1695376064898 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.core.resources.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..839d647e --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.jdt.apt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..d4313d4b --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.jdt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..46235dc0 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.m2e.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/nb-configuration.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/nb-configuration.xml new file mode 100644 index 00000000..700cc508 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + 10-web + pfv5ee8 + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/pom.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/pom.xml new file mode 100644 index 00000000..d651f461 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/pom.xml @@ -0,0 +1,77 @@ + + 4.0.0 + com.mycompany + assignment1 + 1.0-SNAPSHOT + war + assignment1-1.0-SNAPSHOT + + + 11 + 11 + ${project.build.directory}/endorsed + UTF-8 + false + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + jar + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/com/mycompany/mavenproject1/JakartaRestConfiguration.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/com/mycompany/mavenproject1/JakartaRestConfiguration.java new file mode 100644 index 00000000..b40feeac --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/com/mycompany/mavenproject1/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package com.mycompany.mavenproject1; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/com/mycompany/mavenproject1/resources/JakartaEE10Resource.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/com/mycompany/mavenproject1/resources/JakartaEE10Resource.java new file mode 100644 index 00000000..afa8f93a --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/com/mycompany/mavenproject1/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package com.mycompany.mavenproject1.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/AddTodo.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/AddTodo.java new file mode 100644 index 00000000..93fc8da0 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/AddTodo.java @@ -0,0 +1,106 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package servlets; + +import jakarta.servlet.*; +import jakarta.servlet.annotation.*; +import jakarta.servlet.http.*; +import java.io.*; +import java.util.*; +import todo.*; + +/** + * + * @author andrew + */ +@WebServlet(name = "AddTodo", urlPatterns = {"/AddTodo"}) +public class AddTodo extends HttpServlet { + + /** + * 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 { + response.setContentType("text/html;charset=UTF-8"); + + // getting the subject and details parameters from the request + String subject = request.getParameter("subject"); + String details = request.getParameter("details"); + + // getting reference to the seeion object + HttpSession session = request.getSession(); + + // attempting to get a reference to the taskList in the session object (may be null) + ArrayList taskList = (ArrayList) session.getAttribute("taskList"); + + // if the tasklist hasn't been initialised yet, create one + if (taskList == null) { + taskList = new ArrayList<>(); + } + + // adding the task to the list and displaying it, if it's valid + if (subject != null && !subject.isEmpty() && details != null && !details.isEmpty()) { + // adding ToDo task to list + taskList.add(new ToDo(subject, details)); + + // adding taskList to session as attribute + session.setAttribute("taskList", taskList); + + // redirecting back to the GetTodoList servlet + // request.getRequestDispatcher("GetTodoList").forward(request, response); + response.sendRedirect("GetTodoList"); + } + // if the task is not valid, redirecting to addTodo.html + else { + response.sendRedirect("addTodo.html"); + } + } + + // + /** + * 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 { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/GetTodoList.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/GetTodoList.java new file mode 100644 index 00000000..1f3201be --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/GetTodoList.java @@ -0,0 +1,116 @@ +package servlets; + +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ + +import jakarta.servlet.*; +import jakarta.servlet.annotation.*; +import jakarta.servlet.http.*; +import java.io.*; +import java.util.*; +import todo.*; +/** + * + * @author andrew + */ +@WebServlet(urlPatterns = {"/GetTodoList"}) +public class GetTodoList extends HttpServlet { + + /** + * 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 { + response.setContentType("text/html;charset=UTF-8"); + + // getting reference to session + HttpSession session = request.getSession(); + + // attempting to get a reference to the taskList in the session object (may be null) + ArrayList taskList = (ArrayList) session.getAttribute("taskList"); + + try (PrintWriter out = response.getWriter()) { + /* TODO output your page here. You may use following sample code. */ + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet GetTodoList"); + out.println(""); + out.println(""); + out.println("

Servlet GetTodoList at " + request.getContextPath() + "

"); + + // if taskList doesn't exist yet, don't try to print taskList + if (taskList == null) { + out.println("Add Task"); + } + // else, if taskList does exist, print it in table form + else { + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + + // iterating over the tasklist and creating a row in the table for each task + for (ToDo task : taskList) { + out.println(""); + out.println(""); + } + + out.println("
SubjectDetails
" + task.getSubject() + "" + task.getDetails() + "
"); + out.println("Add Task"); + } + + out.println(""); + out.println(""); + } + } + + // + /** + * 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 { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/LoginServlet.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/LoginServlet.java new file mode 100644 index 00000000..739baba7 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/servlets/LoginServlet.java @@ -0,0 +1,93 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package servlets; + +import jakarta.servlet.*; +import jakarta.servlet.annotation.*; +import jakarta.servlet.http.*; +import java.io.*; + +/** + * + * @author andrew + */ +@WebServlet(name = "LoginServlet", urlPatterns = {"/LoginServlet"}) +public class LoginServlet extends HttpServlet { + + /** + * 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 { + response.setContentType("text/html;charset=UTF-8"); + + // getting the username and password parameters from the request + String user = request.getParameter("user"); + String passwd = request.getParameter("passwd"); + + // reference to the session + HttpSession session = request.getSession(); + + // If the username / password combination are correct add the username to the session as an attribute, and forward control to GetTodoList servlet + if (user.contentEquals("andrew") && passwd.contentEquals("supersecret123")) { + // adding the username to the session as an attribute + session.setAttribute("user", user); + + // forwarding control to the GetTodoList servlet + request.getRequestDispatcher("GetTodoList").forward(request, response); + } + // else redirecting back to index.html + else { + response.sendRedirect("index.html"); + } + } + + // + /** + * 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 { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/todo/ToDo.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/todo/ToDo.java new file mode 100644 index 00000000..a88c271c --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/java/todo/ToDo.java @@ -0,0 +1,45 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Beans/Bean.java to edit this template + */ +package todo; + +import java.beans.*; +import java.io.Serializable; + +/** + * + * @author andrew + */ +public class ToDo implements Serializable { + + private String subject; + private String details; + + // empty constructor as is standard for java beans + public ToDo() { + } + + // polymorphic constructor with subject and details + public ToDo(String subject, String details) { + this.subject = subject; + this.details = details; + } + + // getters and setters + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/resources/META-INF/persistence.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..7582bf11 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/WEB-INF/beans.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 00000000..9dfae34d --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/WEB-INF/web.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..4ae23cea --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + + + 30 + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/addTodo.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/addTodo.html new file mode 100644 index 00000000..22a18913 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/addTodo.html @@ -0,0 +1,21 @@ + + + + + Add a Task + + + + +
+
+
+
+
+ +
+ + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/index.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/index.html new file mode 100644 index 00000000..fe5d01c2 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment1/assignment1/src/main/webapp/index.html @@ -0,0 +1,17 @@ + + + + Login Page + + + +

Login to Manage Your Tasks

+
+
+
+
+
+ +
+ + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/Assignment 2 JSP 2023.pdf b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/Assignment 2 JSP 2023.pdf new file mode 100644 index 00000000..fd5f1b60 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/Assignment 2 JSP 2023.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2.zip b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2.zip new file mode 100644 index 00000000..b7eb3a33 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2.zip differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.classpath b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.classpath new file mode 100644 index 00000000..8c458320 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.classpath @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.project b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.project new file mode 100644 index 00000000..1355c1a8 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.project @@ -0,0 +1,34 @@ + + + assignment2 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1695547277604 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.core.resources.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..839d647e --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.jdt.apt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..d4313d4b --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.jdt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..46235dc0 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.m2e.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/nb-configuration.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/nb-configuration.xml new file mode 100644 index 00000000..346fb42c --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + 10-web + pfv5ee8 + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/pom.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/pom.xml new file mode 100644 index 00000000..70489ed2 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/pom.xml @@ -0,0 +1,77 @@ + + 4.0.0 + com.mycompany + assignment2 + 1.0-SNAPSHOT + war + assignment2-1.0-SNAPSHOT + + + 11 + 11 + ${project.build.directory}/endorsed + UTF-8 + false + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.0 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + jar + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/Servlets/AddArtist.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/Servlets/AddArtist.java new file mode 100644 index 00000000..715c506f --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/Servlets/AddArtist.java @@ -0,0 +1,108 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package Servlets; + +import artist.Artist; +import java.io.IOException; + +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; +import java.util.ArrayList; + +/** + * + * @author andrew + */ +@WebServlet(name = "AddArtistServlet", urlPatterns = {"/AddArtistServlet"}) +public class AddArtist extends HttpServlet { + + /** + * 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 { + response.setContentType("text/html;charset=UTF-8"); + + // getting reference to the seeion object + HttpSession session = request.getSession(); + + // attempting to get a reference to the artistList in the session object (may be null) + ArrayList artistList = (ArrayList) session.getAttribute("artistList"); + + // if the artistList hasn't been initialised yet, create one + if (artistList == null) { + artistList = new ArrayList<>(); + } + + + // adding artist to list + artistList.add(new Artist( + request.getParameter("surname"), + request.getParameter("firstname"), + request.getParameter("nationality"), + request.getParameter("birthYear"), + request.getParameter("deathYear"), + request.getParameter("biography"), + request.getParameter("photoUrl") + )); + + // adding artistList to session as attribute + session.setAttribute("artistList", artistList); + + // redirecting back to the ArtistList JSP page + response.sendRedirect("displayArtists.jsp"); + } + + // + /** + * 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 { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/artist/Artist.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/artist/Artist.java new file mode 100644 index 00000000..0f716553 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/artist/Artist.java @@ -0,0 +1,65 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package artist; + +/** + * + * @author andrew + */ + +public class Artist { + private String surname; + private String firstname; + private String nationality; + private String birthYear; // since no arithmetic is performed on birth & death years, easier to leave them as Strings + private String deathYear; + private String biography; + private String photoUrl; + + // constructor for artist + public Artist(String surname, String firstname, String nationality, String birthYear, String deathYear, String biography, String photoUrl) { + this.surname = surname; + this.firstname = firstname; + this.nationality = nationality; + this.birthYear = birthYear; + this.deathYear = deathYear; // doesn't matter if death year is not entered - will just be an empty string + this.biography = biography; + this.photoUrl = photoUrl; + } + + // getters + public String getSurname() { return surname; } + + public String getFirstname() { return firstname; } + + public String getNationality() { return nationality; } + + public String getBirthYear() { return birthYear; } + + public String getDeathYear() { return deathYear; } + + public String getBiography() { return biography; } + + public String getPhotoUrl() { return photoUrl; } + + // setters + public void setSurname(String surname) { this.surname = surname; } + + public void setFirstname(String firstname) { this.firstname = firstname; } + + public void setNationality(String nationality) { this.nationality = nationality; } + + public void setBirthYear(String birthYear) { this.birthYear = birthYear; } + + public void setDeathYear(String deathYear) { this.deathYear = deathYear; } + + public void setBiography(String biography) { this.biography = biography; } + + public void setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; } + +} + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/com/mycompany/assignment2/JakartaRestConfiguration.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/com/mycompany/assignment2/JakartaRestConfiguration.java new file mode 100644 index 00000000..5986da15 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/com/mycompany/assignment2/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package com.mycompany.assignment2; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/com/mycompany/assignment2/resources/JakartaEE10Resource.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/com/mycompany/assignment2/resources/JakartaEE10Resource.java new file mode 100644 index 00000000..3e2de6d3 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/java/com/mycompany/assignment2/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package com.mycompany.assignment2.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/resources/META-INF/persistence.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..baad2903 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/WEB-INF/beans.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 00000000..d581aa76 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/WEB-INF/web.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..4de8ff31 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + + + 30 + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/addArtist.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/addArtist.html new file mode 100644 index 00000000..7573af9b --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/addArtist.html @@ -0,0 +1,31 @@ + + + + + Add Artist + + + + +

Add Artist

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/displayArtistDetails.jsp b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/displayArtistDetails.jsp new file mode 100644 index 00000000..7434b0df --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/displayArtistDetails.jsp @@ -0,0 +1,31 @@ +<%-- + Document : testdisplayArtistDetails + Created on : 24 Sep 2023, 11:49:41 + Author : andrew +--%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + ${param.firstname} ${param.surname} + + +

Artist Details

+

${param.firstname} ${param.surname}

+ ${param.firstname} ${param.surname} +

Biography

+

${param.biography}

+

Details

+

+ Birth Year: ${param.birthYear}
+ + + Death Year: ${param.deathYear}
+
+ Nationality: ${param.nationality}
+

+ + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/displayArtists.jsp b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/displayArtists.jsp new file mode 100644 index 00000000..c7d59209 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/displayArtists.jsp @@ -0,0 +1,54 @@ +<%-- + Document : displayArtists + Created on : 24 Sep 2023, 11:22:59 + Author : andrew +--%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Display Artists + + + +

Summary of Artists Information

+ + + + + + + + + + + + + + + + + + +
SurnameFirst NameNationalityBirth YearDeath Year
${artist.surname}${artist.firstname}${artist.nationality}${artist.birthYear}${artist.deathYear} + +
+ + + + + + + + +
+
+ Add Artist + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/index.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/index.html new file mode 100644 index 00000000..245047a0 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment2/assignment2/src/main/webapp/index.html @@ -0,0 +1,16 @@ + + + + + Assignment 2 - JSP + + + + +

Assignment 2 - JSP

+ Display Artists + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/Assignment 3 JPA.pdf b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/Assignment 3 JPA.pdf new file mode 100644 index 00000000..a25c2d7e Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/Assignment 3 JPA.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3.zip b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3.zip new file mode 100644 index 00000000..04549730 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3.zip differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.classpath b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.classpath new file mode 100644 index 00000000..8c458320 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.classpath @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.factorypath b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.factorypath new file mode 100644 index 00000000..0b037ae3 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.factorypath @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.project b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.project new file mode 100644 index 00000000..44b3836b --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.project @@ -0,0 +1,34 @@ + + + assignment3 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1695928659323 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.core.resources.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..839d647e --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.jdt.apt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..dfa4f3ad --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=true +org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations +org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.jdt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..2985089d --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=enabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.m2e.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/nb-configuration.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/nb-configuration.xml new file mode 100644 index 00000000..700cc508 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + 10-web + pfv5ee8 + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/pom.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/pom.xml new file mode 100644 index 00000000..1c5d59f3 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/pom.xml @@ -0,0 +1,118 @@ + + 4.0.0 + com.mycompany + assignment3 + 1.0-SNAPSHOT + war + assignment3-1.0-SNAPSHOT + + + 11 + 11 + ${project.build.directory}/endorsed + UTF-8 + false + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + org.eclipse.persistence + org.eclipse.persistence.core + 2.7.10 + + + org.eclipse.persistence + org.eclipse.persistence.asm + 9.2.0 + + + org.eclipse.persistence + org.eclipse.persistence.antlr + 2.7.10 + + + org.eclipse.persistence + org.eclipse.persistence.jpa + 2.7.10 + + + org.eclipse.persistence + org.eclipse.persistence.jpa.jpql + 2.7.10 + + + org.eclipse.persistence + org.eclipse.persistence.moxy + 2.7.10 + + + org.eclipse.persistence + jakarta.persistence + 2.2.3 + + + org.eclipse.persistence + org.eclipse.persistence.jpa.modelgen.processor + 2.7.10 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.0 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + jar + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/AddCustomer.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/AddCustomer.java new file mode 100644 index 00000000..ef609b8a --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/AddCustomer.java @@ -0,0 +1,105 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package Servlets; + +import customer.*; +import jakarta.annotation.Resource; +import jakarta.persistence.*; +import java.io.IOException; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.transaction.UserTransaction; + +/** + * + * @author andrew + */ +@WebServlet(name = "AddCustomer", urlPatterns = {"/AddCustomer"}) +public class AddCustomer extends HttpServlet { + @PersistenceContext(unitName = "pu") + private EntityManager em; + @Resource + private UserTransaction userTransaction; + + /** + * 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 { + response.setContentType("text/html;charset=UTF-8"); + + // creating a new customer object and adding it to the database + try { + userTransaction.begin(); + em.persist(new Customer( + Long.parseLong(request.getParameter("number")), + request.getParameter("name"), + request.getParameter("phone"), + request.getParameter("email"), + request.getParameter("country"), + request.getParameter("postcode"), + Float.parseFloat(request.getParameter("creditLimit")) + )); + em.flush(); + userTransaction.commit(); + } + catch (Exception e) { + System.out.println(e.getStackTrace()); + } + + // redirecting back to the start page + response.sendRedirect("index.html"); + } + + + // + /** + * 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 { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/FindCustomer.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/FindCustomer.java new file mode 100644 index 00000000..8af42bce --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/FindCustomer.java @@ -0,0 +1,101 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package Servlets; + +import customer.*; +import jakarta.annotation.Resource; +import jakarta.persistence.*; +import jakarta.servlet.RequestDispatcher; +import java.io.IOException; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; +import jakarta.transaction.UserTransaction; + +/** + * + * @author andrew + */ +@WebServlet(name = "FindCustomer", urlPatterns = {"/FindCustomer"}) +public class FindCustomer extends HttpServlet { + @PersistenceContext(unitName = "pu") + private EntityManager em; + @Resource + private UserTransaction userTransaction; + + /** + * 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 { + response.setContentType("text/html;charset=UTF-8"); + + // get number of customer to be found - this will be used as the customer ID + long number = Long.parseLong(request.getParameter("number")); + + Customer customer = em.find(Customer.class, number); + + // if customer is not null, adding it to the session as an attribute + if (customer != null) { + HttpSession session = request.getSession(); + session.setAttribute("customer", customer); + + response.sendRedirect("displayCustomer.jsp"); + } + else { + response.sendRedirect("findCustomer.html"); + } + } + + + // + /** + * 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 { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/GetCustomers.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/GetCustomers.java new file mode 100644 index 00000000..0c4b7a0b --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/Servlets/GetCustomers.java @@ -0,0 +1,94 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package Servlets; + +import customer.*; +import jakarta.annotation.Resource; +import jakarta.persistence.*; +import jakarta.servlet.RequestDispatcher; +import java.io.IOException; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; +import jakarta.transaction.UserTransaction; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author andrew + */ +@WebServlet(name = "GetCustomers", urlPatterns = {"/GetCustomers"}) +public class GetCustomers extends HttpServlet { + @PersistenceContext(unitName = "pu") + private EntityManager em; + @Resource + private UserTransaction userTransaction; + + /** + * 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 { + response.setContentType("text/html;charset=UTF-8"); + + Query q = em.createQuery("select c from Customer c"); + List customers = q.getResultList(); + + HttpSession session = request.getSession(); + session.setAttribute("customers", customers); + + response.sendRedirect("displayCustomers.jsp"); + } + + // + /** + * 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 { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/com/mycompany/assignment3/JakartaRestConfiguration.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/com/mycompany/assignment3/JakartaRestConfiguration.java new file mode 100644 index 00000000..65b35e2c --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/com/mycompany/assignment3/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package com.mycompany.assignment3; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/com/mycompany/assignment3/resources/JakartaEE10Resource.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/com/mycompany/assignment3/resources/JakartaEE10Resource.java new file mode 100644 index 00000000..42296264 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/com/mycompany/assignment3/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package com.mycompany.assignment3.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/customer/Customer.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/customer/Customer.java new file mode 100644 index 00000000..13888583 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/java/customer/Customer.java @@ -0,0 +1,103 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package customer; + +import java.io.Serializable; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.*; + +/** + * + * @author andrew + */ +@Entity +@Table(name="customers") +public class Customer implements Serializable { + + @Id + @Column(name="id") + private Long id; + @Column(name="name") + private String name; + @Column(name="phone") + private String phone; // a String because phone numbers sometimes contain letters (although equivalent to numbers) + @Column(name="email") + private String email; + @Column(name="country") + private String country; + @Column(name="postcode") + private String postcode; + @Column(name="creditLimit") + private float creditLimit; + + public Customer() { + } + + public Customer(long id, String name, String phone, String email, String country, String postcode, float creditLimit) { + this.id = id; + this.name = name; + this.phone = phone; + this.email = email; + this.country = country; + this.postcode = postcode; + this.creditLimit = creditLimit; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() {return name; } + public void setName(String name) {this.name = name; } + + public String getPhone() { return phone; } + public void setPhone(String phone) { this.phone = phone; } + + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } + + public String getCountry() { return country; } + public void setCountry(String country) { this.country = country; } + + public String getPostcode() { return postcode; } + public void setPostcode(String postcode) { this.postcode = postcode; } + + public float getCreditLimit() { return creditLimit; } + public void setCreditLimit(float creditLimit) { this.creditLimit = creditLimit; } + + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Customer)) { + return false; + } + Customer other = (Customer) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "customer.Customer[ id=" + id + " ]"; + } + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/resources/META-INF/persistence.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..0b9d5aad --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,13 @@ + + + + false + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/WEB-INF/beans.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 00000000..9dfae34d --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/WEB-INF/web.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..4ae23cea --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + + + 30 + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/addCustomer.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/addCustomer.html new file mode 100644 index 00000000..d1e464a9 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/addCustomer.html @@ -0,0 +1,32 @@ + + + + + Add Customer + + + + +

Add a New Customer

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/displayCustomer.jsp b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/displayCustomer.jsp new file mode 100644 index 00000000..e7d95fb0 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/displayCustomer.jsp @@ -0,0 +1,46 @@ +<%-- + Document : displayCustomer + Created on : 28 Sep 2023, 20:16:21 + Author : andrew +--%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Display Customer + + + + +

Customer Found

+ + + + + + + + + + + + + + + + + + + + + +
Customer NumberNamePhone NumberEmailCountryPostcodeCredit Limit
${customer.id}${customer.name}${customer.phone}${customer.email}${customer.country}${customer.postcode}${customer.creditLimit}
+ + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/displayCustomers.jsp b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/displayCustomers.jsp new file mode 100644 index 00000000..e6debd34 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/displayCustomers.jsp @@ -0,0 +1,48 @@ +<%-- + Document : displayCustomers + Created on : 28 Sep 2023, 20:46:42 + Author : andrew +--%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Display Customers + + + +

Our Customers

+ + + + + + + + + + + + + + + + + + + + + + + +
Customer NumberNamePhone NumberEmailCountryPostcodeCredit Limit
${c.id}${c.name}${c.phone}${c.email}${c.country}${c.postcode}${c.creditLimit}
+ + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/findCustomer.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/findCustomer.html new file mode 100644 index 00000000..9a78f3d3 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/findCustomer.html @@ -0,0 +1,20 @@ + + + + + Find Customer + + + + +

Find a Customer by Customer Number

+
+
+
+ +
+ + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/index.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/index.html new file mode 100644 index 00000000..1a5a7013 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment3/assignment3/src/main/webapp/index.html @@ -0,0 +1,13 @@ + + + + Assignment 3 - JPA + + + +

Assignment 3 - JPA

+ Add Customer
+ Find Customer
+ List Customers
+ + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment4/Assignment 4 EJB and JPA.pdf b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/Assignment 4 EJB and JPA.pdf new file mode 100644 index 00000000..19046733 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/Assignment 4 EJB and JPA.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment4/assignment4.zip b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/assignment4.zip new file mode 100644 index 00000000..6f36f6ab Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/assignment4.zip differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment4/createDB.sql b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/createDB.sql new file mode 100644 index 00000000..855538ba --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/createDB.sql @@ -0,0 +1,49 @@ + + +DROP TABLE IF EXISTS `authors`; +CREATE TABLE IF NOT EXISTS `authors` ( + `authorid` int(11) NOT NULL AUTO_INCREMENT, + `surname` varchar(255) NOT NULL, + `firstname` varchar(255) NOT NULL, + `yob` smallint(6) NOT NULL, + `nationality` varchar(255) NOT NULL, + `biography` longtext NOT NULL, + PRIMARY KEY (`authorid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `authors` +-- + +INSERT INTO `authors` (`authorid`, `surname`, `firstname`, `yob`, `nationality`, `biography`) VALUES +(1, 'Steinbeck', 'John', 1902, 'American', 'John Ernst Steinbeck was an American writer. He won the 1962 Nobel Prize in Literature \"for his realistic and imaginative writings, combining as they do sympathetic humor and keen social perception\". He has been called \"a giant of American letters.\" '), +(2, 'Linklater', 'Eric', 1899, 'British', 'Eric Robert Russell Linklater CBE was a Welsh-born Scottish poet, fiction writer, military historian, and travel writer. For The Wind on the Moon, a children\'s fantasy novel, he won the 1944 Carnegie Medal from the Library Association for the year\'s best children\'s book by a British subject.'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `books` +-- + +DROP TABLE IF EXISTS `books`; +CREATE TABLE IF NOT EXISTS `books` ( + `bookid` int(11) NOT NULL AUTO_INCREMENT, + `year` int(11) NOT NULL, + `title` varchar(255) NOT NULL, + `coverimage` varchar(255) NOT NULL, + `authorid` int(11) NOT NULL, + PRIMARY KEY (`bookid`), + KEY `authorid` (`authorid`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `books` +-- + +INSERT INTO `books` (`bookid`, `year`, `title`, `coverimage`, `authorid`) VALUES +(1, 1962, 'Travels with Charley: In Search of America', 'twc', 1), +(2, 1961, 'The Winter of Our Discontent', 'twood', 1), +(3, 1946, 'Private Angelo', 'pa', 2), +(4, 1952, 'Ripeness is All', 'ria', 2); +COMMIT; + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment4/ejbAssignment.zip b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/ejbAssignment.zip new file mode 100644 index 00000000..94f9471f Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment4/ejbAssignment.zip differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/Assignment 5 JSF.pdf b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/Assignment 5 JSF.pdf new file mode 100644 index 00000000..dc344c41 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/Assignment 5 JSF.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5.zip b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5.zip new file mode 100644 index 00000000..1a4b07cf Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5.zip differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.classpath b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.classpath new file mode 100644 index 00000000..df66b20f --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.classpath @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.project b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.project new file mode 100644 index 00000000..70d55ebb --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.project @@ -0,0 +1,34 @@ + + + assignment5 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1699287495979 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.core.resources.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..839d647e --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.jdt.apt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..d4313d4b --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.jdt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..c9d1e553 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.m2e.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/assignment5.iml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/assignment5.iml new file mode 100644 index 00000000..e2a760d8 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/assignment5.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/faces-config.NavData b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/faces-config.NavData new file mode 100644 index 00000000..298bfc50 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/faces-config.NavData @@ -0,0 +1,6 @@ + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/nb-configuration.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/nb-configuration.xml new file mode 100644 index 00000000..49e25fd3 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/nb-configuration.xml @@ -0,0 +1,22 @@ + + + + + + 9.1-web + gfv610ee9 + JSP + ide + JDK_17 + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/pom.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/pom.xml new file mode 100644 index 00000000..7bc91b74 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/pom.xml @@ -0,0 +1,91 @@ + + 4.0.0 + com.mycompany + assignment5 + 1.0-SNAPSHOT + war + assignment5 + + + ${project.build.directory}/endorsed + UTF-8 + false + 10.0.0 + 13.0.2 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + jakarta.platform + jakarta.jakartaee-web-api + ${jakartaee} + provided + + + + org.primefaces + primefaces + ${primefaces.version} + jakarta + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + jar + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/beans/TodoBean.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/beans/TodoBean.java new file mode 100644 index 00000000..8e05e544 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/beans/TodoBean.java @@ -0,0 +1,90 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package beans; + +import data.Todo; +import services.TodoFacade; +import jakarta.annotation.PostConstruct; +import jakarta.ejb.EJB; +import jakarta.enterprise.context.RequestScoped; +import jakarta.faces.context.FacesContext; +import jakarta.inject.Named; + +/** + * + * @author andrew + */ +@Named("todoBean") +@RequestScoped +public class TodoBean { + @EJB + private TodoFacade todoFacade; + private String category; + private String description; + private int priority; + private long id; + private Todo todo; + + @PostConstruct + public void postConstruct() { + // get todoId + String todoIdParam = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("todoId"); + + // if the todoId exists + if (todoIdParam != null) { + // parse out id, and get a reference to the Todo object that id pertains to + id = Long.parseLong(todoIdParam); + todo = todoFacade.find(id); + + // if that todo exists, get fields + if (todo != null) { + category = todo.getCategory(); + description = todo.getDescription(); + priority = todo.getPriority(); + } + } + } + + // getters and sestters + public long getId() { return id; } + public void setId(long id) { this.id = id; } + + public String getCategory() { return category; } + public void setCategory(String category) { this.category = category; } + + public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } + + public int getPriority() { return priority; } + public void setPriority(int priority) { this.priority = priority; } + + + // method to add a new todo item + public String add() { + Todo newTodo = new Todo(); + newTodo.setCategory(category); + newTodo.setDescription(description); + newTodo.setPriority(priority); + + todoFacade.create(newTodo); + return "success"; + } + + // method to update a todo item + public String update() { + todo.setCategory(category); + todo.setDescription(description); + todo.setPriority(priority); + + todoFacade.edit(todo); + return "success"; + } + + // method to delete a todo item + public String delete() { + todoFacade.remove(todo); + return "success"; + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/beans/TodoList.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/beans/TodoList.java new file mode 100644 index 00000000..281f8884 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/beans/TodoList.java @@ -0,0 +1,60 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package beans; + +import data.Todo; +import services.TodoFacade; +import jakarta.annotation.PostConstruct; +import jakarta.ejb.EJB; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Named; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@Named("todoListBean") +@RequestScoped +public class TodoList implements Serializable { + // inner class to represent table layout + static public class ColumnModel implements Serializable { + private String header; + private String property; + + // columnmodel constructor + public ColumnModel(String header, String property) { + this.header = header; + this.property = property; + } + + // getters and setters + public String getHeader() { return header; } + public void setHeader(String header) { this.header = header; } + + public String getProperty() { return property; } + public void setProperty(String property) { this.property = property; } + } + + @EJB + private TodoFacade todoFacade; + private List todoList; + private List columns; + + @PostConstruct + public void postConstruct() { + columns = new ArrayList<>(); + columns.add(new ColumnModel("Category", "category")); + columns.add(new ColumnModel("Description", "description")); + columns.add(new ColumnModel("Priority", "priority")); + + todoList = todoFacade.findAll(); + } + + + public List getTodoList() { return todoList; } + public void setTodoList(List todoList) { this.todoList = todoList; } + + public List getColumnModel() { return columns; } + public void setColumnModel(List columns) { this.columns = columns; } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/com/mycompany/assignment5/JAXRSConfiguration.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/com/mycompany/assignment5/JAXRSConfiguration.java new file mode 100644 index 00000000..2c8d949e --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/com/mycompany/assignment5/JAXRSConfiguration.java @@ -0,0 +1,13 @@ +package com.mycompany.assignment5; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures JAX-RS for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JAXRSConfiguration extends Application { + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/com/mycompany/assignment5/resources/JavaEE8Resource.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/com/mycompany/assignment5/resources/JavaEE8Resource.java new file mode 100644 index 00000000..52b3d6b3 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/com/mycompany/assignment5/resources/JavaEE8Resource.java @@ -0,0 +1,20 @@ +package com.mycompany.assignment5.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("javaee8") +public class JavaEE8Resource { + + @GET + public Response ping(){ + return Response + .ok("ping") + .build(); + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/data/Todo.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/data/Todo.java new file mode 100644 index 00000000..f7b48c45 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/data/Todo.java @@ -0,0 +1,50 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package data; + +import jakarta.persistence.*; + +import java.io.Serializable; + +/** + * + * @author andrew + */ +@Entity +@Table(name="todo") +public class Todo implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name="ID") + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + private String category; + private String description; + private int priority; + + // empty constructor + public Todo() {} + + // constructor with all fields + public Todo(Long id, String category, String description, int priority) { + this.id = id; + this.category = category; + this.description = description; + this.priority = priority; + } + + // Getters and setters + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public int getPriority() { return priority; } + public void setPriority(int priority) { this.priority = priority; } + + public String getCategory() { return category; } + public void setCategory(String category) { this.category= category; } + + public String getDescription() { return description; } + public void setDescription(String description) { this.description= description; } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/services/AbstractFacade.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/services/AbstractFacade.java new file mode 100644 index 00000000..f35db3eb --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/services/AbstractFacade.java @@ -0,0 +1,64 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package services; + +import java.util.List; +import jakarta.persistence.EntityManager; + +/** + * + * @author andrew + * @param + */ +public abstract class AbstractFacade { + + private Class entityClass; + + public AbstractFacade(Class entityClass) { + this.entityClass = entityClass; + } + + protected abstract EntityManager getEntityManager(); + + public void create(T entity) { + getEntityManager().persist(entity); + getEntityManager().flush(); + } + + public void edit(T entity) { + getEntityManager().merge(entity); + } + + public void remove(T entity) { + getEntityManager().remove(getEntityManager().merge(entity)); + } + + public T find(Object id) { + return getEntityManager().find(entityClass, id); + } + + public List findAll() { + jakarta.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); + cq.select(cq.from(entityClass)); + return getEntityManager().createQuery(cq).getResultList(); + } + + public List findRange(int[] range) { + jakarta.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); + cq.select(cq.from(entityClass)); + jakarta.persistence.Query q = getEntityManager().createQuery(cq); + q.setMaxResults(range[1] - range[0] + 1); + q.setFirstResult(range[0]); + return q.getResultList(); + } + + public int count() { + jakarta.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); + jakarta.persistence.criteria.Root rt = cq.from(entityClass); + cq.select(getEntityManager().getCriteriaBuilder().count(rt)); + jakarta.persistence.Query q = getEntityManager().createQuery(cq); + return ((Long) q.getSingleResult()).intValue(); + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/services/TodoFacade.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/services/TodoFacade.java new file mode 100644 index 00000000..81888289 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/java/services/TodoFacade.java @@ -0,0 +1,30 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package services; + +import data.Todo; +import jakarta.ejb.Stateless; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; + +/** + * + * @author andrew + */ +@Stateless +public class TodoFacade extends AbstractFacade { + @PersistenceContext(unitName = "MyPu") + private EntityManager em; + + @Override + protected EntityManager getEntityManager() { + return em; + } + + public TodoFacade() { + super(Todo.class); + } + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/resources/META-INF/persistence.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..23f3b551 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,11 @@ + + + + + jdbc/softeng + false + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/beans.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 00000000..d581aa76 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/faces-config.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 00000000..d51435ff --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,52 @@ + + + + + + + /todo.xhtml + + success + /index.xhtml + + + + + /edit.xhtml + + success + /index.xhtml + + + + + /delete.xhtml + + success + /index.xhtml + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/glassfish-web.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 00000000..584a477e --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/web.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..8aec7950 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,44 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + + + 30 + + + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + faces/index.xhtml + + + + eot + application/vnd.ms-fontobject + + + ttf + application/x-font-ttf + + + woff + application/x-font-woff + + + woff2 + application/x-font-woff2 + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/delete.xhtml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/delete.xhtml new file mode 100644 index 00000000..11998122 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/delete.xhtml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/edit.xhtml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/edit.xhtml new file mode 100644 index 00000000..79ea5c46 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/edit.xhtml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/index.xhtml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/index.xhtml new file mode 100644 index 00000000..ada1555f --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/index.xhtml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/todo.xhtml b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/todo.xhtml new file mode 100644 index 00000000..29eec246 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment5/assignment5/src/main/webapp/todo.xhtml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/Assignment 6 WebSocket.pdf b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/Assignment 6 WebSocket.pdf new file mode 100644 index 00000000..5a421f8e Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/Assignment 6 WebSocket.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.classpath b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.classpath new file mode 100644 index 00000000..df66b20f --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.classpath @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/.gitignore b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/compiler.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/compiler.xml new file mode 100644 index 00000000..952ae4b1 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/encodings.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/encodings.xml new file mode 100644 index 00000000..aa00ffab --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/jarRepositories.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/jarRepositories.xml new file mode 100644 index 00000000..712ab9d9 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/misc.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/misc.xml new file mode 100644 index 00000000..67e1e611 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.project b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.project new file mode 100644 index 00000000..2acc51a3 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.project @@ -0,0 +1,34 @@ + + + assignment6 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1700926764939 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.core.resources.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..839d647e --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.jdt.apt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..d4313d4b --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.jdt.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..c9d1e553 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.m2e.core.prefs b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/nb-configuration.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/nb-configuration.xml new file mode 100644 index 00000000..8b4b8474 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 9.1-web + gfv610ee9 + ide + JDK_17 + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/pom.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/pom.xml new file mode 100644 index 00000000..2c460a4f --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/pom.xml @@ -0,0 +1,76 @@ + + 4.0.0 + com.mycompany + assignment6 + 1.0-SNAPSHOT + war + assignment6-1.0-SNAPSHOT + + + ${project.build.directory}/endorsed + UTF-8 + false + 10.0.0 + + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + jar + + + + + + + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/com/mycompany/assignment6/JAXRSConfiguration.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/com/mycompany/assignment6/JAXRSConfiguration.java new file mode 100644 index 00000000..b91a2e64 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/com/mycompany/assignment6/JAXRSConfiguration.java @@ -0,0 +1,13 @@ +package com.mycompany.assignment6; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures JAX-RS for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JAXRSConfiguration extends Application { + +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/com/mycompany/assignment6/resources/JavaEE8Resource.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/com/mycompany/assignment6/resources/JavaEE8Resource.java new file mode 100644 index 00000000..4b5cadfb --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/com/mycompany/assignment6/resources/JavaEE8Resource.java @@ -0,0 +1,20 @@ +package com.mycompany.assignment6.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("javaee8") +public class JavaEE8Resource { + + @GET + public Response ping(){ + return Response + .ok("ping") + .build(); + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/model/User.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/model/User.java new file mode 100644 index 00000000..1de1b228 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/model/User.java @@ -0,0 +1,26 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package model; + +/** + * + * @author andrew + */ +public class User { + private String username; + private String forum; // the forum to which the user belongs + + public User(String username, String forum) { + this.username = username; + this.forum = forum; + } + + // getters and setters + public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } + + public String getForum() { return forum; } + public void setForum(String forum) { this.forum = forum; } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/websocket/UserSessionHandler.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/websocket/UserSessionHandler.java new file mode 100644 index 00000000..e8602ca0 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/websocket/UserSessionHandler.java @@ -0,0 +1,110 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package websocket; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; +import jakarta.json.JsonObjectBuilder; +import jakarta.json.spi.JsonProvider; +import jakarta.websocket.Session; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; +import model.User; + +/** + * + * @author andrew + */ + +@ApplicationScoped +public class UserSessionHandler { + + // contains the sessions connected + private final Set sessions = new HashSet<>(); + + // key = session id, value = forum name + private final HashMap sessionForums = new HashMap<>(); + + // key = forum name, value = posts on that forum + private final HashMap> forumPosts = new HashMap<>(); + + // method to update a forum + public void updateForum(String forum, String message) { + // add the forum to forumPosts if it's not already there + forumPosts.putIfAbsent(forum, new ArrayList<>()); + + // add message to forumPosts + forumPosts.get(forum).add(message); + + // build a json object to send to the connected sessions containing all the update information + JsonProvider provider = JsonProvider.provider(); + JsonObjectBuilder jsonObj = provider.createObjectBuilder() + .add("action", "update") + .add("posts", forumPosts.get(forum).get(forumPosts.get(forum).size() -1)); + + // update all connected sessions with the json object + sendToAllConnectedSessionsByForum(jsonObj.build(), forum); + } + + public void addSession(Session session) { + sessions.add(session); + } + + // method to add a user session to a particular forum + public void addSessionToForum(Session session, User user) { + sessionForums.put(session.getId(), user.getForum()); + + JsonObject joinMessage = createJoinMessage(user); + sendToSession(session, joinMessage); + } + + public void removeSession(Session session) { sessions.remove(session); } + + private JsonObject createJoinMessage(User user) { + JsonProvider provider = JsonProvider.provider(); + + JsonObjectBuilder joinMessage = provider.createObjectBuilder() + .add("action", "join") + .add("username", user.getUsername()) + .add("forum", user.getForum()); + + // if the forum is already in forumPosts, add its posts to the joinMessage + if (forumPosts.containsKey(user.getForum())) { + JsonArrayBuilder posts = provider.createArrayBuilder(forumPosts.get(user.getForum())); + joinMessage.add("posts", posts); + } + // otherwise, add an empty posts array to the joinMessage + else { + JsonArrayBuilder postArr = provider.createArrayBuilder(); + joinMessage.add("posts", postArr); + } + + return joinMessage.build(); + } + + // method to send data to all the sessions connected to a given forum + private void sendToAllConnectedSessionsByForum(JsonObject jsonObj, String forum) { + // loop over each connected session + for (Session session : sessions) { + // if the session's id corresponds to the given forum, send the data to the session + // Check if the session's id is in sessionForums + if (sessionForums.get(session.getId()).equals(forum)) { + sendToSession(session, jsonObj); + } + } + } + + private void sendToSession(Session session, JsonObject message) { + try { + session.getBasicRemote().sendText(message.toString()); + } catch (IOException e) { + System.out.println("session could not be reached"); + } + } +} \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/websocket/UserWebSocketServer.java b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/websocket/UserWebSocketServer.java new file mode 100644 index 00000000..cfcf448c --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/java/websocket/UserWebSocketServer.java @@ -0,0 +1,63 @@ +package websocket; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.json.JsonReader; +import jakarta.json.Json; +import jakarta.json.JsonObject; +import jakarta.websocket.OnClose; +import jakarta.websocket.OnError; +import jakarta.websocket.OnMessage; +import jakarta.websocket.OnOpen; +import jakarta.websocket.Session; +import jakarta.websocket.server.ServerEndpoint; +import java.io.StringReader; +import java.util.logging.Level; +import java.util.logging.Logger; +import model.User; + +/** + * + * @author andrew + */ + + +@ApplicationScoped +@ServerEndpoint("/actions") +public class UserWebSocketServer { + @Inject + private UserSessionHandler sessionHandler; + + @OnOpen + public void open(Session session) { + sessionHandler.addSession(session); + } + + @OnClose + public void close(Session session) { + sessionHandler.removeSession(session); + } + + @OnError + public void onError(Throwable error) { Logger.getLogger(UserWebSocketServer.class.getName()).log(Level.SEVERE, null, error); } + + @OnMessage + public void handleMessage(String message, Session session) { + try (JsonReader reader = Json.createReader(new StringReader(message))) { + JsonObject jsonMessage = reader.readObject(); + + // if action is "join", instantiate a new user + if ("join".equals(jsonMessage.getString("action"))) { + User user = new User(jsonMessage.getString("username"), jsonMessage.getString("forum")); + + sessionHandler.addSession(session); + sessionHandler.addSessionToForum(session, user); + } + + // if action is "update", update the specified forum with the message + if ("update".equals(jsonMessage.getString("action"))) { + sessionHandler.updateForum(jsonMessage.getString("forum"), jsonMessage.getString("message")); + } + } + } +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/resources/META-INF/persistence.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..f9d1b69a --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/beans.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 00000000..93000aa9 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/glassfish-web.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 00000000..673cc06f --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/web.xml b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..0f0edeff --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + + + 30 + + + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/index.html b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/index.html new file mode 100644 index 00000000..0d03a54c --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/index.html @@ -0,0 +1,28 @@ + + + + Select Forum + + + + + +
+

Choose the Forum you want to join

+

username

+ + + + +
+ + +
+ + diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/websocket.js b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/websocket.js new file mode 100644 index 00000000..aa75a907 --- /dev/null +++ b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6/src/main/webapp/websocket.js @@ -0,0 +1,81 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/JavaScript.js to edit this template + */ + +// socket for the session +var socket; + +function onMessage(event) { + var data = JSON.parse(event.data); + + // if the action is "join", create the forum on the index.html page + if (data.action === "join") { + document.getElementById("content").innerHTML = + "

" + data.forum + "


" + + "
" + + "

Post a comment on the forum

" + + "" + + // make the button always pass the correct forum and username to the onButtonClick method + ""; + + var messagebox = document.getElementById("messagebox"); + + // looping over each post in the event data and appending it to the messagebox + for(let post of data.posts){ + document.getElementById("messagebox").innerHTML += post + "\n"; + } + } + + // else if action is "update", update the textarea with the posts in the data object + else if (data.action === "update") { + document.getElementById("messagebox").innerHTML += data.posts + "\n"; + } +} + +// function that's ran when the post button is clicked +function onButtonClick(forum, username) { + var messageData = { + action: "update", + // data will be guaranteed to be defined if the button exists to be clicked, as it is only created in onMessage() + forum: forum, + // prepending the user's username onto the message for convenience + // since there is no real signing-in, we will never need to know who posted which message except for displaying it + message: username + ": " + document.getElementById("inputbox").value + }; + + socket.send(JSON.stringify(messageData)); + + // reset the inputbox to be empty + document.getElementById("inputbox").value = ""; +} + + +function showForm(){ document.getElementById("forumForm").style.display = ""; } + +function hideForm() { document.getElementById("forumForm").style.display = "none"; } + +function formSubmit() { + // request to open a websocket with the server application + socket = new WebSocket("ws://localhost:8080/assignment6/actions"); + + // define the socket's onopen function + socket.onopen = () => { + // user data to send to the server + var user = { + action: "join", + username: document.getElementById("forumForm").elements["username"].value, + forum: document.getElementById("forumForm").elements["forum"].value + }; + + // hide the form and reset it + hideForm(); + document.getElementById("forumForm").reset(); + + // send user data to the server to be instantiated + socket.send(JSON.stringify(user)); + }; + + // set socket's onmessage function + socket.onmessage = onMessage; +} diff --git a/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6_Andrew_Hayes.zip b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6_Andrew_Hayes.zip new file mode 100644 index 00000000..b8300726 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/assignments/assignment6/assignment6_Andrew_Hayes.zip differ diff --git a/third/semester1/CT5106: Software Engineering II/slides/1 introduction and getting started.pdf b/third/semester1/CT5106: Software Engineering II/slides/1 introduction and getting started.pdf new file mode 100644 index 00000000..d73302d6 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/slides/1 introduction and getting started.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/slides/2 Servlets.pdf b/third/semester1/CT5106: Software Engineering II/slides/2 Servlets.pdf new file mode 100644 index 00000000..6ef631f7 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/slides/2 Servlets.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/slides/3 Java Server Pages.pdf b/third/semester1/CT5106: Software Engineering II/slides/3 Java Server Pages.pdf new file mode 100644 index 00000000..048d86fb Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/slides/3 Java Server Pages.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/slides/4 JPA.pdf b/third/semester1/CT5106: Software Engineering II/slides/4 JPA.pdf new file mode 100644 index 00000000..621e2ef3 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/slides/4 JPA.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/slides/7 JPA and Session Beans.pdf b/third/semester1/CT5106: Software Engineering II/slides/7 JPA and Session Beans.pdf new file mode 100644 index 00000000..9c259f87 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/slides/7 JPA and Session Beans.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/slides/week 10 WebSocket.pdf b/third/semester1/CT5106: Software Engineering II/slides/week 10 WebSocket.pdf new file mode 100644 index 00000000..faffff69 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/slides/week 10 WebSocket.pdf differ diff --git a/third/semester1/CT5106: Software Engineering II/slides/week 8 JSF.pdf b/third/semester1/CT5106: Software Engineering II/slides/week 8 JSF.pdf new file mode 100644 index 00000000..7d4c6980 Binary files /dev/null and b/third/semester1/CT5106: Software Engineering II/slides/week 8 JSF.pdf differ