| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |   | 
  | 10 |  |   | 
  | 11 |  |   | 
  | 12 |  |   | 
  | 13 |  |   | 
  | 14 |  |   | 
  | 15 |  |   | 
  | 16 |  |  package org.kuali.student.core.organization.entity; | 
  | 17 |  |   | 
  | 18 |  |  import java.util.List; | 
  | 19 |  |   | 
  | 20 |  |  import javax.persistence.CascadeType; | 
  | 21 |  |  import javax.persistence.Column; | 
  | 22 |  |  import javax.persistence.Embedded; | 
  | 23 |  |  import javax.persistence.Entity; | 
  | 24 |  |  import javax.persistence.JoinColumn; | 
  | 25 |  |  import javax.persistence.ManyToOne; | 
  | 26 |  |  import javax.persistence.NamedQueries; | 
  | 27 |  |  import javax.persistence.NamedQuery; | 
  | 28 |  |  import javax.persistence.OneToMany; | 
  | 29 |  |  import javax.persistence.Table; | 
  | 30 |  |  import javax.persistence.UniqueConstraint; | 
  | 31 |  |   | 
  | 32 |  |  import org.kuali.student.core.entity.AttributeOwner; | 
  | 33 |  |  import org.kuali.student.core.entity.KSEntityConstants; | 
  | 34 |  |  import org.kuali.student.core.entity.MetaEntity; | 
  | 35 |  |  import org.kuali.student.core.entity.TimeAmount; | 
  | 36 |  |   | 
  | 37 |  |  @Entity | 
  | 38 |  |  @Table(name = "KSOR_ORG_POS_RESTR",  | 
  | 39 |  |          uniqueConstraints={@UniqueConstraint(columnNames={"ORG","PERS_RELTN_TYPE"})}) | 
  | 40 |  |  @NamedQueries( { | 
  | 41 |  |                  @NamedQuery(name = "OrgPositionRestriction.findOrgPositionRestrictions", query = "SELECT opr FROM OrgPositionRestriction opr WHERE opr.org.id = :orgId"), | 
  | 42 |  |                  @NamedQuery(name = "OrgPositionRestriction.validatePositionRestriction", query = "SELECT COUNT(opr) " | 
  | 43 |  |                                  + "   FROM OrgPositionRestriction opr " | 
  | 44 |  |                                  + "  WHERE opr.org.id = :orgId " | 
  | 45 |  |                                  + "    AND opr.personRelationType.id = :orgPersonRelationTypeKey"), | 
  | 46 |  |                  @NamedQuery(name = "OrgPositionRestriction.getPositionRestrictionByOrgAndPersonRelationTypeKey", query = "SELECT opr FROM OrgPositionRestriction opr JOIN opr.personRelationType oprt WHERE opr.org.id = :orgId AND oprt.id = :orgPersonRelationTypeKey") }) | 
  | 47 | 0 |  public class OrgPositionRestriction extends MetaEntity implements | 
  | 48 |  |                  AttributeOwner<OrgPositionRestrictionAttribute> { | 
  | 49 |  |   | 
  | 50 |  |          @ManyToOne | 
  | 51 |  |          @JoinColumn(name = "ORG") | 
  | 52 |  |          private Org org; | 
  | 53 |  |   | 
  | 54 |  |          @ManyToOne | 
  | 55 |  |          @JoinColumn(name = "PERS_RELTN_TYPE") | 
  | 56 |  |          private OrgPersonRelationType personRelationType; | 
  | 57 |  |   | 
  | 58 |  |          @Column(name = "DESCR", length = KSEntityConstants.LONG_TEXT_LENGTH) | 
  | 59 |  |          private String descr; | 
  | 60 |  |   | 
  | 61 |  |          @Column(name = "TTL") | 
  | 62 |  |          private String title; | 
  | 63 |  |   | 
  | 64 |  |          @Embedded | 
  | 65 |  |          private TimeAmount stdDuration; | 
  | 66 |  |   | 
  | 67 |  |          @Column(name = "MIN_NUM_RELTN") | 
  | 68 |  |          private Integer minNumRelations; | 
  | 69 |  |   | 
  | 70 |  |          @Column(name = "MAX_NUM_RELTN") | 
  | 71 |  |          private String maxNumRelations; | 
  | 72 |  |   | 
  | 73 |  |          @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") | 
  | 74 |  |          private List<OrgPositionRestrictionAttribute> attributes; | 
  | 75 |  |   | 
  | 76 |  |          public String getDescr() { | 
  | 77 | 0 |                  return descr; | 
  | 78 |  |          } | 
  | 79 |  |   | 
  | 80 |  |          public void setDescr(String descr) { | 
  | 81 | 0 |                  this.descr = descr; | 
  | 82 | 0 |          } | 
  | 83 |  |   | 
  | 84 |  |          public String getTitle() { | 
  | 85 | 0 |                  return title; | 
  | 86 |  |          } | 
  | 87 |  |   | 
  | 88 |  |          public void setTitle(String title) { | 
  | 89 | 0 |                  this.title = title; | 
  | 90 | 0 |          } | 
  | 91 |  |   | 
  | 92 |  |          public TimeAmount getStdDuration() { | 
  | 93 | 0 |                  return stdDuration; | 
  | 94 |  |          } | 
  | 95 |  |   | 
  | 96 |  |          public void setStdDuration(TimeAmount stdDuration) { | 
  | 97 | 0 |                  this.stdDuration = stdDuration; | 
  | 98 | 0 |          } | 
  | 99 |  |   | 
  | 100 |  |          public Integer getMinNumRelations() { | 
  | 101 | 0 |                  return minNumRelations; | 
  | 102 |  |          } | 
  | 103 |  |   | 
  | 104 |  |          public void setMinNumRelations(Integer minNumRelations) { | 
  | 105 | 0 |                  this.minNumRelations = minNumRelations; | 
  | 106 | 0 |          } | 
  | 107 |  |   | 
  | 108 |  |          public String getMaxNumRelations() { | 
  | 109 | 0 |                  return maxNumRelations; | 
  | 110 |  |          } | 
  | 111 |  |   | 
  | 112 |  |          public void setMaxNumRelations(String maxNumRelations) { | 
  | 113 | 0 |                  this.maxNumRelations = maxNumRelations; | 
  | 114 | 0 |          } | 
  | 115 |  |   | 
  | 116 |  |          @Override | 
  | 117 |  |          public List<OrgPositionRestrictionAttribute> getAttributes() { | 
  | 118 | 0 |                  return attributes; | 
  | 119 |  |          } | 
  | 120 |  |   | 
  | 121 |  |          @Override | 
  | 122 |  |          public void setAttributes(List<OrgPositionRestrictionAttribute> attributes) { | 
  | 123 | 0 |                  this.attributes = attributes; | 
  | 124 | 0 |          } | 
  | 125 |  |   | 
  | 126 |  |          public Org getOrg() { | 
  | 127 | 0 |                  return org; | 
  | 128 |  |          } | 
  | 129 |  |   | 
  | 130 |  |          public void setOrg(Org org) { | 
  | 131 | 0 |                  this.org = org; | 
  | 132 | 0 |          } | 
  | 133 |  |   | 
  | 134 |  |          public OrgPersonRelationType getPersonRelationType() { | 
  | 135 | 0 |                  return personRelationType; | 
  | 136 |  |          } | 
  | 137 |  |   | 
  | 138 |  |          public void setPersonRelationType(OrgPersonRelationType personRelationType) { | 
  | 139 | 0 |                  this.personRelationType = personRelationType; | 
  | 140 | 0 |          } | 
  | 141 |  |   | 
  | 142 |  |  } |