/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.acg.db.entities; import com.acg.enums.ExcelFormat; import java.io.Serializable; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import java.util.Objects; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; 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; /** * * @author mhi */ @Entity @Table(name = "PROJECT") @SequenceGenerator(name = "PROJECT_SEQUENCE", sequenceName = "PROJECT_SEQUENCE", allocationSize = 1, initialValue = 0) @SuppressWarnings({"PersistenceUnitPresent", "ValidAttributes"}) public class Project implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PROJECT_SEQUENCE") private Long id; private String projectName; private ExcelFormat excelFormat; @Temporal(TemporalType.TIMESTAMP) private Timestamp timestamp; // GUI private boolean editable; private String color; // Datapoints @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy="project",fetch = FetchType.LAZY) private List datapoint; // Advalms @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy="project",fetch = FetchType.LAZY) private List advalm; public Project() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public boolean isEditable() { return editable; } public List getAdvalm() { return advalm; } public void setAdvalm(List advalm) { this.advalm = advalm; } public void setEditable(boolean editable) { this.editable = editable; } public String getProjectName() { return projectName; } public void setProjectName(String projectName) { this.projectName = projectName; } public ExcelFormat getExcelFormat() { return excelFormat; } public void setExcelFormat(ExcelFormat excelFormat) { this.excelFormat = excelFormat; } public Timestamp getTimestamp() { return timestamp; } public void setTimestamp(Timestamp timestamp) { this.timestamp = timestamp; } public List getDatapoint() { return datapoint; } public void setDatapoint(List datapoint) { this.datapoint = datapoint; } @Override public String toString() { return String.valueOf(id); } @Override public boolean equals(Object obj) { Project project = null; boolean valid = false; if (obj instanceof Project) { project = (Project) obj; valid = (project.getId().equals(this.id)); } return valid; } @Override public int hashCode() { int hash = 7; hash = 29 * hash + Objects.hashCode(this.id); return hash; } }