diff --git a/.gitignore b/.gitignore
index 65e59ee..518ae06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -100,3 +100,7 @@
/Semester 3/Assignments/params/target/
/Semester 3/Assignments/templatesMatricesSample/target/
/Semester 3/Assignments/StockBrokerAjaxThreads/target/
+/Semester 3/Assignments/Ajax11_idientifiers/target/
+/Semester 3/Assignments/Json1/target/
+/Semester 3/Assignments/TermProject1_CalebFontenot copy/target/
+/Semester 3/Assignments/TermProject2_CalebFontenot/target/
diff --git a/Semester 3/Assignments/Ajax11_idientifiers.zip b/Semester 3/Assignments/Ajax11_idientifiers.zip
new file mode 100644
index 0000000..05c35d4
Binary files /dev/null and b/Semester 3/Assignments/Ajax11_idientifiers.zip differ
diff --git a/Semester 3/Assignments/Ajax11_idientifiers/nb-configuration.xml b/Semester 3/Assignments/Ajax11_idientifiers/nb-configuration.xml
new file mode 100644
index 0000000..f7b0362
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 10-web
+ gfv700ee10
+ Facelets
+ JDK_15__System_
+
+
diff --git a/Semester 3/Assignments/Ajax11_idientifiers/pom.xml b/Semester 3/Assignments/Ajax11_idientifiers/pom.xml
new file mode 100644
index 0000000..e64b8b0
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/pom.xml
@@ -0,0 +1,48 @@
+
+ 4.0.0
+ asdv
+ Ajax11_idientifiers
+ 1
+ war
+ Ajax11_idientifiers-1
+
+
+ UTF-8
+ 10.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+ org.primefaces
+ primefaces
+ 12.0.0
+ jakarta
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 11
+ 11
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.3.2
+
+
+
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/asdv/ajax11_idientifiers/JakartaRestConfiguration.java b/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/asdv/ajax11_idientifiers/JakartaRestConfiguration.java
new file mode 100644
index 0000000..c403e2f
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/asdv/ajax11_idientifiers/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package asdv.ajax11_idientifiers;
+
+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/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/asdv/ajax11_idientifiers/resources/JakartaEE10Resource.java b/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/asdv/ajax11_idientifiers/resources/JakartaEE10Resource.java
new file mode 100644
index 0000000..700d0ab
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/asdv/ajax11_idientifiers/resources/JakartaEE10Resource.java
@@ -0,0 +1,20 @@
+package asdv.ajax11_idientifiers.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/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/beans/AjaxBean.java b/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/beans/AjaxBean.java
new file mode 100644
index 0000000..89abb7a
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/src/main/java/beans/AjaxBean.java
@@ -0,0 +1,34 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+package beans;
+
+import jakarta.inject.Named;
+import jakarta.enterprise.context.RequestScoped;
+
+/**
+ *
+ * @author asdv5
+ */
+@Named(value = "ajaxBean")
+@RequestScoped
+public class AjaxBean
+{
+ private String name;
+ private int age;
+ private String notExecuted = "never replaced";
+
+ public String getNotExecuted(){return notExecuted;}
+
+ public void setNotExecuted(String notExecuted)
+ {this.notExecuted = notExecuted;}
+
+ public int getAge(){return age;}
+
+ public void setAge(int age){this.age = age;}
+
+ public String getName(){return name;}
+
+ public void setName(String name){this.name = name; }
+}
diff --git a/Semester 3/Assignments/Ajax11_idientifiers/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/Ajax11_idientifiers/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..7582bf1
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..673cc06
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/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/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..fcfcd54
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+
+
+
+ jakarta.faces.PROJECT_STAGE
+ Development
+
+
+ Faces Servlet
+ jakarta.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ /faces/*
+
+
+
+ 30
+
+
+
+ faces/index.xhtml
+
+
diff --git a/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/index.xhtml b/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..351ca1c
--- /dev/null
+++ b/Semester 3/Assignments/Ajax11_idientifiers/src/main/webapp/index.xhtml
@@ -0,0 +1,42 @@
+
+
+
+
+ Ajax 11
+
+
+
+ Name:
+ Age:
+ Not executed:
+
+
+
+
+
+
+
+
+
+
+
+
+ Name:
+ Age:
+ Not executed:
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/Json1.zip b/Semester 3/Assignments/Json1.zip
new file mode 100644
index 0000000..ae08dfc
Binary files /dev/null and b/Semester 3/Assignments/Json1.zip differ
diff --git a/Semester 3/Assignments/Json1/nb-configuration.xml b/Semester 3/Assignments/Json1/nb-configuration.xml
new file mode 100644
index 0000000..f7b0362
--- /dev/null
+++ b/Semester 3/Assignments/Json1/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 10-web
+ gfv700ee10
+ Facelets
+ JDK_15__System_
+
+
diff --git a/Semester 3/Assignments/Json1/pom.xml b/Semester 3/Assignments/Json1/pom.xml
new file mode 100644
index 0000000..d4f7ccb
--- /dev/null
+++ b/Semester 3/Assignments/Json1/pom.xml
@@ -0,0 +1,42 @@
+
+ 4.0.0
+ asdv
+ Json1
+ 1
+ war
+ Json1
+
+
+ UTF-8
+ 10.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 11
+ 11
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.3.2
+
+
+
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/Json1/src/main/java/asdv/mavenproject3/JakartaRestConfiguration.java b/Semester 3/Assignments/Json1/src/main/java/asdv/mavenproject3/JakartaRestConfiguration.java
new file mode 100644
index 0000000..cd07923
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/java/asdv/mavenproject3/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package asdv.mavenproject3;
+
+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/Semester 3/Assignments/Json1/src/main/java/asdv/mavenproject3/resources/JakartaEE10Resource.java b/Semester 3/Assignments/Json1/src/main/java/asdv/mavenproject3/resources/JakartaEE10Resource.java
new file mode 100644
index 0000000..c2eb169
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/java/asdv/mavenproject3/resources/JakartaEE10Resource.java
@@ -0,0 +1,20 @@
+package asdv.mavenproject3.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/Semester 3/Assignments/Json1/src/main/java/jason/Jason.java b/Semester 3/Assignments/Json1/src/main/java/jason/Jason.java
new file mode 100644
index 0000000..f378433
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/java/jason/Jason.java
@@ -0,0 +1,225 @@
+/*
+ * 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 jason;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import jakarta.json.Json;
+import jakarta.json.JsonArray;
+import jakarta.json.JsonArrayBuilder;
+import jakarta.json.JsonNumber;
+import jakarta.json.JsonObject;
+import jakarta.json.JsonObjectBuilder;
+import jakarta.json.JsonString;
+import jakarta.json.JsonValue;
+import jakarta.json.JsonWriter;
+import jakarta.json.stream.JsonParser;
+import java.util.ArrayList;
+
+/**
+ *
+ * @author ASDV2
+ */
+public class Jason
+{
+ public static JsonObject createObject()
+ {
+
+ JsonObject model = Json.createObjectBuilder()
+ .add("firstName", "Duke")
+ .add("lastName", "Java")
+ .add("age", 18)
+ .add("streetAddress", "100 Internet Dr")
+ .add("city", "JavaTown")
+ .add("state", "JA")
+ .add("postalCode", "12345")
+ .add("phoneNumbers", Json.createArrayBuilder()
+ .add(Json.createObjectBuilder().add("type", "mobile").add("number", "111-111-1111"))
+ .add(Json.createObjectBuilder().add("type", "home").add("number", "222-222-2222")))
+ .build();
+ return model;
+ }
+
+ public static JsonObject createDukeObject()
+ {
+ /*
+ JsonObjectBuilder job = Json.createObjectBuilder();
+
+ job = job.add("firstName", "Duke");
+ job = job.add("lastName", "Java");
+
+ JsonObject modelPartial = job.build();
+ return modelPartial;
+ */
+ JsonArrayBuilder jab = Json.createArrayBuilder();
+ //one array
+ jab = jab.add( //1st object
+ Json.createObjectBuilder()
+ .add("type", "mobile")
+ .add("number", "111-111-1111"))
+ //2nd object
+ .add(
+ Json.createObjectBuilder()
+ .add("type", "home")
+ .add("number", "222-222-2222")
+ );
+ JsonObject model = Json.createObjectBuilder()
+ .add("firstName", "Duke")
+ .add("lastName", "Java")
+ .add("age", 18)
+ .add("streetAddress", "100 Internet Dr")
+ .add("city", "JavaTown")
+ .add("state", "JA")
+ .add("postalCode", "12345")
+ .add("phoneNumbers", jab)
+ /*
+ .add(
+ Json.createObjectBuilder()
+ .add("type", "home")
+ .add("number", "222-222-2222")
+ )
+ */
+ .build();
+ return model;
+ }
+
+ public static ArrayList navigateTree(JsonValue tree, String key, ArrayList list)
+ {
+ if (key != null)
+ {
+ System.out.print("Key " + key + ": ");
+ list.add("Key " + key + ": ");
+ }
+ switch (tree.getValueType())
+ {
+ case OBJECT:
+ System.out.println("OBJECT");
+ list.add("OBJECT");
+ JsonObject object = (JsonObject) tree;
+ for (String name : object.keySet())
+ {
+ navigateTree(object.get(name), name, list);
+ }
+ break;
+ case ARRAY:
+ System.out.println("ARRAY");
+ list.add("ARRAY");
+ JsonArray array = (JsonArray) tree;
+ for (JsonValue val : array)
+ {
+ navigateTree(val, null, list);
+ }
+ break;
+ case STRING:
+ JsonString st = (JsonString) tree;
+ System.out.println("STRING " + st.getString());
+ list.add("STRING" + st.getString() ) ;
+ break;
+ case NUMBER:
+ JsonNumber num = (JsonNumber) tree;
+ System.out.println("NUMBER " + num.toString());
+ list.add("NUMBER" + num.toString() ) ;
+ break;
+ case TRUE:
+ case FALSE:
+ case NULL:
+ System.out.println(tree.getValueType().toString());
+ list.add(tree.getValueType().toString());
+ break;
+ }
+ return list;
+ }
+
+ public static String getJsonString(JsonObject jo)
+ {
+ StringWriter stWriter = new StringWriter();
+ JsonWriter jsonWriter = Json.createWriter(stWriter);
+ jsonWriter.writeObject(jo);
+ jsonWriter.close();
+ String jsonData = stWriter.toString();
+ return jsonData;
+ }
+
+ public static String parseObject(JsonObject jo)
+ {
+ JsonParser parser = Json.createParser( new StringReader(jo.toString()) );
+ String s = "";
+ while (parser.hasNext())
+ {
+ JsonParser.Event event = parser.next();
+ switch (event)
+ {
+ case START_ARRAY:
+ case END_ARRAY:
+ case START_OBJECT:
+ case END_OBJECT:
+ case VALUE_FALSE:
+ case VALUE_NULL:
+ case VALUE_TRUE:
+ s += "\n" + event.toString() + "\n";
+ break;
+ case KEY_NAME:
+ s += event.toString() + " "
+ + parser.getString() + " - ";
+ break;
+ case VALUE_STRING:
+ case VALUE_NUMBER:
+ s += event.toString() + " "
+ + parser.getString();
+ break;
+ }
+ }
+ return s;
+ }
+
+ public static String testCreateComplexObject()
+ {
+ JsonObjectBuilder jsonObjectBuilder = Json.createObjectBuilder();
+ jsonObjectBuilder.add("emp_name", "John");
+ jsonObjectBuilder.add("emp_id", 1016);
+ jsonObjectBuilder.add("salary", 80000);
+
+ //> create Json array with only values
+ JsonArrayBuilder jab = Json.createArrayBuilder();
+ jab.add("Nick");
+ jab.add("John");
+ jab.add(888);
+ JsonArray ja = jab.build();
+ //> the array got created,
+ //add it to the json as a child element
+ jsonObjectBuilder.add("direct_contacts", ja);
+ //> create an array of key-value pairs
+ JsonArrayBuilder kvArrBld = Json.createArrayBuilder();
+ // create each key-value pair as seperate object and add it to the array
+ kvArrBld.add(Json.createObjectBuilder().add("email", "java2novice@gmail.com").build());
+ kvArrBld.add(Json.createObjectBuilder().add("mobile", "123123123123").build());
+ JsonArray contactsArr = kvArrBld.build();
+ // add contacts array object
+ jsonObjectBuilder.add("contacts", contactsArr);
+ JsonObject empObj = jsonObjectBuilder.build();
+ // Write to String writer.
+ // if you want you can write it to a file as well
+ StringWriter strWtr = new StringWriter();
+ JsonWriter jsonWtr = Json.createWriter(strWtr);
+ jsonWtr.writeObject(empObj);
+ jsonWtr.close();
+ System.out.println(strWtr.toString());
+ System.out.println("calling the method getJsonString()");
+ System.out.println(getJsonString(empObj));
+ return empObj.toString();
+ }
+
+ public static void main(String[] args)
+ {
+ JsonObject jo = createObject();
+ System.out.println(jo);
+ //JsonObject jo = createDukeObject();
+ //System.out.println(jo);
+ //navigateTree(jo, null);
+ //System.out.println(getJsonString(jo));
+ //System.out.println(parseObject(jo));
+ //testCreateComplexObject();
+ }
+}
\ No newline at end of file
diff --git a/Semester 3/Assignments/Json1/src/main/java/jason/JsonBean.java b/Semester 3/Assignments/Json1/src/main/java/jason/JsonBean.java
new file mode 100644
index 0000000..d27cf5b
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/java/jason/JsonBean.java
@@ -0,0 +1,81 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+package jason;
+
+import jakarta.inject.Named;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.json.JsonObject;
+import jakarta.json.JsonValue;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+/**
+ *
+ * @author asdv5
+ */
+@Named(value = "jsonBean")
+@RequestScoped
+public class JsonBean
+{
+ private String s;
+ private String fromWriter;
+ private String fromParser;
+ private String complexObject;
+ private String suppliersObject;
+
+ private ArrayList list = new ArrayList();
+
+ public JsonBean()
+ {
+ s = Jason.createObject().toString();
+ list = Jason.navigateTree(JsonValue.TRUE, s, list);
+
+ list = Jason.navigateTree(Jason.createObject(), null, list);
+
+ fromWriter = Jason.getJsonString(Jason.createObject());
+ fromParser = Jason.parseObject(Jason.createObject());
+ complexObject = Jason.testCreateComplexObject();
+ suppliersObject = JsonSupplier.getSuppliersJsonObject();
+ }
+ public String getS()
+ {
+ return s;
+ }
+ public ArrayList getList()
+ {
+ return list;
+ }
+
+ public String getFromWriter()
+ {
+ return fromWriter;
+ }
+
+ public String getFromParser()
+ {
+ return fromParser;
+ }
+
+ public String getComplexObject() {
+ return complexObject;
+ }
+
+ public String getSuppliersObject() {
+ return suppliersObject;
+ }
+
+
+ public void writeSuppliersToFile() throws FileNotFoundException{
+ JsonObject jo = JsonSupplier.createJsonObjectFromString(this.suppliersObject);
+ JsonSupplier.writeJsonToTextFile(jo);
+ }
+ public void readSuppliersFromFile() throws FileNotFoundException {
+ JsonObject jo = JsonSupplier.readFileIntoJson("jason.json");
+ s = jo.toString();
+ }
+
+}
diff --git a/Semester 3/Assignments/Json1/src/main/java/jason/JsonSupplier.java b/Semester 3/Assignments/Json1/src/main/java/jason/JsonSupplier.java
new file mode 100644
index 0000000..5d2c3e5
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/java/jason/JsonSupplier.java
@@ -0,0 +1,160 @@
+package jason;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import jakarta.json.Json;
+import jakarta.json.JsonArray;
+import jakarta.json.JsonArrayBuilder;
+import jakarta.json.JsonObject;
+import jakarta.json.JsonObjectBuilder;
+import jakarta.json.JsonReader;
+import jakarta.json.JsonValue;
+import jakarta.json.JsonWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.util.Scanner;
+
+public class JsonSupplier {
+ /**
+ * Creates a JsonObject by traversing the arrayList of LinkedHashMap
+ *
+ * @param suppliers ArrayList of LinkedHashMap. Each element of the
+ * arrayList is a row of suppliers table. The key of the LinkedHashMap is
+ * the attribute name and the value of the attribute Example ( One liked
+ * hash map is one row from the table) LinkedHashMap 1 : key: snumber,
+ * value: s1 key: sname, value: white key: status, value: 20 key: city,
+ * value London LinkedHashMap 2 : key: snumber, value: s2 key: sname, value:
+ * black key: status, value: 30 key: city, value Paris The value of the map
+ * @return JsonObject
+ */
+ public static JsonObject createJsonObjectForSuppliers(ArrayList< LinkedHashMap> suppliers) {
+ JsonObjectBuilder jsonBuilder = Json.createObjectBuilder();
+ int counter = 1;
+ for (LinkedHashMap supplier : suppliers)
+ {
+ // create an array of key-value pairs
+ JsonArrayBuilder arraySupplierBld = Json.createArrayBuilder();
+ // create each key-value pair as seperate object and add it to the array
+ Set> entrySet = supplier.entrySet();
+ for (Map.Entry entry : entrySet)
+ {
+ arraySupplierBld.add(Json.createObjectBuilder().add(entry.getKey(),
+ entry.getValue()).build());
+ }
+ // add supplier-array to object
+ String objectID = "+" + (counter++);
+ jsonBuilder.add(objectID, arraySupplierBld);
+ }
+
+ JsonObject allSuppliersJsonObject = jsonBuilder.build();
+ return allSuppliersJsonObject;
+ }
+
+ /**
+ * Creates a JsonObject by reading the String data in JSON format
+ *
+ * @param jsonData Json format data
+ * @return JsonObject
+ */
+ public static JsonObject createJsonObjectFromString(String jsonData) {
+ JsonReader jsonReader = Json.createReader(new StringReader(jsonData));
+ JsonObject o = jsonReader.readObject();
+ return o;
+ }
+
+ /**
+ * Creates a LinkedHashMap of 4 ENTRYies.Keys name: snumber, sname, status
+ * and city. Values of map are the parameters.
+ *
+ * @param snumber value of map
+ * @param sname value of map
+ * @param status value of map
+ * @param city value of map
+ * @return
+ */
+ public static LinkedHashMap createMapOfSupplier(
+ String snumber,
+ String sname,
+ String status,
+ String city
+ )
+ {
+ LinkedHashMap mapSupplier
+ = new LinkedHashMap();
+ mapSupplier.put("snumber", snumber);
+ mapSupplier.put("sname", sname);
+ mapSupplier.put("status", status);
+ mapSupplier.put("city", city);
+
+ return mapSupplier;
+ }
+
+ public static String getSuppliersJsonObject(){
+ ArrayList< LinkedHashMap> suppliers = new ArrayList();
+ for (int i = 1; i <= 2; ++i)
+ {
+ LinkedHashMap oneSupplierRowOfTable
+ = createMapOfSupplier(
+ "s1" + i,
+ "Johnson" + i,
+ Integer.toString(20 + i),
+ "london" + i);
+ suppliers.add(oneSupplierRowOfTable);
+ }
+
+ JsonObject j = createJsonObjectForSuppliers(suppliers);
+ return j.toString();
+ }
+
+ public static void main(String a[]) {
+ ArrayList< LinkedHashMap> suppliers = new ArrayList<>();
+ for (int i = 1; i <= 2; ++i)
+ {
+ LinkedHashMap oneSupplierRowOfTable
+ = createMapOfSupplier(
+ "s1" + i,
+ "Johnson" + i,
+ Integer.toString(20 + i),
+ "london" + i);
+ suppliers.add(oneSupplierRowOfTable);
+ }
+
+ JsonObject j = createJsonObjectForSuppliers(suppliers);
+
+ StringWriter strWtr = new StringWriter();
+ JsonWriter jsonWtr = Json.createWriter(strWtr);
+ jsonWtr.writeObject(j);
+ String s = strWtr.toString();
+ System.out.println(s);
+ jsonWtr.close();
+ /*
+ JSONobj.readJASONdataUsingParser(strWtr.toString());
+
+ JsonObject o = createJsonObjectFromString(strWtr.toString());
+ System.out.println("------------------------------------------------");
+ JSONobj.writeObjectModelToStream(o);
+ */
+ }
+ public static void writeJsonToTextFile(JsonObject jo) throws FileNotFoundException {
+ String jsonString = Jason.getJsonString(jo);
+ PrintWriter output = new PrintWriter(new FileOutputStream("jason.json", true));
+ output.print(jsonString);
+ output.close();
+ }
+ public static JsonObject readFileIntoJson(String fileName) throws FileNotFoundException {
+ File file = new java.io.File(fileName);
+ Scanner input = new Scanner(file);
+ String joString = "";
+ while (!input.hasNext()) {
+ joString += input.next();
+ }
+ input.close();
+ JsonObject jo = createJsonObjectFromString(joString);
+ return jo;
+ }
+}
\ No newline at end of file
diff --git a/Semester 3/Assignments/Json1/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/Json1/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..7582bf1
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..584a477
--- /dev/null
+++ b/Semester 3/Assignments/Json1/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/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..678f793
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,26 @@
+
+
+
+ jakarta.faces.PROJECT_STAGE
+ Development
+
+
+ Faces Servlet
+ jakarta.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ /faces/*
+
+
+
+ 30
+
+
+
+ faces/index.xhtml
+
+
diff --git a/Semester 3/Assignments/Json1/src/main/webapp/index.xhtml b/Semester 3/Assignments/Json1/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..a6f64f7
--- /dev/null
+++ b/Semester 3/Assignments/Json1/src/main/webapp/index.xhtml
@@ -0,0 +1,21 @@
+
+
+
+
+ Facelet Title
+
+
+ #{jsonBean.s}
+
+ #{jsonBean.getList()}
+
+ #{jsonBean.fromWriter}
+
+ #{jsonBean.fromParser}
+
+ #{jsonBean.complexObject}
+
+ #{jsonBean.suppliersObject}
+
+
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/nb-configuration.xml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/nb-configuration.xml
new file mode 100644
index 0000000..5e1a2de
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/nb-configuration.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+ 10-web
+ gfv700ee10
+ Facelets
+
+
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/pom.xml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/pom.xml
new file mode 100644
index 0000000..1f17d19
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/pom.xml
@@ -0,0 +1,120 @@
+
+ 4.0.0
+ asdv
+ MP1_Ajax
+ 1
+ war
+ MP1_Ajax-1
+
+
+ 11
+ 11
+ ${project.build.directory}/endorsed
+ UTF-8
+ false
+ 10.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+ org.primefaces
+ primefaces
+ 13.0.2
+ jakarta
+
+
+
+
+ org.eclipse.persistence
+ org.eclipse.persistence.core
+ 2.7.12
+
+
+ org.eclipse.persistence
+ org.eclipse.persistence.asm
+ 9.4.0
+
+
+ org.eclipse.persistence
+ org.eclipse.persistence.antlr
+ 2.7.12
+
+
+ org.eclipse.persistence
+ org.eclipse.persistence.jpa
+ 2.7.12
+
+
+ org.eclipse.persistence
+ org.eclipse.persistence.jpa.jpql
+ 2.7.12
+
+
+ org.eclipse.persistence
+ org.eclipse.persistence.moxy
+ 2.7.12
+
+
+ org.eclipse.persistence
+ jakarta.persistence
+ 2.2.3
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 11
+ 11
+
+ ${endorsed.dir}
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 2.3
+
+ 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/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/Dao.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/Dao.java
new file mode 100644
index 0000000..788ccda
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/Dao.java
@@ -0,0 +1,25 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
+ */
+
+
+import asdv.mp1_ajax.pojos.Stock;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public interface Dao
+{
+ void create(T t);
+ void edit(T t);
+ void remove(T t);
+ T find(Object id);
+ List findAll();
+ List findRange(int[] range);
+ int count();
+}
+
+
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/JakartaRestConfiguration.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/JakartaRestConfiguration.java
new file mode 100644
index 0000000..c06b3d1
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package asdv.mp1_ajax;
+
+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/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/ManyToMany.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/ManyToMany.java
new file mode 100644
index 0000000..abced83
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/ManyToMany.java
@@ -0,0 +1,109 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
+ */
+package asdv.mp1_ajax.pojos;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ *
+ * @author A. V. Markou
+ * @param
+ * @param
+ */
+public interface ManyToMany
+{
+ /**
+ * Creates a Many to Many relationship between the parentLeft and the
+ * childrenRight. Example for ( Many1 a, Many2 1, 2, 3) it creates --> (a 1)
+ * ( a 2 ) ( a 3 ) and ( 1, a ), ( 2, a ), ( 3, a). No duplicate values of
+ * Many2 are allowed.
+ *
+ * @param parentLeft - exactly one Many1 object.
+ * @param childrenRight - one or more Many2 objects.
+ * @return the previous value associated with Many1, or null if there was no
+ * Many1 with the same "key".
+ * @throws ClassCastException - if the class of the specified Many1, or
+ * Many2 or value prevents it from being stored in this map( i,e Many1 is
+ * String and you pass an object)
+ * @throws NullPointerException - if the specified Many1 or Many2 is null
+ * and ManyToMany does not permit nulls as values.
+ * @throw IllegalArgumentException - if a duplicate exists in childrenRight
+ * list ( s1 --> p1,p2,p2 is not allowed).
+ * @return the previous value associated with parentLeft, or null if there
+ * was no childrenRight for parentLeft.
+ */
+ List add(Many1 parentLeft, Many2... childrenRight);
+
+ /**
+ * Returns the List of all left children of the parentRight.
+ *
+ * @param parentRight a parent at the RHS of the many to many relationship.
+ * @return the List of all left children of the parentRight.
+ * @throw IllegalArgumentException if the value of parameter parentRight
+ * does not exist in the RHS of the many to many relationship.
+ */
+ List getChildrenLeft(Many2 parentRight);
+
+ /**
+ * Returns the List of all right children of the parentLeft.
+ *
+ * @param parentLeft a parent at the LHS of the many to many relationship.
+ * @return the List of all right children of the parentLeft.
+ * @throws IllegalArgumentException if the value of parameter parentLeft
+ * does not exist on the LHS of the many to many relationship.
+ */
+ List getChildrenRight(Many1 parentLeft);
+
+ /**
+ * Returns a set of the Many1 elements that exist on the LHS of the many to
+ * many relationship.
+ *
+ * @return Set of Many1
+ */
+ Set getParentsLeft();
+
+ /**
+ * Returns a set of the Many2 elements that exist on the RHS of the many to
+ * many relationship.
+ *
+ * @return Set of Many2
+ */
+ Set getParentsRight();
+
+ /**
+ * Removes the many1 parameter from the LHS of the many relationship AND all
+ * its corresponding values that exist in the RHS of the many to many
+ * relationship. For example given: ( LHS e1: p1, p2 e2: p2, p3 RHS: p1: e1
+ * p2: e1, e2 p3: e2 after removing e1 from the LHS will results into: ( LHS
+ * e2: p2, p3 RHS: p2: e2 p3: e2
+ *
+ * @param many1 the unique element on the LHS to be removed.
+ * @throws NullPointerException if parameter many1 is null.
+ * @return true if the removal occurred, false if many1 does not exist in
+ * the LHS of the many to many relationship.
+ */
+ boolean removeLeft(Many1 many1);
+
+ /**
+ * Removes the many1 parameter from the RHS of the many relationship AND all
+ * its corresponding values that exist in the LHS of the many to many
+ * relationship. For example given: LHS e2: p2, p3 RHS: p2: e2 p3: e2 after
+ * removing p2 from the RHS will results into: LHS e2: p3 RHS p3: e2
+ *
+ *
+ * @param many2 the unique element on the LHS to be removed.
+ * @throws NullPointerException if parameter many1 is null.
+ * @return true if the removal occurred, false if many1 does not exist in
+ * the LHS of the many to many relationship.
+ */
+ boolean removeRight(Many2 many2);
+
+ /**
+ * Clears all.
+ *
+ */
+ void clear();
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/ManyToManyFactory1.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/ManyToManyFactory1.java
new file mode 100644
index 0000000..2467e1c
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/ManyToManyFactory1.java
@@ -0,0 +1,212 @@
+/*
+ * 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 asdv.mp1_ajax.pojos;
+
+import asdv.mp1_ajax.pojos.ManyToMany;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author asdv5
+ */
+public class ManyToManyFactory1
+{
+ public static //generic types to be used in the method
+ ManyToMany< Many1, Many2>//return type
+ createManyToMany()
+ {
+ return new ManyToMany()
+ {
+
+ private Map left = new HashMap();
+ private Map right = new HashMap();
+
+ @Override
+ public String toString()
+ {
+ return "{" + "left=" + left + ", right=" + right + '}';
+ }
+
+ @Override
+ public List add(Many1 parentLeft, Many2... childrenRight)
+ {
+ if (parentLeft==null || childrenRight==null || getParentsLeft().contains(parentLeft)) {
+ throw new IllegalArgumentException("Invalid input: null arguments or duplicate parent");
+ }
+
+ left.put(parentLeft, Arrays.asList(childrenRight));
+
+ for(Many2 parentRight : childrenRight)
+ {
+
+ right.put(parentRight, Arrays.asList(parentLeft));
+ }
+
+
+ return Arrays.asList(childrenRight);
+ }
+
+ @Override
+ public List getChildrenLeft(Many2 parentRight)
+ {
+ if(right.get(parentRight)==null)
+ {
+ throw new IllegalArgumentException(parentRight+" is not a valid R parent");
+ }
+ return (List) right.get(parentRight);
+ }
+
+ @Override
+ public List getChildrenRight(Many1 parentLeft)
+ {
+ if(left.get(parentLeft)==null)
+ {
+ throw new IllegalArgumentException(parentLeft+" is not a valid L parent");
+ }
+ return (List)left.get(parentLeft);
+ }
+
+ @Override
+ public Set getParentsLeft()
+ {
+ return (Set) left.keySet();
+ }
+
+ @Override
+ public Set getParentsRight()
+ {
+ return (Set) right.keySet();
+ }
+
+ @Override
+ public boolean removeLeft(Many1 many1)
+ {
+ if(!getParentsLeft().contains(many1))
+ {
+ return false;
+ }
+ left.remove(many1);
+ for(Many2 parentRight : getParentsRight())
+ {
+ right.remove(parentRight, many1);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean removeRight(Many2 many2)
+ {
+ if(!getParentsRight().contains(many2))
+ {
+ return false;
+ }
+ right.remove(many2);
+ for(Many1 parentLeft : getParentsLeft())
+ {
+ left.remove(parentLeft, many2);
+ }
+ return true;
+ }
+
+ @Override
+ public void clear()
+ {
+ left.clear();
+ right.clear();
+ }
+ };
+ }
+
+ public static void main(String[] args) throws InterruptedException
+ {
+ ManyToMany mm = ManyToManyFactory1.createManyToMany();
+ //mm.add(1, 1);///will not compile, we have Many1, Many2 as String
+ System.out.println("add(e1, p1, p2)returns: " + mm.add("e1", "p1", "p2"));
+ System.out.println("add(e2, p2, p3)returns: " + mm.add("e2", "p2", "p3"));
+ System.out.println("getParentsLeft returns: " + mm.getParentsLeft());
+ System.out.println("getParentsRight returns: " + mm.getParentsRight());
+ System.out.println("getChildrenLeft(p2) returns: " + mm.getChildrenLeft("p2"));
+ System.out.println("getChildrenLeft(p3) returns: " + mm.getChildrenLeft("p3"));
+ System.out.println("getChildrenRight(e1) returns: " + mm.getChildrenRight("e1"));
+ System.out.println("getChildrenRight(e2) returns: " + mm.getChildrenRight("e2"));
+ System.out.println("-----------------------------------------------");
+ System.out.println("The internal hash maps of ManyToMany after insertions: " + mm);
+
+ System.out.println("----------AFTER REMOVAL of e1 LEFT----------------------------------------");
+ System.out.println("removeLeft(e1) returns: " + mm.removeLeft("e1"));
+ System.out.println("getParentsLeft returns: " + mm.getParentsLeft());
+ System.out.println("getParentsRight returns: " + mm.getParentsRight());
+ System.out.println("getChildrenRight(e2) returns: " + mm.getChildrenRight("e2"));
+ System.out.println("getChildrenLeft(p2) returns: " + mm.getChildrenLeft("p2"));
+ System.out.println("getChildrenLeft(p3) returns: " + mm.getChildrenLeft("p3"));
+ System.out.println("The internal hash maps of ManyToMany after removal LEFT: " + mm);
+
+ System.out.println("\n----------AFTER REMOVAL of p2 RIGHT----------------------------------------");
+ System.out.println("removeRight(p2) returns: " + mm.removeRight("p2"));
+ System.out.println("getParentsLeft returns: " + mm.getParentsLeft());
+ System.out.println("getParentsRight returns: " + mm.getParentsRight());
+ System.out.println("getChildrenRight(e2) returns: " + mm.getChildrenRight("e2"));
+ System.out.println("getChildrenLeft(p3) returns: " + mm.getChildrenLeft("p3"));
+ System.out.println("--------------------------------------------------");
+ System.out.println("mm.removeLeft(e1) returns: " + mm.removeLeft("e1"));
+
+ System.out.println("The internal hash maps of ManyToMany after removal RIGHT: " + mm);
+ Thread.sleep(5000, 0);
+
+ System.out.println("---------------CATCHING EXCEPTIONS -----------------------------------");
+ try
+ {
+ mm.getChildrenRight("e10");//e10 dos not exist
+ }
+ catch (RuntimeException e)
+ {
+ System.err.println("getChildrenRight for e10 throws exception:" + e);
+ }
+ try
+ {
+ System.out.println(mm.add("e6", new String[]
+ {
+ "value1", null
+ }));
+ }
+ catch (RuntimeException e)
+ {
+ System.err.println("add(e6, new String[]{null } ) throws exception: " + e);
+ }
+ try
+ {
+ System.out.println(mm.add(null, "p1"));
+ }
+ catch (RuntimeException e)
+ {
+ System.err.println("add(null, p1)returns throws exception: " + e);
+ }
+ try
+ {
+ System.out.println(mm.getChildrenRight("p1"));
+ }
+ catch (RuntimeException e)
+ {
+ System.err.println("getChildrenRight(p1) throws exception: " + e);
+ }
+ try
+ {
+ mm.add((String) new Object(), (String) new Object());
+ }
+ catch (RuntimeException e)
+ {
+ System.err.println("add((String) new Object(), (String) new Object()) throws exception: " + e);
+ }
+ mm.clear();
+ System.out.println("-----------------------------------------------");
+ System.out.println("The internal hash maps of ManyToMany after clear: " + mm);
+
+
+ }
+}
\ No newline at end of file
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/Stock.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/Stock.java
new file mode 100644
index 0000000..94ce92f
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/Stock.java
@@ -0,0 +1,147 @@
+/*
+ * 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 asdv.mp1_ajax.pojos;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+
+public class Stock implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String stockId;
+
+ private String companyName;
+
+ private double priceCurrent;
+
+ private double priceClosing;
+
+ private long numberOfSharesAvailable;
+
+ private long numberOfSharesSold;
+ private Collection transactionsCollection;
+
+ public Stock()
+ {
+ }
+
+ public Stock(String stockId)
+ {
+ this.stockId = stockId;
+ }
+
+ public Stock(String stockId, String companyName, double priceCurrent, double priceClosing, long numberOfSharesAvailable, long numberOfSharesSold)
+ {
+ this.stockId = stockId;
+ this.companyName = companyName;
+ this.priceCurrent = priceCurrent;
+ this.priceClosing = priceClosing;
+ this.numberOfSharesAvailable = numberOfSharesAvailable;
+ this.numberOfSharesSold = numberOfSharesSold;
+ }
+
+ public String getStockId()
+ {
+ return stockId;
+ }
+
+ public void setStockId(String stockId)
+ {
+ this.stockId = stockId;
+ }
+
+ public String getCompanyName()
+ {
+ return companyName;
+ }
+
+ public void setCompanyName(String companyName)
+ {
+ this.companyName = companyName;
+ }
+
+ public double getPriceCurrent()
+ {
+ return priceCurrent;
+ }
+
+ public void setPriceCurrent(double priceCurrent)
+ {
+ this.priceCurrent = priceCurrent;
+ }
+
+ public double getPriceClosing()
+ {
+ return priceClosing;
+ }
+
+ public void setPriceClosing(double priceClosing)
+ {
+ this.priceClosing = priceClosing;
+ }
+
+ public long getNumberOfSharesAvailable()
+ {
+ return numberOfSharesAvailable;
+ }
+
+ public void setNumberOfSharesAvailable(long numberOfSharesAvailable)
+ {
+ this.numberOfSharesAvailable = numberOfSharesAvailable;
+ }
+
+ public long getNumberOfSharesSold()
+ {
+ return numberOfSharesSold;
+ }
+
+ public void setNumberOfSharesSold(long numberOfSharesSold)
+ {
+ this.numberOfSharesSold = numberOfSharesSold;
+ }
+
+ public Collection getTransactionsCollection()
+ {
+ return transactionsCollection;
+ }
+
+ public void setTransactionsCollection(Collection transactionsCollection)
+ {
+ this.transactionsCollection = transactionsCollection;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 0;
+ hash += (stockId != null ? stockId.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 Stock))
+ {
+ return false;
+ }
+ Stock other = (Stock) object;
+ if ((this.stockId == null && other.stockId != null) || (this.stockId != null && !this.stockId.equals(other.stockId)))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "asdv.mp1_ajax.entities.Stock[ stockId=" + stockId + " ]";
+ }
+
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/StockHolder.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/StockHolder.java
new file mode 100644
index 0000000..eb79d83
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/StockHolder.java
@@ -0,0 +1,98 @@
+/*
+ * 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 asdv.mp1_ajax.pojos;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+
+
+public class StockHolder implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private Integer stockHolderId;
+
+ private String name;
+
+ //cascade
+ private Collection transactionsCollection;
+
+ public StockHolder()
+ {
+ }
+
+ public StockHolder(Integer stockHolderId)
+ {
+ this.stockHolderId = stockHolderId;
+ }
+
+ public StockHolder(Integer stockHolderId, String name)
+ {
+ this.stockHolderId = stockHolderId;
+ this.name = name;
+ }
+
+ public Integer getStockHolderId()
+ {
+ return stockHolderId;
+ }
+
+ public void setStockHolderId(Integer stockHolderId)
+ {
+ this.stockHolderId = stockHolderId;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Collection getTransactionsCollection()
+ {
+ return transactionsCollection;
+ }
+
+ public void setTransactionsCollection(Collection transactionsCollection)
+ {
+ this.transactionsCollection = transactionsCollection;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 0;
+ hash += (stockHolderId != null ? stockHolderId.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 StockHolder))
+ {
+ return false;
+ }
+ StockHolder other = (StockHolder) object;
+ if ((this.stockHolderId == null && other.stockHolderId != null) || (this.stockHolderId != null && !this.stockHolderId.equals(other.stockHolderId)))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "asdv.mp1_ajax.entities.StockHolder[ stockHolderId=" + stockHolderId + " ]";
+ }
+
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/Transactions.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/Transactions.java
new file mode 100644
index 0000000..805d3d5
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/Transactions.java
@@ -0,0 +1,112 @@
+/*
+ * 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 asdv.mp1_ajax.pojos;
+
+import java.io.Serializable;
+
+
+public class Transactions implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ protected TransactionsPK transactionsPK;
+
+ private int qty;
+
+ private Stock stock;
+
+ private StockHolder stockHolder;
+
+ public Transactions()
+ {
+ }
+
+ public Transactions(TransactionsPK transactionsPK)
+ {
+ this.transactionsPK = transactionsPK;
+ }
+
+ public Transactions(TransactionsPK transactionsPK, int qty)
+ {
+ this.transactionsPK = transactionsPK;
+ this.qty = qty;
+ }
+
+ public Transactions(int stockHolderId, String stockId)
+ {
+ this.transactionsPK = new TransactionsPK(stockHolderId, stockId);
+ }
+
+ public TransactionsPK getTransactionsPK()
+ {
+ return transactionsPK;
+ }
+
+ public void setTransactionsPK(TransactionsPK transactionsPK)
+ {
+ this.transactionsPK = transactionsPK;
+ }
+
+ public int getQty()
+ {
+ return qty;
+ }
+
+ public void setQty(int qty)
+ {
+ this.qty = qty;
+ }
+
+ public Stock getStock()
+ {
+ return stock;
+ }
+
+ public void setStock(Stock stock)
+ {
+ this.stock = stock;
+ }
+
+ public StockHolder getStockHolder()
+ {
+ return stockHolder;
+ }
+
+ public void setStockHolder(StockHolder stockHolder)
+ {
+ this.stockHolder = stockHolder;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 0;
+ hash += (transactionsPK != null ? transactionsPK.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 Transactions))
+ {
+ return false;
+ }
+ Transactions other = (Transactions) object;
+ if ((this.transactionsPK == null && other.transactionsPK != null) || (this.transactionsPK != null && !this.transactionsPK.equals(other.transactionsPK)))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "asdv.mp1_ajax.entities.Transactions[ transactionsPK=" + transactionsPK + " ]";
+ }
+
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/TransactionsPK.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/TransactionsPK.java
new file mode 100644
index 0000000..0b09f48
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/pojos/TransactionsPK.java
@@ -0,0 +1,87 @@
+/*
+ * 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 asdv.mp1_ajax.pojos;
+
+import java.io.Serializable;
+import jakarta.persistence.Embeddable;
+
+/**
+ *
+ * @author asdv5
+ */
+@Embeddable
+public class TransactionsPK implements Serializable
+{
+
+ private int stockHolderId;
+
+ private String stockId;
+
+ public TransactionsPK()
+ {
+ }
+
+ public TransactionsPK(int stockHolderId, String stockId)
+ {
+ this.stockHolderId = stockHolderId;
+ this.stockId = stockId;
+ }
+
+ public int getStockHolderId()
+ {
+ return stockHolderId;
+ }
+
+ public void setStockHolderId(int stockHolderId)
+ {
+ this.stockHolderId = stockHolderId;
+ }
+
+ public String getStockId()
+ {
+ return stockId;
+ }
+
+ public void setStockId(String stockId)
+ {
+ this.stockId = stockId;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 0;
+ hash += (int) stockHolderId;
+ hash += (stockId != null ? stockId.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 TransactionsPK))
+ {
+ return false;
+ }
+ TransactionsPK other = (TransactionsPK) object;
+ if (this.stockHolderId != other.stockHolderId)
+ {
+ return false;
+ }
+ if ((this.stockId == null && other.stockId != null) || (this.stockId != null && !this.stockId.equals(other.stockId)))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "asdv.mp1_ajax.entities.TransactionsPK[ stockHolderId=" + stockHolderId + ", stockId=" + stockId + " ]";
+ }
+
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/resources/JakartaEE10Resource.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/resources/JakartaEE10Resource.java
new file mode 100644
index 0000000..ef65f84
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/asdv/mp1_ajax/resources/JakartaEE10Resource.java
@@ -0,0 +1,20 @@
+package asdv.mp1_ajax.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/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/beans/StockBean.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/beans/StockBean.java
new file mode 100644
index 0000000..5d1563f
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/beans/StockBean.java
@@ -0,0 +1,36 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+
+package beans;
+
+import edu.slcc.ajax.bl.StockDB;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import java.io.Serializable;
+
+/**
+ *
+ * @author asdv5
+ */
+@Named(value="stockBean")
+@SessionScoped
+public class StockBean implements Serializable
+{
+
+ @Inject
+ StockDB stocks;
+ /** Creates a new instance of StockBean */
+ public StockBean() {
+ }
+
+ public StockDB getStocks()
+ {
+ return stocks;
+ }
+
+
+
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/Dao.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/Dao.java
new file mode 100644
index 0000000..e57ab26
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/Dao.java
@@ -0,0 +1,28 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
+ */
+package edu.slcc.ajax.bl;
+
+import java.sql.SQLException;
+import java.util.List;
+
+public interface Dao
+{
+ void create(T t);
+
+ void edit(T t);
+
+ void remove(T t);
+
+ T find(Object id) ;
+
+
+ List findAll()
+ throws SQLException;;
+
+ List findRange(int[] range);
+
+ int count();
+
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/Database.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/Database.java
new file mode 100644
index 0000000..bf00493
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/Database.java
@@ -0,0 +1,73 @@
+
+package edu.slcc.ajax.bl;
+
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author ASDV2
+ */
+public interface Database
+{
+
+ /**
+ * Returns a Connection to a database or null if no connection is done.
+ *
+ * @param databaseName name
+ * @param userName database user name
+ * @param password database password
+ * @param driver driver that connects us to database
+ * @return Connection the connection to database or null if no connection
+ */
+ public Connection getConnection(String databaseName, String userName, String password, String driver);
+
+ /**
+ * Selects the projected columns of a table where the AND condition of the
+ * WHERE clause is true.
+ *
+ * @param tableName table name
+ * @param projectionFields fields if SELECT clause ( projected columns)
+ * @param whereFieldsNValues fields in WHERE clause, key is the field name(
+ * LHS ) and value of the field ( RHS ). For example snumber = 's1', status
+ * > "10".
+ * @param operators the operators that apply to whereFieldsNValues. They are
+ * positioned between the LHS and the RHS of the whereFieldsNValues
+ * parameter. The operators are always the same size as the
+ * whereFieldsNValues. That is,the first operator applies to the first entry
+ * of the map, the second operator to the 2nd entry and so on.
+ * @return the projected columns of a table, after the WHERE clause applies
+ * by ANDing all entries of the map ( whereFieldsNValues). If an SQL
+ * exception is thrown return NULL if an error ( exception occurs).
+ *
+ */
+ public List selectFieldsFromTableWhereFields(String tableName,
+ List projectionFields,
+ Map whereFieldsNValues,
+ List operators
+ );
+
+ /**
+ * Returns the list of all rows of the table "tableName"
+ *
+ * @param tableName the name of the table to return
+ * @return a list with all rows in the the table.
+ */
+ public List selectAllFromTable(String tableName);
+
+ /**
+ * Returns true if the table exists in the database, false otherwise
+ *
+ * @param tableName the name of the table
+ * @return true if the table exists in the database, false otherwise
+ */
+ boolean isTable(String tableName);
+
+ /**
+ * Closes a connection
+ *
+ * @param c the connection to close
+ */
+ public void closeConnection(Connection c);
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/StockDB.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/StockDB.java
new file mode 100644
index 0000000..a6a7bea
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/StockDB.java
@@ -0,0 +1,129 @@
+/*
+ * 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 edu.slcc.ajax.bl;
+
+
+import asdv.mp1_ajax.pojos.Stock;
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Supplier;
+
+/**
+ *
+ * @author asdv5
+ */
+public class StockDB
+ implements Dao, Serializable
+{
+ @Override
+ public List findAll()
+ throws SQLException
+ {
+ // test exception code
+ //if ( true)
+ // throw new SQLException();
+
+ List tableStocks = new ArrayList();
+ String databaseName = "nyse";
+ String userName = "root";
+ String password = "root";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ PreparedStatement ps = null;
+ try
+ {
+ if (con == null)
+ {
+ throw new RuntimeException("cannot connect to database");
+ }
+ String table = "";
+ ResultSet rs = null;
+ String sqlStr = "SELECT * FROM stock";
+ //prepare statement
+ ps = con.prepareStatement(sqlStr);
+ //execute
+ rs = ps.executeQuery();
+ while (rs.next())
+ {
+ String stockId = rs.getString(1);
+ String companyName = rs.getString(2);
+ double priceCurrent = rs.getDouble(3);
+ double priceClosing = rs.getDouble(4);
+ long numberOfSharesAvailable = rs.getLong(5);
+ long numberOfSharesSold = rs.getLong(6);
+ Stock stock = new Stock(stockId, companyName, priceCurrent, priceClosing, numberOfSharesAvailable, numberOfSharesSold);
+ tableStocks.add(stock);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw ex;
+ }
+ finally
+ {
+ try
+ {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (ps != null)
+ {
+ ps.close();
+ }
+ }
+ catch (SQLException sqle)
+ {
+ System.out.println(sqle);
+ sqle.printStackTrace();
+ throw sqle;
+ }
+ }
+ return tableStocks;
+ }
+
+ @Override
+ public void create(Stock t)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void edit(Stock t)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void remove(Stock t)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public Stock find(Object id)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public List findRange(int[] range)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public int count()
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/UtilitiesDatabase.java b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/UtilitiesDatabase.java
new file mode 100644
index 0000000..88afd2e
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/UtilitiesDatabase.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 edu.slcc.ajax.bl;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+/**
+ *
+ * @author asdv5
+ */
+public class UtilitiesDatabase
+{
+ public Connection connection(
+ String databaseName,
+ String userName,
+ String password,
+ String URL2
+
+ ) //throws InstantiationException, IllegalAccessException
+ {
+/*
+ String databaseName = "suppliers_parts_23";
+ String userName = "root";
+ String password = "root";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = null;
+*/
+ Connection con;
+ try
+ {// Load Sun's jdbc driver
+ Class.forName(URL2).newInstance();
+ System.out.println("JDBC Driver loaded!");
+ }
+ catch (Exception e) // driver not found
+ {
+ System.err.println("Unable to load database driver");
+ System.err.println("Details : " + e);
+ return null;
+ }
+ String ip = "localhost"; //internet connection
+ String url = "jdbc:mysql://" + ip + ":8889/" + databaseName + "?useSSL=false";
+ try
+ {
+ con = DriverManager.getConnection(url, userName, password);
+ con.setReadOnly(false);
+ }
+ catch (Exception e)
+ {
+ System.err.println(e.toString());
+ return null;
+ }
+ System.out.println("connection successfull");
+ return con;
+ }
+
+
+ public void closeDatabaseConnection( Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch (SQLException e)
+ {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+
+
+public static java.sql.Date stringDateToSqlDate(String sDate)
+ {
+ java.util.Date date = null;
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ try
+ {
+ date = sdf.parse(sDate);
+ }
+ catch (ParseException e)
+ {
+ e.printStackTrace();
+ }
+ return new java.sql.Date( date.getTime() );
+
+ }
+
+
+public static java.util.Date stringDateToJavaUtilitiesDate(String sDate)
+ {
+ java.sql.Date sqldate = stringDateToSqlDate(sDate);
+ return new java.util.Date(sqldate.getTime() );
+ }
+}
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..93c708b
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,8 @@
+
+
+
+ java:app/nyse
+ false
+
+
+
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/glassfish-resources.xml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/glassfish-resources.xml
new file mode 100644
index 0000000..674afe0
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/glassfish-resources.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..673cc06
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/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/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..fcfcd54
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+
+
+
+ jakarta.faces.PROJECT_STAGE
+ Development
+
+
+ Faces Servlet
+ jakarta.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ /faces/*
+
+
+
+ 30
+
+
+
+ faces/index.xhtml
+
+
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/index.xhtml b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..8fc397d
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/index.xhtml
@@ -0,0 +1,49 @@
+
+
+
+
+ MP1 Ajax
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/resources/8.zip b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/resources/8.zip
new file mode 100644
index 0000000..843fb7b
Binary files /dev/null and b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/resources/8.zip differ
diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/resources/css/styles.css b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..cc3b207
--- /dev/null
+++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,45 @@
+/*
+Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template
+*/
+/*
+ Created on : Jan 13, 2024, 9:50:00 AM
+ Author : asdv5
+*/
+
+
+.grandParent{
+ margin:0 auto;
+ float:left;
+ min-width:100px;
+ max-width:120px;
+ height:150px;
+ position:relative;
+ border-left: 1px solid #000000;
+ border-right: 1px solid #000000;
+ background:#cccccc;
+ font-size:11px;
+ cursor:pointer;
+}
+.theColumn{
+ width:100%;
+
+ padding: 20px;
+ background-color: blue;
+}
+
+
+.elementsOfTheColumn{
+ width:60%;
+ margin-left: 10px;
+ display:inline-table;
+ position:relative;
+}
+
+.elementsOfTheColumnButton{
+ width:30%;
+ margin-left: 10px;
+ display:inline-table;
+ position:relative;
+}
+
diff --git a/Semester 3/Assignments/StockBrokerAjaxThreads/nb-configuration.xml b/Semester 3/Assignments/StockBrokerAjaxThreads/nb-configuration.xml
index 5e1a2de..c678822 100644
--- a/Semester 3/Assignments/StockBrokerAjaxThreads/nb-configuration.xml
+++ b/Semester 3/Assignments/StockBrokerAjaxThreads/nb-configuration.xml
@@ -15,6 +15,7 @@ Any value defined here will override the pom.xml file value but is only applicab
-->
10-web
gfv700ee10
- Facelets
+ JSP
+ ide
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/nb-configuration.xml b/Semester 3/Assignments/TermProject2_CalebFontenot/nb-configuration.xml
new file mode 100644
index 0000000..39d0b87
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 10-web
+ gfv700ee10
+ JDK_11__System_
+ Facelets
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/pom.xml b/Semester 3/Assignments/TermProject2_CalebFontenot/pom.xml
new file mode 100644
index 0000000..6570dbd
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/pom.xml
@@ -0,0 +1,48 @@
+
+ 4.0.0
+ edu.slcc.asdv.caleb
+ TermProject1_CalebFontenot
+ 1.0-SNAPSHOT
+ war
+ TermProject1_CalebFontenot-1.0-SNAPSHOT
+
+
+ UTF-8
+ 10.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+ org.primefaces
+ primefaces
+ 13.0.5
+ jakarta
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 11
+ 11
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.3.2
+
+
+
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/JakartaRestConfiguration.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/JakartaRestConfiguration.java
new file mode 100644
index 0000000..b095b4f
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package edu.slcc.asdv.caleb.termproject1_calebfontenot;
+
+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/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanA.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanA.java
new file mode 100644
index 0000000..54fc6f4
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanA.java
@@ -0,0 +1,38 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
+
+import jakarta.inject.Named;
+import jakarta.faces.view.ViewScoped;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ *
+ * @author A. V. Markou
+ */
+@Named(value = "matrixBeanA")
+@ViewScoped
+public class MatrixBeanA implements Serializable
+{
+
+ ArrayList> matrix = new ArrayList>();
+
+ ArrayList> getMatrix()
+ {
+ return matrix;
+ }
+
+ public void setMatrixA(ArrayList> matrix)
+ {
+ this.matrix = matrix;
+ }
+
+ public void changeRowsColumns() {
+ // String componentId;
+ }
+
+
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanB.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanB.java
new file mode 100644
index 0000000..21842d4
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanB.java
@@ -0,0 +1,34 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
+
+import jakarta.inject.Named;
+import jakarta.faces.view.ViewScoped;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import org.primefaces.PrimeFaces;
+
+/**
+ *
+ * @author A. V. Markou
+ */
+@Named(value = "matrixBeanB")
+@ViewScoped
+public class MatrixBeanB implements Serializable
+{
+
+ ArrayList> matrix = new ArrayList>();
+
+ ArrayList> getMatrix()
+ {
+ return matrix;
+ }
+
+ public void setMatrixB(ArrayList> matrix)
+ {
+ this.matrix = matrix;
+ }
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanC.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanC.java
new file mode 100644
index 0000000..fba03a3
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixBeanC.java
@@ -0,0 +1,32 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
+
+import jakarta.inject.Named;
+import jakarta.faces.view.ViewScoped;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ *
+ * @author A. V. Markou
+ */
+@Named(value = "matrixBeanC")
+@ViewScoped
+public class MatrixBeanC implements Serializable
+{
+
+ ArrayList> matrix = new ArrayList>();
+
+ ArrayList> getMatrix()
+ {
+ return matrix;
+ }
+ public void setMatrixC(ArrayList> matrix)
+ {
+ this.matrix = matrix;
+ }
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixOperations.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixOperations.java
new file mode 100644
index 0000000..7dad73e
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MatrixOperations.java
@@ -0,0 +1,64 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
+
+import jakarta.inject.Named;
+import jakarta.faces.view.ViewScoped;
+import jakarta.inject.Inject;
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.ArrayList;
+
+/**
+ *
+ * @author A. V. Markou
+ */
+@Named(value = "matrixOperations")
+@ViewScoped
+public class MatrixOperations implements Serializable
+{
+
+ @Inject
+ MatrixBeanA matrixA;
+ @Inject
+ MatrixBeanB matrixB;
+
+ @Inject
+ MatrixBeanC matrixC;
+
+ public String add() {
+
+ ArrayList> a = matrixA.getMatrix();
+ ArrayList> b = matrixB.getMatrix();
+ ArrayList> c = new ArrayList>();
+
+ for ( int i=0; i < a.size(); ++i)
+ {
+ ArrayList row = new ArrayList<>();
+ for ( int j=0; j < a.size(); ++j)
+ {
+ Integer result = Integer.parseInt ( a.get(i).get(j))
+ +
+ Integer.parseInt ( b.get(i).get(j));
+
+ row.add( result.toString() );
+ }
+ c.add(row);
+ System.out.println(row);
+ }
+ matrixC.setMatrixC( c );
+ return "";
+ }
+
+ public String multiply(){return "";}
+
+
+ public MatrixBeanC getMatrixC(){return this.matrixC;}
+
+ public MatrixBeanA getMatrixA(){return matrixA;}
+
+ public MatrixBeanB getMatrixB(){return matrixB;}
+
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MenuBar.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MenuBar.java
new file mode 100644
index 0000000..99504fa
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/beans/MenuBar.java
@@ -0,0 +1,64 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
+ */
+package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
+
+import jakarta.faces.application.FacesMessage;
+import jakarta.faces.application.FacesMessage.Severity;
+import jakarta.faces.context.FacesContext;
+import jakarta.inject.Named;
+import jakarta.faces.view.ViewScoped;
+import jakarta.inject.Inject;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.primefaces.PrimeFaces;
+
+@Named(value = "menuBar")
+@ViewScoped
+public class MenuBar implements Serializable
+{
+ @Inject
+ MatrixOperations matrixOperations;
+ private List> menus = new ArrayList>();
+
+ public void add()
+ {
+ System.out.println("Menu multiply was called");
+ matrixOperations.multiply();
+ List idsC = new ArrayList<>();
+ idsC.add("formC");
+ idsC.add("formC:datatableC");
+ idsC.add("formC:datatableC:columnsC");
+ idsC.add("formC:datatableC:columnsC:inputTextC");
+ //idsC.add("form-menu");//:menuBar:submenu_matricies:menuitem_add");
+ PrimeFaces.current().ajax().update(idsC);
+ }
+
+ public void multiply()
+ {
+ message(
+ FacesMessage.SEVERITY_INFO,
+ "Not implemented.", "To be implemented."
+ );
+ }
+
+ public void subtract()
+ {
+ message(
+ FacesMessage.SEVERITY_INFO,
+ "Not implemented.", "To be implemented."
+ );
+ }
+
+
+
+
+
+ public void message(Severity severity, String msg, String msgDetails)
+ {
+ FacesMessage m = new FacesMessage(severity, msg, msgDetails);
+ FacesContext.getCurrentInstance().addMessage("msg", m);
+ }
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/bl/Matrices.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/bl/Matrices.java
new file mode 100644
index 0000000..eb98e93
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/bl/Matrices.java
@@ -0,0 +1,261 @@
+package edu.slcc.asdv.bl;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.RecursiveTask;
+
+/**
+ *
+ * @author A. V. Markou
+ */
+public class Matrices implements Matrix
+{
+
+
+ @Override
+ public ArrayList> addParallel(ArrayList> A, ArrayList> B)
+ {
+ RecursiveTask>> rt
+ = new Matrices.MatricesAddition(0, A.size() - 1, A, B);
+ ForkJoinPool pool = new ForkJoinPool();
+ ArrayList> result = pool.invoke(rt);
+ return result;
+ }
+
+ @Override
+ public ArrayList> multiplyParallel(ArrayList> A, ArrayList> B)
+ {
+ RecursiveTask>> rt
+ = new Matrices.MatricesMultiplication(0, A.size() - 1, A, B);
+ ForkJoinPool pool = new ForkJoinPool();
+ ArrayList> result = pool.invoke(rt);
+ return result;
+ }
+
+
+
+
+
+
+ static class MatricesAddition extends RecursiveTask>>
+ {
+
+ ArrayList> A;
+ ArrayList> B;
+ ArrayList> AplusB;
+ final int HOW_MANY_ROWS_IN_PARALLEL = 100;//threshold
+ int startIndex;
+ int endIndex;
+
+ public MatricesAddition(int startIndex, int endIndex,
+ ArrayList> A,
+ ArrayList> B)
+ {
+ this.startIndex = startIndex;//start at this row of the matrix
+ this.endIndex = endIndex;//end at this row of the matrix
+ this.A = A;
+ this.B = B;
+ AplusB = new ArrayList>();
+
+ }
+
+ @Override
+ protected ArrayList> compute()
+ {
+ //>>This is the addition of matrices in the IF.
+ //That is, HOW_MANY_ROWS_IN_PARALLEL from matrix A and HOW_MANY_ROWS_IN_PARALLEL from matrix B
+ if (this.endIndex - this.startIndex < HOW_MANY_ROWS_IN_PARALLEL)
+ {
+ ArrayList> resultC = new ArrayList>();
+ for (int i = this.startIndex; i <= this.endIndex; ++i)
+ {
+ //>create a new row to add it to the resulting matrix resultC
+ ArrayList rowAplusB = new ArrayList();
+
+ for (int j = 0; j < A.get(0).size(); j++)
+
+ //>get the Ith row from A and the Ith row from B and
+ //and add all the Jth entries from each row
+ {
+ BigInteger x = A.get(i).get(j);
+ BigInteger y = B.get(i).get(j);
+ BigInteger z = x.add(y);
+
+ rowAplusB.add(z);
+ }
+ resultC.add(rowAplusB);
+ }
+ return resultC;
+ }
+ else
+ { //>> keep on FORKING the matrix until the
+ //side of the matric is equal or less to HOW_MANY_ROWS_IN_PARALLEL
+
+ int mid = (this.endIndex + this.startIndex) / 2;
+ RecursiveTask>> firstHalf
+ = new MatricesAddition(this.startIndex, mid, A, B);
+
+ RecursiveTask>> secondHalf
+ = new MatricesAddition(mid + 1, this.endIndex, A, B);
+
+ firstHalf.fork();//this line will invoke method compute
+ secondHalf.fork();///this line will invoke method compute
+
+ //>> join what the FORKs returned from the IFs
+ AplusB.addAll(firstHalf.join());
+ AplusB.addAll(secondHalf.join());
+
+ return AplusB;
+ }
+ }
+
+ }
+
+ /**
+ * Multiples two lists one 1-t01 correspondence, that is the 1st element of
+ * the first list is multiplied with 1st elements of the second list and so
+ * on
+ *
+ * @param list1
+ * @param list2
+ * @return the multiplied results
+ */
+ public static ArrayList multiplyLists(ArrayList list1, ArrayList list2)
+ {
+ ArrayList resultsOfMultiplications = new ArrayList();
+ for (int bi = 0; bi < list1.size();
+ ++bi)
+ {
+ resultsOfMultiplications.add(list1.get(bi).multiply(list2.get(bi)));
+ }
+ return resultsOfMultiplications;
+ }
+
+ public static ArrayList> columnMajorOrderReversal(ArrayList> b)
+ {
+ ArrayList> tranformed = new ArrayList>();
+ for (int column = 0;
+ column < b.get(0).size();
+ ++column)
+ {
+ ArrayList rowTrandormedToColmn = new ArrayList();
+ for (int row = 0;
+ row < b.size();
+ ++row)
+ {
+ BigInteger bd = b.get(row).get(column);
+ rowTrandormedToColmn.add(bd);
+ }
+ tranformed.add(rowTrandormedToColmn);
+ }
+
+ return tranformed;
+ }
+
+ /**
+ * Adds a list of Big Decimals and returns the result of the addition.
+ *
+ * @param list - list of BigDecimal type
+ * @return the sum of the list
+ */
+ public static BigInteger add(ArrayList list)
+ {
+ BigInteger bd = BigInteger.ZERO;
+ for (int bi = 0; bi < list.size();
+ bi++)
+ {
+ bd = bd.add(list.get(bi));
+ }
+ return bd;
+ }
+
+ static class MatricesMultiplication extends RecursiveTask>>
+ {
+
+ ArrayList> A;
+ ArrayList> B;
+ ArrayList> AxB;
+ final int HOW_MANY_ROWS_IN_PARALLEL = 3;//threshold
+ int startIndex;
+ int endIndex;
+
+ public MatricesMultiplication(int startIndex, int endIndex,
+ ArrayList> A,
+ ArrayList> B)
+ {
+ this.startIndex = startIndex;//start at this row of the matrix
+ this.endIndex = endIndex;//end at this row of the matrix
+ this.A = A;
+ this.B = B;
+ AxB = new ArrayList>();
+
+ }
+
+ /**
+ * matrix 1, 2, 3 4, 5, 6
+ *
+ * will be transformed to 1, 4 2, 5 3, 6
+ *
+ * @param list
+ * @return
+ */
+ @Override
+ protected ArrayList> compute()
+ {
+ //>>This is the addition of matrices in the IF.
+ //That is, HOW_MANY_ROWS_IN_PARALLEL from matrix A and HOW_MANY_ROWS_IN_PARALLEL from matrix B
+ if (this.endIndex - this.startIndex < HOW_MANY_ROWS_IN_PARALLEL)
+ {
+ ArrayList> resultC = new ArrayList>();
+ ArrayList> bTransformed = columnMajorOrderReversal(B);
+
+ for (int biA = this.startIndex;
+ biA <= this.endIndex;
+ ++biA)
+ {
+ ArrayList rowA = A.get(biA);
+ ArrayList rowAxB = new ArrayList();
+ ArrayList rowCalculation = new ArrayList();
+ for (int biB = 0;
+ biB < bTransformed.size();
+ ++biB)
+ {
+ ArrayList rowB = bTransformed.get(biB);
+
+ ArrayList productsOfRow = multiplyLists(rowA, rowB);
+ BigInteger sumOfRow = add(productsOfRow);
+ rowCalculation.add(sumOfRow);
+
+ }
+ resultC.add(rowCalculation);
+
+ }
+ return resultC;
+ }
+ else
+ { //>> keep on FORKING the matrix until the
+ //side of the matric is equal or less to HOW_MANY_ROWS_IN_PARALLEL
+
+ int mid = (this.startIndex + this.endIndex) / 2;
+ RecursiveTask>> firstHalf
+ = new MatricesMultiplication(this.startIndex, mid, A, B);
+
+ RecursiveTask>> secondHalf
+ = new MatricesMultiplication(mid + 1, this.endIndex, A, B);
+
+ firstHalf.fork();//this line will invoke method compute
+ secondHalf.fork();///this line will invoke method compute
+
+ //>> join what the FORKs returned from the IFs
+ AxB.addAll(firstHalf.join());
+ AxB.addAll(secondHalf.join());
+
+ return AxB;
+ }
+ }
+
+ }
+
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/bl/Matrix.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/bl/Matrix.java
new file mode 100644
index 0000000..fd06101
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/bl/Matrix.java
@@ -0,0 +1,19 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
+ */
+package edu.slcc.asdv.bl;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+
+/**
+ *
+ * @author ASDV1
+ */
+public interface Matrix
+{
+ ArrayList> addParallel(ArrayList> A, ArrayList> B);
+ ArrayList> multiplyParallel(ArrayList> A, ArrayList> B);
+
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/resources/JakartaEE10Resource.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/resources/JakartaEE10Resource.java
new file mode 100644
index 0000000..8cef555
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/resources/JakartaEE10Resource.java
@@ -0,0 +1,20 @@
+package edu.slcc.asdv.caleb.termproject1_calebfontenot.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/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/utilities/Utilities.java b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/utilities/Utilities.java
new file mode 100644
index 0000000..bbb2b11
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/termproject1_calebfontenot/utilities/Utilities.java
@@ -0,0 +1,123 @@
+/*
+ * 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 edu.slcc.asdv.caleb.termproject1_calebfontenot.utilities;
+
+
+import jakarta.el.ELContext;
+import jakarta.el.ELResolver;
+import jakarta.faces.application.Application;
+import jakarta.faces.application.FacesMessage;
+import jakarta.faces.component.UIComponent;
+import jakarta.faces.context.FacesContext;
+import java.math.BigInteger;
+import java.util.ArrayList;
+
+
+public class Utilities
+{
+
+ public static UIComponent findComponent(String id)
+ {
+
+ UIComponent result = null;
+ UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
+ if (root != null)
+ {
+ result = findComponent(root, id);
+ }
+ return result;
+
+ }
+
+ public static UIComponent findComponent(UIComponent root, String id)
+ {
+
+ UIComponent result = null;
+ if (root.getId().equals(id))
+ {
+ return root;
+ }
+
+ for (UIComponent child : root.getChildren())
+ {
+ if (child.getId().equals(id))
+ {
+ result = child;
+ break;
+ }
+ result = findComponent(child, id);
+ if (result != null)
+ {
+ break;
+ }
+ }
+ return result;
+
+ }
+
+ public static void printIDs(UIComponent component)
+ {
+ System.out.println("\n\nPARENT ID " + component.getId());
+
+ if (component.getChildren() == null)
+ {
+ return;
+ }
+
+ for (UIComponent child : component.getChildren())
+ {
+ System.out.println("\t\tCHILD ID " + child.getId());
+
+ printIDs(child);
+
+ }
+ }
+
+public static boolean isNumberOrDecimal( String s )
+{
+ System.out.println("isNumberOrDecimal called " + s);
+ //[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)
+ String regx = "^[+-]?(\\d*\\.)?\\d+$";
+ return s.matches(regx);
+
+}
+ public static void message( FacesMessage.Severity severity, String msg, String msgDetails)
+ {
+ FacesMessage m = new FacesMessage(severity, msg, msgDetails);
+ FacesContext.getCurrentInstance().addMessage("msg", m);
+ }
+
+
+ public static T getCDIBean(String nameOfTheBean)
+ {
+ ELContext elc = FacesContext.getCurrentInstance().getELContext();
+ FacesContext fc = FacesContext.getCurrentInstance();
+ Application ap = fc.getApplication();
+ ELResolver elr = ap.getELResolver();
+ return (T) elr.getValue(elc, null, nameOfTheBean);
+ }
+
+
+ public static ArrayList> convertBigIntegerToString(ArrayList> matrix)
+ {
+ ArrayList> stringMatrix = new ArrayList>();
+
+ for (ArrayList row : matrix)
+ {
+ ArrayList stringRow = new ArrayList();
+ for (BigInteger bigInt : row)
+ {
+ stringRow.add(new String(bigInt.toString()));
+
+ }
+ stringMatrix.add(stringRow);
+ }
+ return stringMatrix;
+ }
+
+
+
+
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..7582bf1
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..673cc06
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/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/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..fcfcd54
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+
+
+
+ jakarta.faces.PROJECT_STAGE
+ Development
+
+
+ Faces Servlet
+ jakarta.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ /faces/*
+
+
+
+ 30
+
+
+
+ faces/index.xhtml
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/index.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..3018965
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/index.xhtml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Application Software Development, SLCC
+
+
+
+ Templates, and Menus Illustration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ASDV 2800 , Templates
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/login-n-search/login.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/login-n-search/login.xhtml
new file mode 100644
index 0000000..e5b3f6c
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/login-n-search/login.xhtml
@@ -0,0 +1,25 @@
+
+
+
+
+ Login
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/login-n-search/search.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/login-n-search/search.xhtml
new file mode 100644
index 0000000..21586b9
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/login-n-search/search.xhtml
@@ -0,0 +1,21 @@
+
+
+
+
+ Login
+ >
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/compose.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/compose.xhtml
new file mode 100644
index 0000000..900ea85
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/compose.xhtml
@@ -0,0 +1,26 @@
+
+
+
+
+ Facelet Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixA.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixA.xhtml
new file mode 100644
index 0000000..59cb4a9
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixA.xhtml
@@ -0,0 +1,24 @@
+
+
+
+
+ MatriX A
+
+
+
+
+
+
+
+
+
+ Matrix A
+ DataTable of dynamically created of input-texts
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixB.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixB.xhtml
new file mode 100644
index 0000000..381d7ef
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixB.xhtml
@@ -0,0 +1,18 @@
+
+
+
+
+ MatriX A
+
+
+
+
+ Matrix B
+ DataTable of dynamically created of input-texts
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixC.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixC.xhtml
new file mode 100644
index 0000000..40e89d4
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/matrixC.xhtml
@@ -0,0 +1,18 @@
+
+
+
+
+ MAtrix C
+
+
+
+
+ Matrix C = A menu-operation B
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/menuActivities.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/menuActivities.xhtml
new file mode 100644
index 0000000..c3363b5
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/menuActivities.xhtml
@@ -0,0 +1,29 @@
+
+
+
+
+ Menu Matricies
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/menuMatrices.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/menuMatrices.xhtml
new file mode 100644
index 0000000..b5229db
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/matrices/menuMatrices.xhtml
@@ -0,0 +1,39 @@
+
+
+
+
+ Menu
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/bottomStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/bottomStyle.css
new file mode 100644
index 0000000..eeca699
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/bottomStyle.css
@@ -0,0 +1,18 @@
+#bottom {
+ margin: 0px 0px 0px 0px;
+ text-align:center;
+ color: #ffffff;
+
+ background-image: -webkit-gradient(
+ linear,
+ left top,
+ left bottom,
+ color-stop(0, blue),
+ color-stop(1, blue)
+ );
+ background-image: -o-linear-gradient(bottom, blue 0%, #120205 100%);
+ background-image: -moz-linear-gradient(bottom, blue 0%, #120205 100%);
+ background-image: -webkit-linear-gradient(bottom, blue 0%, #120205 100%);
+ background-image: -ms-linear-gradient(bottom, blue 0%, #120205 100%);
+ background-image: linear-gradient(to bottom, blue 0%, #120205 100%);
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/contentStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/contentStyle.css
new file mode 100644
index 0000000..f505a90
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/contentStyle.css
@@ -0,0 +1,3 @@
+#content {
+ background: white;
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/cssLayout.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/cssLayout.css
new file mode 100644
index 0000000..4b6e5ff
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/cssLayout.css
@@ -0,0 +1,50 @@
+#wrapper {
+ margin-left:auto;
+ margin-right:auto;
+}
+
+#title {
+ position: relative;
+ margin: 1px 0px 0px 0px;
+}
+
+#login_and_search {
+ position: relative;
+ margin: 0px 0px 5px 0px;
+}
+
+#login {
+ float: left;
+ position: relative;
+}
+
+#search {
+ float: right;
+ position: relative;
+}
+
+#top {
+ position: relative;
+ overflow: hidden;
+}
+
+#bottom {
+ position: relative;
+}
+
+#left {
+ float: left;
+}
+
+#logo {
+ float: left;
+}
+
+#right {
+ float: right;
+}
+
+#content {
+ overflow: hidden;
+}
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/dataTable.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/dataTable.css
new file mode 100644
index 0000000..8b0bacf
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/dataTable.css
@@ -0,0 +1,237 @@
+
+.rowNumber{
+
+ margin-right:20px;
+ width : 100px;
+ background: blue;
+ font-family: Impact;
+ font-size: 1.2em;
+ color: white;
+}
+
+body .ui-datatable .ui-paginator {
+ position: relative;
+ text-align: left;
+ bottom: 0px;
+ width: inherit;
+ padding: 2px;
+ z-index: 1;
+}
+
+
+.input {
+ font-size: 1em;
+ max-width: 35px;
+ min-width: 35px;
+ height : 35px;
+ font-size: 1em;
+ font-family: inherit;
+ background-color: #fff;
+ border: solid 1px;
+
+ border-color: blueviolet;
+ border-radius: 4px;
+}
+
+.dataTables {
+ overflow-y:scroll;
+ overflow-x:scroll;
+
+
+ height : 386px;
+ width: 300px;
+ display:block;
+ background-color: #fff;
+
+ zoom: 1;
+}
+
+.ui-datatable table{
+ border-collapse:collapse;
+ width:100%;
+}
+.ui-datatable.ui-datatable-header,.ui-datatable.ui-datatable-footer{
+ text-align:center;
+ padding:4px 10px;
+
+}
+.ui-datatable.ui-datatable-header{
+ border-bottom:0px none;
+
+}
+.ui-datatable.ui-datatable-footer{
+ border-top:0px none;
+}
+.ui-datatable thead th
+{
+ font-family: Arial;
+ font-size: 1.2em;
+ color: blue;
+ background: white;
+}
+.ui-datatable thead td
+{
+ font-family: Impact;
+ font-size:1.2em;
+ color: blue;
+}
+.ui-datatable tfoot td{
+ text-align:center;
+}
+ui-datatable thead th
+{
+ overflow:hidden;
+}
+.ui-datatable tbody td , .ui-datatable tfoot td{
+ padding:4px 10px;
+ overflow:hidden;
+ white-space:nowrap;
+ border-width:1px;
+ border-style:solid;
+}
+.ui-datatable tbody tr
+{
+ clear: both;
+}
+
+.ui-datatable .ui-sortable-column{
+ cursor:pointer;
+}
+.ui-datatable div.ui-dt-c{
+ position:relative;
+}
+.ui-datatable .ui-sortable-column-icon{
+ display:inline-block;
+ margin:-3px 0px -3px 2px;
+}
+.ui-datatable .ui-column-filter{
+ display:block;
+ width:100px;
+ margin:auto;
+}
+.ui-datatable .ui-expanded-row{
+ border-bottom:0px none;
+}
+.ui-datatable .ui-expanded-row-content{
+ border-top:0px none;
+}
+.ui-datatable .ui-row-toggler{
+ cursor:pointer;
+}
+.ui-datatable tr.ui-state-highlight{
+ cursor:pointer;
+}
+.ui-datatable .ui-selection-column .ui-chkbox-all{
+ display:block;
+ margin:0px auto;
+ width:16px;
+ height:16px;
+}
+.ui-datatable-scrollable table{
+ table-layout:auto;
+}
+.ui-datatable-scrollable-body{
+ overflow:auto;
+}
+.ui-datatable-scrollable-header,.ui-datatable-scrollable-footer{
+ overflow:hidden;
+ border:0px none;
+}
+.ui-datatable-scrollable .ui-datatable-scrollable-header,.ui-datatable-scrollable .ui-datatable-scrollable-footer{
+ position:relative;
+}
+.ui-datatable-scrollable .ui-datatable-scrollable-header td{
+ font-weight:normal;
+}
+.ui-datatable-scrollable-body::-webkit-scrollbar{
+ -webkit-appearance:none;
+ width:15px;
+ background-color:transparent;
+}
+.ui-datatable-scrollable-body::-webkit-scrollbar-thumb{
+ border-radius:8px;
+ border:1px solid white;
+ background-color:rgba(194,194,194,.5);
+}
+.ui-datatable .ui-datatable-data tr.ui-state-hover{
+ border-color:inherit;
+ font-weight:inherit;
+ cursor:pointer;
+}
+.ui-datatable .ui-paginator,.ui-datatable .ui-paginator{
+ padding:2px;
+}
+.ui-column-dnd-top, ui-column-dnd-bottom{
+ display:none;
+ position:absolute;
+}
+.ui-column-dnd-top .ui-icon, ui-column-dnd-bottom .ui-icon{
+ position:absolute;
+ top:-4px;
+}
+/* InCell Editing */.ui-datatable .ui-cell-editor-input{
+ display:none;
+}
+.ui-datatable .ui-row-editing .ui-cell-editor .ui-cell-editor-output{
+ display:none;
+}
+.ui-datatable .ui-row-editing .ui-cell-editor .ui-cell-editor-input{
+ display:block;
+}
+.ui-datatable .ui-row-editor span{
+ cursor:pointer;
+ display:inline-block;
+}
+.ui-datatable .ui-row-editor .ui-icon-pencil{
+ display:inline-block;
+}
+.ui-datatable .ui-row-editing .ui-row-editor .ui-icon-pencil{
+ display:none;
+}
+.ui-datatable .ui-row-editor .ui-icon-check,.ui-datatable .ui-row-editor .ui-icon-close{
+ display:none;
+}
+.ui-datatable .ui-row-editing .ui-row-editor .ui-icon-check,.ui-datatable .ui-row-editing .ui-row-editor .ui-icon-close{
+ display:inline-block;
+}
+.ui-datatable .ui-datatable-data tr.ui-row-editing td.ui-editable-column,.ui-datatable .ui-datatable-data td.ui-cell-editing{
+ padding:0;
+ margin:0;
+}
+/*resizer */.ui-datatable .ui-column-resizer{
+ width:8px;
+ height:20px;
+ padding:0px;
+ cursor:col-resize;
+ background-image:url("/ScraperOnWeb/javax.faces.resource/spacer/dot_clear.gif.jsf?ln=primefaces");
+ margin:-4px -10px -4px 0px;
+ float:right;
+}
+.ui-datatable .ui-filter-column .ui-column-resizer{
+ height:45px;
+}
+.ui-datatable .ui-column-resizer-helper{
+ width:1px;
+ position:absolute;
+ z-index:10;
+ display:none;
+}
+.ui-datatable-resizable{
+ padding-bottom:1px;/*fix for webkit overlow*/
+ overflow:auto;
+}
+.ui-datatable-resizable table{
+ table-layout:auto;
+}
+.ui-datatable-rtl{
+ direction:rtl;
+}
+.ui-datatable-rtl.ui-datatable thead th, .ui-datatable-rtl.ui-datatable tfoot td{
+ text-align:right;
+}
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/default.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/default.css
new file mode 100644
index 0000000..0c5e67f
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/default.css
@@ -0,0 +1,8 @@
+
+body {
+ background-color: #ffffff;
+ font-size: 12px;
+ font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
+ color: #000000;
+ margin: 2px;
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/imageZoomStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/imageZoomStyle.css
new file mode 100644
index 0000000..8aa00a0
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/imageZoomStyle.css
@@ -0,0 +1,34 @@
+
+* {box-sizing: border-box;}
+
+.img-zoom-container {
+ position: relative;
+}
+
+.img-zoom-lens {
+ position: absolute;
+ /*set the size of the lens:*/
+ width: 40px;
+ height: 40px;
+}
+
+.img-zoom-result {
+
+ /*border: 5px solid #000000;*/
+ /*set the size of the result div:*/
+ width: 300px;
+ height: 300px;
+}
+.myDiv
+{
+ align: center;
+ padding: 30px;
+ margin: 10;
+ border-left: 10px solid navy;
+}
+
+.hpanel{
+ position: relative;
+ top: 0px; left: 0px;
+}
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/leftStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/leftStyle.css
new file mode 100644
index 0000000..aaafa7d
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/leftStyle.css
@@ -0,0 +1,22 @@
+#left {
+
+ background-image: -webkit-gradient(
+ linear,
+ left top,
+ left bottom,
+ color-stop(0, #2D4A37),
+ color-stop(1, #789480)
+ );
+ background-image: -o-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
+ background-image: -moz-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
+ background-image: -webkit-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
+ background-image: -ms-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
+ background-image: linear-gradient(to bottom, #2D4A37 0%, #789480 100%);
+ -moz-box-shadow: 0px 0px 15px 3px #333333;
+ -webkit-box-shadow: 0px 0px 15px 3px #333333;
+ box-shadow: 0px 0px 15px 3px #333333;
+
+ text-align:left;
+ padding-left:10px;
+ margin-right: 5px;
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/loginStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/loginStyle.css
new file mode 100644
index 0000000..2849107
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/loginStyle.css
@@ -0,0 +1,65 @@
+.inputs {
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ background-color: #00f;
+ background: -moz-linear-gradient(top, #FFF, #EAEAEA);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #FFF), color-stop(1.0, #EAEAEA));
+ border: 1px solid #CACACA;
+ color: #444;
+ font-size: 1.1em;
+ margin: 0px 10px 0px 0px;
+ padding-left: 2px;
+ width:200px;
+}
+.inputs:focus {
+ color: #ffffff;
+ background: #0000cc;
+ -webkit-box-shadow: 0 0 25px #CCC;
+ -moz-box-shadow: 0 0 25px #cccc00;
+ box-shadow: 0 0 25px #CCCC00;
+ -webkit-transform: scale(1.05);
+ -moz-transform: scale(1.05);
+ transform: scale(1.05);
+}
+
+.lbutton {
+ -moz-box-shadow: 4px 7px 13px -7px #276873;
+ -webkit-box-shadow: 4px 7px 13px -7px #276873;
+ box-shadow: 4px 7px 13px -7px #276873;
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #171717), color-stop(1, #d92323));
+ background:-moz-linear-gradient(top, #171717 5%, #222 100%);
+ background:-webkit-linear-gradient(top, #171717 5%, #222 100%);
+ background:-o-linear-gradient(top, #171717 5%, #222 100%);
+ background:-ms-linear-gradient(top, #171717 5%, #222 100%);
+ background:linear-gradient(to bottom, #171717 5%, #222 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#171717', endColorstr='#d92323',GradientType=0);
+ background-color:#222;
+ -moz-border-radius:17px;
+ -webkit-border-radius:17px;
+ border-radius:17px;
+ display:inline-block;
+ cursor:pointer;
+ color:#ffffff;
+ font-family:arial;
+ font-size:12px;
+ font-weight:bold;
+ padding:2px 12px;
+ text-decoration:none;
+ text-shadow:0px 1px 0px #3d768a;
+}
+.lbutton:hover {
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #222), color-stop(1, #171717));
+ background:-moz-linear-gradient(top, #00f 5%, #222 100%);
+ background:-webkit-linear-gradient(top, 00f 5%, #222 100%);
+ background:-o-linear-gradient(top, #00f 5%, #222 100%);
+ background:-ms-linear-gradient(top, #00f 5%, #222 100%);
+ background:linear-gradient(to bottom, #00f 5%, #222 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d92323', endColorstr='#222',GradientType=0);
+ background-color:#00f;
+}
+.lbutton:active {
+ position:relative;
+ top:1px;
+}
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/login_and_searchStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/login_and_searchStyle.css
new file mode 100644
index 0000000..b35091d
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/login_and_searchStyle.css
@@ -0,0 +1,8 @@
+#login_and_search {
+
+ width:100%;
+ height:90px;
+ background-color: white;
+ padding: 20px;
+ display: inline-block;
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/logoStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/logoStyle.css
new file mode 100644
index 0000000..83870d2
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/logoStyle.css
@@ -0,0 +1,9 @@
+#logo {
+ background-image : url("#{resource['images/owl.png']}") ;
+ background-repeat: no-repeat;
+ margin-right: 0px;
+ width:60px;
+ height:60px;
+ float: left;
+
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/menuStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/menuStyle.css
new file mode 100644
index 0000000..a68d788
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/menuStyle.css
@@ -0,0 +1,37 @@
+#menu {
+ white-space: nowrap;
+ height: 28px;
+ width:100%;
+ background: #fff url("#{resource['images/menu.png']}") bottom center ;
+ margin-bottom: 5px;
+}
+
+#menu ul {
+ margin: 0;
+ padding: 0;
+ list-style:none;
+ float:left;
+}
+
+#menu li {
+ float: left;
+ margin: 0 3px 0 3px;
+ padding: 0;
+ background: transparent;
+}
+
+#menu a {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 15px;
+ font-weight: normal;
+ float:left;
+ display:block;
+ height: 26px;
+ line-height: 24px;
+ padding: 2px 10px 0 10px;
+ color: #cccc00;
+ text-decoration: none;
+ background: transparent;
+
+}
+
\ No newline at end of file
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/rightStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/rightStyle.css
new file mode 100644
index 0000000..4c5502a
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/rightStyle.css
@@ -0,0 +1,5 @@
+#right {
+ background-color: #FA0519;
+ text-align:center;
+ margin-left: 5px;
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/searchStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/searchStyle.css
new file mode 100644
index 0000000..57e52f1
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/searchStyle.css
@@ -0,0 +1,3 @@
+#search {
+ color: #ffffff;
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/stylesLinks.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/stylesLinks.css
new file mode 100644
index 0000000..eef30a3
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/stylesLinks.css
@@ -0,0 +1,67 @@
+
+a {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 15px;
+ font-weight: normal;
+ float:left;
+ display:block;
+ height: 26px;
+ line-height: 24px;
+ padding: 2px 10px 0 10px;
+ color: #cccc00;
+ text-decoration:#A3979A;
+ background-color: white;
+ border: white;
+ padding: 0px
+}
+a.hover {
+ float: left;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 15px;
+ font-weight: normal;
+ float:left;
+ display:block;
+ height: 26px;
+ line-height: 24px;
+ color: #cccc00;
+ text-decoration: none;
+
+ background-color: white;
+ border: white;
+ padding: 0px
+}
+
+.menus
+{
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 15px;
+ font-weight: normal;
+ float:right;
+
+
+ color: #cccc00;
+ text-decoration:#A3979A;
+ background-color: white;
+ border: white;
+ padding: 0px ;
+ margin-top: 0px;
+ margin-right: 0px;
+ margin-bottom: 0px;
+ margin-left: 0px;
+}
+
+ .affaires .ui-menuitem-text{color:#cccc00;
+ decoration: bold, italic;
+
+ }
+ .affaires .ui-menu-child{background: white; mouseover: #000;
+ background-color: #A80000;}
+ .affaires .ui-menubar{mouseover: #000;
+ background-color: #A80000;}
+ .affaires .ui-state-hover {}
+
+ a.active {
+ color: #D09d23;
+ font-weight: bold;
+ background-color : #c7c3c3;
+}
\ No newline at end of file
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/titleStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/titleStyle.css
new file mode 100644
index 0000000..24b1112
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/titleStyle.css
@@ -0,0 +1,9 @@
+#title {
+ background: white;
+ color:blue;
+ text-align:center;
+ font-size: 24px;
+ font-weight: bold;
+}
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/topStyle.css b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/topStyle.css
new file mode 100644
index 0000000..63294a9
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/css/layout-css/topStyle.css
@@ -0,0 +1,9 @@
+#top {
+ color: blue;
+ font-family: cursive, sans-serif;
+ font-size: 22px;
+ font-style: italic;
+ text-align: center;
+ height:60px;
+ background: white;
+}
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/images/download.png b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/images/download.png
new file mode 100644
index 0000000..b1315ca
Binary files /dev/null and b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/images/download.png differ
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/images/owl.png b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/images/owl.png
new file mode 100644
index 0000000..84fb6d0
Binary files /dev/null and b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/images/owl.png differ
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/js/do_validation.js b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/js/do_validation.js
new file mode 100644
index 0000000..6e21513
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/js/do_validation.js
@@ -0,0 +1,22 @@
+
+
+
+function validateText(textInputID)
+{
+ var htmlInputText = document.getElementById(textInputID);
+ var text = htmlInputText.value;
+
+
+ var regex = /[^A-Za-z0-9]/g;
+
+ if (text.search( regex) != -1)
+ {
+ newText = text.replace(regex, "");
+ htmlInputText.value = newText;
+ //alert("alphanumeric chars only please");
+
+ }
+
+}
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/bottomDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/bottomDefault.xhtml
new file mode 100644
index 0000000..1925805
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/bottomDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ This is default footer
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/contentDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/contentDefault.xhtml
new file mode 100644
index 0000000..81c4495
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/contentDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ This is default content
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/leftDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/leftDefault.xhtml
new file mode 100644
index 0000000..1e7e628
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/leftDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ This is default left side
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/loginDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/loginDefault.xhtml
new file mode 100644
index 0000000..b1dd7a8
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/loginDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ Default Login Section
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/logoDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/logoDefault.xhtml
new file mode 100644
index 0000000..54103c8
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/logoDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ LOGO
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/menuDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/menuDefault.xhtml
new file mode 100644
index 0000000..f244225
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/menuDefault.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Menu default
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/rightDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/rightDefault.xhtml
new file mode 100644
index 0000000..9aabcc8
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/rightDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ This is default right side
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/searchDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/searchDefault.xhtml
new file mode 100644
index 0000000..80b6c4b
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/searchDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ Default Search Section
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/titleDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/titleDefault.xhtml
new file mode 100644
index 0000000..7c9eeb4
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/titleDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ This is default title
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/topDefault.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/topDefault.xhtml
new file mode 100644
index 0000000..f1b76a0
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/default/topDefault.xhtml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ This is default header
+
+
+
diff --git a/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/generic/generic-layout.xhtml b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/generic/generic-layout.xhtml
new file mode 100644
index 0000000..39934fa
--- /dev/null
+++ b/Semester 3/Assignments/TermProject2_CalebFontenot/src/main/webapp/resources/templates/generic/generic-layout.xhtml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Generic Template
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 3/Assignments/params/nb-configuration.xml b/Semester 3/Assignments/params/nb-configuration.xml
index f89ff8d..97c9bbd 100644
--- a/Semester 3/Assignments/params/nb-configuration.xml
+++ b/Semester 3/Assignments/params/nb-configuration.xml
@@ -17,5 +17,6 @@ Any value defined here will override the pom.xml file value but is only applicab
gfv700ee10
Facelets
JDK_11__System_
+ ide
diff --git a/Semester 3/Assignments/templatesMatricesSample-2.zip b/Semester 3/Assignments/templatesMatricesSample-2.zip
new file mode 100644
index 0000000..a895883
Binary files /dev/null and b/Semester 3/Assignments/templatesMatricesSample-2.zip differ
diff --git a/Semester 3/Assignments/templatesMatricesSample/nb-configuration.xml b/Semester 3/Assignments/templatesMatricesSample/nb-configuration.xml
index c678822..7529ba2 100644
--- a/Semester 3/Assignments/templatesMatricesSample/nb-configuration.xml
+++ b/Semester 3/Assignments/templatesMatricesSample/nb-configuration.xml
@@ -17,5 +17,12 @@ Any value defined here will override the pom.xml file value but is only applicab
gfv700ee10
JSP
ide
+ JDK_11
+ /less:/css
+ false
+ false
+
+
+ /scss:/css
diff --git a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanA.java b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanA.java
index c2f6b2e..a53fcdf 100644
--- a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanA.java
+++ b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanA.java
@@ -7,6 +7,7 @@ package edu.slcc.asdv.beans;
import jakarta.inject.Named;
import jakarta.faces.view.ViewScoped;
import java.io.Serializable;
+import java.math.BigInteger;
import java.util.ArrayList;
/**
@@ -17,19 +18,43 @@ import java.util.ArrayList;
@ViewScoped
public class MatrixBeanA implements Serializable
{
+ private int columns = 2;
+ private int rows = 2;
ArrayList> matrix = new ArrayList>();
public MatrixBeanA()
{
- ArrayList row1 = new ArrayList();
- ArrayList row2 = new ArrayList();
- row1.add("1");
- row1.add("1");
- row2.add("3");
- row2.add("2");
matrix = new ArrayList>();
- matrix.add(row1);
- matrix.add(row2);
+ BigInteger counter = BigInteger.ZERO;
+ for (int i = 0; i < columns; ++i) {
+ ArrayList row = new ArrayList<>();
+ for (int j = 0; j < rows; ++j) {
+ counter = counter.add(BigInteger.ONE);
+ System.out.println(counter.toString());
+ row.add(counter.toString());
+ }
+ matrix.add(row);
+ }
+ }
+
+ public int getColumns()
+ {
+ return columns;
+ }
+
+ public void setColumns(int columns)
+ {
+ this.columns = columns;
+ }
+
+ public int getRows()
+ {
+ return rows;
+ }
+
+ public void setRows(int rows)
+ {
+ this.rows = rows;
}
public void listenForKeyUp(int i, int j, String input)
@@ -45,4 +70,26 @@ public class MatrixBeanA implements Serializable
{
return matrix;
}
+ public void changeRowsColumns() {
+ System.out.println("Columns:" + columns);
+ System.out.println("Rows:" + rows);
+ ArrayList> resizedMatrix = new ArrayList<>();
+ for (int i = 0; i < rows; ++i) {
+ ArrayList row = new ArrayList<>();
+ for (int j = 0; j < columns; ++j) {
+ row.add("1");
+ }
+ resizedMatrix.add(row);
+ }
+ // add the data from the old matrix to the new one
+ for (int i = 0; i < columns; ++i) {
+ for (int j = 0; j < rows; ++j) {
+ if (i < matrix.size() && j < matrix.get(i).size()) {
+ resizedMatrix.get(i).set(j, matrix.get(i).get(j));
+ }
+ }
+ }
+ // overwrite the old matrix
+ matrix = resizedMatrix;
+ }
}
diff --git a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanB.java b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanB.java
index ed76c94..fed1575 100644
--- a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanB.java
+++ b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanB.java
@@ -7,9 +7,8 @@ package edu.slcc.asdv.beans;
import jakarta.inject.Named;
import jakarta.faces.view.ViewScoped;
import java.io.Serializable;
+import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.Arrays;
-import org.primefaces.PrimeFaces;
/**
*
@@ -19,20 +18,43 @@ import org.primefaces.PrimeFaces;
@ViewScoped
public class MatrixBeanB implements Serializable
{
-
+ private int columns = 2;
+ private int rows = 2;
ArrayList> matrix = new ArrayList>();
-
- public MatrixBeanB()
+
+ public MatrixBeanB()
{
- ArrayList row1 = new ArrayList();
- ArrayList row2 = new ArrayList();
- row1.add("4");
- row1.add("5");
- row2.add("6");
- row2.add("7");
matrix = new ArrayList>();
- matrix.add(row1);
- matrix.add(row2);
+ BigInteger counter = BigInteger.ZERO;
+ for (int i = 0; i < columns; ++i) {
+ ArrayList row = new ArrayList<>();
+ for (int j = 0; j < rows; ++j) {
+ counter = counter.add(BigInteger.ONE);
+ System.out.println(counter.toString());
+ row.add(counter.toString());
+ }
+ matrix.add(row);
+ }
+ }
+
+ public int getColumns()
+ {
+ return columns;
+ }
+
+ public void setColumns(int columns)
+ {
+ this.columns = columns;
+ }
+
+ public int getRows()
+ {
+ return rows;
+ }
+
+ public void setRows(int rows)
+ {
+ this.rows = rows;
}
public void listenForKeyUp(int i, int j, String input)
@@ -40,11 +62,34 @@ public class MatrixBeanB implements Serializable
System.out.println("i=" + i);
System.out.println("j=" + j);
System.out.println("input=" + input);
- matrix.get(i).set(j, input);
+ matrix.get(i).set(j, input);
+
}
public ArrayList> getMatrix()
{
return matrix;
- }
+ }
+ public void changeRowsColumns() {
+ System.out.println("Columns:" + columns);
+ System.out.println("Rows:" + rows);
+ ArrayList> resizedMatrix = new ArrayList<>();
+ for (int i = 0; i < rows; ++i) {
+ ArrayList row = new ArrayList<>();
+ for (int j = 0; j < columns; ++j) {
+ row.add("1");
+ }
+ resizedMatrix.add(row);
+ }
+ // add the data from the old matrix to the new one
+ for (int i = 0; i < columns; ++i) {
+ for (int j = 0; j < rows; ++j) {
+ if (i < matrix.size() && j < matrix.get(i).size()) {
+ resizedMatrix.get(i).set(j, matrix.get(i).get(j));
+ }
+ }
+ }
+ // overwrite the old matrix
+ matrix = resizedMatrix;
+ }
}
diff --git a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanC.java b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanC.java
index 8d1c8e2..3793dbd 100644
--- a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanC.java
+++ b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixBeanC.java
@@ -7,8 +7,8 @@ package edu.slcc.asdv.beans;
import jakarta.inject.Named;
import jakarta.faces.view.ViewScoped;
import java.io.Serializable;
+import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.Arrays;
/**
*
@@ -18,32 +18,84 @@ import java.util.Arrays;
@ViewScoped
public class MatrixBeanC implements Serializable
{
-
+ private int columns = 2;
+ private int rows = 2;
ArrayList> matrix = new ArrayList>();
-
-
- public MatrixBeanC()
+
+ public MatrixBeanC()
{
- ArrayList row1 = new ArrayList();
- ArrayList row2 = new ArrayList();
- row1.add("-1");
- row1.add("-1");
- row2.add("-1");
- row2.add("-1");
matrix = new ArrayList>();
- matrix.add(row1);
- matrix.add(row2);
+ BigInteger counter = BigInteger.ZERO;
+ for (int i = 0; i < columns; ++i) {
+ ArrayList row = new ArrayList<>();
+ for (int j = 0; j < rows; ++j) {
+ counter = counter.add(BigInteger.ONE);
+ System.out.println(counter.toString());
+ row.add(counter.toString());
+ }
+ matrix.add(row);
+ }
}
+
+ public int getColumns()
+ {
+ return columns;
+ }
+
+ public void setColumns(int columns)
+ {
+ this.columns = columns;
+ }
+
+ public int getRows()
+ {
+ return rows;
+ }
+
+ public void setRows(int rows)
+ {
+ this.rows = rows;
+ }
+
+ public void listenForKeyUp(int i, int j, String input)
+ {
+ System.out.println("i=" + i);
+ System.out.println("j=" + j);
+ System.out.println("input=" + input);
+ matrix.get(i).set(j, input);
+
+ }
+
public ArrayList> getMatrix()
{
return matrix;
}
- public void setMatrixC(ArrayList> matrix)
+
+ public void setMatrix(ArrayList> matrix)
{
this.matrix = matrix;
}
-
-
-
+ public void changeRowsColumns() {
+ System.out.println("Columns:" + columns);
+ System.out.println("Rows:" + rows);
+ ArrayList> resizedMatrix = new ArrayList<>();
+ for (int i = 0; i < rows; ++i) {
+ ArrayList row = new ArrayList<>();
+ for (int j = 0; j < columns; ++j) {
+ row.add("1");
+ }
+ resizedMatrix.add(row);
+ }
+ // add the data from the old matrix to the new one
+ for (int i = 0; i < columns; ++i) {
+ for (int j = 0; j < rows; ++j) {
+ if (i < matrix.size() && j < matrix.get(i).size()) {
+ resizedMatrix.get(i).set(j, matrix.get(i).get(j));
+ }
+ }
+ }
+ // overwrite the old matrix
+ matrix = resizedMatrix;
+ }
}
diff --git a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixOperations.java b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixOperations.java
index 43351fd..3de68b4 100644
--- a/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixOperations.java
+++ b/Semester 3/Assignments/templatesMatricesSample/src/main/java/edu/slcc/asdv/beans/MatrixOperations.java
@@ -30,14 +30,28 @@ public class MatrixOperations implements Serializable
edu.slcc.asdv.bl.Matrices matrixManipulator = new edu.slcc.asdv.bl.Matrices();
- public String add(){
- ArrayList> a = convertToBigInteger(matrixA.getMatrix());
- ArrayList> b = convertToBigInteger(matrixA.getMatrix());
+ public String add() {
+
+ ArrayList> a = matrixA.getMatrix();
+ ArrayList> b = matrixB.getMatrix();
ArrayList> c = new ArrayList>();
- c = convertToString(matrixManipulator.addParallel(a, b));
- printArray(c);
- matrixC.setMatrixC( c );
- return "";
+
+ for ( int i=0; i < a.size(); ++i)
+ {
+ ArrayList row = new ArrayList<>();
+ for ( int j=0; j < a.size(); ++j)
+ {
+ Integer result = Integer.parseInt ( a.get(i).get(j))
+ +
+ Integer.parseInt ( b.get(i).get(j));
+
+ row.add( result.toString() );
+ }
+ c.add(row);
+ System.out.println(row);
+ }
+ matrixC.setMatrix( c );
+ return "";
}
public String multiply() {
@@ -46,17 +60,32 @@ public class MatrixOperations implements Serializable
ArrayList> c = new ArrayList>();
c = convertToString(matrixManipulator.multiplyParallel(a, b));
printArray(c);
- matrixC.setMatrixC( c );
+ matrixC.setMatrix( c );
return "";}
public String subtract() {
- ArrayList> a = convertToBigInteger(matrixA.getMatrix());
- ArrayList> b = convertToBigInteger(matrixA.getMatrix());
+
+ ArrayList> a = matrixA.getMatrix();
+ ArrayList> b = matrixB.getMatrix();
ArrayList> c = new ArrayList>();
- c = convertToString(matrixManipulator.subtractParallel(a, b));
- printArray(c);
- matrixC.setMatrixC( c );
- return "";}
+
+ for ( int i=0; i < a.size(); ++i)
+ {
+ ArrayList row = new ArrayList<>();
+ for ( int j=0; j < a.size(); ++j)
+ {
+ Integer result = Integer.parseInt ( a.get(i).get(j))
+ -
+ Integer.parseInt ( b.get(i).get(j));
+
+ row.add( result.toString() );
+ }
+ c.add(row);
+ System.out.println(row);
+ }
+ matrixC.setMatrix( c );
+ return "";
+ }
public MatrixBeanC getMatrixC(){return this.matrixC;}
@@ -65,6 +94,8 @@ public class MatrixOperations implements Serializable
public MatrixBeanB getMatrixB(){return matrixB;}
+ /*
+
public ArrayList> convertToBigInteger(ArrayList> matrix) {
ArrayList> bigInt2DArray = new ArrayList<>();
@@ -94,7 +125,7 @@ public class MatrixOperations implements Serializable
}
return string2DArray;
}
-
+*/
/**
*
* @param matrix
diff --git a/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixA.xhtml b/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixA.xhtml
index 2af9005..32ede54 100644
--- a/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixA.xhtml
+++ b/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixA.xhtml
@@ -11,7 +11,7 @@
-
+
@@ -32,18 +32,22 @@
value="#{matrixOperations.getMatrixA().getMatrix().get(i)}"
var="arrayListElement" columnIndexVar="j">
+ value="#{row[j]}" >
+ listener="#{matrixOperations.getMatrixA().listenForKeyUp(i,j, row.get(j) )}"/>
-
-
+
+ columns:
+
+ rows:
+
+
+
diff --git a/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixB.xhtml b/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixB.xhtml
index c6c5176..786595a 100644
--- a/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixB.xhtml
+++ b/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixB.xhtml
@@ -33,13 +33,18 @@
converterMessage="Invalid format!"
title= "(#{i},#{j})"
style="margin-left: 2px;" class="input"
- value="#{row[i]}" >
-
+ value="#{row[j]}" >
+
-
+
+ columns:
+
+ rows:
+
+
+
diff --git a/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixC.xhtml b/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixC.xhtml
index 958d8a5..e1f021d 100644
--- a/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixC.xhtml
+++ b/Semester 3/Assignments/templatesMatricesSample/src/main/webapp/matrices/matrixC.xhtml
@@ -33,11 +33,17 @@
converterMessage="Invalid format!"
title= "(#{i},#{j})"
style="margin-left: 2px;" class="input"
- value="#{row[i]}" >
+ value="#{row[j]}" >
-
+
+ columns:
+
+ rows:
+
+
+