src/main/java/is/surreal/ppr/model/Notification.java
/*
* Project Puerto Rico
* Copyright (C) 2018 Thomas Pötzsch, Stephan Stroh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package is.surreal.ppr.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
@Entity
public class Notification {
private Long id;
private String message;
private Long operationId;
private Operation operationByOperationId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Basic
@Column(name = "message")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Basic
@Column(name = "operation_id")
public Long getOperationId() {
return operationId;
}
public void setOperationId(Long operationId) {
this.operationId = operationId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Notification notification = (Notification) o;
if (id != notification.id) return false;
if (message != null ? !message.equals(notification.message) : notification.message != null) return false;
if (operationId != null ? !operationId.equals(notification.operationId) : notification.operationId != null)
return false;
return true;
}
@ManyToOne
@JoinColumn(name = "operation_id", referencedColumnName = "id", insertable = false, updatable = false)
@JsonIgnore
public Operation getOperationByOperationId() {
return operationByOperationId;
}
public void setOperationByOperationId(Operation operationByOperationId) {
this.operationByOperationId = operationByOperationId;
}
}