Coverage Report - org.kuali.rice.kim.api.identity.visa.EntityVisa
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityVisa
0%
0/27
N/A
1.148
EntityVisa$1
N/A
N/A
1.148
EntityVisa$Builder
0%
0/38
0%
0/4
1.148
EntityVisa$Constants
0%
0/1
N/A
1.148
EntityVisa$Elements
0%
0/1
N/A
1.148
 
 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.visa;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.util.Collection;
 20  
 import javax.xml.bind.annotation.XmlAccessType;
 21  
 import javax.xml.bind.annotation.XmlAccessorType;
 22  
 import javax.xml.bind.annotation.XmlAnyElement;
 23  
 import javax.xml.bind.annotation.XmlElement;
 24  
 import javax.xml.bind.annotation.XmlRootElement;
 25  
 import javax.xml.bind.annotation.XmlType;
 26  
 
 27  
 import org.apache.commons.lang.StringUtils;
 28  
 import org.kuali.rice.core.api.CoreConstants;
 29  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 30  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 31  
 import org.w3c.dom.Element;
 32  
 
 33  
 @XmlRootElement(name = EntityVisa.Constants.ROOT_ELEMENT_NAME)
 34  
 @XmlAccessorType(XmlAccessType.NONE)
 35  
 @XmlType(name = EntityVisa.Constants.TYPE_NAME, propOrder = {
 36  
     EntityVisa.Elements.ID,
 37  
     EntityVisa.Elements.ENTITY_ID,
 38  
     EntityVisa.Elements.VISA_TYPE_KEY,
 39  
     EntityVisa.Elements.VISA_ENTRY,
 40  
     EntityVisa.Elements.VISA_ID,
 41  
     CoreConstants.CommonElements.VERSION_NUMBER,
 42  
     CoreConstants.CommonElements.OBJECT_ID,
 43  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 44  
 })
 45  0
 public final class EntityVisa extends AbstractDataTransferObject
 46  
     implements EntityVisaContract
 47  
 {
 48  
 
 49  
     @XmlElement(name = Elements.ENTITY_ID, required = false)
 50  
     private final String entityId;
 51  
     @XmlElement(name = Elements.VISA_TYPE_KEY, required = false)
 52  
     private final String visaTypeKey;
 53  
     @XmlElement(name = Elements.VISA_ENTRY, required = false)
 54  
     private final String visaEntry;
 55  
     @XmlElement(name = Elements.VISA_ID, required = false)
 56  
     private final String visaId;
 57  
     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
 58  
     private final Long versionNumber;
 59  
     @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
 60  
     private final String objectId;
 61  
     @XmlElement(name = Elements.ID, required = false)
 62  
     private final String id;
 63  0
     @SuppressWarnings("unused")
 64  
     @XmlAnyElement
 65  
     private final Collection<Element> _futureElements = null;
 66  
 
 67  
     /**
 68  
      * Private constructor used only by JAXB.
 69  
      * 
 70  
      */
 71  0
     private EntityVisa() {
 72  0
         this.entityId = null;
 73  0
         this.visaTypeKey = null;
 74  0
         this.visaEntry = null;
 75  0
         this.visaId = null;
 76  0
         this.versionNumber = null;
 77  0
         this.objectId = null;
 78  0
         this.id = null;
 79  0
     }
 80  
 
 81  0
     private EntityVisa(Builder builder) {
 82  0
         this.entityId = builder.getEntityId();
 83  0
         this.visaTypeKey = builder.getVisaTypeKey();
 84  0
         this.visaEntry = builder.getVisaEntry();
 85  0
         this.visaId = builder.getVisaId();
 86  0
         this.versionNumber = builder.getVersionNumber();
 87  0
         this.objectId = builder.getObjectId();
 88  0
         this.id = builder.getId();
 89  0
     }
 90  
 
 91  
     @Override
 92  
     public String getEntityId() {
 93  0
         return this.entityId;
 94  
     }
 95  
 
 96  
     @Override
 97  
     public String getVisaTypeKey() {
 98  0
         return this.visaTypeKey;
 99  
     }
 100  
 
 101  
     @Override
 102  
     public String getVisaEntry() {
 103  0
         return this.visaEntry;
 104  
     }
 105  
 
 106  
     @Override
 107  
     public String getVisaId() {
 108  0
         return this.visaId;
 109  
     }
 110  
 
 111  
     @Override
 112  
     public Long getVersionNumber() {
 113  0
         return this.versionNumber;
 114  
     }
 115  
 
 116  
     @Override
 117  
     public String getObjectId() {
 118  0
         return this.objectId;
 119  
     }
 120  
 
 121  
     @Override
 122  
     public String getId() {
 123  0
         return this.id;
 124  
     }
 125  
 
 126  
 
 127  
 
 128  
     /**
 129  
      * A builder which can be used to construct {@link EntityVisa} instances.  Enforces the constraints of the {@link EntityVisaContract}.
 130  
      * 
 131  
      */
 132  0
     public final static class Builder
 133  
         implements Serializable, ModelBuilder, EntityVisaContract
 134  
     {
 135  
 
 136  
         private String entityId;
 137  
         private String visaTypeKey;
 138  
         private String visaEntry;
 139  
         private String visaId;
 140  
         private Long versionNumber;
 141  
         private String objectId;
 142  
         private String id;
 143  
 
 144  0
         private Builder() { }
 145  
 
 146  
         public static Builder create() {
 147  0
             return new Builder();
 148  
         }
 149  
 
 150  
         public static Builder create(EntityVisaContract contract) {
 151  0
             if (contract == null) {
 152  0
                 throw new IllegalArgumentException("contract was null");
 153  
             }
 154  0
             Builder builder = create();
 155  0
             builder.setEntityId(contract.getEntityId());
 156  0
             builder.setVisaTypeKey(contract.getVisaTypeKey());
 157  0
             builder.setVisaEntry(contract.getVisaEntry());
 158  0
             builder.setVisaId(contract.getVisaId());
 159  0
             builder.setVersionNumber(contract.getVersionNumber());
 160  0
             builder.setObjectId(contract.getObjectId());
 161  0
             builder.setId(contract.getId());
 162  0
             return builder;
 163  
         }
 164  
 
 165  
         public EntityVisa build() {
 166  0
             return new EntityVisa(this);
 167  
         }
 168  
 
 169  
         @Override
 170  
         public String getEntityId() {
 171  0
             return this.entityId;
 172  
         }
 173  
 
 174  
         @Override
 175  
         public String getVisaTypeKey() {
 176  0
             return this.visaTypeKey;
 177  
         }
 178  
 
 179  
         @Override
 180  
         public String getVisaEntry() {
 181  0
             return this.visaEntry;
 182  
         }
 183  
 
 184  
         @Override
 185  
         public String getVisaId() {
 186  0
             return this.visaId;
 187  
         }
 188  
 
 189  
         @Override
 190  
         public Long getVersionNumber() {
 191  0
             return this.versionNumber;
 192  
         }
 193  
 
 194  
         @Override
 195  
         public String getObjectId() {
 196  0
             return this.objectId;
 197  
         }
 198  
 
 199  
         @Override
 200  
         public String getId() {
 201  0
             return this.id;
 202  
         }
 203  
 
 204  
         public void setEntityId(String entityId) {
 205  0
             this.entityId = entityId;
 206  0
         }
 207  
 
 208  
         public void setVisaTypeKey(String visaTypeKey) {
 209  0
             this.visaTypeKey = visaTypeKey;
 210  0
         }
 211  
 
 212  
         public void setVisaEntry(String visaEntry) {
 213  0
             this.visaEntry = visaEntry;
 214  0
         }
 215  
 
 216  
         public void setVisaId(String visaId) {
 217  0
             this.visaId = visaId;
 218  0
         }
 219  
 
 220  
         public void setVersionNumber(Long versionNumber) {
 221  0
             this.versionNumber = versionNumber;
 222  0
         }
 223  
 
 224  
         public void setObjectId(String objectId) {
 225  0
             this.objectId = objectId;
 226  0
         }
 227  
 
 228  
         public void setId(String id) {
 229  0
             if (StringUtils.isWhitespace(id)) {
 230  0
                 throw new IllegalArgumentException("id is blank");
 231  
             }
 232  0
             this.id = id;
 233  0
         }
 234  
 
 235  
     }
 236  
 
 237  
 
 238  
     /**
 239  
      * Defines some internal constants used on this class.
 240  
      * 
 241  
      */
 242  0
     static class Constants {
 243  
 
 244  
         final static String ROOT_ELEMENT_NAME = "entityVisa";
 245  
         final static String TYPE_NAME = "EntityVisaType";
 246  
     }
 247  
 
 248  
 
 249  
     /**
 250  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 251  
      * 
 252  
      */
 253  0
     static class Elements {
 254  
 
 255  
         final static String ENTITY_ID = "entityId";
 256  
         final static String VISA_TYPE_KEY = "visaTypeKey";
 257  
         final static String VISA_ENTRY = "visaEntry";
 258  
         final static String VISA_ID = "visaId";
 259  
         final static String ID = "id";
 260  
 
 261  
     }
 262  
 
 263  
 }