Coverage Report - org.kuali.rice.kim.api.role.RoleResponsibilityAction
 
Classes in this File Line Coverage Branch Coverage Complexity
RoleResponsibilityAction
94%
35/37
N/A
1.205
RoleResponsibilityAction$1
N/A
N/A
1.205
RoleResponsibilityAction$Builder
71%
38/53
80%
8/10
1.205
RoleResponsibilityAction$Constants
50%
1/2
N/A
1.205
RoleResponsibilityAction$Elements
0%
0/1
N/A
1.205
 
 1  
 /*
 2  
  * Copyright 2006-2011 The Kuali Foundation
 3  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 4  
  * you may not use this file except in compliance with the License.
 5  
  * You may obtain a copy of the License at
 6  
  *
 7  
  * http://www.opensource.org/licenses/ecl2.php
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing, software
 10  
  * distributed under the License is distributed on an "AS IS" BASIS,
 11  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
  * See the License for the specific language governing permissions and
 13  
  * limitations under the License.
 14  
  */
 15  
 package org.kuali.rice.kim.api.role;
 16  
 
 17  
 import org.apache.commons.lang.StringUtils;
 18  
 import org.apache.commons.lang.builder.EqualsBuilder;
 19  
 import org.apache.commons.lang.builder.HashCodeBuilder;
 20  
 import org.apache.commons.lang.builder.ToStringBuilder;
 21  
 import org.kuali.rice.core.api.CoreConstants;
 22  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 23  
 import org.kuali.rice.core.api.mo.ModelObjectComplete;
 24  
 import org.w3c.dom.Element;
 25  
 
 26  
 import javax.xml.bind.annotation.XmlAccessType;
 27  
 import javax.xml.bind.annotation.XmlAccessorType;
 28  
 import javax.xml.bind.annotation.XmlAnyElement;
 29  
 import javax.xml.bind.annotation.XmlElement;
 30  
 import javax.xml.bind.annotation.XmlRootElement;
 31  
 import javax.xml.bind.annotation.XmlType;
 32  
 import java.util.Collection;
 33  
 
 34  
 /**
 35  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 36  
  */
 37  1
 @XmlRootElement(name = RoleResponsibilityAction.Constants.ROOT_ELEMENT_NAME)
 38  
 @XmlAccessorType(XmlAccessType.NONE)
 39  
 @XmlType(name = RoleResponsibilityAction.Constants.TYPE_NAME, propOrder = {
 40  
         RoleResponsibilityAction.Elements.ID,
 41  
         RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY_ID,
 42  
         RoleResponsibilityAction.Elements.ROLE_MEMBER_ID,
 43  
         RoleResponsibilityAction.Elements.ACTION_TYPE_CODE,
 44  
         RoleResponsibilityAction.Elements.ACTION_POLICY_CODE,
 45  
         RoleResponsibilityAction.Elements.FORCE_ACTION,
 46  
         RoleResponsibilityAction.Elements.PRIORITY_NUMBER,
 47  
         RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY,
 48  
         CoreConstants.CommonElements.VERSION_NUMBER,
 49  
         CoreConstants.CommonElements.FUTURE_ELEMENTS
 50  
 })
 51  3
 public class RoleResponsibilityAction implements RoleResponsibilityActionContract, ModelObjectComplete {
 52  
 
 53  
     @XmlElement(name = RoleResponsibilityAction.Elements.ID, required = true)
 54  
     private final String id;
 55  
 
 56  
     @XmlElement(name = RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY_ID)
 57  
     private final String roleResponsibilityId;
 58  
 
 59  
     @XmlElement(name = RoleResponsibilityAction.Elements.ROLE_MEMBER_ID)
 60  
     private final String roleMemberId;
 61  
 
 62  
     @XmlElement(name = RoleResponsibilityAction.Elements.ACTION_TYPE_CODE)
 63  
     private final String actionTypeCode;
 64  
 
 65  
     @XmlElement(name = RoleResponsibilityAction.Elements.ACTION_POLICY_CODE)
 66  
     private final String actionPolicyCode;
 67  
 
 68  
     @XmlElement(name = RoleResponsibilityAction.Elements.FORCE_ACTION)
 69  
     private final boolean forceAction;
 70  
 
 71  
     @XmlElement(name = RoleResponsibilityAction.Elements.PRIORITY_NUMBER)
 72  
     private final Integer priorityNumber;
 73  
 
 74  
     @XmlElement(name = RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY)
 75  
     private final RoleResponsibility roleResponsibility;
 76  
 
 77  
     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER)
 78  
     private final Long versionNumber;
 79  
 
 80  5
     @SuppressWarnings("unused")
 81  
     @XmlAnyElement
 82  
     private final Collection<Element> _futureElements = null;
 83  
 
 84  
     /**
 85  
      * Private default constructor should only be called by JAXB
 86  
      */
 87  
     @SuppressWarnings("unused")
 88  2
     private RoleResponsibilityAction() {
 89  2
         id = null;
 90  2
         roleResponsibilityId = null;
 91  2
         roleMemberId = null;
 92  2
         actionTypeCode = null;
 93  2
         actionPolicyCode = null;
 94  2
         forceAction = false;
 95  2
         priorityNumber = null;
 96  2
         roleResponsibility = null;
 97  2
         versionNumber = null;
 98  2
     }
 99  
 
 100  3
     private RoleResponsibilityAction(Builder b) {
 101  3
         id = b.getId();
 102  3
         roleResponsibilityId = b.getRoleResponsibilityId();
 103  3
         roleMemberId = b.getRoleMemberId();
 104  3
         actionTypeCode = b.getActionTypeCode();
 105  3
         actionPolicyCode = b.getActionPolicyCode();
 106  3
         forceAction = b.isForceAction();
 107  3
         priorityNumber = b.getPriorityNumber();
 108  3
         roleResponsibility = b.getRoleResponsibility();
 109  3
         versionNumber = b.getVersionNumber();
 110  3
     }
 111  
 
 112  
     @Override
 113  
     public String getId() {
 114  1
         return this.id;
 115  
     }
 116  
 
 117  
     @Override
 118  
     public String getRoleResponsibilityId() {
 119  1
         return this.roleResponsibilityId;
 120  
     }
 121  
 
 122  
     @Override
 123  
     public String getActionTypeCode() {
 124  1
         return this.actionTypeCode;
 125  
     }
 126  
 
 127  
     @Override
 128  
     public Integer getPriorityNumber() {
 129  1
         return this.priorityNumber;
 130  
     }
 131  
 
 132  
     @Override
 133  
     public String getActionPolicyCode() {
 134  1
         return this.actionPolicyCode;
 135  
     }
 136  
 
 137  
     @Override
 138  
     public String getRoleMemberId() {
 139  1
         return this.roleMemberId;
 140  
     }
 141  
 
 142  
     @Override
 143  
     public RoleResponsibility getRoleResponsibility() {
 144  1
         return this.roleResponsibility;
 145  
     }
 146  
 
 147  
     @Override
 148  
     public boolean isForceAction() {
 149  1
         return this.forceAction;
 150  
     }
 151  
 
 152  
     @Override
 153  
     public Long getVersionNumber() {
 154  1
         return this.versionNumber;
 155  
     }
 156  
 
 157  
     @Override
 158  
     public int hashCode() {
 159  0
         return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 160  
     }
 161  
 
 162  
     @Override
 163  
     public boolean equals(Object obj) {
 164  1
         return EqualsBuilder.reflectionEquals(obj, this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 165  
     }
 166  
 
 167  
     @Override
 168  
     public String toString() {
 169  0
         return ToStringBuilder.reflectionToString(this);
 170  
     }
 171  
 
 172  6
     public static class Builder implements RoleResponsibilityActionContract, ModelBuilder, ModelObjectComplete {
 173  
 
 174  
         private String Id;
 175  
         private String roleResponsibilityId;
 176  
         private String roleMemberId;
 177  
         private String actionTypeCode;
 178  
         private String actionPolicyCode;
 179  
         private boolean forceAction;
 180  
         private Integer priorityNumber;
 181  
         private RoleResponsibility roleResponsibility;
 182  
         private Long versionNumber;
 183  
 
 184  9
         private Builder() {
 185  9
         }
 186  
 
 187  
         public static Builder create() {
 188  9
             return new Builder();
 189  
         }
 190  
 
 191  
         public static Builder create(RoleResponsibilityActionContract rra) {
 192  0
             Builder b = new Builder();
 193  0
             b.setForceAction(rra.isForceAction());
 194  0
             b.setActionPolicyCode(rra.getActionPolicyCode());
 195  0
             b.setActionTypeCode(rra.getActionTypeCode());
 196  0
             b.setPriorityNumber(rra.getPriorityNumber());
 197  0
             b.setRoleMemberId(rra.getRoleMemberId());
 198  0
             if (rra.getRoleResponsibility() != null) {
 199  0
                 b.setRoleResponsibility(RoleResponsibility.Builder.create(rra.getRoleResponsibility()).build());
 200  
             }
 201  0
             b.setId(rra.getId());
 202  0
             b.setRoleResponsibilityId(rra.getRoleResponsibilityId());
 203  0
             b.setVersionNumber(rra.getVersionNumber());
 204  0
             return b;
 205  
         }
 206  
 
 207  
         @Override
 208  
         public RoleResponsibilityAction build() {
 209  6
             if (versionNumber == null || Id == null) {
 210  3
                 throw new IllegalStateException("versionNumber and id must be non-null and " +
 211  
                         "not empty for RoleResponsibilityAction");
 212  
             }
 213  3
             return new RoleResponsibilityAction(this);
 214  
         }
 215  
 
 216  
         @Override
 217  
         public String getId() {
 218  3
             return Id;
 219  
         }
 220  
 
 221  
         public void setId(String id) {
 222  6
             if (StringUtils.isBlank(id)) {
 223  2
                 throw new IllegalArgumentException("id must be non-null and not empty");
 224  
             }
 225  4
             this.Id = id;
 226  4
         }
 227  
 
 228  
         @Override
 229  
         public String getRoleResponsibilityId() {
 230  3
             return roleResponsibilityId;
 231  
         }
 232  
 
 233  
         public void setRoleResponsibilityId(String roleResponsibilityId) {
 234  2
             this.roleResponsibilityId = roleResponsibilityId;
 235  2
         }
 236  
 
 237  
         @Override
 238  
         public String getActionTypeCode() {
 239  3
             return actionTypeCode;
 240  
         }
 241  
 
 242  
         public void setActionTypeCode(String actionTypeCode) {
 243  2
             this.actionTypeCode = actionTypeCode;
 244  2
         }
 245  
 
 246  
         @Override
 247  
         public Integer getPriorityNumber() {
 248  3
             return priorityNumber;
 249  
         }
 250  
 
 251  
         public void setPriorityNumber(Integer priorityNumber) {
 252  2
             this.priorityNumber = priorityNumber;
 253  2
         }
 254  
 
 255  
         @Override
 256  
         public String getActionPolicyCode() {
 257  3
             return actionPolicyCode;
 258  
         }
 259  
 
 260  
         public void setActionPolicyCode(String actionPolicyCode) {
 261  2
             this.actionPolicyCode = actionPolicyCode;
 262  2
         }
 263  
 
 264  
         @Override
 265  
         public String getRoleMemberId() {
 266  3
             return roleMemberId;
 267  
         }
 268  
 
 269  
         public void setRoleMemberId(String roleMemberId) {
 270  2
             this.roleMemberId = roleMemberId;
 271  2
         }
 272  
 
 273  
         @Override
 274  
         public RoleResponsibility getRoleResponsibility() {
 275  3
             return roleResponsibility;
 276  
         }
 277  
 
 278  
         public void setRoleResponsibility(RoleResponsibility roleResponsibility) {
 279  2
             this.roleResponsibility = roleResponsibility;
 280  2
         }
 281  
 
 282  
         @Override
 283  
         public boolean isForceAction() {
 284  3
             return forceAction;
 285  
         }
 286  
 
 287  
         public void setForceAction(boolean forceAction) {
 288  2
             this.forceAction = forceAction;
 289  2
         }
 290  
 
 291  
         @Override
 292  
         public Long getVersionNumber() {
 293  3
             return versionNumber;
 294  
         }
 295  
 
 296  
         public void setVersionNumber(Long versionNumber) {
 297  5
             if (versionNumber == null) {
 298  1
                 throw new IllegalArgumentException("versionNumber must be non-null");
 299  
             }
 300  4
             this.versionNumber = versionNumber;
 301  4
         }
 302  
 
 303  
         @Override
 304  
         public int hashCode() {
 305  0
             return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 306  
         }
 307  
 
 308  
         @Override
 309  
         public boolean equals(Object obj) {
 310  0
             return EqualsBuilder.reflectionEquals(obj, this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 311  
         }
 312  
 
 313  
         @Override
 314  
         public String toString() {
 315  0
             return ToStringBuilder.reflectionToString(this);
 316  
         }
 317  
     }
 318  
 
 319  
 
 320  
     /**
 321  
      * A private class which exposes constants which define the XML element names to use
 322  
      * when this object is marshalled to XML.
 323  
      */
 324  0
     static class Elements {
 325  
         final static String ID = "id";
 326  
         final static String ROLE_RESPONSIBILITY_ID = "roleResponsibilityId";
 327  
         final static String ROLE_MEMBER_ID = "roleMemberId";
 328  
         final static String ACTION_TYPE_CODE = "actionTypeCode";
 329  
         final static String ACTION_POLICY_CODE = "actionPolicyCode";
 330  
         final static String FORCE_ACTION = "forceAction";
 331  
         final static String PRIORITY_NUMBER = "priorityNumber";
 332  
         final static String ROLE_RESPONSIBILITY = "roleResponsibility";
 333  
     }
 334  
 
 335  
     /**
 336  
      * Defines some internal constants used on this class.
 337  
      */
 338  0
     static class Constants {
 339  
         final static String ROOT_ELEMENT_NAME = "roleResponsibilityAction";
 340  
         final static String TYPE_NAME = "RoleResponsibilityActionType";
 341  1
         final static String[] HASH_CODE_EQUALS_EXCLUDE = {CoreConstants.CommonElements.FUTURE_ELEMENTS};
 342  
     }
 343  
 }