Coverage Report - org.kuali.rice.kim.api.identity.employment.EntityEmployment
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityEmployment
100%
46/46
100%
6/6
1.222
EntityEmployment$1
N/A
N/A
1.222
EntityEmployment$Builder
98%
64/65
90%
9/10
1.222
EntityEmployment$Constants
0%
0/1
N/A
1.222
EntityEmployment$Elements
0%
0/1
N/A
1.222
 
 1  
 package org.kuali.rice.kim.api.identity.employment;
 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.kuali.rice.core.api.util.jaxb.KualiDecimalAdapter;
 8  
 import org.kuali.rice.core.api.util.type.KualiDecimal;
 9  
 import org.kuali.rice.kim.api.identity.Type;
 10  
 import org.kuali.rice.kim.api.identity.affiliation.EntityAffiliation;
 11  
 import org.w3c.dom.Element;
 12  
 
 13  
 import javax.xml.bind.annotation.XmlAccessType;
 14  
 import javax.xml.bind.annotation.XmlAccessorType;
 15  
 import javax.xml.bind.annotation.XmlAnyElement;
 16  
 import javax.xml.bind.annotation.XmlElement;
 17  
 import javax.xml.bind.annotation.XmlRootElement;
 18  
 import javax.xml.bind.annotation.XmlType;
 19  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 20  
 import java.io.Serializable;
 21  
 import java.util.Collection;
 22  
 
 23  41
 @XmlRootElement(name = EntityEmployment.Constants.ROOT_ELEMENT_NAME)
 24  
 @XmlAccessorType(XmlAccessType.NONE)
 25  
 @XmlType(name = EntityEmployment.Constants.TYPE_NAME, propOrder = {
 26  
     EntityEmployment.Elements.ID,
 27  
     EntityEmployment.Elements.ENTITY_ID,
 28  
     EntityEmployment.Elements.EMPLOYEE_ID,
 29  
     EntityEmployment.Elements.EMPLOYMENT_RECORD_ID,
 30  
     EntityEmployment.Elements.ENTITY_AFFILIATION,
 31  
     EntityEmployment.Elements.EMPLOYEE_STATUS,
 32  
     EntityEmployment.Elements.EMPLOYEE_TYPE,
 33  
     EntityEmployment.Elements.PRIMARY_DEPARTMENT_CODE,
 34  
     EntityEmployment.Elements.BASE_SALARY_AMOUNT,
 35  
     EntityEmployment.Elements.PRIMARY,
 36  
     CoreConstants.CommonElements.VERSION_NUMBER,
 37  
     CoreConstants.CommonElements.OBJECT_ID,
 38  
     EntityEmployment.Elements.ACTIVE,
 39  
 
 40  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 41  
 })
 42  6
 public final class EntityEmployment extends AbstractDataTransferObject
 43  
     implements EntityEmploymentContract
 44  
 {
 45  
     @XmlElement(name = Elements.ID, required = false)
 46  
     private final String id;
 47  
     @XmlElement(name = Elements.ENTITY_ID, required = false)
 48  
     private final String entityId;
 49  
     @XmlElement(name = Elements.ENTITY_AFFILIATION, required = false)
 50  
     private final EntityAffiliation entityAffiliation;
 51  
     @XmlElement(name = Elements.EMPLOYEE_STATUS, required = false)
 52  
     private final Type employeeStatus;
 53  
     @XmlElement(name = Elements.EMPLOYEE_TYPE, required = false)
 54  
     private final Type employeeType;
 55  
     @XmlElement(name = Elements.PRIMARY_DEPARTMENT_CODE, required = false)
 56  
     private final String primaryDepartmentCode;
 57  
     @XmlElement(name = Elements.EMPLOYEE_ID, required = false)
 58  
     private final String employeeId;
 59  
     @XmlElement(name = Elements.EMPLOYMENT_RECORD_ID, required = false)
 60  
     private final String employmentRecordId;
 61  
     @XmlElement(name = Elements.BASE_SALARY_AMOUNT, required = false)
 62  
     @XmlJavaTypeAdapter(KualiDecimalAdapter.class)
 63  
     private final KualiDecimal baseSalaryAmount;
 64  
     @XmlElement(name = Elements.PRIMARY, required = false)
 65  
     private final boolean primary;
 66  
     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
 67  
     private final Long versionNumber;
 68  
     @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
 69  
     private final String objectId;
 70  
     @XmlElement(name = Elements.ACTIVE, required = false)
 71  
     private final boolean active;
 72  
 
 73  10
     @SuppressWarnings("unused")
 74  
     @XmlAnyElement
 75  
     private final Collection<Element> _futureElements = null;
 76  
 
 77  
     /**
 78  
      * Private constructor used only by JAXB.
 79  
      * 
 80  
      */
 81  4
     private EntityEmployment() {
 82  4
         this.entityAffiliation = null;
 83  4
         this.employeeStatus = null;
 84  4
         this.employeeType = null;
 85  4
         this.primaryDepartmentCode = null;
 86  4
         this.employeeId = null;
 87  4
         this.employmentRecordId = null;
 88  4
         this.baseSalaryAmount = null;
 89  4
         this.primary = false;
 90  4
         this.versionNumber = null;
 91  4
         this.objectId = null;
 92  4
         this.active = false;
 93  4
         this.entityId = null;
 94  4
         this.id = null;
 95  4
     }
 96  
 
 97  6
     private EntityEmployment(Builder builder) {
 98  6
         this.entityAffiliation = builder.getEntityAffiliation() != null ? builder.getEntityAffiliation().build() : null;
 99  6
         this.employeeStatus = builder.getEmployeeStatus() != null ? builder.getEmployeeStatus().build() : null;
 100  6
         this.employeeType = builder.getEmployeeType() != null ? builder.getEmployeeType().build() : null;
 101  6
         this.primaryDepartmentCode = builder.getPrimaryDepartmentCode();
 102  6
         this.employeeId = builder.getEmployeeId();
 103  6
         this.employmentRecordId = builder.getEmploymentRecordId();
 104  6
         this.baseSalaryAmount = builder.getBaseSalaryAmount();
 105  6
         this.primary = builder.isPrimary();
 106  6
         this.versionNumber = builder.getVersionNumber();
 107  6
         this.objectId = builder.getObjectId();
 108  6
         this.active = builder.isActive();
 109  6
         this.id = builder.getId();
 110  6
         this.entityId = builder.getEntityId();
 111  6
     }
 112  
 
 113  
     @Override
 114  
     public String getEntityId() {
 115  4
         return this.entityId;
 116  
     }
 117  
     @Override
 118  
     public EntityAffiliation getEntityAffiliation() {
 119  19
         return this.entityAffiliation;
 120  
     }
 121  
 
 122  
     @Override
 123  
     public Type getEmployeeStatus() {
 124  11
         return this.employeeStatus;
 125  
     }
 126  
 
 127  
     @Override
 128  
     public Type getEmployeeType() {
 129  11
         return this.employeeType;
 130  
     }
 131  
 
 132  
     @Override
 133  
     public String getPrimaryDepartmentCode() {
 134  4
         return this.primaryDepartmentCode;
 135  
     }
 136  
 
 137  
     @Override
 138  
     public String getEmployeeId() {
 139  4
         return this.employeeId;
 140  
     }
 141  
 
 142  
     @Override
 143  
     public String getEmploymentRecordId() {
 144  4
         return this.employmentRecordId;
 145  
     }
 146  
 
 147  
     @Override
 148  
     public KualiDecimal getBaseSalaryAmount() {
 149  4
         return this.baseSalaryAmount;
 150  
     }
 151  
 
 152  
     @Override
 153  
     public boolean isPrimary() {
 154  4
         return this.primary;
 155  
     }
 156  
 
 157  
     @Override
 158  
     public Long getVersionNumber() {
 159  4
         return this.versionNumber;
 160  
     }
 161  
 
 162  
     @Override
 163  
     public String getObjectId() {
 164  4
         return this.objectId;
 165  
     }
 166  
 
 167  
     @Override
 168  
     public boolean isActive() {
 169  4
         return this.active;
 170  
     }
 171  
 
 172  
     @Override
 173  
     public String getId() {
 174  4
         return this.id;
 175  
     }
 176  
 
 177  
     /**
 178  
      * A builder which can be used to construct {@link EntityEmployment} instances.  Enforces the constraints of the {@link EntityEmploymentContract}.
 179  
      * 
 180  
      */
 181  4
     public final static class Builder
 182  
         implements Serializable, ModelBuilder, EntityEmploymentContract
 183  
     {
 184  
         private String entityId;
 185  
         private EntityAffiliation.Builder entityAffiliation;
 186  
         private Type.Builder employeeStatus;
 187  
         private Type.Builder employeeType;
 188  
         private String primaryDepartmentCode;
 189  
         private String employeeId;
 190  
         private String employmentRecordId;
 191  
         private KualiDecimal baseSalaryAmount;
 192  
         private boolean primary;
 193  
         private Long versionNumber;
 194  
         private String objectId;
 195  
         private boolean active;
 196  
         private String id;
 197  
 
 198  8
         private Builder() { }
 199  
 
 200  
         public static Builder create() {
 201  8
             return new Builder();
 202  
         }
 203  
 
 204  
         public static Builder create(EntityEmploymentContract contract) {
 205  5
             if (contract == null) {
 206  0
                 throw new IllegalArgumentException("contract was null");
 207  
             }
 208  5
             Builder builder = create();
 209  5
             builder.setEntityId(contract.getEntityId());
 210  5
             if (contract.getEntityAffiliation() != null) {
 211  4
                 builder.setEntityAffiliation(EntityAffiliation.Builder.create(contract.getEntityAffiliation()));
 212  
             }
 213  5
             if (contract.getEmployeeStatus() != null) {
 214  4
                 builder.setEmployeeStatus(Type.Builder.create(contract.getEmployeeStatus()));
 215  
             }
 216  5
             if (contract.getEmployeeType() != null) {
 217  4
                 builder.setEmployeeType(Type.Builder.create(contract.getEmployeeType()));
 218  
             }
 219  5
             builder.setPrimaryDepartmentCode(contract.getPrimaryDepartmentCode());
 220  5
             builder.setEmployeeId(contract.getEmployeeId());
 221  5
             builder.setEmploymentRecordId(contract.getEmploymentRecordId());
 222  5
             builder.setBaseSalaryAmount(contract.getBaseSalaryAmount());
 223  5
             builder.setPrimary(contract.isPrimary());
 224  5
             builder.setVersionNumber(contract.getVersionNumber());
 225  5
             builder.setObjectId(contract.getObjectId());
 226  5
             builder.setActive(contract.isActive());
 227  5
             builder.setId(contract.getId());
 228  5
             return builder;
 229  
         }
 230  
 
 231  
         public EntityEmployment build() {
 232  6
             return new EntityEmployment(this);
 233  
         }
 234  
 
 235  
         @Override
 236  
         public String getEntityId() {
 237  6
             return this.entityId;
 238  
         }
 239  
         @Override
 240  
         public EntityAffiliation.Builder getEntityAffiliation() {
 241  10
             return this.entityAffiliation;
 242  
         }
 243  
 
 244  
         @Override
 245  
         public Type.Builder getEmployeeStatus() {
 246  10
             return this.employeeStatus;
 247  
         }
 248  
 
 249  
         @Override
 250  
         public Type.Builder getEmployeeType() {
 251  10
             return this.employeeType;
 252  
         }
 253  
 
 254  
         @Override
 255  
         public String getPrimaryDepartmentCode() {
 256  6
             return this.primaryDepartmentCode;
 257  
         }
 258  
 
 259  
         @Override
 260  
         public String getEmployeeId() {
 261  6
             return this.employeeId;
 262  
         }
 263  
 
 264  
         @Override
 265  
         public String getEmploymentRecordId() {
 266  6
             return this.employmentRecordId;
 267  
         }
 268  
 
 269  
         @Override
 270  
         public KualiDecimal getBaseSalaryAmount() {
 271  6
             return this.baseSalaryAmount;
 272  
         }
 273  
 
 274  
         @Override
 275  
         public boolean isPrimary() {
 276  8
             return this.primary;
 277  
         }
 278  
 
 279  
         @Override
 280  
         public Long getVersionNumber() {
 281  6
             return this.versionNumber;
 282  
         }
 283  
 
 284  
         @Override
 285  
         public String getObjectId() {
 286  6
             return this.objectId;
 287  
         }
 288  
 
 289  
         @Override
 290  
         public boolean isActive() {
 291  6
             return this.active;
 292  
         }
 293  
 
 294  
         @Override
 295  
         public String getId() {
 296  6
             return this.id;
 297  
         }
 298  
 
 299  
         public void setEntityAffiliation(EntityAffiliation.Builder entityAffiliation) {
 300  4
             this.entityAffiliation = entityAffiliation;
 301  4
         }
 302  
 
 303  
         public void setEmployeeStatus(Type.Builder employeeStatus) {
 304  4
             this.employeeStatus = employeeStatus;
 305  4
         }
 306  
 
 307  
         public void setEmployeeType(Type.Builder employeeType) {
 308  4
             this.employeeType = employeeType;
 309  4
         }
 310  
 
 311  
         public void setEntityId(String entityId) {
 312  5
             this.entityId = entityId;
 313  5
         }
 314  
 
 315  
         public void setPrimaryDepartmentCode(String primaryDepartmentCode) {
 316  5
             this.primaryDepartmentCode = primaryDepartmentCode;
 317  5
         }
 318  
 
 319  
         public void setEmployeeId(String employeeId) {
 320  5
             this.employeeId = employeeId;
 321  5
         }
 322  
 
 323  
         public void setEmploymentRecordId(String employmentRecordId) {
 324  5
             this.employmentRecordId = employmentRecordId;
 325  5
         }
 326  
 
 327  
         public void setBaseSalaryAmount(KualiDecimal baseSalaryAmount) {
 328  5
             this.baseSalaryAmount = baseSalaryAmount;
 329  5
         }
 330  
 
 331  
         public void setPrimary(boolean primary) {
 332  5
             this.primary = primary;
 333  5
         }
 334  
 
 335  
         public void setVersionNumber(Long versionNumber) {
 336  5
             this.versionNumber = versionNumber;
 337  5
         }
 338  
 
 339  
         public void setObjectId(String objectId) {
 340  5
             this.objectId = objectId;
 341  5
         }
 342  
 
 343  
         public void setActive(boolean active) {
 344  5
             this.active = active;
 345  5
         }
 346  
 
 347  
         public void setId(String id) {
 348  6
             if (StringUtils.isWhitespace(id)) {
 349  1
                 throw new IllegalArgumentException("id is blank");
 350  
             }
 351  5
             this.id = id;
 352  5
         }
 353  
 
 354  
     }
 355  
 
 356  
 
 357  
     /**
 358  
      * Defines some internal constants used on this class.
 359  
      * 
 360  
      */
 361  0
     static class Constants {
 362  
 
 363  
         final static String ROOT_ELEMENT_NAME = "entityEmployment";
 364  
         final static String TYPE_NAME = "EntityEmploymentType";
 365  
     }
 366  
 
 367  
 
 368  
     /**
 369  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 370  
      * 
 371  
      */
 372  0
     static class Elements {
 373  
 
 374  
         final static String ENTITY_AFFILIATION = "entityAffiliation";
 375  
         final static String EMPLOYEE_STATUS = "employeeStatus";
 376  
         final static String EMPLOYEE_TYPE = "employeeType";
 377  
         final static String PRIMARY_DEPARTMENT_CODE = "primaryDepartmentCode";
 378  
         final static String EMPLOYEE_ID = "employeeId";
 379  
         final static String EMPLOYMENT_RECORD_ID = "employmentRecordId";
 380  
         final static String BASE_SALARY_AMOUNT = "baseSalaryAmount";
 381  
         final static String PRIMARY = "primary";
 382  
         final static String ACTIVE = "active";
 383  
         final static String ENTITY_ID = "entityId";
 384  
         final static String ID = "id";
 385  
 
 386  
     }
 387  
 
 388  
 }