Skip to content

Commit

Permalink
tadeocrud complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeo Rivera committed Nov 2, 2019
1 parent e274e88 commit 19be3c2
Show file tree
Hide file tree
Showing 36 changed files with 1,962 additions and 0 deletions.
134 changes: 134 additions & 0 deletions main/java/com/livejournal/xtecuan/microprofile/dto/UsersDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* Copyright (c) 2019 xtecuan.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* xtecuan - initial API and implementation and/or initial documentation
*/
package com.livejournal.xtecuan.microprofile.dto;

import java.io.Serializable;

/**
*
* @author xtecuan
*/

public class UsersDTO implements Serializable {

private static final long serialVersionUID = 1L;

private Long userid;

private String email;

private String firstname;

private String middlename;

private String lastname;

private String password;

private String wrole;

public UsersDTO() {
}

public UsersDTO(Long userid) {
this.userid = userid;
}

public UsersDTO(Long userid, String email, String firstname, String lastname, String password) {
this.userid = userid;
this.email = email;
this.firstname = firstname;
this.lastname = lastname;
this.password = password;
}

public Long getUserid() {
return userid;
}

public void setUserid(Long userid) {
this.userid = userid;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getFirstname() {
return firstname;
}

public void setFirstname(String firstname) {
this.firstname = firstname;
}

public String getMiddlename() {
return middlename;
}

public void setMiddlename(String middlename) {
this.middlename = middlename;
}

public String getLastname() {
return lastname;
}

public void setLastname(String lastname) {
this.lastname = lastname;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getWrole() {
return wrole;
}

public void setWrole(String wrole) {
this.wrole = wrole;
}

@Override
public int hashCode() {
int hash = 0;
hash += (userid != null ? userid.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 UsersDTO)) {
return false;
}
UsersDTO other = (UsersDTO) object;
if ((this.userid == null && other.userid != null) || (this.userid != null && !this.userid.equals(other.userid))) {
return false;
}
return true;
}

@Override
public String toString() {
return "UsersDTO[email=" + email + "]";
}

}
188 changes: 188 additions & 0 deletions main/java/com/livejournal/xtecuan/microprofile/entities/Users.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/*
* Copyright (c) 2019 xtecuan.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* xtecuan - initial API and implementation and/or initial documentation
*/
package com.livejournal.xtecuan.microprofile.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.ColumnResult;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.ParameterMode;
import javax.persistence.SqlResultSetMapping;
import javax.persistence.SqlResultSetMappings;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.eclipse.persistence.annotations.NamedStoredFunctionQueries;
import org.eclipse.persistence.annotations.NamedStoredFunctionQuery;
import org.eclipse.persistence.annotations.StoredProcedureParameter;

/**
*
* @author xtecuan
*/
@Entity
@Table(name = "USERS_TABLE")
@SqlResultSetMappings({
@SqlResultSetMapping(
name = "passHashResult", columns = {
@ColumnResult(name = "MYHASH")}
)
})

@NamedQueries({
@NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"),
@NamedQuery(name = "Users.findByUserid", query = "SELECT u FROM Users u WHERE u.userid = :userid"),
@NamedQuery(name = "Users.findByEmail", query = "SELECT u FROM Users u WHERE u.email = :email"),
@NamedQuery(name = "Users.findByFirstname", query = "SELECT u FROM Users u WHERE u.firstname = :firstname"),
@NamedQuery(name = "Users.findByMiddlename", query = "SELECT u FROM Users u WHERE u.middlename = :middlename"),
@NamedQuery(name = "Users.findByLastname", query = "SELECT u FROM Users u WHERE u.lastname = :lastname"),
@NamedQuery(name = "Users.findByPassword", query = "SELECT u FROM Users u WHERE u.password = :password"),
@NamedQuery(name = "Users.findByEmailAndPassword", query = "SELECT u FROM Users u WHERE u.email = :email and u.password = :password ")})
public class Users implements Serializable {

private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "USERID")
private Long userid;
// @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 150)
@Column(name = "EMAIL")
private String email;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 200)
@Column(name = "FIRSTNAME")
private String firstname;
@Size(max = 200)
@Column(name = "MIDDLENAME")
private String middlename;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 200)
@Column(name = "LASTNAME")
private String lastname;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 500)
@Column(name = "PASSWORD")
private String password;
@NotNull
@Size(min = 1, max = 10)
@Column(name = "WROLE")
private String wrole;

public Users() {
}

public Users(Long userid) {
this.userid = userid;
}

public Users(Long userid, String email, String firstname, String lastname, String password) {
this.userid = userid;
this.email = email;
this.firstname = firstname;
this.lastname = lastname;
this.password = password;
}

public Long getUserid() {
return userid;
}

public void setUserid(Long userid) {
this.userid = userid;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getFirstname() {
return firstname;
}

public void setFirstname(String firstname) {
this.firstname = firstname;
}

public String getMiddlename() {
return middlename;
}

public void setMiddlename(String middlename) {
this.middlename = middlename;
}

public String getLastname() {
return lastname;
}

public void setLastname(String lastname) {
this.lastname = lastname;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getWrole() {
return wrole;
}

public void setWrole(String wrole) {
this.wrole = wrole;
}

@Override
public int hashCode() {
int hash = 0;
hash += (userid != null ? userid.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 Users)) {
return false;
}
Users other = (Users) object;
if ((this.userid == null && other.userid != null) || (this.userid != null && !this.userid.equals(other.userid))) {
return false;
}
return true;
}

@Override
public String toString() {
return "Users[email=" + email + "]";
}

}
Loading

0 comments on commit 19be3c2

Please sign in to comment.