211 lines
6.3 KiB
Java
211 lines
6.3 KiB
Java
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.rjconsultores.ventaboletos.entidad;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
import java.util.Calendar;
|
|
import java.util.Date;
|
|
import java.util.GregorianCalendar;
|
|
import java.util.List;
|
|
|
|
import javax.persistence.Basic;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.GenerationType;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.OneToMany;
|
|
import javax.persistence.SequenceGenerator;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Temporal;
|
|
import javax.persistence.TemporalType;
|
|
import javax.persistence.Transient;
|
|
|
|
import br.com.rjconsultores.auditador.annotations.AuditarAtributo;
|
|
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
|
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
|
|
|
/**
|
|
*
|
|
* @author Rafius
|
|
*/
|
|
@Entity
|
|
@SequenceGenerator(name = "ESQUEMA_OPERACIONAL_SEQ", sequenceName = "ESQUEMA_OPERACIONAL_SEQ", allocationSize = 1)
|
|
@Table(name = "ESQUEMA_OPERACIONAL")
|
|
public class EsquemaOperacional implements Serializable, Auditavel<EsquemaOperacional> {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
@Id
|
|
@Basic(optional = false)
|
|
@Column(name = "ESQUEMAOPERACIONAL_ID")
|
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_OPERACIONAL_SEQ")
|
|
private Integer esquemaoperacionalId;
|
|
|
|
@Column(name = "FECNICIOVIGENCIA")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
@AuditarAtributo(pattern = "dd/MM/yyyy", nome = "Inicio Vigencia")
|
|
private Date fecniciovigencia;
|
|
|
|
@Column(name = "FECFINVIGENCIA")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
@AuditarAtributo(pattern = "dd/MM/yyyy", nome = "Fim Vigencia")
|
|
private Date fecfinvigencia;
|
|
|
|
@Column(name = "ACTIVO")
|
|
@NaoAuditar
|
|
private Boolean activo;
|
|
|
|
@Column(name = "USUARIO_ID")
|
|
@NaoAuditar
|
|
private Integer usuarioId;
|
|
|
|
@Column(name = "FECMODIF")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
@NaoAuditar
|
|
private Date fecmodif;
|
|
|
|
@OneToMany(mappedBy = "esquemaOperacional")
|
|
@NaoAuditar
|
|
private List<EsquemaCorrida> esquemaCorridaList;
|
|
|
|
@Transient
|
|
@NaoAuditar
|
|
private EsquemaOperacional esquemaOperacionalClone;
|
|
|
|
public EsquemaOperacional() {
|
|
}
|
|
|
|
public EsquemaOperacional(Integer esquemaoperacionalId) {
|
|
this.esquemaoperacionalId = esquemaoperacionalId;
|
|
}
|
|
|
|
public Integer getEsquemaoperacionalId() {
|
|
return esquemaoperacionalId;
|
|
}
|
|
|
|
public void setEsquemaoperacionalId(Integer esquemaoperacionalId) {
|
|
this.esquemaoperacionalId = esquemaoperacionalId;
|
|
}
|
|
|
|
public Date getFecniciovigencia() {
|
|
return fecniciovigencia;
|
|
}
|
|
|
|
public void setFecniciovigencia(Date fecniciovigencia) {
|
|
if (fecniciovigencia != null) {
|
|
GregorianCalendar fecInicioVigenciaEsquema = new GregorianCalendar();
|
|
|
|
fecInicioVigenciaEsquema.setTime(fecniciovigencia);
|
|
fecInicioVigenciaEsquema.set(Calendar.SECOND, 0);
|
|
fecInicioVigenciaEsquema.set(Calendar.MILLISECOND, 0);
|
|
fecInicioVigenciaEsquema.set(Calendar.MINUTE, 0);
|
|
fecInicioVigenciaEsquema.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
fecniciovigencia = fecInicioVigenciaEsquema.getTime();
|
|
}
|
|
this.fecniciovigencia = fecniciovigencia;
|
|
}
|
|
|
|
public Date getFecfinvigencia() {
|
|
return fecfinvigencia;
|
|
}
|
|
|
|
public void setFecfinvigencia(Date fecfinvigencia) {
|
|
if (fecfinvigencia != null) {
|
|
GregorianCalendar fecFinVigenciaEsquema = new GregorianCalendar();
|
|
|
|
fecFinVigenciaEsquema.setTime(fecfinvigencia);
|
|
fecFinVigenciaEsquema.set(Calendar.SECOND, 0);
|
|
fecFinVigenciaEsquema.set(Calendar.MILLISECOND, 0);
|
|
fecFinVigenciaEsquema.set(Calendar.MINUTE, 0);
|
|
fecFinVigenciaEsquema.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
fecfinvigencia = fecFinVigenciaEsquema.getTime();
|
|
}
|
|
this.fecfinvigencia = fecfinvigencia;
|
|
}
|
|
|
|
public Boolean getActivo() {
|
|
return activo;
|
|
}
|
|
|
|
public void setActivo(Boolean activo) {
|
|
this.activo = activo;
|
|
}
|
|
|
|
public Integer getUsuarioId() {
|
|
return usuarioId;
|
|
}
|
|
|
|
public void setUsuarioId(Integer usuarioId) {
|
|
this.usuarioId = usuarioId;
|
|
}
|
|
|
|
public Date getFecmodif() {
|
|
return fecmodif;
|
|
}
|
|
|
|
public void setFecmodif(Date fecmodif) {
|
|
this.fecmodif = fecmodif;
|
|
}
|
|
|
|
public List<EsquemaCorrida> getEsquemaCorridaList() {
|
|
List<EsquemaCorrida> esquemaList = new ArrayList<EsquemaCorrida>();
|
|
for (EsquemaCorrida ec : this.esquemaCorridaList) {
|
|
if (ec.getActivo() == Boolean.TRUE) {
|
|
esquemaList.add(ec);
|
|
}
|
|
}
|
|
return esquemaList;
|
|
}
|
|
|
|
public void setEsquemaCorridaList(List<EsquemaCorrida> esquemaCorridaList) {
|
|
this.esquemaCorridaList = esquemaCorridaList;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
int hash = 0;
|
|
hash += (getEsquemaoperacionalId() != null ? getEsquemaoperacionalId().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 EsquemaOperacional)) {
|
|
return false;
|
|
}
|
|
EsquemaOperacional other = (EsquemaOperacional) object;
|
|
if ((this.getEsquemaoperacionalId() == null && other.getEsquemaoperacionalId() != null) || (this.getEsquemaoperacionalId() != null && !this.getEsquemaoperacionalId().equals(other.getEsquemaoperacionalId()))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "com.rjconsultores.ventaboletos.entidad.test.EsquemaOperacional[esquemaoperacionalId=" + esquemaoperacionalId + "]";
|
|
}
|
|
|
|
@Override
|
|
public void clonar() throws CloneNotSupportedException {
|
|
esquemaOperacionalClone = new EsquemaOperacional();
|
|
esquemaOperacionalClone = (EsquemaOperacional) this.clone();
|
|
|
|
}
|
|
|
|
@Override
|
|
public EsquemaOperacional getCloneObject() throws CloneNotSupportedException {
|
|
return esquemaOperacionalClone;
|
|
}
|
|
|
|
@Override
|
|
public String getTextoInclusaoExclusao() {
|
|
return String.format("ID [%s]", getEsquemaoperacionalId());
|
|
}
|
|
}
|