Coverage Report - org.kuali.rice.kim.api.identity.citizenship.EntityCitizenship
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityCitizenship
0%
0/34
0%
0/2
1.182
EntityCitizenship$1
N/A
N/A
1.182
EntityCitizenship$Builder
0%
0/48
0%
0/6
1.182
EntityCitizenship$Constants
0%
0/1
N/A
1.182
EntityCitizenship$Elements
0%
0/1
N/A
1.182
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.api.identity.citizenship;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.joda.time.DateTime;
 20  
 import org.kuali.rice.core.api.CoreConstants;
 21  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 22  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 23  
 import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
 24  
 import org.kuali.rice.kim.api.identity.CodedAttribute;
 25  
 import org.w3c.dom.Element;
 26  
 
 27  
 import javax.xml.bind.annotation.XmlAccessType;
 28  
 import javax.xml.bind.annotation.XmlAccessorType;
 29  
 import javax.xml.bind.annotation.XmlAnyElement;
 30  
 import javax.xml.bind.annotation.XmlElement;
 31  
 import javax.xml.bind.annotation.XmlRootElement;
 32  
 import javax.xml.bind.annotation.XmlType;
 33  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 34  
 import java.io.Serializable;
 35  
 import java.util.Collection;
 36  
 
 37  0
 @XmlRootElement(name = EntityCitizenship.Constants.ROOT_ELEMENT_NAME)
 38  
 @XmlAccessorType(XmlAccessType.NONE)
 39  
 @XmlType(name = EntityCitizenship.Constants.TYPE_NAME, propOrder = {
 40  
     EntityCitizenship.Elements.ID,
 41  
     EntityCitizenship.Elements.ENTITY_ID,
 42  
     EntityCitizenship.Elements.STATUS,
 43  
     EntityCitizenship.Elements.COUNTRY_CODE,
 44  
     EntityCitizenship.Elements.START_DATE,
 45  
     EntityCitizenship.Elements.END_DATE,
 46  
     CoreConstants.CommonElements.VERSION_NUMBER,
 47  
     CoreConstants.CommonElements.OBJECT_ID,
 48  
     EntityCitizenship.Elements.ACTIVE,
 49  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 50  
 })
 51  0
 public final class EntityCitizenship extends AbstractDataTransferObject
 52  
     implements EntityCitizenshipContract
 53  
 {
 54  
     @XmlElement(name = Elements.ID, required = false)
 55  
     private final String id;
 56  
     @XmlElement(name = Elements.ENTITY_ID, required = false)
 57  
     private final String entityId;
 58  
     @XmlElement(name = Elements.STATUS, required = false)
 59  
     private final CodedAttribute status;
 60  
     @XmlElement(name = Elements.COUNTRY_CODE, required = false)
 61  
     private final String countryCode;
 62  
     @XmlJavaTypeAdapter(DateTimeAdapter.class)
 63  
     @XmlElement(name = Elements.START_DATE, required = false)
 64  
     private final DateTime startDate;
 65  
     @XmlJavaTypeAdapter(DateTimeAdapter.class)
 66  
     @XmlElement(name = Elements.END_DATE, required = false)
 67  
     private final DateTime endDate;
 68  
     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
 69  
     private final Long versionNumber;
 70  
     @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
 71  
     private final String objectId;
 72  
     @XmlElement(name = Elements.ACTIVE, required = false)
 73  
     private final boolean active;
 74  0
     @SuppressWarnings("unused")
 75  
     @XmlAnyElement
 76  
     private final Collection<Element> _futureElements = null;
 77  
 
 78  
     /**
 79  
      * Private constructor used only by JAXB.
 80  
      * 
 81  
      */
 82  0
     private EntityCitizenship() {
 83  0
         this.status = null;
 84  0
         this.countryCode = null;
 85  0
         this.startDate = null;
 86  0
         this.endDate = null;
 87  0
         this.versionNumber = null;
 88  0
         this.objectId = null;
 89  0
         this.active = false;
 90  0
         this.id = null;
 91  0
         this.entityId = null;
 92  0
     }
 93  
 
 94  0
     private EntityCitizenship(Builder builder) {
 95  0
         this.status = builder.getStatus() != null ? builder.getStatus().build() : null;
 96  0
         this.countryCode = builder.getCountryCode();
 97  0
         this.startDate = builder.getStartDate();
 98  0
         this.endDate = builder.getEndDate();
 99  0
         this.versionNumber = builder.getVersionNumber();
 100  0
         this.objectId = builder.getObjectId();
 101  0
         this.active = builder.isActive();
 102  0
         this.id = builder.getId();
 103  0
         this.entityId = builder.getEntityId();
 104  0
     }
 105  
 
 106  
     @Override
 107  
     public String getEntityId() {
 108  0
         return this.entityId;
 109  
     }
 110  
 
 111  
     @Override
 112  
     public CodedAttribute getStatus() {
 113  0
         return this.status;
 114  
     }
 115  
 
 116  
     @Override
 117  
     public String getCountryCode() {
 118  0
         return this.countryCode;
 119  
     }
 120  
 
 121  
     @Override
 122  
     public DateTime getStartDate() {
 123  0
         return this.startDate;
 124  
     }
 125  
 
 126  
     @Override
 127  
     public DateTime getEndDate() {
 128  0
         return this.endDate;
 129  
     }
 130  
 
 131  
     @Override
 132  
     public Long getVersionNumber() {
 133  0
         return this.versionNumber;
 134  
     }
 135  
 
 136  
     @Override
 137  
     public String getObjectId() {
 138  0
         return this.objectId;
 139  
     }
 140  
 
 141  
     @Override
 142  
     public boolean isActive() {
 143  0
         return this.active;
 144  
     }
 145  
 
 146  
     @Override
 147  
     public String getId() {
 148  0
         return this.id;
 149  
     }
 150  
 
 151  
     /**
 152  
      * A builder which can be used to construct {@link EntityCitizenship} instances.  Enforces the constraints of the {@link EntityCitizenshipContract}.
 153  
      * 
 154  
      */
 155  0
     public final static class Builder
 156  
         implements Serializable, ModelBuilder, EntityCitizenshipContract
 157  
     {
 158  
         private String entityId;
 159  
         private CodedAttribute.Builder status;
 160  
         private String countryCode;
 161  
         private DateTime startDate;
 162  
         private DateTime endDate;
 163  
         private Long versionNumber;
 164  
         private String objectId;
 165  
         private boolean active;
 166  
         private String id;
 167  
 
 168  0
         private Builder() {
 169  0
         }
 170  
 
 171  
         public static Builder create() {
 172  0
             return new Builder();
 173  
         }
 174  
 
 175  
         public static Builder create(EntityCitizenshipContract contract) {
 176  0
             if (contract == null) {
 177  0
                 throw new IllegalArgumentException("contract was null");
 178  
             }
 179  0
             Builder builder = create();
 180  0
             builder.setEntityId(contract.getEntityId());
 181  0
             if (contract.getStatus() != null) {
 182  0
                 builder.setStatus(CodedAttribute.Builder.create(contract.getStatus()));
 183  
             }
 184  0
             builder.setCountryCode(contract.getCountryCode());
 185  0
             builder.setStartDate(contract.getStartDate());
 186  0
             builder.setEndDate(contract.getEndDate());
 187  0
             builder.setVersionNumber(contract.getVersionNumber());
 188  0
             builder.setObjectId(contract.getObjectId());
 189  0
             builder.setActive(contract.isActive());
 190  0
             builder.setId(contract.getId());
 191  0
             return builder;
 192  
         }
 193  
 
 194  
         public EntityCitizenship build() {
 195  0
             return new EntityCitizenship(this);
 196  
         }
 197  
 
 198  
         @Override
 199  
         public String getEntityId() {
 200  0
             return this.entityId;
 201  
         }
 202  
 
 203  
         @Override
 204  
         public CodedAttribute.Builder getStatus() {
 205  0
             return this.status;
 206  
         }
 207  
 
 208  
         @Override
 209  
         public String getCountryCode() {
 210  0
             return this.countryCode;
 211  
         }
 212  
 
 213  
         @Override
 214  
         public DateTime getStartDate() {
 215  0
             return this.startDate;
 216  
         }
 217  
 
 218  
         @Override
 219  
         public DateTime getEndDate() {
 220  0
             return this.endDate;
 221  
         }
 222  
 
 223  
         @Override
 224  
         public Long getVersionNumber() {
 225  0
             return this.versionNumber;
 226  
         }
 227  
 
 228  
         @Override
 229  
         public String getObjectId() {
 230  0
             return this.objectId;
 231  
         }
 232  
 
 233  
         @Override
 234  
         public boolean isActive() {
 235  0
             return this.active;
 236  
         }
 237  
 
 238  
         @Override
 239  
         public String getId() {
 240  0
             return this.id;
 241  
         }
 242  
 
 243  
         public void setEntityId(String entityId) {
 244  0
             this.entityId = entityId;
 245  0
         }
 246  
         public void setStatus(CodedAttribute.Builder status) {
 247  0
             this.status = status;
 248  0
         }
 249  
 
 250  
         public void setCountryCode(String countryCode) {
 251  0
             this.countryCode = countryCode;
 252  0
         }
 253  
 
 254  
         public void setStartDate(DateTime startDate) {
 255  0
             this.startDate = startDate;
 256  0
         }
 257  
 
 258  
         public void setEndDate(DateTime endDate) {
 259  0
             this.endDate = endDate;
 260  0
         }
 261  
 
 262  
         public void setVersionNumber(Long versionNumber) {
 263  0
             this.versionNumber = versionNumber;
 264  0
         }
 265  
 
 266  
         public void setObjectId(String objectId) {
 267  0
             this.objectId = objectId;
 268  0
         }
 269  
 
 270  
         public void setActive(boolean active) {
 271  0
             this.active = active;
 272  0
         }
 273  
 
 274  
         public void setId(String id) {
 275  0
             if (StringUtils.isWhitespace(id)) {
 276  0
                 throw new IllegalArgumentException("id is blank");
 277  
             }
 278  0
             this.id = id;
 279  0
         }
 280  
 
 281  
     }
 282  
 
 283  
 
 284  
     /**
 285  
      * Defines some internal constants used on this class.
 286  
      * 
 287  
      */
 288  0
     static class Constants {
 289  
 
 290  
         final static String ROOT_ELEMENT_NAME = "entityCitizenship";
 291  
         final static String TYPE_NAME = "EntityCitizenshipType";
 292  
     }
 293  
 
 294  
 
 295  
     /**
 296  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 297  
      * 
 298  
      */
 299  0
     static class Elements {
 300  
         final static String ENTITY_ID = "entityId";
 301  
         final static String STATUS = "status";
 302  
         final static String COUNTRY_CODE = "countryCode";
 303  
         final static String START_DATE = "startDate";
 304  
         final static String END_DATE = "endDate";
 305  
         final static String ACTIVE = "active";
 306  
         final static String ID = "id";
 307  
 
 308  
     }
 309  
 
 310  
 }