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