br.com.utfpr.porta.modelo.Log Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tcc-porta-servico Show documentation
Show all versions of tcc-porta-servico Show documentation
Projeto serviço que realiza acesso ao banco de dados para o projeto API e web
The newest version!
package br.com.utfpr.porta.modelo;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name = "log")
public class Log implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String acao;
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm:ss")
@Column(name = "data_hora")
private LocalDateTime dataHora;
@ManyToOne
@JoinColumn(name = "codigo_estabelecimento")
private Estabelecimento estabelecimento;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAcao() {
return acao;
}
public void setAcao(String acao) {
this.acao = acao;
}
public LocalDateTime getDataHora() {
return dataHora;
}
public void setDataHora(LocalDateTime dataHora) {
this.dataHora = dataHora;
}
public String getDataHoraFormatado() {
if(dataHora != null) {
DateTimeFormatter formatador = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
return dataHora.format(formatador);
}
return "";
}
public Estabelecimento getEstabelecimento() {
return estabelecimento;
}
public void setEstabelecimento(Estabelecimento estabelecimento) {
this.estabelecimento = estabelecimento;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Log other = (Log) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy