entry : this.languagesMap.entrySet())
+ {
+ Object o = event.getNewValue();
+ String lang = entry.getValue();
+ if (lang.equals(o.toString()))
+ {
+ contextInstance.getViewRoot().setLocale(
+ new Locale(o.toString(), entry.getKey()));
+ this.language = o.toString();
+ name = null;
+ break;
+ }
+ }
+ //contextInstance.renderResponse();
+ }
+
+ public String newData()
+ {
+ if (name == null)
+ {
+ return "";
+ }
+ return "Data in
"
+ + "Your name: " + name + "
"
+ + "Your language: " + language + "
"
+ + "
";
+ }
+}
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..7582bf1
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages.zip b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages.zip
new file mode 100644
index 0000000..fa8bf5c
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages.zip differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages.properties b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages.properties
new file mode 100644
index 0000000..ce3b238
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=Immediate
+txtLang=Your language is English.
+txtName=Your name:
+txtEmptyName=The name cannot be empty!
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_el_GR.properties b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_el_GR.properties
new file mode 100644
index 0000000..b81194c
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_el_GR.properties
@@ -0,0 +1,5 @@
+
+indexWindowTitle=\u1f0c\u03bc\u03b5\u03c3\u03c9\u03c2
+txtLang=\u1f29 \u03b3\u03bb\u1ff6\u03c3\u03c3\u03b1 \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f19\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac.
+txtName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9:
+txtEmptyName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03b4\u03ac\u03bd \u03bc\u03c0\u03bf\u03c1\u03b5\u1fd6 \u03bd\u03ac \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f04\u03b4\u03b5\u03b9\u03bf!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_en_US.properties b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_en_US.properties
new file mode 100644
index 0000000..9881f2a
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_en_US.properties
@@ -0,0 +1,3 @@
+txtLang=Your language is English.
+txtName=Your name:
+txtEmptyName=The name cannot be empty!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_es_ES.properties b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_es_ES.properties
new file mode 100644
index 0000000..06ffcd4
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_es_ES.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=Inmediato
+txtLang=Tu idioma es el ingl\u00e9s.
+txtName=Su nombre:
+txtEmptyName=\u00a1El nombre no puede estar vac\u00edo!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_ru_RU.properties b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_ru_RU.properties
new file mode 100644
index 0000000..9403a26
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_ru_RU.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=\u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e
+txtLang=\u0412\u0430\u0448 \u044f\u0437\u044b\u043a \u2014 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439.
+txtName=\u0412\u0430\u0448\u0435 \u0438\u043c\u044f:
+txtEmptyName = \u0418\u043c\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_vi_VI.properties b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_vi_VI.properties
new file mode 100644
index 0000000..4645e4a
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_vi_VI.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=Ngay l\u1eadp t\u1ee9c
+txtLang=Ng\u00f4n ng\u1eef c\u1ee7a b\u1ea1n l\u00e0 ti\u1ebfng Vi\u1ec7t.
+txtName=T\u00ean b\u1ea1n l\u00e0:
+txtEmptyName=T\u00ean kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u1ec3 tr\u1ed1ng!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_zn_CN.properties b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_zn_CN.properties
new file mode 100644
index 0000000..9458de8
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/resources/messages/messages_zn_CN.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=\u7acb\u5373
+txtLang=\u4f60\u7684\u8bed\u8a00\u662f\u4fc4\u8bed\u3002
+txtName=\u4f60\u7684\u540d\u5b57\u662f:
+txtEmptyName=\u8be5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener-primefaces.xhtml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener-primefaces.xhtml
new file mode 100644
index 0000000..662a4ac
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener-primefaces.xhtml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+ #{msgs.indexWindowTitle}
+
+
+ #{msgs.indexWindowTitle}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener.xhtml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener.xhtml
new file mode 100644
index 0000000..082087a
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener.xhtml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+ #{msgs.indexWindowTitle}
+
+
+ #{msgs.indexWindowTitle}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener_1.xhtml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener_1.xhtml
new file mode 100644
index 0000000..18d6311
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/1-value-change-listener_1.xhtml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ #{msgs.indexWindowTitle}
+
+
+ #{msgs.indexWindowTitle}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/faces-config.xml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..bdb99db
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ messages.messages
+ msgs
+
+
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..673cc06
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/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 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..847f134
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/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/1-value-change-listener-primefaces.xhtml
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/css/styles.css b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..69f1a60
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,3 @@
+.columns {
+ vertical-align: top;
+}
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ca_flag.gif b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ca_flag.gif
new file mode 100644
index 0000000..dd95017
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ca_flag.gif differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ca_flag.jpg b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ca_flag.jpg
new file mode 100644
index 0000000..1b051a8
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ca_flag.jpg differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ch_flag.gif b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ch_flag.gif
new file mode 100644
index 0000000..99eeec9
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/ch_flag.gif differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/cn_flag.jpg b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/cn_flag.jpg
new file mode 100644
index 0000000..8bb0d6f
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/cn_flag.jpg differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/de_flag.gif b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/de_flag.gif
new file mode 100644
index 0000000..e7ff41f
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/de_flag.gif differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/dn_flag.gif b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/dn_flag.gif
new file mode 100644
index 0000000..fce18f1
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/dn_flag.gif differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/el_flag.png b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/el_flag.png
new file mode 100644
index 0000000..7ea5f24
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/el_flag.png differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/en_flag.gif b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/en_flag.gif
new file mode 100644
index 0000000..4483f69
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/en_flag.gif differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/uk_flag.gif b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/uk_flag.gif
new file mode 100644
index 0000000..3acb3ac
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/uk_flag.gif differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/us_flag.jpg b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/us_flag.jpg
new file mode 100644
index 0000000..f586f66
Binary files /dev/null and b/Semester 2/Assignments/EventsLabValueChangeListener/src/main/webapp/resources/images/us_flag.jpg differ
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/faces-config.NavData b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/faces-config.NavData
new file mode 100644
index 0000000..e69de29
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/nb-configuration.xml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/nb-configuration.xml
new file mode 100644
index 0000000..f89ff8d
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 10-web
+ gfv700ee10
+ Facelets
+ JDK_11__System_
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/pom.xml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/pom.xml
new file mode 100644
index 0000000..0f9f8f2
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/pom.xml
@@ -0,0 +1,42 @@
+
+ 4.0.0
+ edu.slcc.asdv.caleb
+ EventsLabValueChangeListener_CalebFontenot
+ 1.0-SNAPSHOT
+ war
+ EventsLabValueChangeListener_CalebFontenot-1.0-SNAPSHOT
+
+
+ UTF-8
+ 10.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 11
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.3.2
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/TextListener.java b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/TextListener.java
new file mode 100644
index 0000000..065fa0c
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/TextListener.java
@@ -0,0 +1,27 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package beans;
+
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.event.AbortProcessingException;
+import jakarta.faces.event.ValueChangeEvent;
+import jakarta.faces.event.ValueChangeListener;
+
+/**
+ *
+ * @author caleb
+ */
+public class TextListener implements ValueChangeListener {
+
+ @Override
+ public void processValueChange(ValueChangeEvent event) throws AbortProcessingException
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Object o = event.getNewValue();
+ String s = o.toString();
+ System.out.println(s);
+ }
+
+}
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/TextListener1.java b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/TextListener1.java
new file mode 100644
index 0000000..9cf01e4
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/TextListener1.java
@@ -0,0 +1,27 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package beans;
+
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.event.AbortProcessingException;
+import jakarta.faces.event.ValueChangeEvent;
+import jakarta.faces.event.ValueChangeListener;
+
+/**
+ *
+ * @author caleb
+ */
+public class TextListener1 implements ValueChangeListener {
+
+ @Override
+ public void processValueChange(ValueChangeEvent event) throws AbortProcessingException
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Object o = event.getNewValue();
+ String s = o.toString();
+ System.out.println(s + " a second listener was called");
+ }
+
+}
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/ValueChangedTestBean.java b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/ValueChangedTestBean.java
new file mode 100644
index 0000000..060478c
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/beans/ValueChangedTestBean.java
@@ -0,0 +1,101 @@
+package beans;
+
+import jakarta.inject.Named;
+import jakarta.enterprise.context.SessionScoped;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.event.AbortProcessingException;
+import jakarta.faces.event.ValueChangeEvent;
+
+@Named(value = "vst")
+@SessionScoped
+public class ValueChangedTestBean implements Serializable
+{
+ private String name;
+ private String language = "en";
+ private Map languagesMap;
+
+ public ValueChangedTestBean()
+ {
+ languagesMap = new LinkedHashMap();
+ languagesMap.put("US", "en");//usa
+ languagesMap.put("ES", "es");//spain
+ languagesMap.put("GR", "el");//greece
+ languagesMap.put("RU", "ru");//russia
+ languagesMap.put("CN", "zn");//china
+ languagesMap.put("VI", "vi");//vietnam
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getLanguage()
+ {
+ return language;
+ }
+
+ public void setLanguage(String language)
+ {
+ this.language = language;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Map getLanguagesMap()
+ {
+ List list = Arrays.asList("en", "gr", "es", "ru", "zn", "vi");
+ return languagesMap;
+ }
+
+ public List getLanguages()
+ {
+ List list = Arrays.asList("en", "gr", "es", "ru", "zn", "vi");
+ return list;
+ }
+ public void inputTextValueChangeListener(ValueChangeEvent event) throws AbortProcessingException {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Object o = event.getNewValue();
+ String s = o.toString();
+ System.out.println(s);
+ }
+ public void languageChanged(ValueChangeEvent event)
+ {
+ FacesContext contextInstance = FacesContext.getCurrentInstance();
+ for (Map.Entry entry : this.languagesMap.entrySet())
+ {
+ Object o = event.getNewValue();
+ String lang = entry.getValue();
+ if (lang.equals(o.toString()))
+ {
+ contextInstance.getViewRoot().setLocale(
+ new Locale(o.toString(), entry.getKey()));
+ this.language = o.toString();
+ name = null;
+ break;
+ }
+ }
+ contextInstance.renderResponse();
+ }
+
+ public String newData()
+ {
+ if (name == null)
+ {
+ return "";
+ }
+ return "Data in
"
+ + "Your name: " + name + "
"
+ + "Your language: " + language + "
"
+ + "
";
+ }
+}
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/eventslabvaluechangelistener_calebfontenot/JakartaRestConfiguration.java b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/eventslabvaluechangelistener_calebfontenot/JakartaRestConfiguration.java
new file mode 100644
index 0000000..ec5a406
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/eventslabvaluechangelistener_calebfontenot/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package edu.slcc.asdv.caleb.eventslabvaluechangelistener_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 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/eventslabvaluechangelistener_calebfontenot/resources/JakartaEE10Resource.java b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/eventslabvaluechangelistener_calebfontenot/resources/JakartaEE10Resource.java
new file mode 100644
index 0000000..287b3e7
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/eventslabvaluechangelistener_calebfontenot/resources/JakartaEE10Resource.java
@@ -0,0 +1,20 @@
+package edu.slcc.asdv.caleb.eventslabvaluechangelistener_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 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..7582bf1
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages.properties b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages.properties
new file mode 100644
index 0000000..ce3b238
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=Immediate
+txtLang=Your language is English.
+txtName=Your name:
+txtEmptyName=The name cannot be empty!
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_el_GR.properties b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_el_GR.properties
new file mode 100644
index 0000000..b81194c
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_el_GR.properties
@@ -0,0 +1,5 @@
+
+indexWindowTitle=\u1f0c\u03bc\u03b5\u03c3\u03c9\u03c2
+txtLang=\u1f29 \u03b3\u03bb\u1ff6\u03c3\u03c3\u03b1 \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f19\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac.
+txtName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03c3\u03b1\u03c2 \u03b5\u1f36\u03bd\u03b1\u03b9:
+txtEmptyName=\u03a4\u03cc \u1f44\u03bd\u03bf\u03bc\u03ac \u03b4\u03ac\u03bd \u03bc\u03c0\u03bf\u03c1\u03b5\u1fd6 \u03bd\u03ac \u03b5\u1f36\u03bd\u03b1\u03b9 \u1f04\u03b4\u03b5\u03b9\u03bf!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_en_US.properties b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_en_US.properties
new file mode 100644
index 0000000..9881f2a
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_en_US.properties
@@ -0,0 +1,3 @@
+txtLang=Your language is English.
+txtName=Your name:
+txtEmptyName=The name cannot be empty!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_es_ES.properties b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_es_ES.properties
new file mode 100644
index 0000000..06ffcd4
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_es_ES.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=Inmediato
+txtLang=Tu idioma es el ingl\u00e9s.
+txtName=Su nombre:
+txtEmptyName=\u00a1El nombre no puede estar vac\u00edo!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_ru_RU.properties b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_ru_RU.properties
new file mode 100644
index 0000000..9403a26
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_ru_RU.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=\u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e
+txtLang=\u0412\u0430\u0448 \u044f\u0437\u044b\u043a \u2014 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439.
+txtName=\u0412\u0430\u0448\u0435 \u0438\u043c\u044f:
+txtEmptyName = \u0418\u043c\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_vi_VI.properties b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_vi_VI.properties
new file mode 100644
index 0000000..4645e4a
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_vi_VI.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=Ngay l\u1eadp t\u1ee9c
+txtLang=Ng\u00f4n ng\u1eef c\u1ee7a b\u1ea1n l\u00e0 ti\u1ebfng Vi\u1ec7t.
+txtName=T\u00ean b\u1ea1n l\u00e0:
+txtEmptyName=T\u00ean kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u1ec3 tr\u1ed1ng!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_zn_CN.properties b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_zn_CN.properties
new file mode 100644
index 0000000..9458de8
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/resources/messages/messages_zn_CN.properties
@@ -0,0 +1,4 @@
+indexWindowTitle=\u7acb\u5373
+txtLang=\u4f60\u7684\u8bed\u8a00\u662f\u4fc4\u8bed\u3002
+txtName=\u4f60\u7684\u540d\u5b57\u662f:
+txtEmptyName=\u8be5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a!
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/1-value-change-listener.xhtml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/1-value-change-listener.xhtml
new file mode 100644
index 0000000..dfd6183
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/1-value-change-listener.xhtml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+ #{msgs.indexWindowTitle}
+
+
+ #{msgs.indexWindowTitle}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/faces-config.xml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..8b5a26c
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+ messages.messages
+ msgs
+
+
+
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..584a477
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_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 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..0cd9172
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_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/1-value-change-listener.xhtml
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/resources/css/styles.css b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..34a6c9a
--- /dev/null
+++ b/Semester 2/Assignments/EventsLabValueChangeListener_CalebFontenot/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,28 @@
+/*
+Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/css.css to edit this template
+*/
+/*
+ Created on : Nov 13, 2023, 10:07:11 AM
+ Author : caleb
+*/
+
+.normalSize { font-size: 110% }
+.largeSize { font-size: 200% }
+body {
+ background-color: #e9e9e9;
+}
+a:hover {
+ color: red
+}
+
+h1,h2,h3 {
+ text-align: center;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ color: black;
+}
+
+.button1
+{
+ text-height:font-size;
+}
diff --git a/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/nb-configuration.xml b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/nb-configuration.xml
new file mode 100644
index 0000000..f89ff8d
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 10-web
+ gfv700ee10
+ Facelets
+ JDK_11__System_
+
+
diff --git a/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/pom.xml b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/pom.xml
new file mode 100644
index 0000000..5a125fc
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/pom.xml
@@ -0,0 +1,52 @@
+
+ 4.0.0
+ edu.slcc.asdv.caleb
+ JavaScriptValidation_CalebFontenot
+ 1.0-SNAPSHOT
+ war
+ JavaScriptValidation_CalebFontenot-1.0-SNAPSHOT
+
+
+ UTF-8
+ 10.0.0
+
+
+
+
+ com.google.protobuf
+ protobuf-java
+ 3.21.9
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ 10.0.0
+
+
+ org.primefaces
+ primefaces
+ 12.0.0
+ jakarta
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 11
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.3.2
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/beans/ControlRender.java b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/beans/ControlRender.java
new file mode 100644
index 0000000..e5e2465
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/beans/ControlRender.java
@@ -0,0 +1,111 @@
+/*
+ * 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 caleb
+ */
+@Named(value="controlRender")
+@RequestScoped
+public class ControlRender {
+
+ private String text;
+ private String mask;
+ private int rate;
+ private String userName;
+ private String alpha;
+
+ public String getAlpha()
+ {
+ return alpha;
+ }
+
+ public void setAlpha(String alpha)
+ {
+ this.alpha = alpha;
+ }
+
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+
+ /**
+ * Get the value of rate
+ *
+ * @return the value of rate
+ */
+ public int getRate()
+ {
+ return rate;
+ }
+
+ /**
+ * Set the value of rate
+ *
+ * @param rate new value of rate
+ */
+ public void setRate(int rate)
+ {
+ this.rate = rate;
+ }
+
+
+ /**
+ * Get the value of mask
+ *
+ * @return the value of mask
+ */
+ public String getMask()
+ {
+ return mask;
+ }
+
+ /**
+ * Set the value of mask
+ *
+ * @param mask new value of mask
+ */
+ public void setMask(String mask)
+ {
+ this.mask = mask;
+ }
+
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+ public void printToServer() {
+ System.out.println(this.text);
+ System.out.println(this.mask);
+ System.out.println(this.rate);
+ System.out.println(this.userName);
+ System.out.println(this.alpha);
+ }
+
+ /** Creates a new instance of ControlRender */
+ public ControlRender() {
+ }
+
+}
diff --git a/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/javascriptvalidation_calebfontenot/JakartaRestConfiguration.java b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/javascriptvalidation_calebfontenot/JakartaRestConfiguration.java
new file mode 100644
index 0000000..d786073
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/javascriptvalidation_calebfontenot/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package edu.slcc.asdv.caleb.javascriptvalidation_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 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/javascriptvalidation_calebfontenot/resources/JakartaEE10Resource.java b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/javascriptvalidation_calebfontenot/resources/JakartaEE10Resource.java
new file mode 100644
index 0000000..5917789
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/javascriptvalidation_calebfontenot/resources/JakartaEE10Resource.java
@@ -0,0 +1,20 @@
+package edu.slcc.asdv.caleb.javascriptvalidation_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 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..7582bf1
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..673cc06
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_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 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..f182148
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_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 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/index.xhtml b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..1b1d910
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/index.xhtml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ Validation with javascript and primefaces
+
+
+ alphanumeric input only javascript called:
+
+
+
+
+ only letters and numbers regex:
+
+
+
+
+
+
+ only numbers mask:
+
+
+
+
+ only letters mask:
+
+
+ rate:
+
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/resources/js/do_validation.js b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/resources/js/do_validation.js
new file mode 100644
index 0000000..e66c47e
--- /dev/null
+++ b/Semester 2/Assignments/JavaScriptValidation_CalebFontenot/src/main/webapp/resources/js/do_validation.js
@@ -0,0 +1,20 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/JavaScript.js to edit this template
+ */
+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");
+ }
+
+};
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/faces-config.NavData b/Semester 2/Assignments/LabEvents_CalebFontenot/faces-config.NavData
new file mode 100644
index 0000000..e69de29
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/nb-configuration.xml b/Semester 2/Assignments/LabEvents_CalebFontenot/nb-configuration.xml
new file mode 100644
index 0000000..5e1a2de
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/nb-configuration.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+ 10-web
+ gfv700ee10
+ Facelets
+
+
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/pom.xml b/Semester 2/Assignments/LabEvents_CalebFontenot/pom.xml
new file mode 100644
index 0000000..c412e81
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/pom.xml
@@ -0,0 +1,42 @@
+
+ 4.0.0
+ edu.slcc.asdv.caleb
+ LabEvents_CalebFontenot
+ 1.0-SNAPSHOT
+ war
+ LabEvents_CalebFontenot-1.0-SNAPSHOT
+
+
+ UTF-8
+ 10.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 11
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.3.2
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/FormSettings.java b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/FormSettings.java
new file mode 100644
index 0000000..2265471
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/FormSettings.java
@@ -0,0 +1,31 @@
+/*
+ * 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.SessionScoped;
+import java.io.Serializable;
+import jakarta.faces.event.ActionEvent;
+
+@Named(value = "formSettings")
+@SessionScoped
+public class FormSettings implements Serializable
+{
+ private boolean isNormalSize = true;
+
+ public String getBodyStyleClass()
+ {
+ if (isNormalSize) return ("normalSize");//css class
+ else return ("largeSize");
+ }
+ public void setNormalSize(ActionEvent event){
+ System.out.println("****************************setNormalSize called");
+ isNormalSize = true;}
+ public void setLargeSize(ActionEvent event){
+ System.out.println(
+ "**************************************setLargeSize called");
+ isNormalSize = false;}
+}
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/FormSettingsLocale.java b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/FormSettingsLocale.java
new file mode 100644
index 0000000..c62686c
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/FormSettingsLocale.java
@@ -0,0 +1,100 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package beans;
+
+/**
+ *
+ * @author caleb
+ */
+import jakarta.inject.Named;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.faces.event.ActionEvent;
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+
+@Named(value = "formSettingsLocale")
+@SessionScoped
+public class FormSettingsLocale implements Serializable
+{
+
+ private boolean isNormalSize = true;
+ private boolean isEnglish = true;
+ private static final Locale ENGLISH = new Locale("en");
+ private static final Locale SPANISH = new Locale("es");
+ private static final Locale JAPANESE = new Locale("jp");
+ private static final Locale GREEK = new Locale("el");
+
+ private Locale locale = ENGLISH;
+ private String language = locale.getLanguage();
+
+ private static final Map LANGUAGE_MAP
+ = new LinkedHashMap<>();
+
+ static
+ {
+ LANGUAGE_MAP.put("English", "en");
+ LANGUAGE_MAP.put("Español", "es");
+ LANGUAGE_MAP.put("日本人", "jp");
+ LANGUAGE_MAP.put(" Ἑλληνικά", "el");
+ }
+
+ public String getBodyStyleClass()
+ {
+ if (isNormalSize)
+ {
+ return ("normalSize");
+ }
+ else
+ {
+ return ("largeSize");
+ }
+ }
+
+ public void setNormalSize(ActionEvent event)
+ {
+ isNormalSize = true;
+ }
+
+ public void setLargeSize(ActionEvent event)
+ {
+ isNormalSize = false;
+ }
+
+ public Locale getLocale()
+ {
+ return (locale);
+ }
+
+ public void swapLocale( ActionEvent event )
+ {
+ isEnglish = !isEnglish;
+ if (isEnglish)
+ {
+ locale = ENGLISH;
+ }
+ else
+ {
+ locale = SPANISH;
+ }
+ }
+
+ public String getLanguage()
+ {
+ return (language);
+ }
+
+ public void setLanguage(String language)
+ {
+ this.language = language;
+ locale = new Locale(language);
+ }
+
+ public Map getLanguages()
+ {
+ return (LANGUAGE_MAP);
+ }
+}
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/Person.java b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/Person.java
new file mode 100644
index 0000000..4178fc0
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/beans/Person.java
@@ -0,0 +1,66 @@
+package beans;
+
+import jakarta.inject.Named;
+import jakarta.enterprise.context.RequestScoped;
+
+@Named(value = "person")
+@RequestScoped
+public class Person {
+
+ private String firstName, lastName, emailAddress;
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ System.out.println("---------------------------------------first name called");
+ this.firstName = firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ public String getEmailAddress()
+ {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress)
+ {
+ this.emailAddress = emailAddress;
+ }
+
+ public String doRegistration()
+ {
+ if (isAnyEmpty(firstName, lastName, emailAddress)) {
+ return "missing-input";
+ } else {
+ return "confirm-registration";
+ }
+ }
+
+ private boolean isAnyEmpty(String... values)
+ {
+ for (String value : values) {
+ if (isEmpty(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean isEmpty(String value)
+ {
+ return value == null || value.trim().length() == 0;
+ }
+}
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/labevents_calebfontenot/JakartaRestConfiguration.java b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/labevents_calebfontenot/JakartaRestConfiguration.java
new file mode 100644
index 0000000..522373e
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/labevents_calebfontenot/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package edu.slcc.asdv.caleb.labevents_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 2/Assignments/LabEvents_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/labevents_calebfontenot/resources/JakartaEE10Resource.java b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/labevents_calebfontenot/resources/JakartaEE10Resource.java
new file mode 100644
index 0000000..5bffd4b
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/labevents_calebfontenot/resources/JakartaEE10Resource.java
@@ -0,0 +1,20 @@
+package edu.slcc.asdv.caleb.labevents_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 2/Assignments/LabEvents_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..7582bf1
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages.properties b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages.properties
new file mode 100644
index 0000000..6f2a779
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages.properties
@@ -0,0 +1,14 @@
+registrationTitle=Registration
+firstName=First Name
+lastName=Last Name
+emailAddress=Email Address
+registrationText=Please Enter Your {0}, {1}, and {2}.
+prompt=Enter {0}
+buttonLabel=Register Me
+successTitle=Success
+successText=You Registered Successfully.
+switchLanguage=En Español
+normalFont=Normal Font
+largeFont=Large Font
+errorTitle=Error!
+missingData=Missing input. Please try again.
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_el.properties b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_el.properties
new file mode 100644
index 0000000..c5b957b
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_el.properties
@@ -0,0 +1,14 @@
+registrationTitle=\u1f18\u03b3\u03b3\u03c1\u03b1\u03c6\u03ae
+firstName= \u1f4c\u03bd\u03bf\u03bc\u03b1
+lastName=\u1f18\u03c0\u03c9\u03bd\u03c5\u03bc\u03bf\u03bd
+emailAddress=\u1f38\u03bc\u03ad\u03b9\u03bb
+registrationText=\u03a0\u03b1\u03c1\u03b1\u03ba\u03b1\u03bb\u1ff6 \u03b3\u03c1\u03ac\u03c8\u03b1\u03c4\u03b5 {0}, {1}, \u03ba\u03b1\u1f30 {2}.
+prompt=\u0393\u03c1\u03ac\u03c8\u03b5 {0}
+buttonLabel=\u1f18\u03b3\u03b3\u03c1\u03ac\u03c8\u03b5 \u03bc\u03b5
+successTitle=\u1f18\u03c0\u03b9\u03c4\u03c5\u03c7\u03af\u03b1
+successText=\u0393\u03c1\u03ac\u03c6\u03c4\u03b7\u03ba\u03b5\u03c2
+switchLanguage=\u03a3\u03c4\u03ac \u1f19\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac
+normalFont=\u039c\u03b9\u03ba\u03c1\u03ac \u03b3\u03c1\u03ac\u03bc\u03bc\u03b1\u03c4\u03b1
+largeFont=\u039c\u03b5\u03b3\u03ac\u03bb\u03b1 \u03b3\u03c1\u03ac\u03bc\u03bc\u03b1\u03c4\u03b1
+errorTitle=\u039b\u03ac\u03b8\u03bf\u03c2!
+missingData=\u1f18\u03bb\u03bb\u03b5\u03b9\u03c0\u1f20 \u03c3\u03c4\u03bf\u03b9\u03c7\u03b5\u1fd6\u03b1. \u03a0\u03b1\u03c1\u03b1\u03ba\u03b1\u03bb\u1ff6 \u03be\u03b1\u03bd\u03b1\u03b4\u03bf\u03ba\u03b9\u03bc\u1fb6\u03c3\u03c4\u03b5!
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_es.properties b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_es.properties
new file mode 100644
index 0000000..1b3edb8
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_es.properties
@@ -0,0 +1,14 @@
+registrationTitle=Registro
+firstName=Primer Nombre
+lastName=Apellido
+emailAddress=Dirección de Email
+registrationText=Incorpore Por Favor su {0}, {1}, y {2}.
+prompt=Incorpore {0}
+buttonLabel=Coloqúeme
+successTitle=Éxito
+successText=Se Registró con Éxito.
+switchLanguage=In English
+normalFont=Fuente Normal
+largeFont=Fuente Grande
+errorTitle=¡Error!
+missingData=Falta de input. Por favor, inténtelo de nuevo.
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_jp.properties b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_jp.properties
new file mode 100644
index 0000000..4c04071
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/resources/messages/messages_jp.properties
@@ -0,0 +1,14 @@
+registrationTitle=\u767B\u9332
+firstName=\u540D\u524D
+lastName=\u59D3
+emailAddress=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9
+registrationText=\u3042\u306A\u305F\u306E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 {0}, {1}, \u3068 {2}.
+prompt=\u30BF\u30A4\u30D7 {0}
+buttonLabel=\u79C1\u3092\u767B\u9332
+successTitle=\u6210\u529F
+successText=\u3042\u306A\u305F\u304C\u6B63\u5E38\u306B\u767B\u9332\u3002
+switchLanguage=\u65E5\u672C\u8A9E\u3067
+normalFont=\u901A\u5E38\u306E\u30D5\u30A9\u30F3\u30C8
+largeFont=\u5927\u304D\u3044\u30D5\u30A9\u30F3\u30C8
+errorTitle=\u30A8\u30E9\u30FC\uFF01
+missingData=\u672A\u5165\u529B\u3067\u3059\u3002\u3082\u3046\u4E00\u5EA6\u3084\u308A\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..9dfae34
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/faces-config.xml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..8b5a26c
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+ messages.messages
+ msgs
+
+
+
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..673cc06
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_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 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..f182148
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_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 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/confirm-registration.xhtml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/confirm-registration.xhtml
new file mode 100644
index 0000000..8f36117
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/confirm-registration.xhtml
@@ -0,0 +1,21 @@
+
+
+
+ #{msgs.successTitle}
+
+
+
+
+
+ #{msgs.successTitle}
+ #{msgs.successText}
+
+ - #{msgs.firstName}: #{person.firstName}
+ - #{msgs.lastName}: #{person.lastName}
+ - #{msgs.emailAddress}: #{person.emailAddress}
+
+
+
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/index.xhtml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..e631438
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/index.xhtml
@@ -0,0 +1,19 @@
+
+
+
+
+ Events
+
+
+ Handling Application Events
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/register1.xhtml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/register1.xhtml
new file mode 100644
index 0000000..fecafa1
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/register1.xhtml
@@ -0,0 +1,52 @@
+
+
+ #{msgs.registrationTitle}
+
+
+
+
+
+
+ #{msgs.registrationTitle}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/register3.xhtml b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/register3.xhtml
new file mode 100644
index 0000000..bc86b76
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/register3.xhtml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ #{msgs.registrationTitle}
+
+
+
+ #{msgs.registrationTitle}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/resources/css/styles.css b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..34a6c9a
--- /dev/null
+++ b/Semester 2/Assignments/LabEvents_CalebFontenot/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,28 @@
+/*
+Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/css.css to edit this template
+*/
+/*
+ Created on : Nov 13, 2023, 10:07:11 AM
+ Author : caleb
+*/
+
+.normalSize { font-size: 110% }
+.largeSize { font-size: 200% }
+body {
+ background-color: #e9e9e9;
+}
+a:hover {
+ color: red
+}
+
+h1,h2,h3 {
+ text-align: center;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ color: black;
+}
+
+.button1
+{
+ text-height:font-size;
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/nb-configuration.xml b/Semester 2/Assignments/SupplierPartsCalendar/nb-configuration.xml
new file mode 100644
index 0000000..f29f292
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 9.0-web
+ gfv700ee10
+ Facelets
+ JDK_11__System_
+
+
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/pom.xml b/Semester 2/Assignments/SupplierPartsCalendar/pom.xml
new file mode 100644
index 0000000..2ac98e0
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/pom.xml
@@ -0,0 +1,87 @@
+
+ 4.0.0
+ com.mycompany
+ SuppliersPartsCalendar
+ 1.0-SNAPSHOT
+ war
+ SuppliersPartsCalendar
+
+
+ 1.8
+ 1.8
+ ${project.build.directory}/endorsed
+ UTF-8
+ false
+ 9.0.0
+
+
+
+
+ com.mysql
+ mysql-connector-j
+ 8.1.0
+
+
+ org.primefaces
+ primefaces
+ 12.0.0
+ jakarta
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ 10.0.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.8
+
+ ${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 2/Assignments/SupplierPartsCalendar/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java
new file mode 100644
index 0000000..110a745
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package com.mycompany.supplierspartsdatabase;
+
+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 2/Assignments/SupplierPartsCalendar/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java
new file mode 100644
index 0000000..f7f850d
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java
@@ -0,0 +1,20 @@
+package com.mycompany.supplierspartsdatabase.resources;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.core.Response;
+
+/**
+ *
+ * @author
+ */
+@Path("jakartaee9")
+public class JakartaEE9Resource {
+
+ @GET
+ public Response ping(){
+ return Response
+ .ok("ping Jakarta EE")
+ .build();
+ }
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/beans/SupplierBean.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/beans/SupplierBean.java
new file mode 100644
index 0000000..9e05f94
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/beans/SupplierBean.java
@@ -0,0 +1,133 @@
+/*
+ * 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.beans;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.part.DatabaseManipulationPart;
+import edu.slcc.asdv.bl.part.Part;
+import edu.slcc.asdv.bl.supplier.DatabaseManipulationSupplier;
+import edu.slcc.asdv.bl.supplier.Supplier;
+import jakarta.annotation.PostConstruct;
+import jakarta.inject.Named;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.faces.application.FacesMessage;
+import jakarta.faces.application.FacesMessage.Severity;
+import jakarta.faces.context.FacesContext;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+
+@Named(value = "supplierBean")
+@SessionScoped
+public class SupplierBean implements Serializable {
+
+ //DBase dms;
+ //DBase dmp;
+ DBase dms = new DatabaseManipulationSupplier();
+ DBase dmp = new DatabaseManipulationPart();
+ List suppliers;
+ List parts;
+
+ private Supplier selectedSupplier;
+
+ public Supplier getSelectedSupplier() {
+ return selectedSupplier;
+ }
+
+ public void setSelectedSupplier(Supplier selectedSupplier) {
+ this.selectedSupplier = selectedSupplier;
+ }
+
+ public SupplierBean() {
+ suppliers = dms.listAll();
+ parts = dmp.listAll();
+ }
+
+ public List getSuppliers() {
+ return suppliers;
+ }
+
+ public List getParts() {
+ return parts;
+ }
+
+ public void deleteFromList() {
+ int totalRowsUpdated = 0;
+ Iterator iterator = this.suppliers.iterator();
+ while (iterator.hasNext()) {
+ Supplier s = iterator.next();
+ if (s.isModify()) {
+ try {
+ int rowsUpdated = this.dms.delete(s);
+ if (rowsUpdated > 0) {
+ iterator.remove();
+ }
+ } catch (Exception e) {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ break;
+ }
+ }
+ }
+}
+
+
+ public void saveFromUpdate() {
+ int totalRowsUpdated = 0;
+ for (Supplier s : this.suppliers) {
+ if (s.isModify()) {
+ try {
+ int rowsUpdated = this.dms.update(s);
+ if (rowsUpdated > 0) {
+ totalRowsUpdated += rowsUpdated;
+ s.setModify(false);
+ }
+ } catch (Exception e) {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ break;
+ }
+ }
+ }
+ String msg = ("Numbers of rows updated: " + totalRowsUpdated);
+ addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
+ }
+
+ public void saveFromUpdatePart() {
+ int totalRowsUpdated = 0;
+
+ for (Part s : this.parts) {
+ if (s.isModify()) {
+ try {
+ int rowsUpdated = this.dmp.update(s);
+ if (rowsUpdated > 0) {
+ totalRowsUpdated += rowsUpdated;
+ s.setModify(false);
+ }
+ } catch (Exception e) {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ break;
+ }
+ }
+ }
+ String msg = ("Numbers of rows updated: " + totalRowsUpdated);
+ addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
+ }
+
+ public void addMessage(String summary, String detail, Severity severity) {
+ FacesMessage msg = new FacesMessage(severity, summary, detail);
+ FacesContext.getCurrentInstance().addMessage(null, msg);
+ }
+
+ @PostConstruct
+ public void init() {
+ try {
+ //suppliers.dms.listAll();
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/DBase.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/DBase.java
new file mode 100644
index 0000000..f09fd59
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/DBase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.bl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public interface DBase
+{
+ List listAll();
+
+ int update( T t)
+ throws SQLException;
+
+ int delete(T t)
+ throws SQLException;
+
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/DateValidator.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/DateValidator.java
new file mode 100644
index 0000000..b8a144d
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/DateValidator.java
@@ -0,0 +1,31 @@
+/*
+ * 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.bl;
+
+import jakarta.faces.application.FacesMessage;
+import jakarta.faces.component.UIComponent;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.validator.FacesValidator;
+import jakarta.faces.validator.Validator;
+import jakarta.faces.validator.ValidatorException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+@FacesValidator("dateValidator")
+public class DateValidator implements Validator {
+
+ private static final String DATE_PATTERN = "yyyy-MM-dd";
+
+ @Override
+ public void validate(FacesContext context, UIComponent component, String value) throws ValidatorException {
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN);
+ sdf.setLenient(false);
+ try {
+ sdf.parse(value);
+ } catch (ParseException e) {
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid date format", "Date must be in 'yyyy-MM-dd' format"));
+ }
+ }
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java
new file mode 100644
index 0000000..36a5d46
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java
@@ -0,0 +1,99 @@
+/*
+ * 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.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 + ":3306/" + databaseName + "?allowPublicKeyRetrieval=true&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 {
+// java.sqlDate sqldate = stringDateToSqlDate();
+//}
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java
new file mode 100644
index 0000000..2078ad6
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java
@@ -0,0 +1,71 @@
+/*
+ * 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.bl.part;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import edu.slcc.asdv.bl.supplier.Supplier;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public class DatabaseManipulationPart implements DBase
+{
+ private static final String DATABASE_NAME = "suppliers_parts_23";
+private static final String USER_NAME = "java";
+private static final String PASSWORD = "8VCS49HT2xjsEZvC";
+private static final String DRIVER_URL = "com.mysql.jdbc.Driver";
+
+ @Override
+public List listAll() {
+ List tablePart = new ArrayList<>();
+ String sqlStr = "SELECT * FROM part";
+ try (Connection con = new UtilitiesDatabase().connection(DATABASE_NAME, USER_NAME, PASSWORD, DRIVER_URL);
+ PreparedStatement ps = con.prepareStatement(sqlStr);
+ ResultSet rs = ps.executeQuery()) {
+
+ while (rs.next()) {
+ String pNumber = rs.getString(1);
+ String pName = rs.getString(2);
+ String color = rs.getString(3);
+ String city = rs.getString(4);
+ Part part = new Part(pNumber, pName, color, city);
+ tablePart.add(part);
+ }
+ } catch (SQLException ex) {
+ throw new RuntimeException("Error fetching parts from database", ex);
+ }
+ return tablePart;
+}
+
+@Override
+public int update(Part part) throws SQLException {
+ String sqlStr = "UPDATE part SET pname=?, color=?, city=? WHERE pnumber=?";
+ try (Connection con = new UtilitiesDatabase().connection(DATABASE_NAME, USER_NAME, PASSWORD, DRIVER_URL);
+ PreparedStatement ps = con.prepareStatement(sqlStr)) {
+
+ ps.setString(1, part.getPname());
+ ps.setString(2, part.getColor());
+ ps.setString(3, part.getCity());
+ ps.setString(4, part.getPnumber());
+ return ps.executeUpdate();
+
+ } catch (SQLException ex) {
+ throw new RuntimeException("Error updating part in database", ex);
+ }
+}
+
+ @Override
+ public int delete(Part t) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/part/Part.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/part/Part.java
new file mode 100644
index 0000000..1f03a1f
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/part/Part.java
@@ -0,0 +1,86 @@
+/*
+ * 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.bl.part;
+
+/**
+ *
+ * @author asdv5
+ */
+public class Part
+{
+ private String pnumber;
+ private String pname;
+ private String color;
+ private String city;
+
+ private boolean modify;
+
+ public boolean isModify()
+ {
+ return modify;
+ }
+
+ public void setModify(boolean modify)
+ {
+ this.modify = modify;
+ }
+ public Part(String pnumber, String pname, String color, String city)
+ {
+ this.pnumber = pnumber;
+ this.pname = pname;
+ this.color = color;
+ this.city = city;
+ }
+
+
+ public String getColor()
+ {
+ return color;
+ }
+
+ public void setColor(String color)
+ {
+ this.color = color;
+ }
+
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ public String getPname()
+ {
+ return pname;
+ }
+
+ public void setPname(String pname)
+ {
+ this.pname = pname;
+ }
+
+ public String getPnumber()
+ {
+ return pnumber;
+ }
+
+ public void setPnumber(String pnumber)
+ {
+ this.pnumber = pnumber;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Part{" + "pnumber=" + pnumber + ", pname=" + pname + ", color=" + color + ", city=" + city + '}';
+ }
+
+
+
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java
new file mode 100644
index 0000000..fb5b991
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java
@@ -0,0 +1,151 @@
+/*
+ * 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.bl.supplier;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import java.sql.Connection;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public class DatabaseManipulationSupplier implements DBase {
+
+ @Override
+ public List listAll() {
+ List tableSuppliers = new ArrayList();
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ 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 supplier";
+ //prepare statement
+ ps = con.prepareStatement(sqlStr);
+ //execute
+ rs = ps.executeQuery();
+ int row = 0;
+ while (rs.next()) {
+ String sNumber = rs.getString(1);
+ String sName = rs.getString(2);
+ String bdate = rs.getDate(3) + " ";
+ int status = rs.getInt(4);
+ String city = rs.getString(5) + " ";
+ Supplier supplier = new Supplier(sNumber, sName, bdate, status, city);
+ tableSuppliers.add(supplier);
+ row++;
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ } finally {
+ try {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (ps != null) {
+ ps.close();
+ }
+ } catch (SQLException sqle) {
+ sqle.printStackTrace();
+ }
+ }
+ return tableSuppliers;
+ }
+
+ @Override
+ public int update(Supplier t)
+ throws SQLException {
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ int result = 0;
+ PreparedStatement updateSupplier = null;
+ try {
+ if (con == null) {
+ throw new RuntimeException("cannot connect to database");
+ }
+
+ updateSupplier = con.prepareStatement(
+ "UPDATE supplier SET snumber=?, sname=?, status=?, birthday=?, city=? WHERE snumber=?");
+ updateSupplier.setString(1, t.getSnumber());
+ updateSupplier.setString(2, t.getSname());
+ updateSupplier.setInt(3, t.getStatus());
+ java.sql.Date bd = UtilitiesDatabase.stringDateToSqlDate(t.getBirthday());
+ updateSupplier.setDate(4, bd);
+ updateSupplier.setString(5, t.getCity());
+ updateSupplier.setString(6, t.getSnumber());
+ result = updateSupplier.executeUpdate();
+ } catch (SQLException ex) {
+ System.err.println(ex.toString());
+ throw ex;
+ } finally {
+ try {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (updateSupplier != null) {
+ updateSupplier.close();
+ }
+ } catch (SQLException sqle) {
+ sqle.printStackTrace();
+ throw sqle;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public int delete(Supplier t) throws SQLException {
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ int result = 0;
+ PreparedStatement deleteSupplier = null;
+ try {
+ if (con == null) {
+ throw new RuntimeException("cannot connect to database");
+ }
+
+ deleteSupplier = con.prepareStatement(
+ "DELETE FROM supplier WHERE snumber=?");
+ deleteSupplier.setString(1, t.getSnumber());
+ result = deleteSupplier.executeUpdate();
+ } catch (SQLException ex) {
+ System.err.println(ex.toString());
+ throw ex;
+ } finally {
+ try {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ if (deleteSupplier != null) {
+ deleteSupplier.close();
+ }
+ } catch (SQLException sqle) {
+ sqle.printStackTrace();
+ throw sqle;
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java
new file mode 100644
index 0000000..d636407
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java
@@ -0,0 +1,136 @@
+/*
+ * 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.bl.supplier;
+
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+/**
+ *
+ * @author asdv5
+ */
+public class Supplier implements Serializable {
+
+ private String snumber;
+ private String sname;
+ private String birthday;
+ private int status;
+ private String city;
+ private Date birthdayDate;
+
+ /**
+ * Get the value of birthdayDate
+ *
+ * @return the value of birthdayDate
+ */
+ public Date getBirthdayDate()
+ {
+ birthdayDate = UtilitiesDatabase.stringDateToJavaUtilitiesDate(this.birthday);
+ return birthdayDate;
+ }
+
+ /**
+ * Set the value of birthdayDate
+ *
+ * @param birthdayDate new value of birthdayDate
+ */
+ /*
+ public void setBirthdayDate(Date birthdayDate)
+
+ {
+ // this.birthday = birthdayDate;
+ int year = this.birthdayDate.getYear() + 1900;
+ int month = this.birthdayDate.getMonth()+1;
+ int day = this.birthdayDate.getDate();
+ this.birthdayDate = Integer.toString(year) + "-" +
+ //Integer.toString(month) + "-" +
+ Integer.toString(day);
+ }
+*/
+
+ private boolean modify;
+
+ public boolean isModify()
+ {
+ return modify;
+ }
+
+ public void setModify(boolean modify)
+ {
+ this.modify = modify;
+ }
+
+ public Supplier(String snumber, String sname, String birthday, int status, String city)
+ {
+ this.snumber = snumber;
+ this.sname = sname;
+ this.birthday = birthday;
+ this.status = status;
+ this.city = city;
+ this.modify = false;
+ }
+
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ public int getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(int status)
+ {
+ this.status = status;
+ }
+
+ public String getBirthday()
+ {
+ return birthday;
+ }
+
+ public void setBirthday(String birthday)
+ {
+ this.birthday = birthday;
+ }
+
+
+ public String getSname()
+ {
+ return sname;
+ }
+
+ public void setSname(String sname)
+ {
+ System.out.println(sname);
+ this.sname = sname;
+ }
+
+ public String getSnumber()
+ {
+
+ return snumber;
+ }
+
+ public void setSnumber(String snumber)
+ {
+ this.snumber = snumber;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Supplier{" + "snumber=" + snumber + ", sname=" + sname + ", birthday=" + birthday + ", status=" + status + ", city=" + city + '}';
+ }
+
+}
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/SupplierPartsCalendar/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..baad290
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..b3a1279
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..584a477
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/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 2/Assignments/SupplierPartsCalendar/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..11562f0
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/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/supplier.xhtml
+
+
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/index.xhtml b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..3220605
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/index.xhtml
@@ -0,0 +1,51 @@
+
+
+
+
+
+ Supplier Parts DB
+
+
+
+
+ Suppliers-Parts Database
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/part.xhtml b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/part.xhtml
new file mode 100644
index 0000000..40bc71b
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/part.xhtml
@@ -0,0 +1,68 @@
+
+
+
+
+ Facelet Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/resources/css/styles.css b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..9d96af6
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,71 @@
+.body {
+ background: #eee;
+}
+
+.button {
+ margin: 10px;
+ border-left: thin solid darkGray;
+ border-bottom: thin solid darkGray;
+ border-top: thin solid lightGray;
+ border-right: thin solid lightGray;
+ color: #777;
+ background: #A7C942;
+ font-family: "Comic Sans MS";
+ border-radius: 20%;
+}
+h1
+{
+ vertical-align: top;
+ text-align: middle;
+ font-style: italic;
+ color: #888;
+ font-size: 2em;
+ font-family: "Comic Sans MS";
+
+}
+
+.label
+{
+ color: #888;
+ font-size: 0.8em;
+ font-family: "Comic Sans MS";
+}
+.leftImage {
+ float: left;
+ margin-right: 1em;
+}
+
+.backLink {
+ font-style: italic;
+}
+
+
+.tableHeader {
+ font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
+ border-collapse:collapse;
+ font-size:1.1em;
+ text-align:left;
+ padding-top:5px;
+ padding-bottom:4px;
+ background-color:#A7C942;
+ color:white;
+ border:1px solid #98bf21;
+}
+
+.oddTableRow {
+ border:1px solid #98bf21;
+}
+
+.evenTableRow {
+ background-color: #eeeeee;
+ font-size:1em;
+
+ padding:3px 7px 2px 7px;
+
+ color:#000000;
+ background-color:#EAF2D3;
+}
+
+.table {
+ border:1px solid green;
+}
\ No newline at end of file
diff --git a/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/supplier.xhtml b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/supplier.xhtml
new file mode 100644
index 0000000..b9f2794
--- /dev/null
+++ b/Semester 2/Assignments/SupplierPartsCalendar/src/main/webapp/supplier.xhtml
@@ -0,0 +1,67 @@
+
+
+
+
+ Facelet Title
+
+ Supplier Information
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/nb-configuration.xml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/nb-configuration.xml
new file mode 100644
index 0000000..f29f292
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 9.0-web
+ gfv700ee10
+ Facelets
+ JDK_11__System_
+
+
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/pom.xml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/pom.xml
new file mode 100644
index 0000000..0abdfe5
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/pom.xml
@@ -0,0 +1,88 @@
+
+ 4.0.0
+ com.mycompany
+ Suppliers_Parts_Calendar_Primefaces
+ 1.0-SNAPSHOT
+ war
+ Suppliers_Parts_Calendar_Primefaces
+
+
+ 1.8
+ 1.8
+ ${project.build.directory}/endorsed
+ UTF-8
+ false
+ 9.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+ com.mysql
+ mysql-connector-j
+ 8.1.0
+
+
+ org.primefaces
+ primefaces
+ 12.0.0
+ jakarta
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.8
+
+ ${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 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java
new file mode 100644
index 0000000..110a745
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package com.mycompany.supplierspartsdatabase;
+
+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 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java
new file mode 100644
index 0000000..f7f850d
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java
@@ -0,0 +1,20 @@
+package com.mycompany.supplierspartsdatabase.resources;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.core.Response;
+
+/**
+ *
+ * @author
+ */
+@Path("jakartaee9")
+public class JakartaEE9Resource {
+
+ @GET
+ public Response ping(){
+ return Response
+ .ok("ping Jakarta EE")
+ .build();
+ }
+}
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/beans/SupplierBean.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/beans/SupplierBean.java
new file mode 100644
index 0000000..a89ddc9
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/beans/SupplierBean.java
@@ -0,0 +1,166 @@
+/*
+ * 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.beans;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.supplier.DatabaseManipulationSupplier;
+import edu.slcc.asdv.bl.supplier.Supplier;
+import jakarta.annotation.PostConstruct;
+import jakarta.inject.Named;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.faces.application.FacesMessage;
+import jakarta.faces.application.FacesMessage.Severity;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.event.ComponentSystemEvent;
+import jakarta.inject.Inject;
+import java.io.Serializable;
+import java.util.List;
+
+@Named(value = "supplierBean")
+@SessionScoped
+public class SupplierBean implements Serializable {
+
+ //DBase dms = new DatabaseManipulationSupplier();
+ @Inject
+ DatabaseManipulationSupplier dms;
+ List suppliers;
+
+
+ /*
+ public SupplierBean()
+ {
+ try
+ {
+ suppliers = dms.listAll();
+ }
+ catch (Exception e)
+ {
+ suppliers = null;
+ }
+ }
+ */
+ @PostConstruct
+ public void init()
+ {
+ try {
+ suppliers = dms.listAll();
+ } catch (Exception e) {
+ suppliers = null;
+ }
+ }
+
+ public DatabaseManipulationSupplier getDms()
+ {
+ return dms;
+ }
+
+ public void displayExceptionMessageAtPreRenderListener(ComponentSystemEvent event)
+ {
+ if (suppliers == null) {
+ addMessage("Database problem occured.",
+ "", FacesMessage.SEVERITY_ERROR);
+ }
+ }
+
+ public List getSuppliers()
+ {
+ return suppliers;
+ }
+
+ public void insertSupplier()
+ {
+ System.out.println("insertSupplier(Supplier s)");
+ suppliers.add(new Supplier());
+ }
+
+ public void deleteSupplier(Supplier s)
+ {
+ if (suppliers == null) {
+ return;
+ }
+ int totalRowsUpdated = 0;
+ try {
+ int rowsUpdated = this.dms.delete(s);
+ if (rowsUpdated > 0) {
+ suppliers = dms.listAll();
+ totalRowsUpdated += rowsUpdated;
+ }
+ } catch (Exception e) {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ }
+ if (totalRowsUpdated > 0) {
+ String msg = ("Numbers of rows updated: " + totalRowsUpdated);
+ addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
+ }
+ }
+
+ public void deleteSupplier()
+ {
+ if (suppliers == null) {
+ return;
+ }
+ int totalRowsUpdated = 0;
+ for (Supplier s : this.suppliers) {
+ if (s.isModify()) {
+ try {
+ int rowsUpdated = this.dms.delete(s);
+ if (rowsUpdated > 0) {
+ totalRowsUpdated += rowsUpdated;
+ s.setModify(false);
+ }
+ } catch (Exception e) {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ break;
+ }
+ }
+ }
+ if (totalRowsUpdated > 0) {
+ try {
+ suppliers = dms.listAll();
+ } catch (Exception e) {
+ suppliers = null;
+ addMessage("Unable to obtain suppliers!", "no exception", FacesMessage.SEVERITY_INFO);
+ }
+ String msg = ("Numbers of rows updated: " + totalRowsUpdated);
+ addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
+ }
+ }
+
+ public void saveFromUpdate()
+ {
+ if (suppliers == null) {
+ return;
+ }
+ int totalRowsUpdated = 0;
+ for (Supplier s : this.suppliers) {
+ if (s.isModify()) {
+ try {
+ int rowsUpdated = this.dms.update(s);
+ if (rowsUpdated > 0) {
+ System.out.println(s);
+ totalRowsUpdated += rowsUpdated;
+ s.setModify(false);
+ }
+ } catch (Exception e) {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ break;
+ }
+ }
+ }
+ if (totalRowsUpdated > 0) {
+ String msg = ("Numbers of rows updated: " + totalRowsUpdated);
+ addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
+ }
+ }
+
+ public void addMessage(String summary, String detail, Severity severity)
+ {
+ FacesMessage msg = new FacesMessage(severity, summary, detail);
+ FacesContext.getCurrentInstance().addMessage(null, msg);
+ }
+}
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/DBase.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/DBase.java
new file mode 100644
index 0000000..7a79952
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/DBase.java
@@ -0,0 +1,30 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package edu.slcc.asdv.bl;
+
+import java.io.Serializable;
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public interface DBase
+{
+ List listAll()
+ throws SQLException;
+
+ int update( T t)
+ throws SQLException;
+
+ int delete( T t)
+ throws SQLException;
+
+
+ int insert( T t)
+ throws SQLException;
+
+}
\ No newline at end of file
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java
new file mode 100644
index 0000000..6fdca3b
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/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.asdv.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 + ":3306/" + databaseName + "?allowPublicKeyRetrieval=true&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 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java
new file mode 100644
index 0000000..ebdec92
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java
@@ -0,0 +1,104 @@
+/*
+ * 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.bl.part;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public class DatabaseManipulationPart implements DBase
+{
+ @Override
+ public List listAll()
+ {
+ List tableParts = new ArrayList();
+ String databaseName = "suppliers_parts_23";
+ 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 part";
+ //prepare statement
+ ps = con.prepareStatement(sqlStr);
+ //execute
+ rs = ps.executeQuery();
+ int row = 0;
+ while (rs.next())
+ {
+ String pNumber = rs.getString(1);
+ String pName = rs.getString(2);
+ String color = rs.getString(3) + " ";
+ String city = rs.getString(4) + " ";
+ Part part = new Part(pNumber, pName, color, city);
+ tableParts.add(part);
+ row++;
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (ps != null)
+ {
+ ps.close();
+ }
+ }
+ catch (SQLException sqle)
+ {
+ sqle.printStackTrace();
+ }
+ }
+ return tableParts;
+ }
+
+ public static void main(String[] args)
+ {
+ DatabaseManipulationPart dmp = new DatabaseManipulationPart();
+ System.out.println(dmp.listAll());
+ }
+
+ @Override
+ public int update(Part t)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public int delete(Part t) throws SQLException
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public int insert(Part t) throws SQLException
+ {
+ return -1;
+ }
+}
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/part/Part.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/part/Part.java
new file mode 100644
index 0000000..54bd19a
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/part/Part.java
@@ -0,0 +1,75 @@
+/*
+ * 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.bl.part;
+
+/**
+ *
+ * @author asdv5
+ */
+public class Part
+{
+ private String pnumber;
+ private String pname;
+ private String color;
+ private String city;
+
+ public Part(String pnumber, String pname, String color, String city)
+ {
+ this.pnumber = pnumber;
+ this.pname = pname;
+ this.color = color;
+ this.city = city;
+ }
+
+
+ public String getColor()
+ {
+ return color;
+ }
+
+ public void setColor(String color)
+ {
+ this.color = color;
+ }
+
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ public String getPname()
+ {
+ return pname;
+ }
+
+ public void setPname(String pname)
+ {
+ this.pname = pname;
+ }
+
+ public String getPnumber()
+ {
+ return pnumber;
+ }
+
+ public void setPnumber(String pnumber)
+ {
+ this.pnumber = pnumber;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Part{" + "pnumber=" + pnumber + ", pname=" + pname + ", color=" + color + ", city=" + city + '}';
+ }
+
+
+
+}
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java
new file mode 100644
index 0000000..1b60dd8
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java
@@ -0,0 +1,228 @@
+/*
+ * 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.bl.supplier;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+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;
+
+/**
+ *
+ * @author asdv5
+ */
+public class DatabaseManipulationSupplier
+ implements DBase, Serializable
+{
+ @Override
+ public List listAll()
+ throws SQLException
+ {
+ // test exception code
+ //if ( true)
+ // throw new SQLException();
+
+ List tableSuppliers = new ArrayList();
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ 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 supplier";
+ //prepare statement
+ ps = con.prepareStatement(sqlStr);
+ //execute
+ rs = ps.executeQuery();
+ int row = 0;
+ while (rs.next())
+ {
+ String sNumber = rs.getString(1);
+ String sName = rs.getString(2);
+ String bdate = "";
+ if ( rs.getDate(3) == null )
+ {
+ bdate = "2000-01-01 ";
+ }
+ else
+ bdate = rs.getDate(3) + " ";
+ int status = rs.getInt(4);
+ String city = rs.getString(5) + " ";
+ Supplier supplier = new Supplier(sNumber, sName, bdate, status, city);
+ tableSuppliers.add(supplier);
+ row++;
+ }
+ }
+ 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 tableSuppliers;
+ }
+
+ @Override
+ public int update(Supplier t)
+ throws SQLException
+ {
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ int result = 0;
+ PreparedStatement updateSupplier = null;
+ try
+ {
+ if (con == null)
+ {
+ throw new RuntimeException("cannot connect to database");
+ }
+
+
+ updateSupplier = con.prepareStatement(
+ "UPDATE supplier SET snumber=?, sname=?, status=?, birthday=?, city=? WHERE snumber=?");
+ updateSupplier.setString(1, t.getSnumber());
+ updateSupplier.setString(2, t.getSname());
+ updateSupplier.setInt(3, t.getStatus());
+ java.sql.Date bd = UtilitiesDatabase.stringDateToSqlDate(t.getBirthday());
+ updateSupplier.setDate(4, bd);
+ updateSupplier.setString(5, t.getCity());
+ updateSupplier.setString(6, t.getSnumber());
+ result = updateSupplier.executeUpdate();
+ }
+ catch (SQLException ex)
+ {
+ System.err.println(ex.toString());
+ throw ex;
+ }
+ finally
+ {
+ try
+ {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (updateSupplier != null)
+ {
+ updateSupplier.close();
+ }
+ }
+ catch (SQLException sqle)
+ {
+ sqle.printStackTrace();
+ throw sqle;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public int delete(Supplier c) throws SQLException
+ {
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ int result = 0;
+ PreparedStatement ps = null;
+ try
+ {
+ if (con == null)
+ {
+ throw new RuntimeException("Database connection failed.");
+ }
+ String query = "DELETE FROM supplier WHERE snumber=? ";
+ ps = con.prepareStatement(query);
+ ps.setString(1, c.getSnumber());
+ result = ps.executeUpdate();
+ }
+ catch (Exception ex)
+ {
+ System.err.println(ex.toString());
+ }
+ finally
+ {
+ try
+ {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (ps != null)
+ {
+ ps.close();
+ }
+ }
+ catch (SQLException sqlee)
+ {
+ sqlee.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public int insert(Supplier c) throws SQLException {
+ String databaseName = "tennis-23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String driver = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(databaseName, userName, password, driver);
+ ///"UPDATE supplier SET snumber=?, sname=?, status=?, birthday=?, city=? WHERE snumber=?"
+ String sqlStr = "INSERT INTO suppliers (snumber, sname, status, birthday, city) VALUES (?, ?, ?, ?, ?)";
+ int result = 0;
+
+ try (PreparedStatement ps = con.prepareStatement(sqlStr)) {
+ ps.setString(1, c.getSnumber());
+ ps.setString(2, c.getSname());
+ ps.setInt(3, c.getStatus());
+ ps.setDate(4, new java.sql.Date(c.getBirth_Date().getTime())); // Converts java.util.Date to java.sql.Date
+ ps.setString(5, c.getCity());
+
+ result = ps.executeUpdate();
+ } catch (SQLException sqle) {
+ sqle.printStackTrace();
+ throw sqle;
+ } finally {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ }
+ return result;
+ }
+
+
+}
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java
new file mode 100644
index 0000000..c7bff35
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java
@@ -0,0 +1,138 @@
+/*
+ * 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.bl.supplier;
+
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * @author asdv5
+ */
+public class Supplier implements Serializable
+{
+ private String snumber;
+ private String sname;
+ private String birthday;
+ private int status;
+ private String city;
+ private Date birthday_date;
+ private boolean insertFromDatatable;
+ private boolean modify;
+
+ public boolean isModify()
+ {
+ return modify;
+ }
+
+ public void setModify(boolean modify)
+ {
+ this.modify = modify;
+ }
+
+ public Supplier()
+ {
+ this.modify = true;
+ insertFromDatatable = true;
+ birthday = "2000-01-01";
+ birthday_date = UtilitiesDatabase.stringDateToJavaUtilitiesDate(birthday);
+ }
+
+ public Supplier(String snumber, String sname, String birthday, int status, String city)
+ {
+ insertFromDatatable = false;
+ this.snumber = snumber;
+ this.sname = sname;
+ this.birthday = birthday;
+ this.status = status;
+ this.city = city;
+ this.modify = false;
+ }
+
+ public boolean isInsertFromDatatable()
+ {
+ return insertFromDatatable;
+ }
+
+ public void setInsertFromDatatable(boolean insertFromDatatable)
+ {
+ this.insertFromDatatable = insertFromDatatable;
+ }
+
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ public int getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(int status)
+ {
+ this.status = status;
+ }
+
+ public String getBirthday()
+ {
+ return birthday;
+ }
+
+ public void setBirthday(String birthday)
+ {
+ this.birthday = birthday;
+ }
+
+ public Date getBirthday_date()
+ {
+ birthday_date = UtilitiesDatabase.stringDateToJavaUtilitiesDate(this.birthday);
+ return birthday_date;
+ }
+
+ public void setBirthday_date(Date birthday_date)
+ {
+ this.birthday_date = birthday_date;
+ int year = this.birthday_date.getYear() + 1900;
+ int month = this.birthday_date.getMonth() + 1;
+ int day = this.birthday_date.getDate();
+ this.birthday = Integer.toString(year) + "-"
+ + Integer.toString(month) + "-"
+ + Integer.toString(day);
+ }
+
+ public String getSname()
+ {
+ return sname;
+ }
+
+ public void setSname(String sname)
+ {
+ System.out.println(sname);
+ this.sname = sname;
+ }
+
+ public String getSnumber()
+ {
+ return snumber;
+ }
+
+ public void setSnumber(String snumber)
+ {
+ this.snumber = snumber;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Supplier{" + "snumber=" + snumber + ", sname=" + sname + ", birthday=" + birthday + ", status=" + status + ", city=" + city + '}';
+ }
+}
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..baad290
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..b3a1279
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..584a477
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/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 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..11562f0
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/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/supplier.xhtml
+
+
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/index.xhtml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..3220605
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/index.xhtml
@@ -0,0 +1,51 @@
+
+
+
+
+
+ Supplier Parts DB
+
+
+
+
+ Suppliers-Parts Database
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/resources/css/styles.css b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..9d96af6
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,71 @@
+.body {
+ background: #eee;
+}
+
+.button {
+ margin: 10px;
+ border-left: thin solid darkGray;
+ border-bottom: thin solid darkGray;
+ border-top: thin solid lightGray;
+ border-right: thin solid lightGray;
+ color: #777;
+ background: #A7C942;
+ font-family: "Comic Sans MS";
+ border-radius: 20%;
+}
+h1
+{
+ vertical-align: top;
+ text-align: middle;
+ font-style: italic;
+ color: #888;
+ font-size: 2em;
+ font-family: "Comic Sans MS";
+
+}
+
+.label
+{
+ color: #888;
+ font-size: 0.8em;
+ font-family: "Comic Sans MS";
+}
+.leftImage {
+ float: left;
+ margin-right: 1em;
+}
+
+.backLink {
+ font-style: italic;
+}
+
+
+.tableHeader {
+ font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
+ border-collapse:collapse;
+ font-size:1.1em;
+ text-align:left;
+ padding-top:5px;
+ padding-bottom:4px;
+ background-color:#A7C942;
+ color:white;
+ border:1px solid #98bf21;
+}
+
+.oddTableRow {
+ border:1px solid #98bf21;
+}
+
+.evenTableRow {
+ background-color: #eeeeee;
+ font-size:1em;
+
+ padding:3px 7px 2px 7px;
+
+ color:#000000;
+ background-color:#EAF2D3;
+}
+
+.table {
+ border:1px solid green;
+}
\ No newline at end of file
diff --git a/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/supplier.xhtml b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/supplier.xhtml
new file mode 100644
index 0000000..3372982
--- /dev/null
+++ b/Semester 2/Assignments/Supplier_Parts_Calendar_Primefaces/src/main/webapp/supplier.xhtml
@@ -0,0 +1,101 @@
+
+
+
+
+ Suppliers Table
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/SuppliersPartsDatabase/src/main/webapp/supplier.xhtml b/Semester 2/Assignments/SuppliersPartsDatabase/src/main/webapp/supplier.xhtml
index ef1c1b7..752e1cd 100644
--- a/Semester 2/Assignments/SuppliersPartsDatabase/src/main/webapp/supplier.xhtml
+++ b/Semester 2/Assignments/SuppliersPartsDatabase/src/main/webapp/supplier.xhtml
@@ -32,7 +32,8 @@
-
+
+
@@ -57,7 +58,7 @@
-
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/nb-configuration.xml b/Semester 2/Assignments/suppliers_parts_calendar/nb-configuration.xml
new file mode 100644
index 0000000..f29f292
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/nb-configuration.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ 9.0-web
+ gfv700ee10
+ Facelets
+ JDK_11__System_
+
+
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/pom.xml b/Semester 2/Assignments/suppliers_parts_calendar/pom.xml
new file mode 100644
index 0000000..da7d077
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/pom.xml
@@ -0,0 +1,88 @@
+
+ 4.0.0
+ com.mycompany
+ SuppliersPartsCalendar
+ 1.0-SNAPSHOT
+ war
+ Suppliers_Parts_Calendar
+
+
+ 1.8
+ 1.8
+ ${project.build.directory}/endorsed
+ UTF-8
+ false
+ 9.0.0
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-api
+ ${jakartaee}
+ provided
+
+
+ com.mysql
+ mysql-connector-j
+ 8.1.0
+
+
+ org.primefaces
+ primefaces
+ 12.0.0
+ jakarta
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.8
+
+ ${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 2/Assignments/suppliers_parts_calendar/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java
new file mode 100644
index 0000000..110a745
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java
@@ -0,0 +1,13 @@
+package com.mycompany.supplierspartsdatabase;
+
+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 2/Assignments/suppliers_parts_calendar/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java
new file mode 100644
index 0000000..f7f850d
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java
@@ -0,0 +1,20 @@
+package com.mycompany.supplierspartsdatabase.resources;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.core.Response;
+
+/**
+ *
+ * @author
+ */
+@Path("jakartaee9")
+public class JakartaEE9Resource {
+
+ @GET
+ public Response ping(){
+ return Response
+ .ok("ping Jakarta EE")
+ .build();
+ }
+}
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/beans/SupplierBean.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/beans/SupplierBean.java
new file mode 100644
index 0000000..96b42fb
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/beans/SupplierBean.java
@@ -0,0 +1,148 @@
+/*
+ * 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.beans;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.supplier.DatabaseManipulationSupplier;
+import edu.slcc.asdv.bl.supplier.Supplier;
+import jakarta.inject.Named;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.faces.application.FacesMessage;
+import jakarta.faces.application.FacesMessage.Severity;
+import jakarta.faces.component.UIComponent;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.event.ComponentSystemEvent;
+import java.io.Serializable;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+
+@Named(value = "supplierBean")
+@SessionScoped
+public class SupplierBean implements Serializable
+{
+ DBase dms = new DatabaseManipulationSupplier();
+ List suppliers;
+
+
+
+ public SupplierBean()
+ {
+ try
+ {
+ suppliers = dms.listAll();
+ }
+ catch (Exception e)
+ {
+ suppliers = null;
+ }
+ }
+
+
+
+ public void displayExceptionMessageAtPreRenderListener(ComponentSystemEvent event)
+ {
+ if (suppliers == null)
+ addMessage("Database problem occured.",
+ "", FacesMessage.SEVERITY_ERROR);
+ }
+
+ public List getSuppliers()
+ {
+ return suppliers;
+ }
+
+ public void deleteSupplier(Supplier s)
+ {
+ System.out.println("deleteSupplier(Supplier s)");
+ }
+ public void deleteSupplier()
+ {
+ if (suppliers == null)
+ return;
+
+ int totalRowsUpdated = 0;
+ for (Supplier s : this.suppliers)
+ {
+ if (s.isModify())
+ {
+ try
+ {
+ int rowsUpdated = this.dms.update(s);
+ if (rowsUpdated > 0)
+ {
+ totalRowsUpdated += rowsUpdated;
+ s.setModify(false);
+ }
+ }
+ catch (Exception e)
+ {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ break;
+ }
+ }
+ }
+ if (totalRowsUpdated > 0)
+ {
+ String msg = ("Numbers of rows updated: " + totalRowsUpdated);
+ addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
+ }
+ }
+
+ public void insertNew() {
+ Supplier newSupplier = new Supplier();
+ suppliers.add(newSupplier);
+ try {
+ this.dms.insert(newSupplier);
+ } catch (SQLException e) {
+ String msg = ("Unable to add a new row.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ }
+
+ }
+
+
+ public void saveFromUpdate()
+ {
+ if (suppliers == null)
+ return;
+
+ int totalRowsUpdated = 0;
+ for (Supplier s : this.suppliers)
+ {
+ if (s.isModify())
+ {
+ try
+ {
+ int rowsUpdated = this.dms.update(s);
+ if (rowsUpdated > 0)
+ {
+ System.out.println(s);
+ totalRowsUpdated += rowsUpdated;
+ s.setModify(false);
+ }
+ }
+ catch (Exception e)
+ {
+ String msg = ("Numbers of rows updated is 0.");
+ addMessage(msg, e.getMessage(), FacesMessage.SEVERITY_ERROR);
+ break;
+ }
+ }
+ }
+ if (totalRowsUpdated > 0)
+ {
+ String msg = ("Numbers of rows updated: " + totalRowsUpdated);
+ addMessage(msg, "no exception", FacesMessage.SEVERITY_INFO);
+ }
+ }
+
+ public void addMessage(String summary, String detail, Severity severity)
+ {
+ FacesMessage msg = new FacesMessage(severity, summary, detail);
+ FacesContext.getCurrentInstance().addMessage(null, msg);
+ }
+}
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/DBase.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/DBase.java
new file mode 100644
index 0000000..e9c194d
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/DBase.java
@@ -0,0 +1,28 @@
+/*
+ * 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.bl;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public interface DBase
+{
+ List listAll()
+ throws SQLException;
+
+ int update( T t)
+ throws SQLException;
+
+ int delete( T t)
+ throws SQLException;
+
+ int insert (T t)
+ throws SQLException;
+}
\ No newline at end of file
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java
new file mode 100644
index 0000000..6fdca3b
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/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.asdv.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 + ":3306/" + databaseName + "?allowPublicKeyRetrieval=true&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 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java
new file mode 100644
index 0000000..f222e07
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java
@@ -0,0 +1,104 @@
+/*
+ * 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.bl.part;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public class DatabaseManipulationPart implements DBase
+{
+ @Override
+ public List listAll()
+ {
+ List tableParts = new ArrayList();
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ 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 part";
+ //prepare statement
+ ps = con.prepareStatement(sqlStr);
+ //execute
+ rs = ps.executeQuery();
+ int row = 0;
+ while (rs.next())
+ {
+ String pNumber = rs.getString(1);
+ String pName = rs.getString(2);
+ String color = rs.getString(3) + " ";
+ String city = rs.getString(4) + " ";
+ Part part = new Part(pNumber, pName, color, city);
+ tableParts.add(part);
+ row++;
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (ps != null)
+ {
+ ps.close();
+ }
+ }
+ catch (SQLException sqle)
+ {
+ sqle.printStackTrace();
+ }
+ }
+ return tableParts;
+ }
+
+ public static void main(String[] args)
+ {
+ DatabaseManipulationPart dmp = new DatabaseManipulationPart();
+ System.out.println(dmp.listAll());
+ }
+
+ @Override
+ public int update(Part t)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public int delete(Part t) throws SQLException
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public int insert(Part t) throws SQLException
+ {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+}
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/part/Part.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/part/Part.java
new file mode 100644
index 0000000..54bd19a
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/part/Part.java
@@ -0,0 +1,75 @@
+/*
+ * 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.bl.part;
+
+/**
+ *
+ * @author asdv5
+ */
+public class Part
+{
+ private String pnumber;
+ private String pname;
+ private String color;
+ private String city;
+
+ public Part(String pnumber, String pname, String color, String city)
+ {
+ this.pnumber = pnumber;
+ this.pname = pname;
+ this.color = color;
+ this.city = city;
+ }
+
+
+ public String getColor()
+ {
+ return color;
+ }
+
+ public void setColor(String color)
+ {
+ this.color = color;
+ }
+
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ public String getPname()
+ {
+ return pname;
+ }
+
+ public void setPname(String pname)
+ {
+ this.pname = pname;
+ }
+
+ public String getPnumber()
+ {
+ return pnumber;
+ }
+
+ public void setPnumber(String pnumber)
+ {
+ this.pnumber = pnumber;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Part{" + "pnumber=" + pnumber + ", pname=" + pname + ", color=" + color + ", city=" + city + '}';
+ }
+
+
+
+}
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java
new file mode 100644
index 0000000..6c69079
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java
@@ -0,0 +1,258 @@
+/*
+ * 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.bl.supplier;
+
+import edu.slcc.asdv.bl.DBase;
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import java.sql.Connection;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author asdv5
+ */
+public class DatabaseManipulationSupplier implements DBase
+{
+ @Override
+ public List listAll()
+ throws SQLException
+ {
+ // test exception code
+ //if ( true)
+ // throw new SQLException();
+
+ List tableSuppliers = new ArrayList();
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ 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 supplier";
+ //prepare statement
+ ps = con.prepareStatement(sqlStr);
+ //execute
+ rs = ps.executeQuery();
+ int row = 0;
+ while (rs.next())
+ {
+ String sNumber = rs.getString(1);
+ String sName = rs.getString(2);
+ String bdate = rs.getDate(3) + " ";
+ int status = rs.getInt(4);
+ String city = rs.getString(5) + " ";
+ Supplier supplier = new Supplier(sNumber, sName, bdate, status, city);
+ tableSuppliers.add(supplier);
+ row++;
+ }
+ }
+ catch (SQLException ex)
+ {
+ ex.printStackTrace();
+ }
+ 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 tableSuppliers;
+ }
+
+ @Override
+ public int update(Supplier t)
+ throws SQLException
+ {
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ int result = 0;
+ PreparedStatement updateSupplier = null;
+ try
+ {
+ if (con == null)
+ {
+ throw new RuntimeException("cannot connect to database");
+ }
+
+
+ updateSupplier = con.prepareStatement(
+ "UPDATE supplier SET snumber=?, sname=?, status=?, birthday=?, city=? WHERE snumber=?");
+ updateSupplier.setString(1, t.getSnumber());
+ updateSupplier.setString(2, t.getSname());
+ updateSupplier.setInt(3, t.getStatus());
+ java.sql.Date bd = UtilitiesDatabase.stringDateToSqlDate(t.getBirthday());
+ updateSupplier.setDate(4, bd);
+ updateSupplier.setString(5, t.getCity());
+ updateSupplier.setString(6, t.getSnumber());
+ result = updateSupplier.executeUpdate();
+ }
+ catch (SQLException ex)
+ {
+ System.err.println(ex.toString());
+ throw ex;
+ }
+ finally
+ {
+ try
+ {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (updateSupplier != null)
+ {
+ updateSupplier.close();
+ }
+ }
+ catch (SQLException sqle)
+ {
+ sqle.printStackTrace();
+ throw sqle;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public int delete(Supplier t) throws SQLException
+ {
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ int result = 0;
+ /*
+
+ Connection con = connection();
+ if (con == null)
+ {
+ result = "cannot connect to database" ;
+ return ;
+ }
+ PreparedStatement ps = null;
+ int rowsAffected = -1;
+
+ try
+ {
+ String query = "DELETE FROM supplier WHERE snumber=? ";
+ ps = con.prepareStatement(query);
+ ps.setString(1, snumber);
+ rowsAffected = ps.executeUpdate();
+ result = "number of rows affected: " + rowsAffected;
+ }
+ catch (Exception ex)
+ {
+ System.err.println(ex.toString());
+ }
+ finally
+ {
+ try
+ {
+ this.closeDatabaseConnection(con);
+ // close the resources
+ if (ps != null)
+ {
+ ps.close();
+ }
+
+ }
+ catch (SQLException sqlee)
+ {
+ sqlee.printStackTrace();
+ }
+ }
+
+
+ */
+ return 0;
+
+ }
+
+ @Override
+ public int insert(Supplier t) throws SQLException
+ {
+ String databaseName = "suppliers_parts_23";
+ String userName = "java";
+ String password = "8VCS49HT2xjsEZvC";
+ String URL2 = "com.mysql.jdbc.Driver";
+ Connection con = new UtilitiesDatabase().connection(
+ databaseName, userName, password, URL2);
+ int result = 0;
+ PreparedStatement updateSupplier = null;
+ try
+ {
+ if (con == null)
+ {
+ throw new RuntimeException("cannot connect to database");
+ }
+
+
+ updateSupplier = con.prepareStatement(
+ "insert into supplier (snumber, sname, status, birthday, city) VALUES (?, ?, ?, ?, ?)");
+ updateSupplier.setString(1, t.getSnumber());
+ updateSupplier.setString(2, t.getSname());
+ updateSupplier.setInt(3, t.getStatus());
+ java.sql.Date bd = UtilitiesDatabase.stringDateToSqlDate(t.getBirthday());
+ updateSupplier.setDate(4, bd);
+ updateSupplier.setString(5, t.getCity());
+ result = updateSupplier.executeUpdate();
+ }
+ catch (SQLException ex)
+ {
+ System.err.println(ex.toString());
+ throw ex;
+ }
+ finally
+ {
+ try
+ {
+ new UtilitiesDatabase().closeDatabaseConnection(con);
+ // close the resources
+ if (updateSupplier != null)
+ {
+ updateSupplier.close();
+ }
+ }
+ catch (SQLException sqle)
+ {
+ sqle.printStackTrace();
+ throw sqle;
+ }
+ }
+ return result;
+ }
+
+
+}
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java
new file mode 100644
index 0000000..5edca8d
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java
@@ -0,0 +1,151 @@
+/*
+ * 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.bl.supplier;
+
+import edu.slcc.asdv.bl.UtilitiesDatabase;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * @author asdv5
+ */
+public class Supplier implements Serializable
+{
+ private String snumber;
+ private String sname;
+ private String birthday;
+ private int status;
+ private String city;
+ private Date birthday_date;
+ private boolean isInsertNew;
+
+ public boolean isIsInsertNew()
+ {
+ return isInsertNew;
+ }
+
+ public void setIsInsertNew(boolean isInsertNew)
+ {
+ this.isInsertNew = isInsertNew;
+ }
+
+ private boolean modify;
+
+ public boolean isModify()
+ {
+ return modify;
+ }
+
+ public void setModify(boolean modify)
+ {
+ this.modify = modify;
+ }
+
+public Supplier() {
+ this.birthday = "0000-00-00";
+ this.isInsertNew = true;
+ this.modify = true;
+}
+
+ public Supplier(String snumber, String sname, String birthday, int status, String city)
+ {
+ this.snumber = snumber;
+ this.sname = sname;
+ this.birthday = birthday;
+ this.status = status;
+ this.city = city;
+ this.modify = false;
+ this.isInsertNew = false;
+ }
+
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+
+ public int getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(int status)
+ {
+ this.status = status;
+ }
+
+
+
+
+ public String getBirthday()
+ {
+ return birthday;
+ }
+
+ public void setBirthday(String birthday)
+ {
+ this.birthday = birthday;
+
+ }
+
+ public Date getBirthday_date()
+ {
+ birthday_date = UtilitiesDatabase.stringDateToJavaUtilitiesDate(this.birthday);
+ return birthday_date;
+ }
+
+ public void setBirthday_date(Date birthday_date)
+ {
+ this.birthday_date = birthday_date;
+ int year = this.birthday_date.getYear() + 1900;
+ int month = this.birthday_date.getMonth()+1;
+ int day = this.birthday_date.getDate();
+
+
+ this.birthday = Integer.toString(year) + "-" +
+ Integer.toString(month)+ "-" +
+ Integer.toString(day);
+
+ }
+
+
+ public String getSname()
+ {
+ return sname;
+ }
+
+ public void setSname(String sname)
+ {
+ System.out.println( sname);
+ this.sname = sname;
+ }
+
+
+ public String getSnumber()
+ {
+
+ return snumber;
+ }
+
+ public void setSnumber(String snumber)
+ {
+ this.snumber = snumber;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Supplier{" + "snumber=" + snumber + ", sname=" + sname + ", birthday=" + birthday + ", status=" + status + ", city=" + city + '}';
+ }
+
+
+
+}
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/suppliers_parts_calendar/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..baad290
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..b3a1279
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..584a477
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/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 2/Assignments/suppliers_parts_calendar/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..11562f0
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/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/supplier.xhtml
+
+
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/index.xhtml b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..3220605
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/index.xhtml
@@ -0,0 +1,51 @@
+
+
+
+
+
+ Supplier Parts DB
+
+
+
+
+ Suppliers-Parts Database
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/resources/css/styles.css b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..9d96af6
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,71 @@
+.body {
+ background: #eee;
+}
+
+.button {
+ margin: 10px;
+ border-left: thin solid darkGray;
+ border-bottom: thin solid darkGray;
+ border-top: thin solid lightGray;
+ border-right: thin solid lightGray;
+ color: #777;
+ background: #A7C942;
+ font-family: "Comic Sans MS";
+ border-radius: 20%;
+}
+h1
+{
+ vertical-align: top;
+ text-align: middle;
+ font-style: italic;
+ color: #888;
+ font-size: 2em;
+ font-family: "Comic Sans MS";
+
+}
+
+.label
+{
+ color: #888;
+ font-size: 0.8em;
+ font-family: "Comic Sans MS";
+}
+.leftImage {
+ float: left;
+ margin-right: 1em;
+}
+
+.backLink {
+ font-style: italic;
+}
+
+
+.tableHeader {
+ font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
+ border-collapse:collapse;
+ font-size:1.1em;
+ text-align:left;
+ padding-top:5px;
+ padding-bottom:4px;
+ background-color:#A7C942;
+ color:white;
+ border:1px solid #98bf21;
+}
+
+.oddTableRow {
+ border:1px solid #98bf21;
+}
+
+.evenTableRow {
+ background-color: #eeeeee;
+ font-size:1em;
+
+ padding:3px 7px 2px 7px;
+
+ color:#000000;
+ background-color:#EAF2D3;
+}
+
+.table {
+ border:1px solid green;
+}
\ No newline at end of file
diff --git a/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/supplier.xhtml b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/supplier.xhtml
new file mode 100644
index 0000000..88c99b4
--- /dev/null
+++ b/Semester 2/Assignments/suppliers_parts_calendar/src/main/webapp/supplier.xhtml
@@ -0,0 +1,75 @@
+
+
+
+
+ Suppliers Table
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Semester 2/SupplierPartsCalendar.zip b/Semester 2/SupplierPartsCalendar.zip
new file mode 100644
index 0000000..e9c386a
Binary files /dev/null and b/Semester 2/SupplierPartsCalendar.zip differ