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