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