Coverage Report - org.kuali.rice.kim.bo.reference.dto.KimCodeInfoBase
 
Classes in this File Line Coverage Branch Coverage Complexity
KimCodeInfoBase
0%
0/31
0%
0/10
1.429
 
 1  
 /*
 2  
  * Copyright 2007-2009 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 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 implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kim.bo.reference.dto;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.kim.bo.reference.KimCode;
 20  
 import org.kuali.rice.krad.bo.KualiCode;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlTransient;
 23  
 
 24  
 /**
 25  
  * This is a description of what this class does - jonathan don't forget to fill this in. 
 26  
  * 
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  */
 29  
 public abstract class KimCodeInfoBase implements KimCode {
 30  
 
 31  
         private static final long serialVersionUID = 3391418027677414695L;
 32  
 
 33  
         protected String code;
 34  
     protected String name;
 35  
     protected boolean active;
 36  0
     protected String displaySortCode = "";
 37  
         
 38  
     public KimCodeInfoBase() {
 39  0
                 super();
 40  0
                 active = true;
 41  0
         }
 42  
 
 43  
     public KimCodeInfoBase(KimCode kimCode) {
 44  0
                 this();
 45  0
                 if ( kimCode != null ) {
 46  0
                         this.code = (kimCode.getCode() != null) ? kimCode.getCode() : "";
 47  0
                         this.name = (kimCode.getName() != null) ? kimCode.getName() : "";
 48  0
                         this.displaySortCode = "";
 49  
                 }
 50  0
         }
 51  
 
 52  
         /**
 53  
          * @return the code
 54  
          */
 55  
         @XmlTransient
 56  
         public String getCode() {
 57  0
                 return this.code;
 58  
         }
 59  
 
 60  
         /**
 61  
          * @param code the code to set
 62  
          */
 63  
         public void setCode(String code) {
 64  0
                 this.code = code;
 65  0
         }
 66  
 
 67  
         /**
 68  
          * @return the name
 69  
          */
 70  
         @XmlTransient
 71  
         public String getName() {
 72  0
                 return this.name;
 73  
         }
 74  
 
 75  
         /**
 76  
          * @param name the name to set
 77  
          */
 78  
         public void setName(String name) {
 79  0
                 this.name = name;
 80  0
         }
 81  
 
 82  
         /**
 83  
          * This overridden method ...
 84  
          * 
 85  
          * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
 86  
          */
 87  
         @Override
 88  
         public String toString() {
 89  0
                 return getClass().getSimpleName() + ":" + getCode() + " - " + getName(); 
 90  
         }
 91  
 
 92  
         /**
 93  
          * @see org.kuali.core.bo.KualiCode#isActive()
 94  
          */
 95  
         public boolean isActive() {
 96  0
                 return active;
 97  
         }
 98  
 
 99  
         /**
 100  
          * @see org.kuali.core.bo.KualiCode#setActive(boolean)
 101  
          */
 102  
         public void setActive(boolean active) {
 103  0
                 this.active = active;
 104  0
         }
 105  
 
 106  
     /**
 107  
      * Implements equals comparing code to code.
 108  
      * 
 109  
      * @see java.lang.Object#equals(java.lang.Object)
 110  
      */
 111  
     public boolean equals(Object obj) {
 112  0
         if (obj instanceof KualiCode) {
 113  0
             return StringUtils.equals(this.getCode(), ((KualiCode) obj).getCode());
 114  
         }
 115  0
         return false;
 116  
     }
 117  
 
 118  
     /**
 119  
      * Overriding equals requires writing a hashCode method.
 120  
      * 
 121  
      * @see java.lang.Object#hashCode()
 122  
      */
 123  
     public int hashCode() {
 124  0
         int hashCode = 0;
 125  
 
 126  0
         if (getCode() != null) {
 127  0
             hashCode = getCode().hashCode();
 128  
         }
 129  
 
 130  0
         return hashCode;
 131  
     }
 132  
 
 133  
         /**
 134  
          * @return the displaySortCode
 135  
          */
 136  
         public String getDisplaySortCode() {
 137  0
                 return this.displaySortCode;
 138  
         }
 139  
 
 140  
         /**
 141  
          * @param displaySortCode the displaySortCode to set
 142  
          */
 143  
         public void setDisplaySortCode(String displaySortCode) {
 144  0
                 this.displaySortCode = displaySortCode;
 145  0
         }        
 146  
 
 147  0
         public void refresh() {}
 148  
 }