Coverage Report - org.kuali.student.core.organization.entity.OrgPersonRelation
 
Classes in this File Line Coverage Branch Coverage Complexity
OrgPersonRelation
100%
22/22
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.Date;
 19  
 import java.util.List;
 20  
 
 21  
 import javax.persistence.CascadeType;
 22  
 import javax.persistence.Column;
 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.Temporal;
 31  
 import javax.persistence.TemporalType;
 32  
 import javax.persistence.UniqueConstraint;
 33  
 
 34  
 import org.kuali.student.core.entity.AttributeOwner;
 35  
 import org.kuali.student.core.entity.MetaEntity;
 36  
 
 37  
 @Entity
 38  
 @Table(name = "KSOR_ORG_PERS_RELTN", uniqueConstraints={@UniqueConstraint(columnNames={"ORG_PERS_RELTN_TYPE","ORG","PERS_ID"})})
 39  
 @NamedQueries( {
 40  
                 @NamedQuery(name = "OrgPersonRelation.getAllOrgPersonRelationsByOrg", query = "SELECT distinct opr FROM OrgPersonRelation opr WHERE opr.org.id = :orgId"),
 41  
                 @NamedQuery(name = "OrgPersonRelation.getAllOrgPersonRelationsByPerson", query = "SELECT distinct opr FROM OrgPersonRelation opr WHERE opr.personId = :personId"),
 42  
                 @NamedQuery(name = "OrgPersonRelation.getOrgPersonRelationsByIdList", query = "SELECT  opr FROM OrgPersonRelation opr WHERE opr.id IN (:idList)"),
 43  
                 @NamedQuery(name = "OrgPersonRelation.getOrgPersonRelationsByPerson", query = "SELECT  opr FROM OrgPersonRelation opr WHERE opr.personId = :personId AND opr.org.id = :orgId"),
 44  
                 @NamedQuery(name = "OrgPersonRelation.getOrgMembershipCount", query = "SELECT COUNT(opr) FROM OrgPersonRelation opr WHERE opr.org.id= :orgId")})
 45  14
 public class OrgPersonRelation extends MetaEntity implements
 46  
                 AttributeOwner<OrgPersonRelationAttribute> {
 47  
 
 48  
         @ManyToOne
 49  
         @JoinColumn(name = "ORG")
 50  
         private Org org;
 51  
 
 52  
         // Foreign Key from external Service
 53  
         @Column(name = "PERS_ID")
 54  
         private String personId;
 55  
 
 56  
         @ManyToOne
 57  
         @JoinColumn(name = "ORG_PERS_RELTN_TYPE")
 58  
         private OrgPersonRelationType orgPersonRelationType;
 59  
 
 60  
         @Temporal(TemporalType.TIMESTAMP)
 61  
         @Column(name = "EFF_DT")
 62  
         private Date effectiveDate;
 63  
 
 64  
         @Temporal(TemporalType.TIMESTAMP)
 65  
         @Column(name = "EXPIR_DT")
 66  
         private Date expirationDate;
 67  
 
 68  
         @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
 69  
         private List<OrgPersonRelationAttribute> attributes;
 70  
 
 71  
         @Column(name = "ST")
 72  
         private String state;
 73  
 
 74  
         @Override
 75  
         public List<OrgPersonRelationAttribute> getAttributes() {
 76  16
                 return attributes;
 77  
         }
 78  
 
 79  
         @Override
 80  
         public void setAttributes(List<OrgPersonRelationAttribute> attributes) {
 81  2
                 this.attributes = attributes;
 82  2
         }
 83  
 
 84  
         public Org getOrg() {
 85  13
                 return org;
 86  
         }
 87  
 
 88  
         public void setOrg(Org org) {
 89  1
                 this.org = org;
 90  1
         }
 91  
 
 92  
         public String getPersonId() {
 93  13
                 return personId;
 94  
         }
 95  
 
 96  
         public void setPersonId(String personId) {
 97  1
                 this.personId = personId;
 98  1
         }
 99  
 
 100  
         public Date getEffectiveDate() {
 101  13
                 return effectiveDate;
 102  
         }
 103  
 
 104  
         public void setEffectiveDate(Date effectiveDate) {
 105  1
                 this.effectiveDate = effectiveDate;
 106  1
         }
 107  
 
 108  
         public Date getExpirationDate() {
 109  13
                 return expirationDate;
 110  
         }
 111  
 
 112  
         public void setExpirationDate(Date expirationDate) {
 113  1
                 this.expirationDate = expirationDate;
 114  1
         }
 115  
 
 116  
         public OrgPersonRelationType getType() {
 117  13
                 return orgPersonRelationType;
 118  
         }
 119  
 
 120  
         public void setType(OrgPersonRelationType type) {
 121  1
                 this.orgPersonRelationType = type;
 122  1
         }
 123  
 
 124  
         public String getState() {
 125  13
                 return state;
 126  
         }
 127  
 
 128  
         public void setState(String state) {
 129  1
                 this.state = state;
 130  1
         }
 131  
 
 132  
 }