WorkLoadAllocation.java
package com.tradecloud.domain.workload;
import com.tradecloud.authentication.User;
import com.tradecloud.common.base.PersistenceBase;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
@Entity
@Table(name = "WorkLoadAllocation")
@Access(AccessType.FIELD)
public class WorkLoadAllocation extends PersistenceBase implements Serializable {
@NotNull
@ManyToOne
private WorkLoadRule workLoadRule;
@ManyToOne
private User allocatedUser;
@ManyToOne
private WorkLoadComment comment;
private String entityReference;
private String entityNumber;
private Long orderId;
private Long shipmentId;
@NotNull
@Enumerated(value = EnumType.STRING)
private RuleScope applyTo;
private Date actionedDate;
private String actionedBy;
private int priority;
private String textComment;
// private Date priorityDate;
private Date ruleDate;
private Date dueDate;
public WorkLoadRule getWorkLoadRule() {
return workLoadRule;
}
public void setWorkLoadRule(WorkLoadRule workLoadRule) {
this.workLoadRule = workLoadRule;
}
public User getAllocatedUser() {
return allocatedUser;
}
public void setAllocatedUser(User allocatedUser) {
this.allocatedUser = allocatedUser;
}
public WorkLoadComment getComment() {
return comment;
}
public void setComment(WorkLoadComment comment) {
this.comment = comment;
}
public String getEntityReference() {
return entityReference;
}
public void setEntityReference(String entityReference) {
this.entityReference = entityReference;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Long getShipmentId() {
return shipmentId;
}
public void setShipmentId(Long shipmentId) {
this.shipmentId = shipmentId;
}
public RuleScope getApplyTo() {
return applyTo;
}
public void setApplyTo(RuleScope applyTo) {
this.applyTo = applyTo;
}
public Date getActionedDate() {
return actionedDate;
}
public void setActionedDate(Date actionedDate) {
this.actionedDate = actionedDate;
}
public String getActionedBy() {
return actionedBy;
}
public void setActionedBy(String actionedBy) {
this.actionedBy = actionedBy;
}
public String getEntityNumber() {
return entityNumber;
}
public void setEntityNumber(String entityNumber) {
this.entityNumber = entityNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
WorkLoadAllocation that = (WorkLoadAllocation) o;
return Objects.equals(workLoadRule, that.workLoadRule) && Objects.equals(entityReference, that.entityReference)
&& Objects.equals(orderId, that.orderId)&& Objects.equals(shipmentId, that.shipmentId);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), workLoadRule, entityReference, orderId,shipmentId);
}
public Long getEntityId() {
return Objects.requireNonNullElse(orderId,shipmentId);
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
// public Date getPriorityDate() {
// return priorityDate;
// }
//
// public void setPriorityDate(Date priorityDate) {
// this.priorityDate = priorityDate;
// }
public String getTextComment() {
return textComment;
}
public void setTextComment(String textComment) {
this.textComment = textComment;
}
public Date getRuleDate() {
return ruleDate;
}
public void setRuleDate(Date ruleDate) {
this.ruleDate = ruleDate;
}
public Date getDueDate() {
return dueDate;
}
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
@Override
public String toString() {
return "WorkLoadAllocation{" +
"applyTo=" + applyTo +
", shipmentId=" + shipmentId +
", orderId=" + orderId +
", entityNumber='" + entityNumber + '\'' +
", entityReference='" + entityReference + '\'' +
'}';
}
}