Coverage Report - org.kuali.rice.kew.actions.ActionSet
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionSet
0%
0/22
0%
0/2
1.118
 
 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 java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.List;
 22  
 
 23  
 import org.kuali.rice.kew.util.KEWConstants;
 24  
 
 25  
 
 26  
 /**
 27  
  * Specifies a set of Action codes.
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  */
 31  0
 public class ActionSet implements Serializable {
 32  
 
 33  
         /**
 34  
          * 
 35  
          */
 36  
         private static final long serialVersionUID = 7857749268529671300L;
 37  0
         private List<String> actionSet = new ArrayList<String>();
 38  
         
 39  
         public boolean hasAction(String actionCode) {
 40  0
                 return actionSet.contains(actionCode);
 41  
         }
 42  
         
 43  
         public boolean addAction(String actionCode) {
 44  0
                 if (!actionSet.contains(actionCode)) {
 45  0
                         actionSet.add(actionCode);
 46  0
                         return true;
 47  
                 }
 48  0
                 return false;
 49  
         }
 50  
         
 51  
         public boolean removeAction(String actionCode) {
 52  0
                 return actionSet.remove(actionCode);
 53  
         }
 54  
         
 55  
         // some convienance methods for common actions
 56  
         
 57  
         public boolean hasApprove() {
 58  0
                 return hasAction(KEWConstants.ACTION_TAKEN_APPROVED_CD);
 59  
         }
 60  
         
 61  
         public boolean hasComplete() {
 62  0
                 return hasAction(KEWConstants.ACTION_TAKEN_COMPLETED_CD);
 63  
         }
 64  
         
 65  
         public boolean hasAcknowledge() {
 66  0
                 return hasAction(KEWConstants.ACTION_TAKEN_ACKNOWLEDGED_CD);
 67  
         }
 68  
         
 69  
         public boolean hasFyi() {
 70  0
                 return hasAction(KEWConstants.ACTION_TAKEN_FYI_CD);
 71  
         }
 72  
         
 73  
         public boolean hasDisapprove() {
 74  0
                 return hasAction(KEWConstants.ACTION_TAKEN_DENIED_CD);
 75  
         }
 76  
         
 77  
         public boolean hasCancel() {
 78  0
                 return hasAction(KEWConstants.ACTION_TAKEN_CANCELED_CD);
 79  
         }
 80  
 
 81  
     public boolean hasRouted() {
 82  0
         return hasAction(KEWConstants.ACTION_TAKEN_ROUTED_CD);
 83  
     }
 84  
 
 85  
         public boolean addApprove() {
 86  0
                 return addAction(KEWConstants.ACTION_TAKEN_APPROVED_CD);
 87  
         }
 88  
         
 89  
         public boolean addComplete() {
 90  0
                 return addAction(KEWConstants.ACTION_TAKEN_COMPLETED_CD);
 91  
         }
 92  
         
 93  
         public boolean addAcknowledge() {
 94  0
                 return addAction(KEWConstants.ACTION_TAKEN_ACKNOWLEDGED_CD);
 95  
         }
 96  
         
 97  
         public boolean addFyi() {
 98  0
                 return addAction(KEWConstants.ACTION_TAKEN_FYI_CD);
 99  
         }
 100  
         
 101  
         public boolean addDisapprove() {
 102  0
                 return addAction(KEWConstants.ACTION_TAKEN_DENIED_CD);
 103  
         }
 104  
         
 105  
         public boolean addCancel() {
 106  0
                 return addAction(KEWConstants.ACTION_TAKEN_CANCELED_CD);
 107  
         }
 108  
 
 109  
     public boolean addRouted() {
 110  0
         return addAction(KEWConstants.ACTION_TAKEN_ROUTED_CD);
 111  
     }
 112  
 }