Coverage Report - org.kuali.rice.kew.api.action.ActionInvocation
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionInvocation
0%
0/16
0%
0/4
1.8
ActionInvocation$Constants
0%
0/1
N/A
1.8
ActionInvocation$Elements
0%
0/1
N/A
1.8
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kew.api.action;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.CoreConstants;
 20  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 21  
 import org.w3c.dom.Element;
 22  
 
 23  
 import javax.xml.bind.annotation.XmlAccessType;
 24  
 import javax.xml.bind.annotation.XmlAccessorType;
 25  
 import javax.xml.bind.annotation.XmlAnyElement;
 26  
 import javax.xml.bind.annotation.XmlElement;
 27  
 import javax.xml.bind.annotation.XmlRootElement;
 28  
 import javax.xml.bind.annotation.XmlType;
 29  
 import java.util.Collection;
 30  
 
 31  
 /**
 32  
  * Represents the definition of an Action invocation against an action item.
 33  
  * 
 34  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 35  
  *
 36  
  */
 37  
 @XmlRootElement(name = ActionInvocation.Constants.ROOT_ELEMENT_NAME)
 38  
 @XmlAccessorType(XmlAccessType.NONE)
 39  
 @XmlType(name = ActionInvocation.Constants.TYPE_NAME, propOrder = {
 40  
         ActionInvocation.Elements.ACTION,
 41  
         ActionInvocation.Elements.ACTION_ITEM_ID,
 42  
         CoreConstants.CommonElements.FUTURE_ELEMENTS
 43  
 })
 44  
 public class ActionInvocation extends AbstractDataTransferObject {
 45  
 
 46  
     @XmlElement(name = Elements.ACTION, required = true)
 47  
     private final ActionType action;
 48  
 
 49  
     @XmlElement(name = Elements.ACTION_ITEM_ID, required = true)
 50  
     private final String actionItemId;
 51  
 
 52  0
     @SuppressWarnings("unused")
 53  
     @XmlAnyElement
 54  
     private final Collection<Element> _futureElements = null;
 55  
 
 56  
     @SuppressWarnings("unused")
 57  0
     private ActionInvocation() {
 58  0
         this.action = null;
 59  0
         this.actionItemId = null;
 60  0
     }
 61  
 
 62  0
     private ActionInvocation(ActionType action, String actionItemId) {
 63  0
         if (action == null) {
 64  0
                         throw new IllegalArgumentException("action was null");
 65  
                 }
 66  0
         if (StringUtils.isBlank(actionItemId)) {
 67  0
                         throw new IllegalArgumentException("actionItemId was a null or blank value");
 68  
                 }
 69  0
                 this.actionItemId = actionItemId;
 70  0
                 this.action = action;
 71  0
     }
 72  
 
 73  
     /**
 74  
      * Creates a new {@code ActionInvocation} which indicates that the specified action should be executed against the
 75  
      * action item with the given id.
 76  
      *
 77  
      * @param action the action to execute against the action item
 78  
      * @param actionItemId the id of the action item against which to execute the action
 79  
      *
 80  
      * @return a new {@code ActionInvocation} containing the provided values
 81  
      *
 82  
      * @throws IllegalArgumentException if {@code action} is null or {@code actionItemId} is a null or blank value
 83  
      */
 84  
         public static ActionInvocation create(ActionType action, String actionItemId) {
 85  0
         return new ActionInvocation(action, actionItemId);
 86  
         }
 87  
                 
 88  
         public ActionType getAction() {
 89  0
                 return action;
 90  
         }
 91  
         
 92  
         public String getActionItemId() {
 93  0
                 return actionItemId;
 94  
         }
 95  
 
 96  
     /**
 97  
      * Defines some internal constants used on this class.
 98  
      */
 99  0
     static class Constants {
 100  
         final static String ROOT_ELEMENT_NAME = "actionInvocation";
 101  
         final static String TYPE_NAME = "ActionInvocationType";
 102  
     }
 103  
 
 104  
     /**
 105  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 106  
      */
 107  0
     static class Elements {
 108  
         final static String ACTION = "action";
 109  
         final static String ACTION_ITEM_ID = "actionItemId";
 110  
     }
 111  
                 
 112  
 }