Coverage Report - org.kuali.student.r2.core.organization.dto.OrgTreeInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
OrgTreeInfo
0%
0/96
0%
0/72
3.75
 
 1  
 /*
 2  
  * Copyright 2010 The Kuali Foundation 
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the
 5  
  * "License"); you may not use this file except in compliance with the
 6  
  * License. You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.osedu.org/licenses/ECL-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 13  
  * implied. See the License for the specific language governing
 14  
  * permissions and limitations under the License.
 15  
  */
 16  
 
 17  
 package org.kuali.student.r2.core.organization.dto;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.List;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlAccessType;
 23  
 import javax.xml.bind.annotation.XmlAccessorType;
 24  
 import javax.xml.bind.annotation.XmlAnyElement;
 25  
 import javax.xml.bind.annotation.XmlElement;
 26  
 import javax.xml.bind.annotation.XmlType;
 27  
 
 28  
 import org.kuali.student.r2.core.organization.infc.OrgTree;
 29  
 import org.w3c.dom.Element;
 30  
 
 31  
 
 32  
 @XmlAccessorType(XmlAccessType.FIELD)
 33  
 @XmlType(name = "OrgTreeInfo", propOrder = {
 34  
                 "displayName", "orgHierarchyId", "orgId", "parentId",
 35  
                 "positions", "positionId", "personId", "relationTypeKey",
 36  
                 "_futureElements" })
 37  
 
 38  
 public class OrgTreeInfo 
 39  
     implements OrgTree, Serializable {
 40  
 
 41  
     private static final long serialVersionUID = 7315439355073246895L;
 42  
     
 43  
     @XmlElement
 44  
     private String displayName;
 45  
 
 46  
     @XmlElement
 47  
     private String orgHierarchyId;
 48  
         
 49  
     @XmlElement
 50  
     private String orgId;
 51  
         
 52  
     @XmlElement
 53  
     private String parentId;
 54  
         
 55  
     @XmlElement
 56  
     private Long positions;
 57  
 
 58  
     @XmlElement
 59  
     private String positionId;
 60  
         
 61  
     @XmlElement
 62  
     private String personId;
 63  
         
 64  
     @XmlElement
 65  
     private String relationTypeKey;
 66  
         
 67  
     @XmlAnyElement
 68  
     private List<Element> _futureElements;
 69  
 
 70  
 
 71  
     /**
 72  
      * Constructs a new OrgTreeInfo.
 73  
      */
 74  0
     public OrgTreeInfo() {
 75  0
     }
 76  
     
 77  
     /**
 78  
      * Constructs a new OrgTreeInfo from another OrgTree
 79  
      *
 80  
      * @param orgTree the org tree to copy
 81  
      */
 82  0
     public OrgTreeInfo(OrgTree tree) {
 83  0
         if (tree != null) {
 84  0
             this.displayName = tree.getDisplayName();
 85  0
             this.orgHierarchyId = tree.getOrgHierarchyId();
 86  0
             this.orgId = tree.getOrgId();
 87  0
             this.parentId = tree.getParentId();
 88  0
             this.positions = tree.getPositions();
 89  0
             this.positionId = tree.getPositionId();
 90  0
             this.personId = tree.getPersonId();
 91  0
             this.relationTypeKey = tree.getRelationTypeKey();
 92  
         }
 93  0
     }        
 94  
         
 95  
     @Override
 96  
     public String getDisplayName() {
 97  0
         return displayName;
 98  
     }
 99  
     
 100  
     public void setDisplayName(String displayName) {
 101  0
         this.displayName = displayName;
 102  0
     }
 103  
 
 104  
     @Override
 105  
     public String getOrgHierarchyId() {
 106  0
         return orgHierarchyId;
 107  
     }
 108  
     
 109  
     public void setOrgHierarchyId(String orgHierarchyId) {
 110  0
         this.orgHierarchyId = orgHierarchyId;
 111  0
     }
 112  
 
 113  
     @Override
 114  
     public String getOrgId() {
 115  0
         return orgId;
 116  
     }
 117  
         
 118  
     public void setOrgId(String orgId) {
 119  0
         this.orgId = orgId;
 120  0
     }
 121  
 
 122  
     @Override
 123  
     public String getParentId() {
 124  0
         return parentId;
 125  
     }
 126  
     
 127  
     public void setParentId(String parentId) {
 128  0
         this.parentId = parentId;
 129  0
     }
 130  
     
 131  
     @Override
 132  
     public Long getPositions(){
 133  0
         return positions;
 134  
     }
 135  
     
 136  
     public void setPositions(Long positions){
 137  0
         this.positions = positions;
 138  0
     }
 139  
 
 140  
     @Override
 141  
     public String getPositionId() {
 142  0
         return positionId;
 143  
     }
 144  
 
 145  
     public void setPositionId(String positionId) {
 146  0
         this.positionId = positionId;
 147  0
     }
 148  
     
 149  
     @Override
 150  
     public String getPersonId() {
 151  0
         return personId;
 152  
     }
 153  
     
 154  
     public void setPersonId(String personId) {
 155  0
         this.positionId = personId;
 156  0
     }
 157  
     
 158  
     @Override
 159  
     public String getRelationTypeKey() {
 160  0
         return relationTypeKey;
 161  
     }
 162  
 
 163  
     public void setRelationTypeKey(String relationTypeKey) {
 164  0
         this.relationTypeKey = relationTypeKey;
 165  0
     }    
 166  
 
 167  
 
 168  
     /*
 169  
      * The hashCode() and equals() methodos are here because the
 170  
      * current Organization service implementation uses a HashSet for
 171  
      * assembling OrgTrees. It isn't really a tree of Orgs but more of
 172  
      * a denormalized mash of information.
 173  
      */
 174  
     @Override
 175  
     public int hashCode() {
 176  0
         final int prime = 31;
 177  0
         int result = 1;
 178  0
         result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
 179  0
         result = prime * result + ((orgHierarchyId == null) ? 0 : orgHierarchyId.hashCode());
 180  0
         result = prime * result + ((orgId == null) ? 0 : orgId.hashCode());
 181  0
         result = prime * result + ((parentId == null) ? 0 : parentId.hashCode());
 182  0
         result = prime * result + ((positions == null) ? 0 : positions.hashCode());
 183  0
         result = prime * result + ((positionId == null) ? 0 : positionId.hashCode());
 184  0
         result = prime * result + ((personId == null) ? 0 : personId.hashCode());
 185  0
         result = prime * result + ((relationTypeKey == null) ? 0 : relationTypeKey.hashCode());
 186  0
         return result;
 187  
     }
 188  
 
 189  
     @Override
 190  
     public boolean equals(Object obj) {
 191  0
         if (this == obj) {
 192  0
             return true;
 193  
         }
 194  
 
 195  0
         if (obj == null) {
 196  0
             return false;
 197  
         }
 198  
 
 199  0
         if (getClass() != obj.getClass()) {
 200  0
             return false;
 201  
         }
 202  
 
 203  0
         OrgTreeInfo other = (OrgTreeInfo) obj;
 204  
         
 205  0
         if (displayName == null) {
 206  0
             if (other.getDisplayName() != null) {
 207  0
                 return false;
 208  
             }
 209  0
         } else if (!displayName.equals(other.getDisplayName())) {
 210  0
             return false;
 211  
         }
 212  
         
 213  0
         if (orgHierarchyId == null) {
 214  0
             if (other.getOrgHierarchyId() != null) {
 215  0
                 return false;
 216  
             }
 217  0
         } else if (!orgHierarchyId.equals(other.getOrgHierarchyId())) {
 218  0
             return false;
 219  
         }
 220  
 
 221  0
         if (orgId == null) {
 222  0
             if (other.getOrgId() != null) {
 223  0
                 return false;
 224  
             }
 225  0
         } else if (!orgId.equals(other.getOrgId())) {
 226  0
             return false;
 227  
         }
 228  
 
 229  0
         if (parentId == null) {
 230  0
             if (other.getParentId() != null) {
 231  0
                 return false;
 232  
             }
 233  0
         } else if (!parentId.equals(other.getParentId())) {
 234  0
             return false;
 235  
         }
 236  
 
 237  0
         if (positions == null) {
 238  0
             if (other.getPositions() != null) {
 239  0
                 return false;
 240  
             }
 241  0
         } else if (!positions.equals(other.getPositions())) {
 242  0
             return false;
 243  
         }
 244  
 
 245  0
         if (positionId == null) {
 246  0
             if (other.getPositionId() != null) {
 247  0
                 return false;
 248  
             }
 249  0
         } else if (!positionId.equals(other.getPositionId())) {
 250  0
             return false;
 251  
         }
 252  
 
 253  0
         if (personId == null) {
 254  0
             if (other.getPersonId() != null) {
 255  0
                 return false;
 256  
             }
 257  0
         } else if (!personId.equals(other.getPersonId())) {
 258  0
             return false;
 259  
         }
 260  
 
 261  0
         if (relationTypeKey == null) {
 262  0
             if (other.getRelationTypeKey() != null) {
 263  0
                 return false;
 264  
             }
 265  0
         } else if (!relationTypeKey.equals(other.getRelationTypeKey())) {
 266  0
             return false;
 267  
         }
 268  
         
 269  0
         return true;
 270  
     }
 271  
 }