Coverage Report - org.kuali.student.core.organization.entity.OrgPositionRestriction
 
Classes in this File Line Coverage Branch Coverage Complexity
OrgPositionRestriction
100%
25/25
N/A
1
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 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.common.entity.AttributeOwner;
 33  
 import org.kuali.student.common.entity.KSEntityConstants;
 34  
 import org.kuali.student.common.entity.MetaEntity;
 35  
 import org.kuali.student.common.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  5
 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  4
                 return descr;
 78  
         }
 79  
 
 80  
         public void setDescr(String descr) {
 81  2
                 this.descr = descr;
 82  2
         }
 83  
 
 84  
         public String getTitle() {
 85  4
                 return title;
 86  
         }
 87  
 
 88  
         public void setTitle(String title) {
 89  2
                 this.title = title;
 90  2
         }
 91  
 
 92  
         public TimeAmount getStdDuration() {
 93  10
                 return stdDuration;
 94  
         }
 95  
 
 96  
         public void setStdDuration(TimeAmount stdDuration) {
 97  2
                 this.stdDuration = stdDuration;
 98  2
         }
 99  
 
 100  
         public Integer getMinNumRelations() {
 101  4
                 return minNumRelations;
 102  
         }
 103  
 
 104  
         public void setMinNumRelations(Integer minNumRelations) {
 105  2
                 this.minNumRelations = minNumRelations;
 106  2
         }
 107  
 
 108  
         public String getMaxNumRelations() {
 109  4
                 return maxNumRelations;
 110  
         }
 111  
 
 112  
         public void setMaxNumRelations(String maxNumRelations) {
 113  2
                 this.maxNumRelations = maxNumRelations;
 114  2
         }
 115  
 
 116  
         @Override
 117  
         public List<OrgPositionRestrictionAttribute> getAttributes() {
 118  10
                 return attributes;
 119  
         }
 120  
 
 121  
         @Override
 122  
         public void setAttributes(List<OrgPositionRestrictionAttribute> attributes) {
 123  4
                 this.attributes = attributes;
 124  4
         }
 125  
 
 126  
         public Org getOrg() {
 127  4
                 return org;
 128  
         }
 129  
 
 130  
         public void setOrg(Org org) {
 131  2
                 this.org = org;
 132  2
         }
 133  
 
 134  
         public OrgPersonRelationType getPersonRelationType() {
 135  4
                 return personRelationType;
 136  
         }
 137  
 
 138  
         public void setPersonRelationType(OrgPersonRelationType personRelationType) {
 139  2
                 this.personRelationType = personRelationType;
 140  2
         }
 141  
 
 142  
 }