diff --git a/Semester 2/Assignments/MapASDV/pom.xml b/Semester 2/Assignments/MapASDV/pom.xml new file mode 100644 index 0000000..00309f4 --- /dev/null +++ b/Semester 2/Assignments/MapASDV/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.calebfontenot + MapASDV + 1.0-SNAPSHOT + jar + + UTF-8 + 17 + 17 + com.calebfontenot.mapasdv.MapASDV + + \ No newline at end of file diff --git a/Semester 2/Assignments/MapASDV/src/main/java/com/calebfontenot/mapasdv/MapASDV.java b/Semester 2/Assignments/MapASDV/src/main/java/com/calebfontenot/mapasdv/MapASDV.java new file mode 100644 index 0000000..7f2ae6b --- /dev/null +++ b/Semester 2/Assignments/MapASDV/src/main/java/com/calebfontenot/mapasdv/MapASDV.java @@ -0,0 +1,793 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package com.calebfontenot.mapasdv; + +/** + * + * @author caleb + */ + +import asdv.ListASDV; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.function.BiConsumer;//needed in putAll + +public class MapASDV implements Map, Cloneable +{ + + private int capacity = 4; + private double loadFactor = 0.75; + private ArrayList>> map = new ArrayList>>(); + + private Set sharedKeySet = new SharedSet(); + private Set> sharedEntrySet = new SharedSet>(); + private Collection sharedValuesCollection = new SharedCollection(); + + private class SharedCollection extends ArrayList + { + + public boolean addValue(V v) + { + return this.add(v); + } + + @Override + public boolean remove(Object o) + { + + //> The parameter is key not entry if we are here + //>>remove value) and key) from the map + return MapASDV.this.removeFirstValue(o); + + //>>remove key from shared values set + //return super.remove(o); + } + + /** + * Removes one value from the collection. This method is meant to be + * called from out class. The overridden remove(Object o) of this inner + * class, calls the remove of the outer class(MapASDV), and the remove + * of the outer class, calls remove(V v, boolean callFromOuterClass) + * instead of remove(Object o) to avoid Stack Overflow when remover of + * inner calls remove of outer and vice versa. + * + * @param o - the key + * @param callFromOuterClass - dummy variable. + * @return true if the key was removed from the Set + */ + public boolean remove(V v, boolean callFromOuterClass) + { + //remove key from shared keys set + boolean b = super.remove(v); + return b; + + } + + @Override + public Object clone() + { + return super.clone(); + } + + @Override + public void clear() + { + super.clear(); + } + } + + private class SharedSet extends HashSet + { + + @Override + public boolean add(E e) + { + throw new UnsupportedOperationException("Not supported...."); + } + + @Override + public boolean removeAll(Collection c) + { + throw new UnsupportedOperationException("Not supported...."); + } + + /** + * Adds an EntryASDV to the set. It is private and cannot be used by the + * user of the Set. It is used from the MapASDV to add EntriesASDV to + * the SharedSet. Without this method we wouldn't be able to create a + * Set of keys or a Set of entries to give to the user via methods + * keySet() and entrySet() of this Map + * + * @param e EntryASDV + * @return true if the entry was added false otherwise + */ + private boolean addEntry(E e) + { + return super.add(e); + } + + @Override + public boolean remove(Object o) + { + + //>if parameter oo is EntryASDV call auxiliary method removeEntry + if (o instanceof EntryASDV) + { + return removeEntry((EntryASDV) o); + } + + //> The parameter is key not entry if we are here + //>>remove key from the map + MapASDV.this.remove(o); + //>>remove key from shared keys set + return super.remove(o); + } + + /** + * Removes the entry for the shared set + * + * @param entry the entry to be removed + * @return true if the entry was removed, false otherwise + */ + private boolean removeEntry(EntryASDV entry) + { + + MapASDV.this.remove(entry.getKey()); + return super.remove(entry); + } + + /** + * Removes the key from the set. This method is meant to be called from + * out class. The overridden remove(Object o) of this inner class calls + * the remove of the out class, and the remove of the outer class calls + * remove(K o, boolean callFromOuterClass) instead of remove(Object o) + * to avoid Stack Overflow when remover of inner calls remove of outer + * and vice versa. + * + * @param o - the key + * @param callFromOuterClass - dummy variable. + * @return true if the key was removed from the Set + */ + public boolean remove(E o, boolean callFromOuterClass) + { + + //remove key from shared keys set + return super.remove(o); + } + + @Override + public Object clone() + { + return super.clone(); + } + + @Override + public void clear() + { + super.clear(); + } + + } + + public MapASDV() + { + for (int i = 0; i < capacity; ++i) + { + map.add(new ListASDV>()); + } + } + + /** + * Double the size of the Map and rehashes the entries of the Map + */ + private void doubleTheSizeOfTheMapAndRehash() + { + capacity *= 2; + //>create a new arrayList of ListsASDV + ArrayList>> newMap = new ArrayList>>(); + + //>Add at every enetry of the arrayList a new ASDVList + for (int i = 0; i < capacity; ++i) + { + newMap.add(new ListASDV>()); + } + + //>for the size of the OLD arrayList + for (int i = 0; i < map.size(); ++i)//array list + { + //>> get The ASDVlist at i + ListASDV> list = map.get(i); + + //>>for the size() of the ASDVlist + for (int j = 0; j < list.size(); ++j) + { + ///>>>hash and put in the the new array + int index = hash( list.get(j).getKey().hashCode() ); + newMap.get(index).add(list.get(j)); + + } + } + map = newMap; + } + + class EntryASDV implements Entry, Comparable + { + + K key; + V value; + + public EntryASDV(K key, V value) + { + this.key = key; + this.value = value; + } + + @Override + public K getKey() + { + return key; + } + + @Override + public V getValue() + { + return value; + } + + @Override + public V setValue(V value) + { + V oldValue = this.value; + this.value = value; + return oldValue; + } + + @Override + public String toString() + { + return "EntryASDV{" + "key=" + key + ", value=" + value + '}'; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + final EntryASDV other = (EntryASDV) obj; + if (!Objects.equals(this.key, other.key)) + { + return false; + } + return true; + } + + /** + * + * @param o + * @return throws IllegalArgumentException if parameter class is not K + */ + @Override + public int compareTo(K o) + { + if (getClass() != o.getClass()) + { + throw new IllegalArgumentException("ellegal parameter " + o); + } + return ((Comparable) key).compareTo(o); + } + + } + + @Override + public int size() + { + return this.keySet().size(); + } + + @Override + public boolean isEmpty() + { + throw new UnsupportedOperationException("Not supported...."); + + } + + @Override + public boolean containsKey(Object key) + { + throw new UnsupportedOperationException("Not supported yet...."); + + } + + /** + * Return an entry of the map + * + * @param key the key of the entry to be returned + * @return the entry, or null if the key is not in the map + */ + private EntryASDV getEntryForKey(Object key) + { + for (ListASDV> list : map) + { + Iterator> it = list.iterator(); + while (it.hasNext()) + { + EntryASDV entry = it.next(); + if (key.equals(entry.getKey())) + { + return entry; + } + } + } + return null; + } + + /** + * Returns the index of the given key + * + * @param key a key of the map + * @return the index of a key in the map or -1, if the key is not in the map + */ + private int getIndexForKey(Object key) + { + for (int i = 0; i < map.size(); ++i) + { + Iterator> it = map.get(i).iterator(); + while (it.hasNext()) + { + EntryASDV entry = it.next(); + if (key.equals(entry.getKey())) + { + return i; + } + } + } + return -1; + } + + /** + * Returns true if this map maps one or more keys to the specified value. + * More formally, returns true if and only if this map contains at least one + * mapping to a value v such that (value==null ? v==null : value.equals(v)). + * This operation will probably require time linear in the map size for most + * implementations of the Map interface. + * + * Parameters: value - value whose presence in this map is to be tested + * Returns: true if this map maps one or more keys to the specified value + * Throws: ClassCastException - if the value is of an inappropriate type for + * this map (optional) NullPointerException - if the specified value is null + * and this map does not permit null values (optional) + * + * @param value - value whose presence in this map is to be tested + * @return true if this map maps one or more keys to the specified value + * @throws NullPointerException - if the specified value is null and this + * map does not permit null values (optional) + */ + @Override + public boolean containsValue(Object value) + { + throw new UnsupportedOperationException("Not supported yet...."); + + } + + /** + * Returns the value to which the specified key is mapped, or null if this + * map contains no mapping for the key. + * + * More formally, if this map contains a mapping from a key k to a value v + * such that (key==null ? k==null : key.equals(k)), then this method returns + * v; otherwise it returns null. (There can be at most one such mapping.) + * + * If this map permits null values, then a return value of null does not + * necessarily indicate that the map contains no mapping for the key; it's + * also possible that the map explicitly maps the key to null. The + * containsKey operation may be used to distinguish these two cases. + * + * @param key - the key whose associated value is to be returned + * @return the value to which the specified key is mapped, or null if this + * map contains no mapping for the key + * @throws NullPointerException - if the specified key is null and this map + * does not permit null keys (optional) + */ + @Override + public V get(Object key) + { + throw new UnsupportedOperationException("Not supported yet...."); + + } + + /** + * Associates the specified value with the specified key in this map + * (optional operation). If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. (A map m is said + * to contain a mapping for a key k if and only if m.containsKey(k) would + * return true.) + * + * @param key - key with which the specified value is to be associated + * @param value - value to be associated with the specified key + * @return the previous value associated with key, or null if there was no + * mapping for key. (A null return can also indicate that the map previously + * associated null with key, if the implementation supports null values.) + * @throws NullPointerException - if specified key or value is null and this + * map does not permit null keys + */ + @Override + public V put(K key, V value) + { + + if (key == null || value == null) + { + throw new NullPointerException("parm(s) null"); + } + + //>if contains the key, replace the key's value + EntryASDV entry = getEntryForKey(key); + if (entry != null) + { + V oldValue = entry.value; + entry.value = value; + + return oldValue; + } + ///>>hash and put in the array + int code = this.hash(key.hashCode()); + int index = hash(code); + + ListASDV> list = map.get(index); + EntryASDV e = new EntryASDV(key, value); + list.add(e); + + //>>add the key to the shared keys-set + ((SharedSet) this.sharedKeySet).addEntry(key); + ((SharedSet>) this.sharedEntrySet).addEntry(e); + + //>>get the value of this entry + V v = list.get(list.size() - 1).getValue(); + + //>> add value to the value collection + ((SharedCollection) this.sharedValuesCollection).addValue(v); + + //>> if reach 75% capacity double the size + if ((double) this.size() / capacity >= 0.75) + { + this.doubleTheSizeOfTheMapAndRehash(); + } + + //>>return the value of Entry just added + return v; + } + + int hash(int keyHashCode) + { + int h = hashHash(keyHashCode); + return Math.abs(h % capacity - 1); + } + + /** + * Removes the first entry with the given values. + * + * @param value - the value to be removed + * @return true if removed, false otherwise + * @throws NullPointerException if the value is null + */ + private boolean removeFirstValue(Object value) + { + throw new UnsupportedOperationException("Not supported yet...."); + + } + + /** + * Ensure hash code is evenly distributed + * + * @param h - hash code + * @return evenly distributed hash code + */ + private static int hashHash(int h) + { + h ^= (h >>> 20) ^ (h >>> 12); + return h ^ (h >>> 7) ^ (h >>> 4); + } + + /** + * Removes the mapping for a key from this map if it is present (optional + * operation). More formally, if this map contains a mapping from key k to + * value v such that (key==null ? k==null : key.equals(k)), that mapping is + * removed. (The map can contain at most one such mapping.) + * + * @param key - key whose mapping is to be removed from the map + * @return the previous value associated with key, or null if there was no + * mapping for key. + * @throws NullPointerException - if the specified key is null and this map + * does not permit null keys + */ + @Override + public V remove(Object key) + { + throw new UnsupportedOperationException("Not supported yet...."); + + } + + /** + * Copies all of the mappings from the specified map to this map (optional + * operation). The effect of this call is equivalent to that of calling + * put(k, v) on this map once for each mapping from key k to value v in the + * specified map. The behavior of this operation is undefined if the + * specified map is modified while the operation is in progress. + * + * @param m - mappings to be stored in this map + * @throws NullPointerException - if the specified map is null, or if this + * map does not permit null keys or values, and the specified map contains + * null keys + */ + @Override + public void putAll(Map m) + { + if (m == null) + { + throw new NullPointerException("null parameter"); + } + + BiConsumer consumeEachEntry = new BiConsumer() + { + MapASDV mapForConsumer = MapASDV.this; + + @Override + public void accept(K k, V v) + { + mapForConsumer.put(k, v); + } + }; + + m.forEach(consumeEachEntry); + } + + + /** + * Removes all of the mappings from this map (optional operation). The map + * will be empty after this call returns. Any shared sets are also cleared. + */ + @Override + public void clear() + { + throw new UnsupportedOperationException("Not supported yet...."); + + } + + /** + * Returns a Set view of the keys contained in this map. The set is backed + * by the map, so changes to the map are reflected in the set, and + * vice-versa. If the map is modified while an iteration over the set is in + * progress (except through the iterator's own remove operation), the + * results of the iteration are undefined. The set supports element removal, + * which removes the corresponding mapping from the map, via the + * Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. + * It does not support the add or addAll operations. + * + * @return a set view of the keys contained in this map + */ + @Override + public Set keySet() + { + + return this.sharedKeySet; + } + + /** + * Returns a Collection view of the values contained in this map. The + * collection is backed by the map, so changes to the map are reflected in + * the collection, and vice-versa. If the map is modified while an iteration + * over the collection is in progress (except through the iterator's own + * remove operation), the results of the iteration are undefined. The + * collection supports element removal, which removes the corresponding + * mapping from the map, via the Iterator.remove, Collection.remove, + * removeAll, retainAll and clear operations. It does not support the add or + * addAll operations. + * + * @return + */ + @Override + public Collection values() + { + return sharedValuesCollection; + } + + /** + * Returns a Set view of the mappings contained in this map. The set is + * backed by the map, so changes to the map are reflected in the set, and + * vice-versa. If the map is modified while an iteration over the set is in + * progress (except through the iterator's own remove operation, or through + * the setValue operation on a map entry returned by the iterator) the + * results of the iteration are undefined. The set supports element removal, + * which removes the corresponding mapping from the map, via the + * Iterator.remove, Set.remove, removeAll, retainAll and clear operations. + * It does not support the add or addAll operations. + * + * + * @return a set view of the mappings contained in this map + */ + @Override + public Set> entrySet() + { + return this.sharedEntrySet; + } + + @Override + public String toString() + { + String s = "[ "; + for (int i = 0; i < capacity; ++i) + { + s += map.get(i).toString() + "\n"; + } + s += " ]"; + + return s; + } + + /** + * Created a deep copy of the MapASDV + * + * @return the deep copy of the map + */ + @Override + public Object clone() + { + /* + MapASDV clonedMap = new MapASDV(); + + //clonedMap.putAll(this); + + for (ListASDV< EntryASDV> list : this.map) + { + ListASDV< EntryASDV> l = (ListASDV< EntryASDV>) list.clone(); + clonedMap.map.add(l); + } + return clonedMap; + */ + + MapASDV clonedMap = new MapASDV(); + clonedMap.putAll(this); + return clonedMap; + } + + public static void main(String[] args) + { + + MapASDV map = new MapASDV(); + System.out.println("---------------------------testing put(K, V)"); + map.put("ann", 20); + map.put("coco", 25); + System.out.println(map); + mapASDV.MapASDV clonedMap = ( mapASDV.MapASDV) map.clone(); + + System.out.println("\n\n---------------------------testing double-the-size-and-rehash by reaching 0.75 load factor with another put(K, V)"); + map.put("Jonathan", 30); + System.out.println(map); + map.put("Jonhathan", 45); + System.out.println(map); + map.put("Alexander", 33); + System.out.println(map); + + System.out.println("\n\n---------------------------testing putAll(Map)"); + Map anotherJavaMap = new HashMap(); + anotherJavaMap.put("lion king", 45); + anotherJavaMap.put("HYENA", 6); + map.putAll(anotherJavaMap); + System.out.println(map); + + + System.out.println("\n\n---------------------------testing containsKey"); + System.out.println(map.containsKey("Alexander")); + System.out.println(map.containsKey("alexander")); + + System.out.println("\n\n---------------------------testing containsValue"); + System.out.println(map.containsValue(33)); + System.out.println(map.containsValue(34)); + + System.out.println("\n\n---------------------------testing getEntryForKey"); + Entry e = map.getEntryForKey("Alexander"); + System.out.println( map.getEntryForKey("Alexander")); + System.out.println( map.getEntryForKey("Alex")); + + System.out.println("\n\n---------------------------testing get"); + System.out.println(map.get( "Alexander") ); + System.out.println(map.get( "Alex") ); + try{ map.get( null);}catch (NullPointerException ex ){System.out.println(ex.getMessage());} + + System.out.println("\n\n---------------------------testing getIndexForKey"); + System.out.println(map.getIndexForKey("Alexander")); + System.out.println(map.getIndexForKey("Alex")); + + System.out.println("\n\n---------------------------testing isEmpty"); + System.out.println( map.isEmpty()); + + + System.out.println("\n\n---------------------------testing size"); + System.out.println( map.size()); + System.out.println( map); + + System.out.println("\n\n---------------------------testing entrySet()"); + Set> entries = map.entrySet(); + System.out.println( entries); + + System.out.println("\n\n---------------------------testing keySet()"); + Set keys = map.keySet(); + System.out.println( keys ); + + System.out.println("\n\n---------------------------testing values()"); + Collection values = map.values(); + System.out.println( values); + + System.out.println("\n\n---------------------------testing remove( K) coco 25"); + map.remove("coco"); + System.out.println(map); + System.out.println(entries); + System.out.println(keys); + System.out.println(values); + + System.out.println("\n\n---------------------------testing Entry-Collection remove "); + entries.remove( e); + System.out.println(map); + System.out.println(entries); + System.out.println(keys); + System.out.println(values); + + + System.out.println("\n\n---------------------------testing Set Keys remove "); + keys.remove( "ann"); + System.out.println(map); + System.out.println(entries); + System.out.println(keys); + System.out.println(values); + + + System.out.println("\n\n---------------------------testing Set Values remove "); + values.remove( 45); + System.out.println(map); + System.out.println(entries); + System.out.println(keys); + System.out.println(values); + + System.out.println("\n\n---------------------------testing clear "); + map.clear(); + System.out.println(map); + System.out.println(entries); + System.out.println(keys); + + System.out.println("\n\n---------------------------testing add of sets and collections "); + try{ keys.add( "a");}catch (Exception ex ){System.out.println(ex.getMessage());} + try{ values.add( 33);}catch (Exception ex ){System.out.println(ex.getMessage());} + try{ entries.add( e);}catch (Exception ex ){System.out.println(ex.getMessage());} + + + + System.out.println("\n\n---------------------------testing clone"); + System.out.println( clonedMap); + + System.out.println("---------------------------testing put(K, V) AGAIN"); + map.put("Nicholas", 100); + map.put("a", 200); + map.put("b", -20); + System.out.println( map); + + } + +} + diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/nb-configuration.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/nb-configuration.xml new file mode 100644 index 0000000..f29f292 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 9.0-web + gfv700ee10 + Facelets + JDK_11__System_ + + diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/pom.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/pom.xml new file mode 100644 index 0000000..0abdfe5 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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 + 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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java new file mode 100644 index 0000000..110a745 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java new file mode 100644 index 0000000..f7f850d --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/beans/SupplierBean.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/beans/SupplierBean.java new file mode 100644 index 0000000..8b56c3b --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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.players.DatabaseManipulationPlayers; +import edu.slcc.asdv.bl.players.Players; +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 + DatabaseManipulationPlayers 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 DatabaseManipulationPlayers 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 Players()); + } + + public void deleteSupplier(Players 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 (Players 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 (Players 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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/DBase.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/DBase.java new file mode 100644 index 0000000..7a79952 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java new file mode 100644 index 0000000..6fdca3b --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java new file mode 100644 index 0000000..ebdec92 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/part/Part.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/part/Part.java new file mode 100644 index 0000000..54bd19a --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/DatabaseManipulationPlayers.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/DatabaseManipulationPlayers.java new file mode 100644 index 0000000..2611b43 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/DatabaseManipulationPlayers.java @@ -0,0 +1,220 @@ +/* + * 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.players; + +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 DatabaseManipulationPlayers + implements DBase, Serializable +{ + final String userName = "java"; + final String password = "8VCS49HT2xjsEZvC"; + final String databaseName = "tennis_db"; + @Override + public List listAll() + throws SQLException + { + // test exception code + //if ( true) + // throw new SQLException(); + + List tableSuppliers = new ArrayList(); + 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 tennis_db"; + //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) + " "; + Players supplier = new Players(String town, String postCode, int houseNo, String street, int yearJoined, String gender, int playerNo, String name, String init, String birthDate, Date birthDateDate); + 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(Players t) + throws SQLException + { + 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(Players c) throws SQLException + { + 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(Players c) throws SQLException { + String databaseName = "tennis-23"; + 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.getBirthday_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/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/Players.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/Players.java new file mode 100644 index 0000000..1a3719f --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/Players.java @@ -0,0 +1,159 @@ +/* + * 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.players; + +import edu.slcc.asdv.bl.UtilitiesDatabase; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author asdv5 + */ +public class Players implements Serializable { + + private String town; + private String postCode; + private int houseNo; + private String street; + private int yearJoined; + private String gender; + private int playerNo; + private String name; + private String init; + private String birthDate; + private Date birthDateDate; + private boolean insertFromDatatable; + private boolean modify; + + public boolean isModify() { + return modify; + } + + public void setModify(boolean modify) { + this.modify = modify; + } + + public int getPlayerNo() { + return playerNo; + } + + public void setPlayerNo(int playerNo) { + this.playerNo = playerNo; + } + + public String getInit() { + return init; + } + + public int getYearJoined() { + return yearJoined; + } + + public String getPostCode() { + return postCode; + } + + public void setPostCode(String postCode) { + this.postCode = postCode; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public int getHouseNo() { + return houseNo; + } + + public void setHouseNo(int houseNo) { + this.houseNo = houseNo; + } + + public void setYearJoined(int yearJoined) { + this.yearJoined = yearJoined; + } + + public void setInit(String init) { + this.init = init; + } + + public String getTown() { + return town; + } + + public void setTown(String town) { + this.town = town; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public Players(String town, String postCode, int houseNo, String street, int yearJoined, String gender, int playerNo, String name, String init, String birthDate, Date birthDateDate) { + this.town = town; + this.postCode = postCode; + this.houseNo = houseNo; + this.street = street; + this.yearJoined = yearJoined; + this.gender = gender; + this.playerNo = playerNo; + this.name = name; + this.init = init; + this.modify = true; + this.insertFromDatatable = true; + this.birthDate = "2000-01-01"; + this.birthDateDate = UtilitiesDatabase.stringDateToJavaUtilitiesDate(this.birthDate); + } + + + public boolean isInsertFromDatatable() { + return insertFromDatatable; + } + + public void setInsertFromDatatable(boolean insertFromDatatable) { + this.insertFromDatatable = insertFromDatatable; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getBirthday() { + return birthDate; + } + + public void setBirthday(String birthday) { + this.birthDate = birthday; + } + + public Date getBirthday_date() { + birthDateDate = UtilitiesDatabase.stringDateToJavaUtilitiesDate(this.birthDate); + return birthDateDate; + } + + public void setBirthday_date(Date birthday_date) { + this.birthDateDate = birthday_date; + int year = this.birthDateDate.getYear() + 1900; + int month = this.birthDateDate.getMonth() + 1; + int day = this.birthDateDate.getDate(); + this.birthDate = Integer.toString(year) + "-" + + Integer.toString(month) + "-" + + Integer.toString(day); + } + +} diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/Supplier_1.java b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/Supplier_1.java new file mode 100644 index 0000000..848b93b --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/players/Supplier_1.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.players; + +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/Tennis_Database_Primefaces_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..baad290 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..b3a1279 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..584a477 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_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/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..11562f0 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_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/supplier.xhtml + + diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/index.xhtml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/index.xhtml new file mode 100644 index 0000000..3220605 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/resources/css/styles.css b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/resources/css/styles.css new file mode 100644 index 0000000..9d96af6 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/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/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/supplier.xhtml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/supplier.xhtml new file mode 100644 index 0000000..3372982 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/webapp/supplier.xhtml @@ -0,0 +1,101 @@ + + + + + Suppliers Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +     + +
+ +
+
+ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT.war b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT.war new file mode 100644 index 0000000..4051679 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT.war differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/beans.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/beans.xml new file mode 100644 index 0000000..b3a1279 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/META-INF/persistence.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/META-INF/persistence.xml new file mode 100644 index 0000000..baad290 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.class new file mode 100644 index 0000000..825b9fc Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.class new file mode 100644 index 0000000..374f419 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/beans/SupplierBean.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/beans/SupplierBean.class new file mode 100644 index 0000000..fc42b7f Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/beans/SupplierBean.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/DBase.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/DBase.class new file mode 100644 index 0000000..a79d62d Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/DBase.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/UtilitiesDatabase.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/UtilitiesDatabase.class new file mode 100644 index 0000000..7de8bbe Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/UtilitiesDatabase.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/part/DatabaseManipulationPart.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/part/DatabaseManipulationPart.class new file mode 100644 index 0000000..1e37981 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/part/DatabaseManipulationPart.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/part/Part.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/part/Part.class new file mode 100644 index 0000000..e8946b0 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/part/Part.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.class new file mode 100644 index 0000000..87fb236 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/supplier/Supplier.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/supplier/Supplier.class new file mode 100644 index 0000000..6ede459 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/classes/edu/slcc/asdv/bl/supplier/Supplier.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/glassfish-web.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..584a477 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/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/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-j-8.1.0.jar b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-j-8.1.0.jar new file mode 100644 index 0000000..9e38a71 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-j-8.1.0.jar differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/primefaces-12.0.0-jakarta.jar b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/primefaces-12.0.0-jakarta.jar new file mode 100644 index 0000000..389c48c Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/primefaces-12.0.0-jakarta.jar differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.21.9.jar b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.21.9.jar new file mode 100644 index 0000000..c4fd860 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.21.9.jar differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/web.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/WEB-INF/web.xml new file mode 100644 index 0000000..11562f0 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/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/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/index.xhtml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/index.xhtml new file mode 100644 index 0000000..3220605 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/index.xhtml @@ -0,0 +1,51 @@ + + + + + + Supplier Parts DB + + + + +

Suppliers-Parts Database

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ \ No newline at end of file diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/resources/css/styles.css b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/resources/css/styles.css new file mode 100644 index 0000000..9d96af6 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/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/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/supplier.xhtml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/supplier.xhtml new file mode 100644 index 0000000..3372982 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/Suppliers_Parts_Calendar_Primefaces-1.0-SNAPSHOT/supplier.xhtml @@ -0,0 +1,101 @@ + + + + + Suppliers Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +     + +
+ +
+
+ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/META-INF/persistence.xml b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/META-INF/persistence.xml new file mode 100644 index 0000000..baad290 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.class new file mode 100644 index 0000000..825b9fc Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.class new file mode 100644 index 0000000..374f419 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/beans/SupplierBean.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/beans/SupplierBean.class new file mode 100644 index 0000000..fc42b7f Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/beans/SupplierBean.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/DBase.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/DBase.class new file mode 100644 index 0000000..a79d62d Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/DBase.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/UtilitiesDatabase.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/UtilitiesDatabase.class new file mode 100644 index 0000000..7de8bbe Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/UtilitiesDatabase.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/part/DatabaseManipulationPart.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/part/DatabaseManipulationPart.class new file mode 100644 index 0000000..1e37981 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/part/DatabaseManipulationPart.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/part/Part.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/part/Part.class new file mode 100644 index 0000000..e8946b0 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/part/Part.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.class new file mode 100644 index 0000000..87fb236 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/supplier/Supplier.class b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/supplier/Supplier.class new file mode 100644 index 0000000..6ede459 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/classes/edu/slcc/asdv/bl/supplier/Supplier.class differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/endorsed/jakarta.jakartaee-api-9.0.0.jar b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/endorsed/jakarta.jakartaee-api-9.0.0.jar new file mode 100644 index 0000000..8f74e44 Binary files /dev/null and b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/endorsed/jakarta.jakartaee-api-9.0.0.jar differ diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-archiver/pom.properties b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-archiver/pom.properties new file mode 100644 index 0000000..6b6f496 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Sun Nov 19 23:24:30 CST 2023 +groupId=com.mycompany +artifactId=Suppliers_Parts_Calendar_Primefaces +version=1.0-SNAPSHOT diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..9779b57 --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,9 @@ +edu/slcc/asdv/bl/DBase.class +edu/slcc/asdv/bl/UtilitiesDatabase.class +com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.class +edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.class +edu/slcc/asdv/bl/supplier/Supplier.class +edu/slcc/asdv/bl/part/DatabaseManipulationPart.class +edu/slcc/asdv/beans/SupplierBean.class +edu/slcc/asdv/bl/part/Part.class +com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.class diff --git a/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..b0cc41b --- /dev/null +++ b/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,9 @@ +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/part/Part.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/part/DatabaseManipulationPart.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/com/mycompany/supplierspartsdatabase/JakartaRestConfiguration.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/DBase.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/supplier/DatabaseManipulationSupplier.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/com/mycompany/supplierspartsdatabase/resources/JakartaEE9Resource.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/beans/SupplierBean.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/UtilitiesDatabase.java +/home/caleb/ASDV-WebDev/Semester 2/Assignments/Tennis_Database_Primefaces_CalebFontenot/src/main/java/edu/slcc/asdv/bl/supplier/Supplier.java diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns.zip b/Semester 3/Assignments/MP3-ajax-threads-patterns.zip new file mode 100644 index 0000000..636c25a Binary files /dev/null and b/Semester 3/Assignments/MP3-ajax-threads-patterns.zip differ diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax.zip b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax.zip new file mode 100644 index 0000000..7fb8466 Binary files /dev/null and b/Semester 3/Assignments/MP3-ajax-threads-patterns/MP1_Ajax.zip differ diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/StockDB.html b/Semester 3/Assignments/MP3-ajax-threads-patterns/StockDB.html new file mode 100644 index 0000000..964371b --- /dev/null +++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/StockDB.html @@ -0,0 +1,78 @@ + + + +StockDB.java + + + + +
/Users/asdv5/Desktop/slcc/S24/2800/MP1_Ajax/src/main/java/edu/slcc/ajax/bl/StockDB.java
+
+    @Override
+    public void create(Stock t)
+            throws Exception
+    {
+        int result = 0;
+        Connection con = null;
+        try
+        {
+            con = con = new UtilitiesDatabase().connection(
+                    "nyse", "root", "root", "com.mysql.jdbc.Driver");
+        }
+        catch (Exception e)
+        {
+            System.err.println(e);
+            throw e;
+        }
+        PreparedStatement updateStock = null;
+        try
+        {
+            updateStock = con.prepareStatement(
+                    "INSERT INTO stock (stock_id, company_name, price_current, price_closing, number_of_shares_available, number_of_shares_sold ) "
+                    + "VALUES ( ?, ?, ? , ? ,? , ?)");
+            updateStock.setString(1, t.getStockId());
+            updateStock.setString(2, t.getCompanyName());
+            updateStock.setDouble(3, t.getPriceCurrent());
+            updateStock.setDouble(4, t.getPriceClosing());
+            updateStock.setLong(5, t.getNumberOfSharesAvailable());
+            updateStock.setLong(6, t.getNumberOfSharesSold());
+            int updateCount = updateStock.executeUpdate();
+            result = updateCount;
+        }
+        catch (Exception ex)
+        {
+            System.err.println(ex.toString());
+            throw ex;
+        }
+        finally
+        {
+            try
+            {
+                new UtilitiesDatabase().closeDatabaseConnection(con);
+                // close the resources 
+                if (updateStock != null)
+                {
+                    updateStock.close();
+                }
+            }
+            catch (SQLException e)
+            {
+                System.err.println(e.toString());
+                throw e;
+            }
+        }
+  
+    }
+
+ diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/instructions.png b/Semester 3/Assignments/MP3-ajax-threads-patterns/instructions.png new file mode 100644 index 0000000..a1a8a9b Binary files /dev/null and b/Semester 3/Assignments/MP3-ajax-threads-patterns/instructions.png differ diff --git a/Semester 3/Assignments/MP3-ajax-threads-patterns/nyse.sql b/Semester 3/Assignments/MP3-ajax-threads-patterns/nyse.sql new file mode 100644 index 0000000..3ff7325 --- /dev/null +++ b/Semester 3/Assignments/MP3-ajax-threads-patterns/nyse.sql @@ -0,0 +1,106 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.0 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost:8889 +-- Generation Time: Feb 20, 2024 at 06:27 PM +-- Server version: 5.7.39 +-- PHP Version: 7.4.33 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `nyse` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `stock` +-- + +CREATE TABLE `stock` ( + `stock_id` varchar(4) NOT NULL, + `company_name` varchar(100) NOT NULL, + `price_current` double NOT NULL, + `price_closing` double NOT NULL, + `number_of_shares_available` bigint(20) NOT NULL, + `number_of_shares_sold` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `stock` +-- + +INSERT INTO `stock` (`stock_id`, `company_name`, `price_current`, `price_closing`, `number_of_shares_available`, `number_of_shares_sold`) VALUES +('PLCE', 'Children\'s Place, Inc.', 14.515, 13.515, 10000000, 5000000); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `stock_holder` +-- + +CREATE TABLE `stock_holder` ( + `stock_holder_id` int(11) NOT NULL, + `name` varchar(50) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `transactions` +-- + +CREATE TABLE `transactions` ( + `stock_holder_id` int(11) NOT NULL, + `stock_id` varchar(4) NOT NULL, + `qty` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `stock` +-- +ALTER TABLE `stock` + ADD PRIMARY KEY (`stock_id`); + +-- +-- Indexes for table `stock_holder` +-- +ALTER TABLE `stock_holder` + ADD PRIMARY KEY (`stock_holder_id`); + +-- +-- Indexes for table `transactions` +-- +ALTER TABLE `transactions` + ADD PRIMARY KEY (`stock_holder_id`,`stock_id`), + ADD KEY `stock_id` (`stock_id`); + +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `transactions` +-- +ALTER TABLE `transactions` + ADD CONSTRAINT `transactions_ibfk_1` FOREIGN KEY (`stock_id`) REFERENCES `stock` (`stock_id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `transactions_ibfk_2` FOREIGN KEY (`stock_holder_id`) REFERENCES `stock_holder` (`stock_holder_id`) ON DELETE CASCADE ON UPDATE CASCADE; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/Semester 3/Assignments/MaxTask/src/main/java/edu/slcc/asdv/caleb/maxtask/ParallelMax$MaxTask.class b/Semester 3/Assignments/MaxTask/src/main/java/edu/slcc/asdv/caleb/maxtask/ParallelMax$MaxTask.class new file mode 100644 index 0000000..2c6dc96 Binary files /dev/null and b/Semester 3/Assignments/MaxTask/src/main/java/edu/slcc/asdv/caleb/maxtask/ParallelMax$MaxTask.class differ diff --git a/Semester 3/Assignments/MaxTask/src/main/java/edu/slcc/asdv/caleb/maxtask/ParallelMax.class b/Semester 3/Assignments/MaxTask/src/main/java/edu/slcc/asdv/caleb/maxtask/ParallelMax.class new file mode 100644 index 0000000..9a2ce5d Binary files /dev/null and b/Semester 3/Assignments/MaxTask/src/main/java/edu/slcc/asdv/caleb/maxtask/ParallelMax.class differ diff --git a/Semester 3/Assignments/Templates01_CalebFontenot.zip b/Semester 3/Assignments/Templates01_CalebFontenot.zip new file mode 100644 index 0000000..71da836 Binary files /dev/null and b/Semester 3/Assignments/Templates01_CalebFontenot.zip differ