:(
This commit is contained in:
parent
8f30705c62
commit
f1c589e653
4
.gitignore
vendored
4
.gitignore
vendored
@ -100,3 +100,7 @@
|
|||||||
/Semester 3/Assignments/params/target/
|
/Semester 3/Assignments/params/target/
|
||||||
/Semester 3/Assignments/templatesMatricesSample/target/
|
/Semester 3/Assignments/templatesMatricesSample/target/
|
||||||
/Semester 3/Assignments/StockBrokerAjaxThreads/target/
|
/Semester 3/Assignments/StockBrokerAjaxThreads/target/
|
||||||
|
/Semester 3/Assignments/Ajax11_idientifiers/target/
|
||||||
|
/Semester 3/Assignments/Json1/target/
|
||||||
|
/Semester 3/Assignments/TermProject1_CalebFontenot copy/target/
|
||||||
|
/Semester 3/Assignments/TermProject2_CalebFontenot/target/
|
||||||
|
BIN
Semester 3/Assignments/Ajax11_idientifiers.zip
Normal file
BIN
Semester 3/Assignments/Ajax11_idientifiers.zip
Normal file
Binary file not shown.
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_15__System_</netbeans.hint.jdkPlatform>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
48
Semester 3/Assignments/Ajax11_idientifiers/pom.xml
Normal file
48
Semester 3/Assignments/Ajax11_idientifiers/pom.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>asdv</groupId>
|
||||||
|
<artifactId>Ajax11_idientifiers</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>Ajax11_idientifiers-1</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>12.0.0</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package asdv.ajax11_idientifiers;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package asdv.ajax11_idientifiers.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
@Named(value = "ajaxBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class AjaxBean
|
||||||
|
{
|
||||||
|
private String name;
|
||||||
|
private int age;
|
||||||
|
private String notExecuted = "never replaced";
|
||||||
|
|
||||||
|
public String getNotExecuted(){return notExecuted;}
|
||||||
|
|
||||||
|
public void setNotExecuted(String notExecuted)
|
||||||
|
{this.notExecuted = notExecuted;}
|
||||||
|
|
||||||
|
public int getAge(){return age;}
|
||||||
|
|
||||||
|
public void setAge(int age){this.age = age;}
|
||||||
|
|
||||||
|
public String getName(){return name;}
|
||||||
|
|
||||||
|
public void setName(String name){this.name = name; }
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:f="jakarta.faces.core"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>Ajax 11</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form>
|
||||||
|
Name: <h:inputText id= "nameInputId" value="#{ajaxBean.name}"/><br/>
|
||||||
|
Age: <h:inputText id="ageInputId" value="#{ajaxBean.age}"/><br/>
|
||||||
|
Not executed: <h:inputText id="notExecutedInputId" value="#{ajaxBean.notExecuted}"/><br/>
|
||||||
|
<h:commandButton value="Execute in Server 2 out of inputTexts" ><br/>
|
||||||
|
<f:ajax execute="nameInputId ageInputId "
|
||||||
|
render="nameOutputId ageOutputId notExecutedOutputId"/>
|
||||||
|
</h:commandButton>
|
||||||
|
<br/>
|
||||||
|
<h:outputText id="nameOutputId" value="#{ajaxBean.name}"/><br/>
|
||||||
|
<h:outputText id="ageOutputId" value="#{ajaxBean.age}"/><br/>
|
||||||
|
<h:outputText id="notExecutedOutputId" value="#{ajaxBean.notExecuted}"/>
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
<h:form>
|
||||||
|
Name: <p:inputText id= "nameInputId1" value="#{ajaxBean.name}"/><br/>
|
||||||
|
Age: <p:inputText id="ageInputId1" value="#{ajaxBean.age}"/><br/>
|
||||||
|
Not executed: <p:inputText id="notExecutedInputId1" value="#{ajaxBean.notExecuted}"/><br/>
|
||||||
|
<p:commandButton value="Execute in Server 2 out of inputTexts" ><br/>
|
||||||
|
<p:ajax process="nameInputId1 ageInputId1 "
|
||||||
|
update="nameOutputId1 ageOutputId1 notExecutedOutputId1"/>
|
||||||
|
</p:commandButton>
|
||||||
|
<br/>
|
||||||
|
<p:outputLabel id="nameOutputId1" value="#{ajaxBean.name}"/><br/>
|
||||||
|
<p:outputLabel id="ageOutputId1" value="#{ajaxBean.age}"/><br/>
|
||||||
|
<p:outputLabel id="notExecutedOutputId1" value="#{ajaxBean.notExecuted}"/>
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
BIN
Semester 3/Assignments/Json1.zip
Normal file
BIN
Semester 3/Assignments/Json1.zip
Normal file
Binary file not shown.
21
Semester 3/Assignments/Json1/nb-configuration.xml
Normal file
21
Semester 3/Assignments/Json1/nb-configuration.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_15__System_</netbeans.hint.jdkPlatform>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
42
Semester 3/Assignments/Json1/pom.xml
Normal file
42
Semester 3/Assignments/Json1/pom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>asdv</groupId>
|
||||||
|
<artifactId>Json1</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>Json1</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package asdv.mavenproject3;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package asdv.mavenproject3.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
225
Semester 3/Assignments/Json1/src/main/java/jason/Jason.java
Normal file
225
Semester 3/Assignments/Json1/src/main/java/jason/Jason.java
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package jason;
|
||||||
|
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import jakarta.json.Json;
|
||||||
|
import jakarta.json.JsonArray;
|
||||||
|
import jakarta.json.JsonArrayBuilder;
|
||||||
|
import jakarta.json.JsonNumber;
|
||||||
|
import jakarta.json.JsonObject;
|
||||||
|
import jakarta.json.JsonObjectBuilder;
|
||||||
|
import jakarta.json.JsonString;
|
||||||
|
import jakarta.json.JsonValue;
|
||||||
|
import jakarta.json.JsonWriter;
|
||||||
|
import jakarta.json.stream.JsonParser;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ASDV2
|
||||||
|
*/
|
||||||
|
public class Jason
|
||||||
|
{
|
||||||
|
public static JsonObject createObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
JsonObject model = Json.createObjectBuilder()
|
||||||
|
.add("firstName", "Duke")
|
||||||
|
.add("lastName", "Java")
|
||||||
|
.add("age", 18)
|
||||||
|
.add("streetAddress", "100 Internet Dr")
|
||||||
|
.add("city", "JavaTown")
|
||||||
|
.add("state", "JA")
|
||||||
|
.add("postalCode", "12345")
|
||||||
|
.add("phoneNumbers", Json.createArrayBuilder()
|
||||||
|
.add(Json.createObjectBuilder().add("type", "mobile").add("number", "111-111-1111"))
|
||||||
|
.add(Json.createObjectBuilder().add("type", "home").add("number", "222-222-2222")))
|
||||||
|
.build();
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonObject createDukeObject()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
JsonObjectBuilder job = Json.createObjectBuilder();
|
||||||
|
|
||||||
|
job = job.add("firstName", "Duke");
|
||||||
|
job = job.add("lastName", "Java");
|
||||||
|
|
||||||
|
JsonObject modelPartial = job.build();
|
||||||
|
return modelPartial;
|
||||||
|
*/
|
||||||
|
JsonArrayBuilder jab = Json.createArrayBuilder();
|
||||||
|
//one array
|
||||||
|
jab = jab.add( //1st object
|
||||||
|
Json.createObjectBuilder()
|
||||||
|
.add("type", "mobile")
|
||||||
|
.add("number", "111-111-1111"))
|
||||||
|
//2nd object
|
||||||
|
.add(
|
||||||
|
Json.createObjectBuilder()
|
||||||
|
.add("type", "home")
|
||||||
|
.add("number", "222-222-2222")
|
||||||
|
);
|
||||||
|
JsonObject model = Json.createObjectBuilder()
|
||||||
|
.add("firstName", "Duke")
|
||||||
|
.add("lastName", "Java")
|
||||||
|
.add("age", 18)
|
||||||
|
.add("streetAddress", "100 Internet Dr")
|
||||||
|
.add("city", "JavaTown")
|
||||||
|
.add("state", "JA")
|
||||||
|
.add("postalCode", "12345")
|
||||||
|
.add("phoneNumbers", jab)
|
||||||
|
/*
|
||||||
|
.add(
|
||||||
|
Json.createObjectBuilder()
|
||||||
|
.add("type", "home")
|
||||||
|
.add("number", "222-222-2222")
|
||||||
|
)
|
||||||
|
*/
|
||||||
|
.build();
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList navigateTree(JsonValue tree, String key, ArrayList list)
|
||||||
|
{
|
||||||
|
if (key != null)
|
||||||
|
{
|
||||||
|
System.out.print("Key " + key + ": ");
|
||||||
|
list.add("Key " + key + ": ");
|
||||||
|
}
|
||||||
|
switch (tree.getValueType())
|
||||||
|
{
|
||||||
|
case OBJECT:
|
||||||
|
System.out.println("OBJECT");
|
||||||
|
list.add("OBJECT");
|
||||||
|
JsonObject object = (JsonObject) tree;
|
||||||
|
for (String name : object.keySet())
|
||||||
|
{
|
||||||
|
navigateTree(object.get(name), name, list);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ARRAY:
|
||||||
|
System.out.println("ARRAY");
|
||||||
|
list.add("ARRAY");
|
||||||
|
JsonArray array = (JsonArray) tree;
|
||||||
|
for (JsonValue val : array)
|
||||||
|
{
|
||||||
|
navigateTree(val, null, list);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
JsonString st = (JsonString) tree;
|
||||||
|
System.out.println("STRING " + st.getString());
|
||||||
|
list.add("STRING" + st.getString() ) ;
|
||||||
|
break;
|
||||||
|
case NUMBER:
|
||||||
|
JsonNumber num = (JsonNumber) tree;
|
||||||
|
System.out.println("NUMBER " + num.toString());
|
||||||
|
list.add("NUMBER" + num.toString() ) ;
|
||||||
|
break;
|
||||||
|
case TRUE:
|
||||||
|
case FALSE:
|
||||||
|
case NULL:
|
||||||
|
System.out.println(tree.getValueType().toString());
|
||||||
|
list.add(tree.getValueType().toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getJsonString(JsonObject jo)
|
||||||
|
{
|
||||||
|
StringWriter stWriter = new StringWriter();
|
||||||
|
JsonWriter jsonWriter = Json.createWriter(stWriter);
|
||||||
|
jsonWriter.writeObject(jo);
|
||||||
|
jsonWriter.close();
|
||||||
|
String jsonData = stWriter.toString();
|
||||||
|
return jsonData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String parseObject(JsonObject jo)
|
||||||
|
{
|
||||||
|
JsonParser parser = Json.createParser( new StringReader(jo.toString()) );
|
||||||
|
String s = "";
|
||||||
|
while (parser.hasNext())
|
||||||
|
{
|
||||||
|
JsonParser.Event event = parser.next();
|
||||||
|
switch (event)
|
||||||
|
{
|
||||||
|
case START_ARRAY:
|
||||||
|
case END_ARRAY:
|
||||||
|
case START_OBJECT:
|
||||||
|
case END_OBJECT:
|
||||||
|
case VALUE_FALSE:
|
||||||
|
case VALUE_NULL:
|
||||||
|
case VALUE_TRUE:
|
||||||
|
s += "\n" + event.toString() + "\n";
|
||||||
|
break;
|
||||||
|
case KEY_NAME:
|
||||||
|
s += event.toString() + " "
|
||||||
|
+ parser.getString() + " - ";
|
||||||
|
break;
|
||||||
|
case VALUE_STRING:
|
||||||
|
case VALUE_NUMBER:
|
||||||
|
s += event.toString() + " "
|
||||||
|
+ parser.getString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String testCreateComplexObject()
|
||||||
|
{
|
||||||
|
JsonObjectBuilder jsonObjectBuilder = Json.createObjectBuilder();
|
||||||
|
jsonObjectBuilder.add("emp_name", "John");
|
||||||
|
jsonObjectBuilder.add("emp_id", 1016);
|
||||||
|
jsonObjectBuilder.add("salary", 80000);
|
||||||
|
|
||||||
|
//> create Json array with only values
|
||||||
|
JsonArrayBuilder jab = Json.createArrayBuilder();
|
||||||
|
jab.add("Nick");
|
||||||
|
jab.add("John");
|
||||||
|
jab.add(888);
|
||||||
|
JsonArray ja = jab.build();
|
||||||
|
//> the array got created,
|
||||||
|
//add it to the json as a child element
|
||||||
|
jsonObjectBuilder.add("direct_contacts", ja);
|
||||||
|
//> create an array of key-value pairs
|
||||||
|
JsonArrayBuilder kvArrBld = Json.createArrayBuilder();
|
||||||
|
// create each key-value pair as seperate object and add it to the array
|
||||||
|
kvArrBld.add(Json.createObjectBuilder().add("email", "java2novice@gmail.com").build());
|
||||||
|
kvArrBld.add(Json.createObjectBuilder().add("mobile", "123123123123").build());
|
||||||
|
JsonArray contactsArr = kvArrBld.build();
|
||||||
|
// add contacts array object
|
||||||
|
jsonObjectBuilder.add("contacts", contactsArr);
|
||||||
|
JsonObject empObj = jsonObjectBuilder.build();
|
||||||
|
// Write to String writer.
|
||||||
|
// if you want you can write it to a file as well
|
||||||
|
StringWriter strWtr = new StringWriter();
|
||||||
|
JsonWriter jsonWtr = Json.createWriter(strWtr);
|
||||||
|
jsonWtr.writeObject(empObj);
|
||||||
|
jsonWtr.close();
|
||||||
|
System.out.println(strWtr.toString());
|
||||||
|
System.out.println("calling the method getJsonString()");
|
||||||
|
System.out.println(getJsonString(empObj));
|
||||||
|
return empObj.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
JsonObject jo = createObject();
|
||||||
|
System.out.println(jo);
|
||||||
|
//JsonObject jo = createDukeObject();
|
||||||
|
//System.out.println(jo);
|
||||||
|
//navigateTree(jo, null);
|
||||||
|
//System.out.println(getJsonString(jo));
|
||||||
|
//System.out.println(parseObject(jo));
|
||||||
|
//testCreateComplexObject();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package jason;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.RequestScoped;
|
||||||
|
import jakarta.json.JsonObject;
|
||||||
|
import jakarta.json.JsonValue;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
@Named(value = "jsonBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class JsonBean
|
||||||
|
{
|
||||||
|
private String s;
|
||||||
|
private String fromWriter;
|
||||||
|
private String fromParser;
|
||||||
|
private String complexObject;
|
||||||
|
private String suppliersObject;
|
||||||
|
|
||||||
|
private ArrayList list = new ArrayList();
|
||||||
|
|
||||||
|
public JsonBean()
|
||||||
|
{
|
||||||
|
s = Jason.createObject().toString();
|
||||||
|
list = Jason.navigateTree(JsonValue.TRUE, s, list);
|
||||||
|
|
||||||
|
list = Jason.navigateTree(Jason.createObject(), null, list);
|
||||||
|
|
||||||
|
fromWriter = Jason.getJsonString(Jason.createObject());
|
||||||
|
fromParser = Jason.parseObject(Jason.createObject());
|
||||||
|
complexObject = Jason.testCreateComplexObject();
|
||||||
|
suppliersObject = JsonSupplier.getSuppliersJsonObject();
|
||||||
|
}
|
||||||
|
public String getS()
|
||||||
|
{
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
public ArrayList getList()
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFromWriter()
|
||||||
|
{
|
||||||
|
return fromWriter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFromParser()
|
||||||
|
{
|
||||||
|
return fromParser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComplexObject() {
|
||||||
|
return complexObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSuppliersObject() {
|
||||||
|
return suppliersObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void writeSuppliersToFile() throws FileNotFoundException{
|
||||||
|
JsonObject jo = JsonSupplier.createJsonObjectFromString(this.suppliersObject);
|
||||||
|
JsonSupplier.writeJsonToTextFile(jo);
|
||||||
|
}
|
||||||
|
public void readSuppliersFromFile() throws FileNotFoundException {
|
||||||
|
JsonObject jo = JsonSupplier.readFileIntoJson("jason.json");
|
||||||
|
s = jo.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,160 @@
|
|||||||
|
package jason;
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import jakarta.json.Json;
|
||||||
|
import jakarta.json.JsonArray;
|
||||||
|
import jakarta.json.JsonArrayBuilder;
|
||||||
|
import jakarta.json.JsonObject;
|
||||||
|
import jakarta.json.JsonObjectBuilder;
|
||||||
|
import jakarta.json.JsonReader;
|
||||||
|
import jakarta.json.JsonValue;
|
||||||
|
import jakarta.json.JsonWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class JsonSupplier {
|
||||||
|
/**
|
||||||
|
* Creates a JsonObject by traversing the arrayList of LinkedHashMap
|
||||||
|
*
|
||||||
|
* @param suppliers ArrayList of LinkedHashMap. Each element of the
|
||||||
|
* arrayList is a row of suppliers table. The key of the LinkedHashMap is
|
||||||
|
* the attribute name and the value of the attribute Example ( One liked
|
||||||
|
* hash map is one row from the table) LinkedHashMap 1 : key: snumber,
|
||||||
|
* value: s1 key: sname, value: white key: status, value: 20 key: city,
|
||||||
|
* value London LinkedHashMap 2 : key: snumber, value: s2 key: sname, value:
|
||||||
|
* black key: status, value: 30 key: city, value Paris The value of the map
|
||||||
|
* @return JsonObject
|
||||||
|
*/
|
||||||
|
public static JsonObject createJsonObjectForSuppliers(ArrayList< LinkedHashMap<String, String>> suppliers) {
|
||||||
|
JsonObjectBuilder jsonBuilder = Json.createObjectBuilder();
|
||||||
|
int counter = 1;
|
||||||
|
for (LinkedHashMap<String, String> supplier : suppliers)
|
||||||
|
{
|
||||||
|
// create an array of key-value pairs
|
||||||
|
JsonArrayBuilder arraySupplierBld = Json.createArrayBuilder();
|
||||||
|
// create each key-value pair as seperate object and add it to the array
|
||||||
|
Set<Map.Entry<String, String>> entrySet = supplier.entrySet();
|
||||||
|
for (Map.Entry<String, String> entry : entrySet)
|
||||||
|
{
|
||||||
|
arraySupplierBld.add(Json.createObjectBuilder().add(entry.getKey(),
|
||||||
|
entry.getValue()).build());
|
||||||
|
}
|
||||||
|
// add supplier-array to object
|
||||||
|
String objectID = "+" + (counter++);
|
||||||
|
jsonBuilder.add(objectID, arraySupplierBld);
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject allSuppliersJsonObject = jsonBuilder.build();
|
||||||
|
return allSuppliersJsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a JsonObject by reading the String data in JSON format
|
||||||
|
*
|
||||||
|
* @param jsonData Json format data
|
||||||
|
* @return JsonObject
|
||||||
|
*/
|
||||||
|
public static JsonObject createJsonObjectFromString(String jsonData) {
|
||||||
|
JsonReader jsonReader = Json.createReader(new StringReader(jsonData));
|
||||||
|
JsonObject o = jsonReader.readObject();
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a LinkedHashMap of 4 ENTRYies.Keys name: snumber, sname, status
|
||||||
|
* and city. Values of map are the parameters.
|
||||||
|
*
|
||||||
|
* @param snumber value of map
|
||||||
|
* @param sname value of map
|
||||||
|
* @param status value of map
|
||||||
|
* @param city value of map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static LinkedHashMap<String, String> createMapOfSupplier(
|
||||||
|
String snumber,
|
||||||
|
String sname,
|
||||||
|
String status,
|
||||||
|
String city
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LinkedHashMap<String, String> mapSupplier
|
||||||
|
= new LinkedHashMap<String, String>();
|
||||||
|
mapSupplier.put("snumber", snumber);
|
||||||
|
mapSupplier.put("sname", sname);
|
||||||
|
mapSupplier.put("status", status);
|
||||||
|
mapSupplier.put("city", city);
|
||||||
|
|
||||||
|
return mapSupplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSuppliersJsonObject(){
|
||||||
|
ArrayList< LinkedHashMap<String, String>> suppliers = new ArrayList();
|
||||||
|
for (int i = 1; i <= 2; ++i)
|
||||||
|
{
|
||||||
|
LinkedHashMap<String, String> oneSupplierRowOfTable
|
||||||
|
= createMapOfSupplier(
|
||||||
|
"s1" + i,
|
||||||
|
"Johnson" + i,
|
||||||
|
Integer.toString(20 + i),
|
||||||
|
"london" + i);
|
||||||
|
suppliers.add(oneSupplierRowOfTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject j = createJsonObjectForSuppliers(suppliers);
|
||||||
|
return j.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String a[]) {
|
||||||
|
ArrayList< LinkedHashMap<String, String>> suppliers = new ArrayList<>();
|
||||||
|
for (int i = 1; i <= 2; ++i)
|
||||||
|
{
|
||||||
|
LinkedHashMap<String, String> oneSupplierRowOfTable
|
||||||
|
= createMapOfSupplier(
|
||||||
|
"s1" + i,
|
||||||
|
"Johnson" + i,
|
||||||
|
Integer.toString(20 + i),
|
||||||
|
"london" + i);
|
||||||
|
suppliers.add(oneSupplierRowOfTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject j = createJsonObjectForSuppliers(suppliers);
|
||||||
|
|
||||||
|
StringWriter strWtr = new StringWriter();
|
||||||
|
JsonWriter jsonWtr = Json.createWriter(strWtr);
|
||||||
|
jsonWtr.writeObject(j);
|
||||||
|
String s = strWtr.toString();
|
||||||
|
System.out.println(s);
|
||||||
|
jsonWtr.close();
|
||||||
|
/*
|
||||||
|
JSONobj.readJASONdataUsingParser(strWtr.toString());
|
||||||
|
|
||||||
|
JsonObject o = createJsonObjectFromString(strWtr.toString());
|
||||||
|
System.out.println("------------------------------------------------");
|
||||||
|
JSONobj.writeObjectModelToStream(o);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
public static void writeJsonToTextFile(JsonObject jo) throws FileNotFoundException {
|
||||||
|
String jsonString = Jason.getJsonString(jo);
|
||||||
|
PrintWriter output = new PrintWriter(new FileOutputStream("jason.json", true));
|
||||||
|
output.print(jsonString);
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
public static JsonObject readFileIntoJson(String fileName) throws FileNotFoundException {
|
||||||
|
File file = new java.io.File(fileName);
|
||||||
|
Scanner input = new Scanner(file);
|
||||||
|
String joString = "";
|
||||||
|
while (!input.hasNext()) {
|
||||||
|
joString += input.next();
|
||||||
|
}
|
||||||
|
input.close();
|
||||||
|
JsonObject jo = createJsonObjectFromString(joString);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
26
Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/web.xml
Normal file
26
Semester 3/Assignments/Json1/src/main/webapp/WEB-INF/web.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="5.0" xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
21
Semester 3/Assignments/Json1/src/main/webapp/index.xhtml
Normal file
21
Semester 3/Assignments/Json1/src/main/webapp/index.xhtml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
<h:head>
|
||||||
|
<title>Facelet Title</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
#{jsonBean.s}
|
||||||
|
<br/><br/><br/>
|
||||||
|
#{jsonBean.getList()}
|
||||||
|
<br/><br/><br/>
|
||||||
|
#{jsonBean.fromWriter}
|
||||||
|
<br/><br/><br/>
|
||||||
|
#{jsonBean.fromParser}
|
||||||
|
<br/><br/><br/>
|
||||||
|
#{jsonBean.complexObject}
|
||||||
|
<br/><br/><br/>
|
||||||
|
#{jsonBean.suppliersObject}
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
@ -0,0 +1,120 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>asdv</groupId>
|
||||||
|
<artifactId>MP1_Ajax</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>MP1_Ajax-1</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>13.0.2</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>org.eclipse.persistence.core</artifactId>
|
||||||
|
<version>2.7.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>org.eclipse.persistence.asm</artifactId>
|
||||||
|
<version>9.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>org.eclipse.persistence.antlr</artifactId>
|
||||||
|
<version>2.7.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>org.eclipse.persistence.jpa</artifactId>
|
||||||
|
<version>2.7.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>org.eclipse.persistence.jpa.jpql</artifactId>
|
||||||
|
<version>2.7.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>org.eclipse.persistence.moxy</artifactId>
|
||||||
|
<version>2.7.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>jakarta.persistence</artifactId>
|
||||||
|
<version>2.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
<compilerArguments>
|
||||||
|
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||||
|
</compilerArguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||||
|
<silent>true</silent>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import asdv.mp1_ajax.pojos.Stock;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
public interface Dao<T>
|
||||||
|
{
|
||||||
|
void create(T t);
|
||||||
|
void edit(T t);
|
||||||
|
void remove(T t);
|
||||||
|
T find(Object id);
|
||||||
|
List<T> findAll();
|
||||||
|
List<T> findRange(int[] range);
|
||||||
|
int count();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
package asdv.mp1_ajax;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
|
||||||
|
*/
|
||||||
|
package asdv.mp1_ajax.pojos;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author A. V. Markou
|
||||||
|
* @param <Many1>
|
||||||
|
* @param <Many2>
|
||||||
|
*/
|
||||||
|
public interface ManyToMany<Many1, Many2>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates a Many to Many relationship between the parentLeft and the
|
||||||
|
* childrenRight. Example for ( Many1 a, Many2 1, 2, 3) it creates --> (a 1)
|
||||||
|
* ( a 2 ) ( a 3 ) and ( 1, a ), ( 2, a ), ( 3, a). No duplicate values of
|
||||||
|
* Many2 are allowed.
|
||||||
|
*
|
||||||
|
* @param parentLeft - exactly one Many1 object.
|
||||||
|
* @param childrenRight - one or more Many2 objects.
|
||||||
|
* @return the previous value associated with Many1, or null if there was no
|
||||||
|
* Many1 with the same "key".
|
||||||
|
* @throws ClassCastException - if the class of the specified Many1, or
|
||||||
|
* Many2 or value prevents it from being stored in this map( i,e Many1 is
|
||||||
|
* String and you pass an object)
|
||||||
|
* @throws NullPointerException - if the specified Many1 or Many2 is null
|
||||||
|
* and ManyToMany does not permit nulls as values.
|
||||||
|
* @throw IllegalArgumentException - if a duplicate exists in childrenRight
|
||||||
|
* list ( s1 --> p1,p2,p2 is not allowed).
|
||||||
|
* @return the previous value associated with parentLeft, or null if there
|
||||||
|
* was no childrenRight for parentLeft.
|
||||||
|
*/
|
||||||
|
List<Many2> add(Many1 parentLeft, Many2... childrenRight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the List of all left children of the parentRight.
|
||||||
|
*
|
||||||
|
* @param parentRight a parent at the RHS of the many to many relationship.
|
||||||
|
* @return the List of all left children of the parentRight.
|
||||||
|
* @throw IllegalArgumentException if the value of parameter parentRight
|
||||||
|
* does not exist in the RHS of the many to many relationship.
|
||||||
|
*/
|
||||||
|
List<Many1> getChildrenLeft(Many2 parentRight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the List of all right children of the parentLeft.
|
||||||
|
*
|
||||||
|
* @param parentLeft a parent at the LHS of the many to many relationship.
|
||||||
|
* @return the List of all right children of the parentLeft.
|
||||||
|
* @throws IllegalArgumentException if the value of parameter parentLeft
|
||||||
|
* does not exist on the LHS of the many to many relationship.
|
||||||
|
*/
|
||||||
|
List<Many2> getChildrenRight(Many1 parentLeft);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a set of the Many1 elements that exist on the LHS of the many to
|
||||||
|
* many relationship.
|
||||||
|
*
|
||||||
|
* @return Set of Many1
|
||||||
|
*/
|
||||||
|
Set<Many1> getParentsLeft();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a set of the Many2 elements that exist on the RHS of the many to
|
||||||
|
* many relationship.
|
||||||
|
*
|
||||||
|
* @return Set of Many2
|
||||||
|
*/
|
||||||
|
Set<Many2> getParentsRight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the many1 parameter from the LHS of the many relationship AND all
|
||||||
|
* its corresponding values that exist in the RHS of the many to many
|
||||||
|
* relationship. For example given: ( LHS e1: p1, p2 e2: p2, p3 RHS: p1: e1
|
||||||
|
* p2: e1, e2 p3: e2 after removing e1 from the LHS will results into: ( LHS
|
||||||
|
* e2: p2, p3 RHS: p2: e2 p3: e2
|
||||||
|
*
|
||||||
|
* @param many1 the unique element on the LHS to be removed.
|
||||||
|
* @throws NullPointerException if parameter many1 is null.
|
||||||
|
* @return true if the removal occurred, false if many1 does not exist in
|
||||||
|
* the LHS of the many to many relationship.
|
||||||
|
*/
|
||||||
|
boolean removeLeft(Many1 many1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the many1 parameter from the RHS of the many relationship AND all
|
||||||
|
* its corresponding values that exist in the LHS of the many to many
|
||||||
|
* relationship. For example given: LHS e2: p2, p3 RHS: p2: e2 p3: e2 after
|
||||||
|
* removing p2 from the RHS will results into: LHS e2: p3 RHS p3: e2
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param many2 the unique element on the LHS to be removed.
|
||||||
|
* @throws NullPointerException if parameter many1 is null.
|
||||||
|
* @return true if the removal occurred, false if many1 does not exist in
|
||||||
|
* the LHS of the many to many relationship.
|
||||||
|
*/
|
||||||
|
boolean removeRight(Many2 many2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears all.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void clear();
|
||||||
|
}
|
@ -0,0 +1,212 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package asdv.mp1_ajax.pojos;
|
||||||
|
|
||||||
|
import asdv.mp1_ajax.pojos.ManyToMany;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
public class ManyToManyFactory1
|
||||||
|
{
|
||||||
|
public static <Many1, Many2> //generic types to be used in the method
|
||||||
|
ManyToMany< Many1, Many2>//return type
|
||||||
|
createManyToMany()
|
||||||
|
{
|
||||||
|
return new ManyToMany<Many1, Many2>()
|
||||||
|
{
|
||||||
|
|
||||||
|
private Map<Object, Object> left = new HashMap();
|
||||||
|
private Map<Object, Object> right = new HashMap();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "{" + "left=" + left + ", right=" + right + '}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Many2> add(Many1 parentLeft, Many2... childrenRight)
|
||||||
|
{
|
||||||
|
if (parentLeft==null || childrenRight==null || getParentsLeft().contains(parentLeft)) {
|
||||||
|
throw new IllegalArgumentException("Invalid input: null arguments or duplicate parent");
|
||||||
|
}
|
||||||
|
|
||||||
|
left.put(parentLeft, Arrays.asList(childrenRight));
|
||||||
|
|
||||||
|
for(Many2 parentRight : childrenRight)
|
||||||
|
{
|
||||||
|
|
||||||
|
right.put(parentRight, Arrays.asList(parentLeft));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return Arrays.asList(childrenRight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Many1> getChildrenLeft(Many2 parentRight)
|
||||||
|
{
|
||||||
|
if(right.get(parentRight)==null)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(parentRight+" is not a valid R parent");
|
||||||
|
}
|
||||||
|
return (List<Many1>) right.get(parentRight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Many2> getChildrenRight(Many1 parentLeft)
|
||||||
|
{
|
||||||
|
if(left.get(parentLeft)==null)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(parentLeft+" is not a valid L parent");
|
||||||
|
}
|
||||||
|
return (List<Many2>)left.get(parentLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Many1> getParentsLeft()
|
||||||
|
{
|
||||||
|
return (Set<Many1>) left.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Many2> getParentsRight()
|
||||||
|
{
|
||||||
|
return (Set<Many2>) right.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeLeft(Many1 many1)
|
||||||
|
{
|
||||||
|
if(!getParentsLeft().contains(many1))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
left.remove(many1);
|
||||||
|
for(Many2 parentRight : getParentsRight())
|
||||||
|
{
|
||||||
|
right.remove(parentRight, many1);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeRight(Many2 many2)
|
||||||
|
{
|
||||||
|
if(!getParentsRight().contains(many2))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
right.remove(many2);
|
||||||
|
for(Many1 parentLeft : getParentsLeft())
|
||||||
|
{
|
||||||
|
left.remove(parentLeft, many2);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
left.clear();
|
||||||
|
right.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws InterruptedException
|
||||||
|
{
|
||||||
|
ManyToMany<String, String> mm = ManyToManyFactory1.createManyToMany();
|
||||||
|
//mm.add(1, 1);///will not compile, we have Many1, Many2 as String
|
||||||
|
System.out.println("add(e1, p1, p2)returns: " + mm.add("e1", "p1", "p2"));
|
||||||
|
System.out.println("add(e2, p2, p3)returns: " + mm.add("e2", "p2", "p3"));
|
||||||
|
System.out.println("getParentsLeft returns: " + mm.getParentsLeft());
|
||||||
|
System.out.println("getParentsRight returns: " + mm.getParentsRight());
|
||||||
|
System.out.println("getChildrenLeft(p2) returns: " + mm.getChildrenLeft("p2"));
|
||||||
|
System.out.println("getChildrenLeft(p3) returns: " + mm.getChildrenLeft("p3"));
|
||||||
|
System.out.println("getChildrenRight(e1) returns: " + mm.getChildrenRight("e1"));
|
||||||
|
System.out.println("getChildrenRight(e2) returns: " + mm.getChildrenRight("e2"));
|
||||||
|
System.out.println("-----------------------------------------------");
|
||||||
|
System.out.println("The internal hash maps of ManyToMany after insertions: " + mm);
|
||||||
|
|
||||||
|
System.out.println("----------AFTER REMOVAL of e1 LEFT----------------------------------------");
|
||||||
|
System.out.println("removeLeft(e1) returns: " + mm.removeLeft("e1"));
|
||||||
|
System.out.println("getParentsLeft returns: " + mm.getParentsLeft());
|
||||||
|
System.out.println("getParentsRight returns: " + mm.getParentsRight());
|
||||||
|
System.out.println("getChildrenRight(e2) returns: " + mm.getChildrenRight("e2"));
|
||||||
|
System.out.println("getChildrenLeft(p2) returns: " + mm.getChildrenLeft("p2"));
|
||||||
|
System.out.println("getChildrenLeft(p3) returns: " + mm.getChildrenLeft("p3"));
|
||||||
|
System.out.println("The internal hash maps of ManyToMany after removal LEFT: " + mm);
|
||||||
|
|
||||||
|
System.out.println("\n----------AFTER REMOVAL of p2 RIGHT----------------------------------------");
|
||||||
|
System.out.println("removeRight(p2) returns: " + mm.removeRight("p2"));
|
||||||
|
System.out.println("getParentsLeft returns: " + mm.getParentsLeft());
|
||||||
|
System.out.println("getParentsRight returns: " + mm.getParentsRight());
|
||||||
|
System.out.println("getChildrenRight(e2) returns: " + mm.getChildrenRight("e2"));
|
||||||
|
System.out.println("getChildrenLeft(p3) returns: " + mm.getChildrenLeft("p3"));
|
||||||
|
System.out.println("--------------------------------------------------");
|
||||||
|
System.out.println("mm.removeLeft(e1) returns: " + mm.removeLeft("e1"));
|
||||||
|
|
||||||
|
System.out.println("The internal hash maps of ManyToMany after removal RIGHT: " + mm);
|
||||||
|
Thread.sleep(5000, 0);
|
||||||
|
|
||||||
|
System.out.println("---------------CATCHING EXCEPTIONS -----------------------------------");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mm.getChildrenRight("e10");//e10 dos not exist
|
||||||
|
}
|
||||||
|
catch (RuntimeException e)
|
||||||
|
{
|
||||||
|
System.err.println("getChildrenRight for e10 throws exception:" + e);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.out.println(mm.add("e6", new String[]
|
||||||
|
{
|
||||||
|
"value1", null
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
catch (RuntimeException e)
|
||||||
|
{
|
||||||
|
System.err.println("add(e6, new String[]{null } ) throws exception: " + e);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.out.println(mm.add(null, "p1"));
|
||||||
|
}
|
||||||
|
catch (RuntimeException e)
|
||||||
|
{
|
||||||
|
System.err.println("add(null, p1)returns throws exception: " + e);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.out.println(mm.getChildrenRight("p1"));
|
||||||
|
}
|
||||||
|
catch (RuntimeException e)
|
||||||
|
{
|
||||||
|
System.err.println("getChildrenRight(p1) throws exception: " + e);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mm.add((String) new Object(), (String) new Object());
|
||||||
|
}
|
||||||
|
catch (RuntimeException e)
|
||||||
|
{
|
||||||
|
System.err.println("add((String) new Object(), (String) new Object()) throws exception: " + e);
|
||||||
|
}
|
||||||
|
mm.clear();
|
||||||
|
System.out.println("-----------------------------------------------");
|
||||||
|
System.out.println("The internal hash maps of ManyToMany after clear: " + mm);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,147 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package asdv.mp1_ajax.pojos;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
|
public class Stock implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String stockId;
|
||||||
|
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
private double priceCurrent;
|
||||||
|
|
||||||
|
private double priceClosing;
|
||||||
|
|
||||||
|
private long numberOfSharesAvailable;
|
||||||
|
|
||||||
|
private long numberOfSharesSold;
|
||||||
|
private Collection<Transactions> transactionsCollection;
|
||||||
|
|
||||||
|
public Stock()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stock(String stockId)
|
||||||
|
{
|
||||||
|
this.stockId = stockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stock(String stockId, String companyName, double priceCurrent, double priceClosing, long numberOfSharesAvailable, long numberOfSharesSold)
|
||||||
|
{
|
||||||
|
this.stockId = stockId;
|
||||||
|
this.companyName = companyName;
|
||||||
|
this.priceCurrent = priceCurrent;
|
||||||
|
this.priceClosing = priceClosing;
|
||||||
|
this.numberOfSharesAvailable = numberOfSharesAvailable;
|
||||||
|
this.numberOfSharesSold = numberOfSharesSold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStockId()
|
||||||
|
{
|
||||||
|
return stockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockId(String stockId)
|
||||||
|
{
|
||||||
|
this.stockId = stockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompanyName()
|
||||||
|
{
|
||||||
|
return companyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanyName(String companyName)
|
||||||
|
{
|
||||||
|
this.companyName = companyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPriceCurrent()
|
||||||
|
{
|
||||||
|
return priceCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceCurrent(double priceCurrent)
|
||||||
|
{
|
||||||
|
this.priceCurrent = priceCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPriceClosing()
|
||||||
|
{
|
||||||
|
return priceClosing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceClosing(double priceClosing)
|
||||||
|
{
|
||||||
|
this.priceClosing = priceClosing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNumberOfSharesAvailable()
|
||||||
|
{
|
||||||
|
return numberOfSharesAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumberOfSharesAvailable(long numberOfSharesAvailable)
|
||||||
|
{
|
||||||
|
this.numberOfSharesAvailable = numberOfSharesAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNumberOfSharesSold()
|
||||||
|
{
|
||||||
|
return numberOfSharesSold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumberOfSharesSold(long numberOfSharesSold)
|
||||||
|
{
|
||||||
|
this.numberOfSharesSold = numberOfSharesSold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<Transactions> getTransactionsCollection()
|
||||||
|
{
|
||||||
|
return transactionsCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionsCollection(Collection<Transactions> transactionsCollection)
|
||||||
|
{
|
||||||
|
this.transactionsCollection = transactionsCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
int hash = 0;
|
||||||
|
hash += (stockId != null ? stockId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object)
|
||||||
|
{
|
||||||
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
|
if (!(object instanceof Stock))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Stock other = (Stock) object;
|
||||||
|
if ((this.stockId == null && other.stockId != null) || (this.stockId != null && !this.stockId.equals(other.stockId)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "asdv.mp1_ajax.entities.Stock[ stockId=" + stockId + " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package asdv.mp1_ajax.pojos;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class StockHolder implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer stockHolderId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
//cascade
|
||||||
|
private Collection<Transactions> transactionsCollection;
|
||||||
|
|
||||||
|
public StockHolder()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public StockHolder(Integer stockHolderId)
|
||||||
|
{
|
||||||
|
this.stockHolderId = stockHolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StockHolder(Integer stockHolderId, String name)
|
||||||
|
{
|
||||||
|
this.stockHolderId = stockHolderId;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStockHolderId()
|
||||||
|
{
|
||||||
|
return stockHolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockHolderId(Integer stockHolderId)
|
||||||
|
{
|
||||||
|
this.stockHolderId = stockHolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<Transactions> getTransactionsCollection()
|
||||||
|
{
|
||||||
|
return transactionsCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionsCollection(Collection<Transactions> transactionsCollection)
|
||||||
|
{
|
||||||
|
this.transactionsCollection = transactionsCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
int hash = 0;
|
||||||
|
hash += (stockHolderId != null ? stockHolderId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object)
|
||||||
|
{
|
||||||
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
|
if (!(object instanceof StockHolder))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
StockHolder other = (StockHolder) object;
|
||||||
|
if ((this.stockHolderId == null && other.stockHolderId != null) || (this.stockHolderId != null && !this.stockHolderId.equals(other.stockHolderId)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "asdv.mp1_ajax.entities.StockHolder[ stockHolderId=" + stockHolderId + " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package asdv.mp1_ajax.pojos;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class Transactions implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected TransactionsPK transactionsPK;
|
||||||
|
|
||||||
|
private int qty;
|
||||||
|
|
||||||
|
private Stock stock;
|
||||||
|
|
||||||
|
private StockHolder stockHolder;
|
||||||
|
|
||||||
|
public Transactions()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Transactions(TransactionsPK transactionsPK)
|
||||||
|
{
|
||||||
|
this.transactionsPK = transactionsPK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Transactions(TransactionsPK transactionsPK, int qty)
|
||||||
|
{
|
||||||
|
this.transactionsPK = transactionsPK;
|
||||||
|
this.qty = qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Transactions(int stockHolderId, String stockId)
|
||||||
|
{
|
||||||
|
this.transactionsPK = new TransactionsPK(stockHolderId, stockId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionsPK getTransactionsPK()
|
||||||
|
{
|
||||||
|
return transactionsPK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionsPK(TransactionsPK transactionsPK)
|
||||||
|
{
|
||||||
|
this.transactionsPK = transactionsPK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getQty()
|
||||||
|
{
|
||||||
|
return qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQty(int qty)
|
||||||
|
{
|
||||||
|
this.qty = qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stock getStock()
|
||||||
|
{
|
||||||
|
return stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStock(Stock stock)
|
||||||
|
{
|
||||||
|
this.stock = stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StockHolder getStockHolder()
|
||||||
|
{
|
||||||
|
return stockHolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockHolder(StockHolder stockHolder)
|
||||||
|
{
|
||||||
|
this.stockHolder = stockHolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
int hash = 0;
|
||||||
|
hash += (transactionsPK != null ? transactionsPK.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object)
|
||||||
|
{
|
||||||
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
|
if (!(object instanceof Transactions))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Transactions other = (Transactions) object;
|
||||||
|
if ((this.transactionsPK == null && other.transactionsPK != null) || (this.transactionsPK != null && !this.transactionsPK.equals(other.transactionsPK)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "asdv.mp1_ajax.entities.Transactions[ transactionsPK=" + transactionsPK + " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package asdv.mp1_ajax.pojos;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
@Embeddable
|
||||||
|
public class TransactionsPK implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
private int stockHolderId;
|
||||||
|
|
||||||
|
private String stockId;
|
||||||
|
|
||||||
|
public TransactionsPK()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionsPK(int stockHolderId, String stockId)
|
||||||
|
{
|
||||||
|
this.stockHolderId = stockHolderId;
|
||||||
|
this.stockId = stockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStockHolderId()
|
||||||
|
{
|
||||||
|
return stockHolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockHolderId(int stockHolderId)
|
||||||
|
{
|
||||||
|
this.stockHolderId = stockHolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStockId()
|
||||||
|
{
|
||||||
|
return stockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockId(String stockId)
|
||||||
|
{
|
||||||
|
this.stockId = stockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
int hash = 0;
|
||||||
|
hash += (int) stockHolderId;
|
||||||
|
hash += (stockId != null ? stockId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object)
|
||||||
|
{
|
||||||
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
|
if (!(object instanceof TransactionsPK))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
TransactionsPK other = (TransactionsPK) object;
|
||||||
|
if (this.stockHolderId != other.stockHolderId)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.stockId == null && other.stockId != null) || (this.stockId != null && !this.stockId.equals(other.stockId)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "asdv.mp1_ajax.entities.TransactionsPK[ stockHolderId=" + stockHolderId + ", stockId=" + stockId + " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package asdv.mp1_ajax.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import edu.slcc.ajax.bl.StockDB;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
@Named(value="stockBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class StockBean implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
StockDB stocks;
|
||||||
|
/** Creates a new instance of StockBean */
|
||||||
|
public StockBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public StockDB getStocks()
|
||||||
|
{
|
||||||
|
return stocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.ajax.bl;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface Dao<T>
|
||||||
|
{
|
||||||
|
void create(T t);
|
||||||
|
|
||||||
|
void edit(T t);
|
||||||
|
|
||||||
|
void remove(T t);
|
||||||
|
|
||||||
|
T find(Object id) ;
|
||||||
|
|
||||||
|
|
||||||
|
List<T> findAll()
|
||||||
|
throws SQLException;;
|
||||||
|
|
||||||
|
List<T> findRange(int[] range);
|
||||||
|
|
||||||
|
int count();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
|
||||||
|
package edu.slcc.ajax.bl;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ASDV2
|
||||||
|
*/
|
||||||
|
public interface Database
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Connection to a database or null if no connection is done.
|
||||||
|
*
|
||||||
|
* @param databaseName name
|
||||||
|
* @param userName database user name
|
||||||
|
* @param password database password
|
||||||
|
* @param driver driver that connects us to database
|
||||||
|
* @return Connection the connection to database or null if no connection
|
||||||
|
*/
|
||||||
|
public Connection getConnection(String databaseName, String userName, String password, String driver);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the projected columns of a table where the AND condition of the
|
||||||
|
* WHERE clause is true.
|
||||||
|
*
|
||||||
|
* @param tableName table name
|
||||||
|
* @param projectionFields fields if SELECT clause ( projected columns)
|
||||||
|
* @param whereFieldsNValues fields in WHERE clause, key is the field name(
|
||||||
|
* LHS ) and value of the field ( RHS ). For example snumber = 's1', status
|
||||||
|
* > "10".
|
||||||
|
* @param operators the operators that apply to whereFieldsNValues. They are
|
||||||
|
* positioned between the LHS and the RHS of the whereFieldsNValues
|
||||||
|
* parameter. The operators are always the same size as the
|
||||||
|
* whereFieldsNValues. That is,the first operator applies to the first entry
|
||||||
|
* of the map, the second operator to the 2nd entry and so on.
|
||||||
|
* @return the projected columns of a table, after the WHERE clause applies
|
||||||
|
* by ANDing all entries of the map ( whereFieldsNValues). If an SQL
|
||||||
|
* exception is thrown return NULL if an error ( exception occurs).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public List<String> selectFieldsFromTableWhereFields(String tableName,
|
||||||
|
List<String> projectionFields,
|
||||||
|
Map<String, String> whereFieldsNValues,
|
||||||
|
List<String> operators
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of all rows of the table "tableName"
|
||||||
|
*
|
||||||
|
* @param tableName the name of the table to return
|
||||||
|
* @return a list with all rows in the the table.
|
||||||
|
*/
|
||||||
|
public List<String> selectAllFromTable(String tableName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the table exists in the database, false otherwise
|
||||||
|
*
|
||||||
|
* @param tableName the name of the table
|
||||||
|
* @return true if the table exists in the database, false otherwise
|
||||||
|
*/
|
||||||
|
boolean isTable(String tableName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes a connection
|
||||||
|
*
|
||||||
|
* @param c the connection to close
|
||||||
|
*/
|
||||||
|
public void closeConnection(Connection c);
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.ajax.bl;
|
||||||
|
|
||||||
|
|
||||||
|
import asdv.mp1_ajax.pojos.Stock;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
public class StockDB
|
||||||
|
implements Dao<Stock>, Serializable
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public List<Stock> findAll()
|
||||||
|
throws SQLException
|
||||||
|
{
|
||||||
|
// test exception code
|
||||||
|
//if ( true)
|
||||||
|
// throw new SQLException();
|
||||||
|
|
||||||
|
List<Stock> tableStocks = new ArrayList<Stock>();
|
||||||
|
String databaseName = "nyse";
|
||||||
|
String userName = "root";
|
||||||
|
String password = "root";
|
||||||
|
String URL2 = "com.mysql.jdbc.Driver";
|
||||||
|
Connection con = new UtilitiesDatabase().connection(
|
||||||
|
databaseName, userName, password, URL2);
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (con == null)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("cannot connect to database");
|
||||||
|
}
|
||||||
|
String table = "";
|
||||||
|
ResultSet rs = null;
|
||||||
|
String sqlStr = "SELECT * FROM stock";
|
||||||
|
//prepare statement
|
||||||
|
ps = con.prepareStatement(sqlStr);
|
||||||
|
//execute
|
||||||
|
rs = ps.executeQuery();
|
||||||
|
while (rs.next())
|
||||||
|
{
|
||||||
|
String stockId = rs.getString(1);
|
||||||
|
String companyName = rs.getString(2);
|
||||||
|
double priceCurrent = rs.getDouble(3);
|
||||||
|
double priceClosing = rs.getDouble(4);
|
||||||
|
long numberOfSharesAvailable = rs.getLong(5);
|
||||||
|
long numberOfSharesSold = rs.getLong(6);
|
||||||
|
Stock stock = new Stock(stockId, companyName, priceCurrent, priceClosing, numberOfSharesAvailable, numberOfSharesSold);
|
||||||
|
tableStocks.add(stock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new UtilitiesDatabase().closeDatabaseConnection(con);
|
||||||
|
// close the resources
|
||||||
|
if (ps != null)
|
||||||
|
{
|
||||||
|
ps.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException sqle)
|
||||||
|
{
|
||||||
|
System.out.println(sqle);
|
||||||
|
sqle.printStackTrace();
|
||||||
|
throw sqle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tableStocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(Stock t)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void edit(Stock t)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Stock t)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stock find(Object id)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Stock> findRange(int[] range)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int count()
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.ajax.bl;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
public class UtilitiesDatabase
|
||||||
|
{
|
||||||
|
public Connection connection(
|
||||||
|
String databaseName,
|
||||||
|
String userName,
|
||||||
|
String password,
|
||||||
|
String URL2
|
||||||
|
|
||||||
|
) //throws InstantiationException, IllegalAccessException
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
String databaseName = "suppliers_parts_23";
|
||||||
|
String userName = "root";
|
||||||
|
String password = "root";
|
||||||
|
String URL2 = "com.mysql.jdbc.Driver";
|
||||||
|
Connection con = null;
|
||||||
|
*/
|
||||||
|
Connection con;
|
||||||
|
try
|
||||||
|
{// Load Sun's jdbc driver
|
||||||
|
Class.forName(URL2).newInstance();
|
||||||
|
System.out.println("JDBC Driver loaded!");
|
||||||
|
}
|
||||||
|
catch (Exception e) // driver not found
|
||||||
|
{
|
||||||
|
System.err.println("Unable to load database driver");
|
||||||
|
System.err.println("Details : " + e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String ip = "localhost"; //internet connection
|
||||||
|
String url = "jdbc:mysql://" + ip + ":8889/" + databaseName + "?useSSL=false";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
con = DriverManager.getConnection(url, userName, password);
|
||||||
|
con.setReadOnly(false);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.err.println(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
System.out.println("connection successfull");
|
||||||
|
return con;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void closeDatabaseConnection( Connection con)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (con != null)
|
||||||
|
{
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
System.out.println(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static java.sql.Date stringDateToSqlDate(String sDate)
|
||||||
|
{
|
||||||
|
java.util.Date date = null;
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
date = sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
catch (ParseException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return new java.sql.Date( date.getTime() );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static java.util.Date stringDateToJavaUtilitiesDate(String sDate)
|
||||||
|
{
|
||||||
|
java.sql.Date sqldate = stringDateToSqlDate(sDate);
|
||||||
|
return new java.util.Date(sqldate.getTime() );
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<persistence-unit name="asdv_MP1_Ajax_war_1PU" transaction-type="JTA">
|
||||||
|
<jta-data-source>java:app/nyse</jta-data-source>
|
||||||
|
<exclude-unlisted-classes>false</exclude-unlisted-classes>
|
||||||
|
<properties/>
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
|
||||||
|
<resources>
|
||||||
|
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="mysql_nyse_rootPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
|
||||||
|
<property name="serverName" value="localhost"/>
|
||||||
|
<property name="portNumber" value="8889"/>
|
||||||
|
<property name="databaseName" value="nyse"/>
|
||||||
|
<property name="User" value="root"/>
|
||||||
|
<property name="Password" value="root"/>
|
||||||
|
<property name="URL" value="jdbc:mysql://localhost:8889/nyse?zeroDateTimeBehavior=CONVERT_TO_NULL"/>
|
||||||
|
<property name="driverClass" value="com.mysql.cj.jdbc.Driver"/>
|
||||||
|
</jdbc-connection-pool>
|
||||||
|
<jdbc-resource enabled="true" jndi-name="java:app/nyse" object-type="user" pool-name="mysql_nyse_rootPool"/>
|
||||||
|
<jdbc-resource enabled="true" jndi-name="java:app/nyse1" object-type="user" pool-name="mysql_nyse_rootPool"/>
|
||||||
|
</resources>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:f5="http://xmlns.jcp.org/jsf/passthrough">
|
||||||
|
<h:head>
|
||||||
|
<title>MP1 Ajax</title>
|
||||||
|
<h:outputStylesheet library="css" name="styles.css"/>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form>
|
||||||
|
<p:dataTable id= "id_dataTable1" value ="#{stockBean.getStocks().findAll() }"
|
||||||
|
style="width: 100%; "
|
||||||
|
|
||||||
|
var="stock"
|
||||||
|
|
||||||
|
scrollable="true"
|
||||||
|
paginator="true"
|
||||||
|
rowHover ="true"
|
||||||
|
paginatorPosition="bottom"
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p:column headerText="Stock ID" >
|
||||||
|
<p:outputLabel title= "Stock ID" value="#{stock.stockId}" />
|
||||||
|
</p:column >
|
||||||
|
<p:column headerText="Stock Name" >
|
||||||
|
<p:outputLabel title= "Stock Name" value="#{stock.companyName}" />
|
||||||
|
</p:column >
|
||||||
|
<p:column headerText="Current Price" >
|
||||||
|
<p:outputLabel title= "Current Price" value="#{stock.priceCurrent}" />
|
||||||
|
</p:column >
|
||||||
|
<p:column headerText="Closing Price" >
|
||||||
|
<p:outputLabel title= "Closing Price" value="#{stock.priceClosing}" />
|
||||||
|
</p:column >
|
||||||
|
<p:column headerText="Shares Avialable" >
|
||||||
|
<p:outputLabel title= "Shares Avialable" value="#{stock.numberOfSharesAvailable}" />
|
||||||
|
</p:column >
|
||||||
|
<p:column headerText="Shares Sold" >
|
||||||
|
<p:outputLabel title= "Shares Sold" value="#{stock.numberOfSharesSold}" />
|
||||||
|
</p:column >
|
||||||
|
|
||||||
|
</p:dataTable>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
Binary file not shown.
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Created on : Jan 13, 2024, 9:50:00 AM
|
||||||
|
Author : asdv5
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
.grandParent{
|
||||||
|
margin:0 auto;
|
||||||
|
float:left;
|
||||||
|
min-width:100px;
|
||||||
|
max-width:120px;
|
||||||
|
height:150px;
|
||||||
|
position:relative;
|
||||||
|
border-left: 1px solid #000000;
|
||||||
|
border-right: 1px solid #000000;
|
||||||
|
background:#cccccc;
|
||||||
|
font-size:11px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.theColumn{
|
||||||
|
width:100%;
|
||||||
|
|
||||||
|
padding: 20px;
|
||||||
|
background-color: blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.elementsOfTheColumn{
|
||||||
|
width:60%;
|
||||||
|
margin-left: 10px;
|
||||||
|
display:inline-table;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.elementsOfTheColumnButton{
|
||||||
|
width:30%;
|
||||||
|
margin-left: 10px;
|
||||||
|
display:inline-table;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ Any value defined here will override the pom.xml file value but is only applicab
|
|||||||
-->
|
-->
|
||||||
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
<org-netbeans-modules-projectapi.jsf_2e_language>JSP</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
</properties>
|
</properties>
|
||||||
</project-shared-configuration>
|
</project-shared-configuration>
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_11__System_</netbeans.hint.jdkPlatform>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
48
Semester 3/Assignments/TermProject2_CalebFontenot/pom.xml
Normal file
48
Semester 3/Assignments/TermProject2_CalebFontenot/pom.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>edu.slcc.asdv.caleb</groupId>
|
||||||
|
<artifactId>TermProject1_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>TermProject1_CalebFontenot-1.0-SNAPSHOT</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>13.0.5</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.faces.view.ViewScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author A. V. Markou
|
||||||
|
*/
|
||||||
|
@Named(value = "matrixBeanA")
|
||||||
|
@ViewScoped
|
||||||
|
public class MatrixBeanA implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> matrix = new ArrayList<ArrayList<String>>();
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> getMatrix()
|
||||||
|
{
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatrixA(ArrayList<ArrayList<String>> matrix)
|
||||||
|
{
|
||||||
|
this.matrix = matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeRowsColumns() {
|
||||||
|
// String componentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.faces.view.ViewScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import org.primefaces.PrimeFaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author A. V. Markou
|
||||||
|
*/
|
||||||
|
@Named(value = "matrixBeanB")
|
||||||
|
@ViewScoped
|
||||||
|
public class MatrixBeanB implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> matrix = new ArrayList<ArrayList<String>>();
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> getMatrix()
|
||||||
|
{
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatrixB(ArrayList<ArrayList<String>> matrix)
|
||||||
|
{
|
||||||
|
this.matrix = matrix;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.faces.view.ViewScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author A. V. Markou
|
||||||
|
*/
|
||||||
|
@Named(value = "matrixBeanC")
|
||||||
|
@ViewScoped
|
||||||
|
public class MatrixBeanC implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> matrix = new ArrayList<ArrayList<String>>();
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> getMatrix()
|
||||||
|
{
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
public void setMatrixC(ArrayList<ArrayList<String>> matrix)
|
||||||
|
{
|
||||||
|
this.matrix = matrix;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.faces.view.ViewScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author A. V. Markou
|
||||||
|
*/
|
||||||
|
@Named(value = "matrixOperations")
|
||||||
|
@ViewScoped
|
||||||
|
public class MatrixOperations implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MatrixBeanA matrixA;
|
||||||
|
@Inject
|
||||||
|
MatrixBeanB matrixB;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MatrixBeanC matrixC;
|
||||||
|
|
||||||
|
public String add() {
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> a = matrixA.getMatrix();
|
||||||
|
ArrayList<ArrayList<String>> b = matrixB.getMatrix();
|
||||||
|
ArrayList<ArrayList<String>> c = new ArrayList<ArrayList<String>>();
|
||||||
|
|
||||||
|
for ( int i=0; i < a.size(); ++i)
|
||||||
|
{
|
||||||
|
ArrayList<String> row = new ArrayList<>();
|
||||||
|
for ( int j=0; j < a.size(); ++j)
|
||||||
|
{
|
||||||
|
Integer result = Integer.parseInt ( a.get(i).get(j))
|
||||||
|
+
|
||||||
|
Integer.parseInt ( b.get(i).get(j));
|
||||||
|
|
||||||
|
row.add( result.toString() );
|
||||||
|
}
|
||||||
|
c.add(row);
|
||||||
|
System.out.println(row);
|
||||||
|
}
|
||||||
|
matrixC.setMatrixC( c );
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String multiply(){return "";}
|
||||||
|
|
||||||
|
|
||||||
|
public MatrixBeanC getMatrixC(){return this.matrixC;}
|
||||||
|
|
||||||
|
public MatrixBeanA getMatrixA(){return matrixA;}
|
||||||
|
|
||||||
|
public MatrixBeanB getMatrixB(){return matrixB;}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot.beans;
|
||||||
|
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.application.FacesMessage.Severity;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.faces.view.ViewScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.primefaces.PrimeFaces;
|
||||||
|
|
||||||
|
@Named(value = "menuBar")
|
||||||
|
@ViewScoped
|
||||||
|
public class MenuBar implements Serializable
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
MatrixOperations matrixOperations;
|
||||||
|
private List<List<Object>> menus = new ArrayList<List<Object>>();
|
||||||
|
|
||||||
|
public void add()
|
||||||
|
{
|
||||||
|
System.out.println("Menu multiply was called");
|
||||||
|
matrixOperations.multiply();
|
||||||
|
List<String> idsC = new ArrayList<>();
|
||||||
|
idsC.add("formC");
|
||||||
|
idsC.add("formC:datatableC");
|
||||||
|
idsC.add("formC:datatableC:columnsC");
|
||||||
|
idsC.add("formC:datatableC:columnsC:inputTextC");
|
||||||
|
//idsC.add("form-menu");//:menuBar:submenu_matricies:menuitem_add");
|
||||||
|
PrimeFaces.current().ajax().update(idsC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void multiply()
|
||||||
|
{
|
||||||
|
message(
|
||||||
|
FacesMessage.SEVERITY_INFO,
|
||||||
|
"Not implemented.", "To be implemented."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void subtract()
|
||||||
|
{
|
||||||
|
message(
|
||||||
|
FacesMessage.SEVERITY_INFO,
|
||||||
|
"Not implemented.", "To be implemented."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void message(Severity severity, String msg, String msgDetails)
|
||||||
|
{
|
||||||
|
FacesMessage m = new FacesMessage(severity, msg, msgDetails);
|
||||||
|
FacesContext.getCurrentInstance().addMessage("msg", m);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,261 @@
|
|||||||
|
package edu.slcc.asdv.bl;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ForkJoinPool;
|
||||||
|
import java.util.concurrent.RecursiveTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author A. V. Markou
|
||||||
|
*/
|
||||||
|
public class Matrices implements Matrix
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<ArrayList<BigInteger>> addParallel(ArrayList<ArrayList<BigInteger>> A, ArrayList<ArrayList<BigInteger>> B)
|
||||||
|
{
|
||||||
|
RecursiveTask<ArrayList<ArrayList<BigInteger>>> rt
|
||||||
|
= new Matrices.MatricesAddition(0, A.size() - 1, A, B);
|
||||||
|
ForkJoinPool pool = new ForkJoinPool();
|
||||||
|
ArrayList<ArrayList<BigInteger>> result = pool.invoke(rt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<ArrayList<BigInteger>> multiplyParallel(ArrayList<ArrayList<BigInteger>> A, ArrayList<ArrayList<BigInteger>> B)
|
||||||
|
{
|
||||||
|
RecursiveTask<ArrayList<ArrayList<BigInteger>>> rt
|
||||||
|
= new Matrices.MatricesMultiplication(0, A.size() - 1, A, B);
|
||||||
|
ForkJoinPool pool = new ForkJoinPool();
|
||||||
|
ArrayList<ArrayList<BigInteger>> result = pool.invoke(rt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static class MatricesAddition extends RecursiveTask<ArrayList<ArrayList<BigInteger>>>
|
||||||
|
{
|
||||||
|
|
||||||
|
ArrayList<ArrayList<BigInteger>> A;
|
||||||
|
ArrayList<ArrayList<BigInteger>> B;
|
||||||
|
ArrayList<ArrayList<BigInteger>> AplusB;
|
||||||
|
final int HOW_MANY_ROWS_IN_PARALLEL = 100;//threshold
|
||||||
|
int startIndex;
|
||||||
|
int endIndex;
|
||||||
|
|
||||||
|
public MatricesAddition(int startIndex, int endIndex,
|
||||||
|
ArrayList<ArrayList<BigInteger>> A,
|
||||||
|
ArrayList<ArrayList<BigInteger>> B)
|
||||||
|
{
|
||||||
|
this.startIndex = startIndex;//start at this row of the matrix
|
||||||
|
this.endIndex = endIndex;//end at this row of the matrix
|
||||||
|
this.A = A;
|
||||||
|
this.B = B;
|
||||||
|
AplusB = new ArrayList<ArrayList<BigInteger>>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ArrayList<ArrayList<BigInteger>> compute()
|
||||||
|
{
|
||||||
|
//>>This is the addition of matrices in the IF.
|
||||||
|
//That is, HOW_MANY_ROWS_IN_PARALLEL from matrix A and HOW_MANY_ROWS_IN_PARALLEL from matrix B
|
||||||
|
if (this.endIndex - this.startIndex < HOW_MANY_ROWS_IN_PARALLEL)
|
||||||
|
{
|
||||||
|
ArrayList<ArrayList<BigInteger>> resultC = new ArrayList<ArrayList<BigInteger>>();
|
||||||
|
for (int i = this.startIndex; i <= this.endIndex; ++i)
|
||||||
|
{
|
||||||
|
//>create a new row to add it to the resulting matrix resultC
|
||||||
|
ArrayList<BigInteger> rowAplusB = new ArrayList<BigInteger>();
|
||||||
|
|
||||||
|
for (int j = 0; j < A.get(0).size(); j++)
|
||||||
|
|
||||||
|
//>get the Ith row from A and the Ith row from B and
|
||||||
|
//and add all the Jth entries from each row
|
||||||
|
{
|
||||||
|
BigInteger x = A.get(i).get(j);
|
||||||
|
BigInteger y = B.get(i).get(j);
|
||||||
|
BigInteger z = x.add(y);
|
||||||
|
|
||||||
|
rowAplusB.add(z);
|
||||||
|
}
|
||||||
|
resultC.add(rowAplusB);
|
||||||
|
}
|
||||||
|
return resultC;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //>> keep on FORKING the matrix until the
|
||||||
|
//side of the matric is equal or less to HOW_MANY_ROWS_IN_PARALLEL
|
||||||
|
|
||||||
|
int mid = (this.endIndex + this.startIndex) / 2;
|
||||||
|
RecursiveTask<ArrayList<ArrayList<BigInteger>>> firstHalf
|
||||||
|
= new MatricesAddition(this.startIndex, mid, A, B);
|
||||||
|
|
||||||
|
RecursiveTask<ArrayList<ArrayList<BigInteger>>> secondHalf
|
||||||
|
= new MatricesAddition(mid + 1, this.endIndex, A, B);
|
||||||
|
|
||||||
|
firstHalf.fork();//this line will invoke method compute
|
||||||
|
secondHalf.fork();///this line will invoke method compute
|
||||||
|
|
||||||
|
//>> join what the FORKs returned from the IFs
|
||||||
|
AplusB.addAll(firstHalf.join());
|
||||||
|
AplusB.addAll(secondHalf.join());
|
||||||
|
|
||||||
|
return AplusB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiples two lists one 1-t01 correspondence, that is the 1st element of
|
||||||
|
* the first list is multiplied with 1st elements of the second list and so
|
||||||
|
* on
|
||||||
|
*
|
||||||
|
* @param list1
|
||||||
|
* @param list2
|
||||||
|
* @return the multiplied results
|
||||||
|
*/
|
||||||
|
public static ArrayList<BigInteger> multiplyLists(ArrayList<BigInteger> list1, ArrayList<BigInteger> list2)
|
||||||
|
{
|
||||||
|
ArrayList<BigInteger> resultsOfMultiplications = new ArrayList<BigInteger>();
|
||||||
|
for (int bi = 0; bi < list1.size();
|
||||||
|
++bi)
|
||||||
|
{
|
||||||
|
resultsOfMultiplications.add(list1.get(bi).multiply(list2.get(bi)));
|
||||||
|
}
|
||||||
|
return resultsOfMultiplications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<ArrayList<BigInteger>> columnMajorOrderReversal(ArrayList<ArrayList<BigInteger>> b)
|
||||||
|
{
|
||||||
|
ArrayList<ArrayList<BigInteger>> tranformed = new ArrayList<ArrayList<BigInteger>>();
|
||||||
|
for (int column = 0;
|
||||||
|
column < b.get(0).size();
|
||||||
|
++column)
|
||||||
|
{
|
||||||
|
ArrayList<BigInteger> rowTrandormedToColmn = new ArrayList<BigInteger>();
|
||||||
|
for (int row = 0;
|
||||||
|
row < b.size();
|
||||||
|
++row)
|
||||||
|
{
|
||||||
|
BigInteger bd = b.get(row).get(column);
|
||||||
|
rowTrandormedToColmn.add(bd);
|
||||||
|
}
|
||||||
|
tranformed.add(rowTrandormedToColmn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tranformed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a list of Big Decimals and returns the result of the addition.
|
||||||
|
*
|
||||||
|
* @param list - list of BigDecimal type
|
||||||
|
* @return the sum of the list
|
||||||
|
*/
|
||||||
|
public static BigInteger add(ArrayList<BigInteger> list)
|
||||||
|
{
|
||||||
|
BigInteger bd = BigInteger.ZERO;
|
||||||
|
for (int bi = 0; bi < list.size();
|
||||||
|
bi++)
|
||||||
|
{
|
||||||
|
bd = bd.add(list.get(bi));
|
||||||
|
}
|
||||||
|
return bd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MatricesMultiplication extends RecursiveTask<ArrayList<ArrayList<BigInteger>>>
|
||||||
|
{
|
||||||
|
|
||||||
|
ArrayList<ArrayList<BigInteger>> A;
|
||||||
|
ArrayList<ArrayList<BigInteger>> B;
|
||||||
|
ArrayList<ArrayList<BigInteger>> AxB;
|
||||||
|
final int HOW_MANY_ROWS_IN_PARALLEL = 3;//threshold
|
||||||
|
int startIndex;
|
||||||
|
int endIndex;
|
||||||
|
|
||||||
|
public MatricesMultiplication(int startIndex, int endIndex,
|
||||||
|
ArrayList<ArrayList<BigInteger>> A,
|
||||||
|
ArrayList<ArrayList<BigInteger>> B)
|
||||||
|
{
|
||||||
|
this.startIndex = startIndex;//start at this row of the matrix
|
||||||
|
this.endIndex = endIndex;//end at this row of the matrix
|
||||||
|
this.A = A;
|
||||||
|
this.B = B;
|
||||||
|
AxB = new ArrayList<ArrayList<BigInteger>>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* matrix 1, 2, 3 4, 5, 6
|
||||||
|
*
|
||||||
|
* will be transformed to 1, 4 2, 5 3, 6
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected ArrayList<ArrayList<BigInteger>> compute()
|
||||||
|
{
|
||||||
|
//>>This is the addition of matrices in the IF.
|
||||||
|
//That is, HOW_MANY_ROWS_IN_PARALLEL from matrix A and HOW_MANY_ROWS_IN_PARALLEL from matrix B
|
||||||
|
if (this.endIndex - this.startIndex < HOW_MANY_ROWS_IN_PARALLEL)
|
||||||
|
{
|
||||||
|
ArrayList<ArrayList<BigInteger>> resultC = new ArrayList<ArrayList<BigInteger>>();
|
||||||
|
ArrayList<ArrayList<BigInteger>> bTransformed = columnMajorOrderReversal(B);
|
||||||
|
|
||||||
|
for (int biA = this.startIndex;
|
||||||
|
biA <= this.endIndex;
|
||||||
|
++biA)
|
||||||
|
{
|
||||||
|
ArrayList<BigInteger> rowA = A.get(biA);
|
||||||
|
ArrayList<BigInteger> rowAxB = new ArrayList<BigInteger>();
|
||||||
|
ArrayList<BigInteger> rowCalculation = new ArrayList<BigInteger>();
|
||||||
|
for (int biB = 0;
|
||||||
|
biB < bTransformed.size();
|
||||||
|
++biB)
|
||||||
|
{
|
||||||
|
ArrayList<BigInteger> rowB = bTransformed.get(biB);
|
||||||
|
|
||||||
|
ArrayList<BigInteger> productsOfRow = multiplyLists(rowA, rowB);
|
||||||
|
BigInteger sumOfRow = add(productsOfRow);
|
||||||
|
rowCalculation.add(sumOfRow);
|
||||||
|
|
||||||
|
}
|
||||||
|
resultC.add(rowCalculation);
|
||||||
|
|
||||||
|
}
|
||||||
|
return resultC;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //>> keep on FORKING the matrix until the
|
||||||
|
//side of the matric is equal or less to HOW_MANY_ROWS_IN_PARALLEL
|
||||||
|
|
||||||
|
int mid = (this.startIndex + this.endIndex) / 2;
|
||||||
|
RecursiveTask<ArrayList<ArrayList<BigInteger>>> firstHalf
|
||||||
|
= new MatricesMultiplication(this.startIndex, mid, A, B);
|
||||||
|
|
||||||
|
RecursiveTask<ArrayList<ArrayList<BigInteger>>> secondHalf
|
||||||
|
= new MatricesMultiplication(mid + 1, this.endIndex, A, B);
|
||||||
|
|
||||||
|
firstHalf.fork();//this line will invoke method compute
|
||||||
|
secondHalf.fork();///this line will invoke method compute
|
||||||
|
|
||||||
|
//>> join what the FORKs returned from the IFs
|
||||||
|
AxB.addAll(firstHalf.join());
|
||||||
|
AxB.addAll(secondHalf.join());
|
||||||
|
|
||||||
|
return AxB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.bl;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ASDV1
|
||||||
|
*/
|
||||||
|
public interface Matrix
|
||||||
|
{
|
||||||
|
ArrayList<ArrayList<BigInteger>> addParallel(ArrayList<ArrayList<BigInteger>> A, ArrayList<ArrayList<BigInteger>> B);
|
||||||
|
ArrayList<ArrayList<BigInteger>> multiplyParallel(ArrayList<ArrayList<BigInteger>> A, ArrayList<ArrayList<BigInteger>> B);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package edu.slcc.asdv.caleb.termproject1_calebfontenot.utilities;
|
||||||
|
|
||||||
|
|
||||||
|
import jakarta.el.ELContext;
|
||||||
|
import jakarta.el.ELResolver;
|
||||||
|
import jakarta.faces.application.Application;
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.component.UIComponent;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
public class Utilities
|
||||||
|
{
|
||||||
|
|
||||||
|
public static UIComponent findComponent(String id)
|
||||||
|
{
|
||||||
|
|
||||||
|
UIComponent result = null;
|
||||||
|
UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
|
||||||
|
if (root != null)
|
||||||
|
{
|
||||||
|
result = findComponent(root, id);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UIComponent findComponent(UIComponent root, String id)
|
||||||
|
{
|
||||||
|
|
||||||
|
UIComponent result = null;
|
||||||
|
if (root.getId().equals(id))
|
||||||
|
{
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (UIComponent child : root.getChildren())
|
||||||
|
{
|
||||||
|
if (child.getId().equals(id))
|
||||||
|
{
|
||||||
|
result = child;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
result = findComponent(child, id);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void printIDs(UIComponent component)
|
||||||
|
{
|
||||||
|
System.out.println("\n\nPARENT ID " + component.getId());
|
||||||
|
|
||||||
|
if (component.getChildren() == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (UIComponent child : component.getChildren())
|
||||||
|
{
|
||||||
|
System.out.println("\t\tCHILD ID " + child.getId());
|
||||||
|
|
||||||
|
printIDs(child);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNumberOrDecimal( String s )
|
||||||
|
{
|
||||||
|
System.out.println("isNumberOrDecimal called " + s);
|
||||||
|
//[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)
|
||||||
|
String regx = "^[+-]?(\\d*\\.)?\\d+$";
|
||||||
|
return s.matches(regx);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void message( FacesMessage.Severity severity, String msg, String msgDetails)
|
||||||
|
{
|
||||||
|
FacesMessage m = new FacesMessage(severity, msg, msgDetails);
|
||||||
|
FacesContext.getCurrentInstance().addMessage("msg", m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static <T> T getCDIBean(String nameOfTheBean)
|
||||||
|
{
|
||||||
|
ELContext elc = FacesContext.getCurrentInstance().getELContext();
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
Application ap = fc.getApplication();
|
||||||
|
ELResolver elr = ap.getELResolver();
|
||||||
|
return (T) elr.getValue(elc, null, nameOfTheBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ArrayList<ArrayList<String>> convertBigIntegerToString(ArrayList<ArrayList<BigInteger>> matrix)
|
||||||
|
{
|
||||||
|
ArrayList<ArrayList<String>> stringMatrix = new ArrayList<ArrayList<String>>();
|
||||||
|
|
||||||
|
for (ArrayList<BigInteger> row : matrix)
|
||||||
|
{
|
||||||
|
ArrayList<String> stringRow = new ArrayList<String>();
|
||||||
|
for (BigInteger bigInt : row)
|
||||||
|
{
|
||||||
|
stringRow.add(new String(bigInt.toString()));
|
||||||
|
|
||||||
|
}
|
||||||
|
stringMatrix.add(stringRow);
|
||||||
|
}
|
||||||
|
return stringMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,56 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
|
<h:head>
|
||||||
|
<title></title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
|
||||||
|
<ui:composition
|
||||||
|
template="resources/templates/generic/generic-layout.xhtml">
|
||||||
|
<ui:param name="wrapperWidth" value="80%"/>
|
||||||
|
|
||||||
|
<ui:define name="title">
|
||||||
|
Application Software Development, SLCC
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
<ui:define name="top">
|
||||||
|
Templates, and Menus Illustration
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ui:param name="loginsearch" value="true"/>
|
||||||
|
<ui:define name="logo"> </ui:define>
|
||||||
|
<ui:define name="login">
|
||||||
|
<ui:include src="/login-n-search/login.xhtml"/>
|
||||||
|
</ui:define>
|
||||||
|
<ui:define name="search">
|
||||||
|
<ui:include src="/login-n-search/search.xhtml"/>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
<ui:define name="menu">
|
||||||
|
<ui:include src="/matrices/menuMatrices.xhtml">
|
||||||
|
<ui:param name = "isMenu" value="true" />
|
||||||
|
</ui:include>
|
||||||
|
</ui:define>
|
||||||
|
<ui:param name="left" value="false"/>
|
||||||
|
<!-- if we do NOT want right to appear, set right to false -->
|
||||||
|
<ui:param name="right" value="false"/>
|
||||||
|
|
||||||
|
<ui:param name="content" value="true"/>
|
||||||
|
<ui:define name="content">
|
||||||
|
<ui:include src="/matrices/compose.xhtml"/>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
|
||||||
|
<ui:define name="bottom">ASDV 2800 , Templates</ui:define>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
<br />
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||||
|
xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:f5="http://xmlns.jcp.org/jsf/passthrough">
|
||||||
|
<h:head>
|
||||||
|
<title>Login</title>
|
||||||
|
>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<ui:composition>
|
||||||
|
<h:form id="loginFormId">
|
||||||
|
<h:inputText styleClass="inputs" value="" f5:type="email" f5:placeholder="E-mail"/>
|
||||||
|
<h:inputSecret styleClass="inputs" value="" f5:placeholder="Password"/>
|
||||||
|
<h:commandButton styleClass="lbutton" value="Login"/>
|
||||||
|
</h:form>
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:f5="http://xmlns.jcp.org/jsf/passthrough">
|
||||||
|
<h:head>
|
||||||
|
<title>Login</title>
|
||||||
|
>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<ui:composition>
|
||||||
|
<h:form id="searchFormId">
|
||||||
|
<h:inputText styleClass="inputs" value="" f5:type="email" f5:placeholder="Search"/>
|
||||||
|
<h:commandButton styleClass="lbutton" value="Search!"/>
|
||||||
|
</h:form>
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>Facelet Title</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<ui:fragment>
|
||||||
|
<p:panelGrid columns="3" >
|
||||||
|
<p:column >
|
||||||
|
<ui:include src="/matrices/matrixA.xhtml"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column >
|
||||||
|
<ui:include src="/matrices/matrixB.xhtml"/>
|
||||||
|
</p:column>
|
||||||
|
<p:column >
|
||||||
|
<ui:include src="/matrices/matrixC.xhtml"/>
|
||||||
|
</p:column>
|
||||||
|
</p:panelGrid>
|
||||||
|
|
||||||
|
</ui:fragment>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>MatriX A</title>
|
||||||
|
<h:outputStylesheet name="css/layout-css/dataTable.css" />
|
||||||
|
<h:outputScript library="js" name="do_validation.js"/>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form id="form_matrix_A">
|
||||||
|
<p:tooltip globalSelector="true"/>
|
||||||
|
<p:growl id="id_messageA" showDetail="true"/>
|
||||||
|
|
||||||
|
<h3>Matrix A</h3>
|
||||||
|
<h4>DataTable of dynamically created of input-texts</h4>
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>MatriX A</title>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form id="form_matrix_B">
|
||||||
|
<h3>Matrix B</h3>
|
||||||
|
<h4>DataTable of dynamically created of input-texts</h4>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>MAtrix C</title>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form id="formC" >
|
||||||
|
<h3> Matrix C = A menu-operation B </h3>
|
||||||
|
</h:form>
|
||||||
|
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="jakarta.faces.html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>Menu Matricies</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<ui:fragment rendered="#{isMenu eq 'true' ? true : false}">
|
||||||
|
<p:tooltip globalSelector="true"/>
|
||||||
|
|
||||||
|
<h:form id="form_menu">
|
||||||
|
<p:growl id="id_message" showDetail="true"/>
|
||||||
|
<p:menubar id="menuBar">
|
||||||
|
<p:submenu id="submenu_matricies" label="Matrix" icon="pi pi-table">
|
||||||
|
<p:menuitem title="Addition" id ="menuitem_add" value="Add" disabled="false"
|
||||||
|
action="#{menuBar.add()}" icon="pi pi-plus" update="id_message"/>
|
||||||
|
<p:menuitem title="Multiplication" id ="menuitem_multiply" value="Multiply" disabled="false"
|
||||||
|
action="#{menuBar.multiply()}" icon="pi pi-plus" update="id_message"/>
|
||||||
|
<p:menuitem title="Subtraction" id ="menuitem_subtract" value="Subtract" disabled="false"
|
||||||
|
action="#{menuBar.subtract()}" icon="pi pi-plus" update="id_message"/>
|
||||||
|
</p:submenu>
|
||||||
|
</p:menubar>
|
||||||
|
</h:form>
|
||||||
|
</ui:fragment>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
|
<h:head>
|
||||||
|
<title>Menu</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<ui:fragment rendered="#{ isMenu eq 'true' ? true : false}">
|
||||||
|
<p:tooltip globalSelector="true"/>
|
||||||
|
|
||||||
|
<h:form id="form_menu">
|
||||||
|
<p:growl id="id_message" showDetail="true"/>
|
||||||
|
<p:menubar id="menuBar">
|
||||||
|
<p:submenu id ="submenu_matrices"
|
||||||
|
label="Matrix" icon="pi pi-table">
|
||||||
|
<p:menuitem title="This does addition"
|
||||||
|
id ="menuitem_add" value="Add" disabled="false"
|
||||||
|
action="#{menuBar.add()}"
|
||||||
|
icon="pi pi-plus" update="id_message "/>
|
||||||
|
|
||||||
|
<p:menuitem icon="pi pi-times" title="Multiplication"
|
||||||
|
id ="menuitem_multiply" value="Multiply"
|
||||||
|
disabled="false"
|
||||||
|
action="#{menuBar.multiply()}"
|
||||||
|
update="id_message"/>
|
||||||
|
|
||||||
|
<p:menuitem title="Subtraction" id ="menuitem_subtract" value="Subtract"
|
||||||
|
action="#{menuBar.subtract}" disabled="false"
|
||||||
|
icon="pi pi-minus" update="id_message"/>
|
||||||
|
</p:submenu>
|
||||||
|
</p:menubar>
|
||||||
|
</h:form>
|
||||||
|
|
||||||
|
</ui:fragment >
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,18 @@
|
|||||||
|
#bottom {
|
||||||
|
margin: 0px 0px 0px 0px;
|
||||||
|
text-align:center;
|
||||||
|
color: #ffffff;
|
||||||
|
|
||||||
|
background-image: -webkit-gradient(
|
||||||
|
linear,
|
||||||
|
left top,
|
||||||
|
left bottom,
|
||||||
|
color-stop(0, blue),
|
||||||
|
color-stop(1, blue)
|
||||||
|
);
|
||||||
|
background-image: -o-linear-gradient(bottom, blue 0%, #120205 100%);
|
||||||
|
background-image: -moz-linear-gradient(bottom, blue 0%, #120205 100%);
|
||||||
|
background-image: -webkit-linear-gradient(bottom, blue 0%, #120205 100%);
|
||||||
|
background-image: -ms-linear-gradient(bottom, blue 0%, #120205 100%);
|
||||||
|
background-image: linear-gradient(to bottom, blue 0%, #120205 100%);
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
#content {
|
||||||
|
background: white;
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
#wrapper {
|
||||||
|
margin-left:auto;
|
||||||
|
margin-right:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#title {
|
||||||
|
position: relative;
|
||||||
|
margin: 1px 0px 0px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#login_and_search {
|
||||||
|
position: relative;
|
||||||
|
margin: 0px 0px 5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#login {
|
||||||
|
float: left;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#search {
|
||||||
|
float: right;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#top {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bottom {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#left {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,237 @@
|
|||||||
|
|
||||||
|
.rowNumber{
|
||||||
|
|
||||||
|
margin-right:20px;
|
||||||
|
width : 100px;
|
||||||
|
background: blue;
|
||||||
|
font-family: Impact;
|
||||||
|
font-size: 1.2em;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
body .ui-datatable .ui-paginator {
|
||||||
|
position: relative;
|
||||||
|
text-align: left;
|
||||||
|
bottom: 0px;
|
||||||
|
width: inherit;
|
||||||
|
padding: 2px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.input {
|
||||||
|
font-size: 1em;
|
||||||
|
max-width: 35px;
|
||||||
|
min-width: 35px;
|
||||||
|
height : 35px;
|
||||||
|
font-size: 1em;
|
||||||
|
font-family: inherit;
|
||||||
|
background-color: #fff;
|
||||||
|
border: solid 1px;
|
||||||
|
|
||||||
|
border-color: blueviolet;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dataTables {
|
||||||
|
overflow-y:scroll;
|
||||||
|
overflow-x:scroll;
|
||||||
|
|
||||||
|
|
||||||
|
height : 386px;
|
||||||
|
width: 300px;
|
||||||
|
display:block;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
zoom: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-datatable table{
|
||||||
|
border-collapse:collapse;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
.ui-datatable.ui-datatable-header,.ui-datatable.ui-datatable-footer{
|
||||||
|
text-align:center;
|
||||||
|
padding:4px 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
.ui-datatable.ui-datatable-header{
|
||||||
|
border-bottom:0px none;
|
||||||
|
|
||||||
|
}
|
||||||
|
.ui-datatable.ui-datatable-footer{
|
||||||
|
border-top:0px none;
|
||||||
|
}
|
||||||
|
.ui-datatable thead th
|
||||||
|
{
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 1.2em;
|
||||||
|
color: blue;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
.ui-datatable thead td
|
||||||
|
{
|
||||||
|
font-family: Impact;
|
||||||
|
font-size:1.2em;
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
.ui-datatable tfoot td{
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
ui-datatable thead th
|
||||||
|
{
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
.ui-datatable tbody td , .ui-datatable tfoot td{
|
||||||
|
padding:4px 10px;
|
||||||
|
overflow:hidden;
|
||||||
|
white-space:nowrap;
|
||||||
|
border-width:1px;
|
||||||
|
border-style:solid;
|
||||||
|
}
|
||||||
|
.ui-datatable tbody tr
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-datatable .ui-sortable-column{
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.ui-datatable div.ui-dt-c{
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-sortable-column-icon{
|
||||||
|
display:inline-block;
|
||||||
|
margin:-3px 0px -3px 2px;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-column-filter{
|
||||||
|
display:block;
|
||||||
|
width:100px;
|
||||||
|
margin:auto;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-expanded-row{
|
||||||
|
border-bottom:0px none;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-expanded-row-content{
|
||||||
|
border-top:0px none;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-toggler{
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.ui-datatable tr.ui-state-highlight{
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-selection-column .ui-chkbox-all{
|
||||||
|
display:block;
|
||||||
|
margin:0px auto;
|
||||||
|
width:16px;
|
||||||
|
height:16px;
|
||||||
|
}
|
||||||
|
.ui-datatable-scrollable table{
|
||||||
|
table-layout:auto;
|
||||||
|
}
|
||||||
|
.ui-datatable-scrollable-body{
|
||||||
|
overflow:auto;
|
||||||
|
}
|
||||||
|
.ui-datatable-scrollable-header,.ui-datatable-scrollable-footer{
|
||||||
|
overflow:hidden;
|
||||||
|
border:0px none;
|
||||||
|
}
|
||||||
|
.ui-datatable-scrollable .ui-datatable-scrollable-header,.ui-datatable-scrollable .ui-datatable-scrollable-footer{
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
.ui-datatable-scrollable .ui-datatable-scrollable-header td{
|
||||||
|
font-weight:normal;
|
||||||
|
}
|
||||||
|
.ui-datatable-scrollable-body::-webkit-scrollbar{
|
||||||
|
-webkit-appearance:none;
|
||||||
|
width:15px;
|
||||||
|
background-color:transparent;
|
||||||
|
}
|
||||||
|
.ui-datatable-scrollable-body::-webkit-scrollbar-thumb{
|
||||||
|
border-radius:8px;
|
||||||
|
border:1px solid white;
|
||||||
|
background-color:rgba(194,194,194,.5);
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-datatable-data tr.ui-state-hover{
|
||||||
|
border-color:inherit;
|
||||||
|
font-weight:inherit;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-paginator,.ui-datatable .ui-paginator{
|
||||||
|
padding:2px;
|
||||||
|
}
|
||||||
|
.ui-column-dnd-top, ui-column-dnd-bottom{
|
||||||
|
display:none;
|
||||||
|
position:absolute;
|
||||||
|
}
|
||||||
|
.ui-column-dnd-top .ui-icon, ui-column-dnd-bottom .ui-icon{
|
||||||
|
position:absolute;
|
||||||
|
top:-4px;
|
||||||
|
}
|
||||||
|
/* InCell Editing */.ui-datatable .ui-cell-editor-input{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-editing .ui-cell-editor .ui-cell-editor-output{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-editing .ui-cell-editor .ui-cell-editor-input{
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-editor span{
|
||||||
|
cursor:pointer;
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-editor .ui-icon-pencil{
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-editing .ui-row-editor .ui-icon-pencil{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-editor .ui-icon-check,.ui-datatable .ui-row-editor .ui-icon-close{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-row-editing .ui-row-editor .ui-icon-check,.ui-datatable .ui-row-editing .ui-row-editor .ui-icon-close{
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-datatable-data tr.ui-row-editing td.ui-editable-column,.ui-datatable .ui-datatable-data td.ui-cell-editing{
|
||||||
|
padding:0;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
/*resizer */.ui-datatable .ui-column-resizer{
|
||||||
|
width:8px;
|
||||||
|
height:20px;
|
||||||
|
padding:0px;
|
||||||
|
cursor:col-resize;
|
||||||
|
background-image:url("/ScraperOnWeb/javax.faces.resource/spacer/dot_clear.gif.jsf?ln=primefaces");
|
||||||
|
margin:-4px -10px -4px 0px;
|
||||||
|
float:right;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-filter-column .ui-column-resizer{
|
||||||
|
height:45px;
|
||||||
|
}
|
||||||
|
.ui-datatable .ui-column-resizer-helper{
|
||||||
|
width:1px;
|
||||||
|
position:absolute;
|
||||||
|
z-index:10;
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.ui-datatable-resizable{
|
||||||
|
padding-bottom:1px;/*fix for webkit overlow*/
|
||||||
|
overflow:auto;
|
||||||
|
}
|
||||||
|
.ui-datatable-resizable table{
|
||||||
|
table-layout:auto;
|
||||||
|
}
|
||||||
|
.ui-datatable-rtl{
|
||||||
|
direction:rtl;
|
||||||
|
}
|
||||||
|
.ui-datatable-rtl.ui-datatable thead th, .ui-datatable-rtl.ui-datatable tfoot td{
|
||||||
|
text-align:right;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #ffffff;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
|
||||||
|
color: #000000;
|
||||||
|
margin: 2px;
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
* {box-sizing: border-box;}
|
||||||
|
|
||||||
|
.img-zoom-container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-zoom-lens {
|
||||||
|
position: absolute;
|
||||||
|
/*set the size of the lens:*/
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-zoom-result {
|
||||||
|
|
||||||
|
/*border: 5px solid #000000;*/
|
||||||
|
/*set the size of the result div:*/
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
.myDiv
|
||||||
|
{
|
||||||
|
align: center;
|
||||||
|
padding: 30px;
|
||||||
|
margin: 10;
|
||||||
|
border-left: 10px solid navy;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hpanel{
|
||||||
|
position: relative;
|
||||||
|
top: 0px; left: 0px;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
#left {
|
||||||
|
|
||||||
|
background-image: -webkit-gradient(
|
||||||
|
linear,
|
||||||
|
left top,
|
||||||
|
left bottom,
|
||||||
|
color-stop(0, #2D4A37),
|
||||||
|
color-stop(1, #789480)
|
||||||
|
);
|
||||||
|
background-image: -o-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
|
||||||
|
background-image: -moz-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
|
||||||
|
background-image: -webkit-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
|
||||||
|
background-image: -ms-linear-gradient(bottom, #2D4A37 0%, #789480 100%);
|
||||||
|
background-image: linear-gradient(to bottom, #2D4A37 0%, #789480 100%);
|
||||||
|
-moz-box-shadow: 0px 0px 15px 3px #333333;
|
||||||
|
-webkit-box-shadow: 0px 0px 15px 3px #333333;
|
||||||
|
box-shadow: 0px 0px 15px 3px #333333;
|
||||||
|
|
||||||
|
text-align:left;
|
||||||
|
padding-left:10px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
.inputs {
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
background-color: #00f;
|
||||||
|
background: -moz-linear-gradient(top, #FFF, #EAEAEA);
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #FFF), color-stop(1.0, #EAEAEA));
|
||||||
|
border: 1px solid #CACACA;
|
||||||
|
color: #444;
|
||||||
|
font-size: 1.1em;
|
||||||
|
margin: 0px 10px 0px 0px;
|
||||||
|
padding-left: 2px;
|
||||||
|
width:200px;
|
||||||
|
}
|
||||||
|
.inputs:focus {
|
||||||
|
color: #ffffff;
|
||||||
|
background: #0000cc;
|
||||||
|
-webkit-box-shadow: 0 0 25px #CCC;
|
||||||
|
-moz-box-shadow: 0 0 25px #cccc00;
|
||||||
|
box-shadow: 0 0 25px #CCCC00;
|
||||||
|
-webkit-transform: scale(1.05);
|
||||||
|
-moz-transform: scale(1.05);
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lbutton {
|
||||||
|
-moz-box-shadow: 4px 7px 13px -7px #276873;
|
||||||
|
-webkit-box-shadow: 4px 7px 13px -7px #276873;
|
||||||
|
box-shadow: 4px 7px 13px -7px #276873;
|
||||||
|
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #171717), color-stop(1, #d92323));
|
||||||
|
background:-moz-linear-gradient(top, #171717 5%, #222 100%);
|
||||||
|
background:-webkit-linear-gradient(top, #171717 5%, #222 100%);
|
||||||
|
background:-o-linear-gradient(top, #171717 5%, #222 100%);
|
||||||
|
background:-ms-linear-gradient(top, #171717 5%, #222 100%);
|
||||||
|
background:linear-gradient(to bottom, #171717 5%, #222 100%);
|
||||||
|
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#171717', endColorstr='#d92323',GradientType=0);
|
||||||
|
background-color:#222;
|
||||||
|
-moz-border-radius:17px;
|
||||||
|
-webkit-border-radius:17px;
|
||||||
|
border-radius:17px;
|
||||||
|
display:inline-block;
|
||||||
|
cursor:pointer;
|
||||||
|
color:#ffffff;
|
||||||
|
font-family:arial;
|
||||||
|
font-size:12px;
|
||||||
|
font-weight:bold;
|
||||||
|
padding:2px 12px;
|
||||||
|
text-decoration:none;
|
||||||
|
text-shadow:0px 1px 0px #3d768a;
|
||||||
|
}
|
||||||
|
.lbutton:hover {
|
||||||
|
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #222), color-stop(1, #171717));
|
||||||
|
background:-moz-linear-gradient(top, #00f 5%, #222 100%);
|
||||||
|
background:-webkit-linear-gradient(top, 00f 5%, #222 100%);
|
||||||
|
background:-o-linear-gradient(top, #00f 5%, #222 100%);
|
||||||
|
background:-ms-linear-gradient(top, #00f 5%, #222 100%);
|
||||||
|
background:linear-gradient(to bottom, #00f 5%, #222 100%);
|
||||||
|
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d92323', endColorstr='#222',GradientType=0);
|
||||||
|
background-color:#00f;
|
||||||
|
}
|
||||||
|
.lbutton:active {
|
||||||
|
position:relative;
|
||||||
|
top:1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
#login_and_search {
|
||||||
|
|
||||||
|
width:100%;
|
||||||
|
height:90px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 20px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#logo {
|
||||||
|
background-image : url("#{resource['images/owl.png']}") ;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin-right: 0px;
|
||||||
|
width:60px;
|
||||||
|
height:60px;
|
||||||
|
float: left;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
#menu {
|
||||||
|
white-space: nowrap;
|
||||||
|
height: 28px;
|
||||||
|
width:100%;
|
||||||
|
background: #fff url("#{resource['images/menu.png']}") bottom center ;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style:none;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu li {
|
||||||
|
float: left;
|
||||||
|
margin: 0 3px 0 3px;
|
||||||
|
padding: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu a {
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: normal;
|
||||||
|
float:left;
|
||||||
|
display:block;
|
||||||
|
height: 26px;
|
||||||
|
line-height: 24px;
|
||||||
|
padding: 2px 10px 0 10px;
|
||||||
|
color: #cccc00;
|
||||||
|
text-decoration: none;
|
||||||
|
background: transparent;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
#right {
|
||||||
|
background-color: #FA0519;
|
||||||
|
text-align:center;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
#search {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
a {
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: normal;
|
||||||
|
float:left;
|
||||||
|
display:block;
|
||||||
|
height: 26px;
|
||||||
|
line-height: 24px;
|
||||||
|
padding: 2px 10px 0 10px;
|
||||||
|
color: #cccc00;
|
||||||
|
text-decoration:#A3979A;
|
||||||
|
background-color: white;
|
||||||
|
border: white;
|
||||||
|
padding: 0px
|
||||||
|
}
|
||||||
|
a.hover {
|
||||||
|
float: left;
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: normal;
|
||||||
|
float:left;
|
||||||
|
display:block;
|
||||||
|
height: 26px;
|
||||||
|
line-height: 24px;
|
||||||
|
color: #cccc00;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
background-color: white;
|
||||||
|
border: white;
|
||||||
|
padding: 0px
|
||||||
|
}
|
||||||
|
|
||||||
|
.menus
|
||||||
|
{
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: normal;
|
||||||
|
float:right;
|
||||||
|
|
||||||
|
|
||||||
|
color: #cccc00;
|
||||||
|
text-decoration:#A3979A;
|
||||||
|
background-color: white;
|
||||||
|
border: white;
|
||||||
|
padding: 0px ;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.affaires .ui-menuitem-text{color:#cccc00;
|
||||||
|
decoration: bold, italic;
|
||||||
|
|
||||||
|
}
|
||||||
|
.affaires .ui-menu-child{background: white; mouseover: #000;
|
||||||
|
background-color: #A80000;}
|
||||||
|
.affaires .ui-menubar{mouseover: #000;
|
||||||
|
background-color: #A80000;}
|
||||||
|
.affaires .ui-state-hover {}
|
||||||
|
|
||||||
|
a.active {
|
||||||
|
color: #D09d23;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color : #c7c3c3;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#title {
|
||||||
|
background: white;
|
||||||
|
color:blue;
|
||||||
|
text-align:center;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
#top {
|
||||||
|
color: blue;
|
||||||
|
font-family: cursive, sans-serif;
|
||||||
|
font-size: 22px;
|
||||||
|
font-style: italic;
|
||||||
|
text-align: center;
|
||||||
|
height:60px;
|
||||||
|
background: white;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function validateText(textInputID)
|
||||||
|
{
|
||||||
|
var htmlInputText = document.getElementById(textInputID);
|
||||||
|
var text = htmlInputText.value;
|
||||||
|
|
||||||
|
|
||||||
|
var regex = /[^A-Za-z0-9]/g;
|
||||||
|
|
||||||
|
if (text.search( regex) != -1)
|
||||||
|
{
|
||||||
|
newText = text.replace(regex, "");
|
||||||
|
htmlInputText.value = newText;
|
||||||
|
//alert("alphanumeric chars only please");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<ui:composition >
|
||||||
|
<h1>This is default footer</h1>
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<ui:composition>
|
||||||
|
This is default content
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<ui:composition>
|
||||||
|
This is default left side
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<ui:composition>
|
||||||
|
Default Login Section
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<ui:composition>
|
||||||
|
LOGO
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<ui:composition>
|
||||||
|
Menu default
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user