Coverage Report - org.kuali.rice.kew.actions.AdHocRevoke
 
Classes in this File Line Coverage Branch Coverage Complexity
AdHocRevoke
0%
0/24
0%
0/22
2.6
 
 1  
 /*
 2  
  * Copyright 2005-2008 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.kew.actions;
 18  
 
 19  
 import org.apache.commons.lang.StringUtils;
 20  
 import org.kuali.rice.kew.actionrequest.ActionRequestValue;
 21  
 
 22  
 
 23  
 /**
 24  
  * Represents a revocation of an AdHoc request.<br><br>
 25  
  * 
 26  
  * If the <code>nodeName</code> property on this object is set, then the system will only
 27  
  * examine pending app-specific requests at nodes with that particular name.  In addition to
 28  
  * this, one of the following 3 parameters is required:<br><br>
 29  
  * 
 30  
  * <ol>
 31  
  *   <li><b>actionRequestId</b> - the ID of the action request to revoke</li>
 32  
  *   <li><b>userId</b> - the ID of the user whose request(s) should be revoked</li>
 33  
  *          <li><b>workgroupId</b> - the ID of the workgroup whose requests(s) should be revoked</li>
 34  
  * </ol>
 35  
  * 
 36  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 37  
  */
 38  
 public class AdHocRevoke implements java.io.Serializable {
 39  
 
 40  
         private static final long serialVersionUID = 8536540010313763068L;
 41  
 
 42  
         private Long actionRequestId;
 43  
         private String nodeName;
 44  
         private String principalId;
 45  
         private String groupId;
 46  
         
 47  0
         public AdHocRevoke() {}
 48  
         
 49  
         public Long getActionRequestId() {
 50  0
                 return actionRequestId;
 51  
         }
 52  
         public void setActionRequestId(Long actionRequestId) {
 53  0
                 this.actionRequestId = actionRequestId;
 54  0
         }
 55  
         public String getNodeName() {
 56  0
                 return nodeName;
 57  
         }
 58  
         public void setNodeName(String nodeName) {
 59  0
                 this.nodeName = nodeName;
 60  0
         }
 61  
         public String getPrincipalId() {
 62  0
                 return principalId;
 63  
         }
 64  
         public void setPrincipalId(String principalId) {
 65  0
                 this.principalId = principalId;
 66  0
         }
 67  
                 
 68  
         /**
 69  
          * Determines if the given action request is an ad hoc request which matches this set of criteria.
 70  
          */
 71  
         public boolean matchesActionRequest(ActionRequestValue actionRequest) {
 72  0
                 if (!actionRequest.isAdHocRequest()) {
 73  0
                         return false;
 74  
                 }
 75  0
                 if (getActionRequestId() != null && !getActionRequestId().equals(actionRequest.getActionRequestId()) ){
 76  0
                         return false;
 77  
                 }
 78  0
                 if (!StringUtils.isEmpty(getNodeName()) && !getNodeName().equals(actionRequest.getNodeInstance().getName())) {
 79  0
                         return false;
 80  
                 }
 81  0
                 if (getPrincipalId() != null && (!actionRequest.isUserRequest() || !actionRequest.getPrincipalId().equals(getPrincipalId()))) {
 82  0
                         return false;
 83  
                 }
 84  0
                 if (getGroupId() != null && (!actionRequest.isGroupRequest() || !actionRequest.getGroupId().equals(getGroupId()))) {
 85  0
                         return false;
 86  
                 }
 87  0
                 return true;
 88  
         }
 89  
 
 90  
         /**
 91  
          * @return the group
 92  
          */
 93  
         public String getGroupId() {
 94  0
                 return this.groupId;
 95  
         }
 96  
 
 97  
         /**
 98  
          * @param groupId of the group to set
 99  
          */
 100  
         public void setGroupId(String groupId) {
 101  0
                 this.groupId = groupId;
 102  0
         }
 103  
         
 104  
 }