This commit is contained in:
2023-09-27 13:31:02 -05:00
parent 99634aba7e
commit a7c5929537
307 changed files with 23548 additions and 0 deletions

View File

@@ -0,0 +1,128 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package beans;
import bl.Company;
import bl.Employee;
import bl.EmployeeInterface;
import jakarta.enterprise.context.SessionScoped;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.inject.Named;
import java.io.Serializable;
/**
*
* @author caleb
*/
@Named(value = "employeeController")
@SessionScoped
public class EmployeeController implements Serializable {
private String employeeFirst;
private String employeeLast;
private String employeeTitle;
private EmployeeInterface company;
public EmployeeController()
{
company = new Company();
}
public EmployeeInterface getCompany()
{
return company;
}
public void setCompany(EmployeeInterface company)
{
this.company = company;
}
/**
* Get the value of employeeLast
*
* @return the value of employeeLast
*/
public String getEmployeeLast()
{
return employeeLast;
}
/**
* Set the value of employeeLast
*
* @param employeeLast new value of employeeLast
*/
public void setEmployeeLast(String employeeLast)
{
this.employeeLast = employeeLast;
}
/**
* Get the value of employeeTitle
*
* @return the value of employeeTitle
*/
public String getEmployeeTitle()
{
return employeeTitle;
}
/**
* Set the value of employeeTitle
*
* @param employeeTitle new value of employeeTitle
*/
public void setEmployeeTitle(String employeeTitle)
{
this.employeeTitle = employeeTitle;
}
/**
* Get the value of employeeFirst
*
* @return the value of employeeFirst
*/
public String getEmployeeFirst()
{
return employeeFirst;
}
/**
* Set the value of employeeFirst
*
* @param employeeFirst new value of employeeFirst
*/
public void setEmployeeFirst(String employeeFirst)
{
this.employeeFirst = employeeFirst;
}
public void insert() {
boolean b = company.insertEmployee(new Employee(this.employeeFirst,
this.getEmployeeLast(), this.employeeTitle, "1.png")
);
FacesMessage facesMsg = null;
if (b) {
facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO,
"Employee Successfully Added", null);
this.employeeFirst = "";
this.employeeLast = "";
this.employeeTitle = "";
}
else {
facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Employee Not Added", null);
FacesContext.getCurrentInstance().addMessage(null, facesMsg);
}
}
public void remove() {
}
}

View File

@@ -0,0 +1,74 @@
/*
* 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.enterprise.context.SessionScoped;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.inject.Named;
import java.util.Date;
/**
*
* @author caleb
*/
@Named(value = "messageController")
@SessionScoped
public class MessageController implements java.io.Serializable {
int hitCounter = 0;
private String javaText;
/**
* Creates a new instance of MessageController
*/
public MessageController()
{
javaText = null;
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Managed Bean Initialized", null);
FacesContext.getCurrentInstance().addMessage(null, facesMsg);
}
public void newMessage()
{
String hitMessage = null;
hitCounter++;
if (hitCounter > 1) {
hitMessage = hitCounter + " times";
} else {
hitMessage = hitCounter + " time";
}
Date currDate = new Date();
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"You've pressed that button " + hitMessage + "! The current date and time: "
+ currDate, null);
FacesContext.getCurrentInstance().addMessage(null, facesMsg);
if (getJavaText().equalsIgnoreCase("java")) {
FacesMessage javaTextMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Good Job, that is the correct text!", null);
FacesContext.getCurrentInstance().addMessage("componentForm:javaText", javaTextMsg);
} else {
FacesMessage javaTextMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Sorry, that is NOT the correct text!", null);
FacesContext.getCurrentInstance().addMessage("componentForm:javaText", javaTextMsg);
}
}
/**
* @return the javaText
*/
public String getJavaText()
{
return javaText;
}
/**
* @param javaText the javaText to set
*/
public void setJavaText(String javaText)
{
this.javaText = javaText;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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 bl;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author caleb
*/
public class Company implements EmployeeInterface {
private List<Employee> employeeList;
public Company(List<Employee> employeeList)
{
this.employeeList = employeeList;
}
public Company() {
employeeList = new ArrayList<Employee>();
}
@Override
public boolean insertEmployee(Employee e){return employeeList.add( e ); }
@Override
public boolean removeEmployee(Employee e){throw new UnsupportedOperationException("Not supported yet."); }
@Override
public List<Employee> getEmployees(){return employeeList;}
}

View File

@@ -0,0 +1,110 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package bl;
/**
*
* @author caleb
*/
public class Employee {
private String employeeFirst;
private String employeeLast;
private String employeeTitle;
private String photo;
public Employee(String employeeFirst, String employeeLast, String employeeTitle, String photo)
{
this.employeeFirst = employeeFirst;
this.employeeLast = employeeLast;
this.employeeTitle = employeeTitle;
this.photo = photo;
}
/**
* Get the value of photo
*
* @return the value of photo
*/
public String getPhoto()
{
return photo;
}
/**
* Set the value of photo
*
* @param photo new value of photo
*/
public void setPhoto(String photo)
{
this.photo = photo;
}
/**
* Get the value of employeeTitle
*
* @return the value of employeeTitle
*/
public String getEmployeeTitle()
{
return employeeTitle;
}
/**
* Set the value of employeeTitle
*
* @param employeeTitle new value of employeeTitle
*/
public void setEmployeeTitle(String employeeTitle)
{
this.employeeTitle = employeeTitle;
}
/**
* Get the value of employeeLast
*
* @return the value of employeeLast
*/
public String getEmployeeLast()
{
return employeeLast;
}
/**
* Set the value of employeeLast
*
* @param employeeLast new value of employeeLast
*/
public void setEmployeeLast(String employeeLast)
{
this.employeeLast = employeeLast;
}
/**
* Get the value of employeeFirst
*
* @return the value of employeeFirst
*/
public String getEmployeeFirst()
{
return employeeFirst;
}
/**
* Set the value of employeeFirst
*
* @param employeeFirst new value of employeeFirst
*/
public void setEmployeeFirst(String employeeFirst)
{
this.employeeFirst = employeeFirst;
}
}

View File

@@ -0,0 +1,17 @@
/*
* 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 bl;
import java.util.List;
/**
*
* @author caleb
*/
public interface EmployeeInterface {
boolean insertEmployee(Employee e);
boolean removeEmployee(Employee e);
List<Employee> getEmployees();
}

View File

@@ -0,0 +1,13 @@
package edu.slcc.asdv.caleb.labjuneauvalidateuserinput_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 {
}

View File

@@ -0,0 +1,20 @@
package edu.slcc.asdv.caleb.labjuneauvalidateuserinput_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();
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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 validators;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.validator.FacesValidator;
import jakarta.faces.validator.Validator;
import jakarta.faces.validator.ValidatorException;
/**
*
* @author caleb
*/
@FacesValidator("employeeTitleValidate")
public class EmployeeTitleValidate implements Validator{
@Override
public void validate(FacesContext fc, UIComponent uic, Object t) throws ValidatorException
{
checkTitle(t);
}
private void checkTitle(Object value) {
String title = value.toString().toLowerCase();
if (!title.contains("java")) {
String messageText = "Title does not include the word Java!";
String messageTextLong = "The title does not include the word Java." +
" Please type the word Java.";
throw new ValidatorException(
new FacesMessage(FacesMessage.SEVERITY_ERROR,
messageText, messageTextLong));
}
}
}