package com.plannaplan.entities; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; /** * Entity of Assignment grouping of state associated about group_id and * commision_id * */ @Entity public class Assignment { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToOne @JoinColumn(name = "group_id") private Groups group; @ManyToOne @JoinColumn(name = "commision_id") private Commision commision; private boolean isPastAssignment; /** * Assignment * * @param group group we would like to assign * @param commision commision that assignment belongs to * @param isPastAssignment is assignment past or no */ public Assignment(Groups group, Commision commision, boolean isPastAssignment) { this.commision = commision; this.group = group; } /** * If it returns trues it mesans u are assigned to group accepted by algorythm * * @return boolean isAccepted */ public boolean isAccepted() { return this.group.getRegisteredStudents().contains(this.commision.getCommisionOwner()); } /** * Assignment * * @param group group we would like to assign * @param commision commision that assignment belongs to */ public Assignment(Groups group, Commision commision) { this(group, commision, false); } public Assignment() { } /** * Id getter * * @return id id of assignment */ public Long getId() { return this.id; } /** * getGroup * * @return group */ public Groups getGroup() { return this.group; } /** * isPastAssignment getter * * @return isPastAssignment */ public boolean isPastAssignment() { return isPastAssignment; } /** * setter isPastAssignment * * @param isPastAssignment is assignment past or not */ public void setPastAssignment(boolean isPastAssignment) { this.isPastAssignment = isPastAssignment; } }