Coverage Report - org.apache.commons.scxml.model.Invoke

Classes in this File Line Coverage Branch Coverage Complexity
Invoke
81% 
N/A 
1

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 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.apache.commons.scxml.model;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.HashMap;
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 import org.apache.commons.scxml.PathResolver;
 26  
 
 27  
 /**
 28  
  * The class in this SCXML object model that corresponds to the
 29  
  * <invoke> SCXML element.
 30  
  *
 31  
  */
 32  
 public class Invoke implements NamespacePrefixesHolder, PathResolverHolder,
 33  
         Serializable {
 34  
 
 35  
     /**
 36  
      * Serial version UID.
 37  
      */
 38  
     private static final long serialVersionUID = 1L;
 39  
 
 40  
     /**
 41  
      * The type of target to be invoked.
 42  
      */
 43  
     private String targettype;
 44  
 
 45  
     /**
 46  
      * The source URL for the external service.
 47  
      */
 48  
     private String src;
 49  
 
 50  
     /**
 51  
      * The expression that evaluates to the source URL for the
 52  
      * external service.
 53  
      */
 54  
     private String srcexpr;
 55  
 
 56  
     /**
 57  
      * The Map of the params to be sent to the invoked process.
 58  
      *
 59  
      * Remove with deprecated getParams() in 1.0
 60  
      */
 61  
     private Map params;
 62  
 
 63  
     /**
 64  
      * The List of the params to be sent to the invoked process.
 65  
      */
 66  
     private List paramsList;
 67  
 
 68  
     /**
 69  
      * The <finalize> child, may be null.
 70  
      */
 71  
     private Finalize finalize;
 72  
 
 73  
     /**
 74  
      * {@link PathResolver} for resolving the "src" or "srcexpr" result.
 75  
      */
 76  
     private PathResolver pathResolver;
 77  
 
 78  
     /**
 79  
      * The current XML namespaces in the SCXML document for this action node,
 80  
      * preserved for deferred XPath evaluation.
 81  
      */
 82  
     private Map namespaces;
 83  
 
 84  
     /**
 85  
      * Default no-args constructor for Digester.
 86  
      */
 87  1
     public Invoke() {
 88  1
         params = new HashMap();
 89  1
         paramsList = new ArrayList();
 90  1
     }
 91  
 
 92  
     /**
 93  
      * Get the target type for this <invoke> element.
 94  
      *
 95  
      * @return String Returns the targettype.
 96  
      */
 97  
     public final String getTargettype() {
 98  2
         return targettype;
 99  
     }
 100  
 
 101  
     /**
 102  
      * Set the target type for this <invoke> element.
 103  
      *
 104  
      * @param targettype The targettype to set.
 105  
      */
 106  
     public final void setTargettype(final String targettype) {
 107  1
         this.targettype = targettype;
 108  1
     }
 109  
 
 110  
     /**
 111  
      * Get the URL for the external service.
 112  
      *
 113  
      * @return String The URL.
 114  
      */
 115  
     public final String getSrc() {
 116  2
         return src;
 117  
     }
 118  
 
 119  
     /**
 120  
      * Set the URL for the external service.
 121  
      *
 122  
      * @param src The source URL.
 123  
      */
 124  
     public final void setSrc(final String src) {
 125  1
         this.src = src;
 126  1
     }
 127  
 
 128  
     /**
 129  
      * Get the expression that evaluates to the source URL for the
 130  
      * external service.
 131  
      *
 132  
      * @return String The source expression.
 133  
      */
 134  
     public final String getSrcexpr() {
 135  1
         return srcexpr;
 136  
     }
 137  
 
 138  
     /**
 139  
      * Set the expression that evaluates to the source URL for the
 140  
      * external service.
 141  
      *
 142  
      * @param srcexpr The source expression.
 143  
      */
 144  
     public final void setSrcexpr(final String srcexpr) {
 145  0
         this.srcexpr = srcexpr;
 146  0
     }
 147  
 
 148  
     /**
 149  
      * Get the params Map.
 150  
      *
 151  
      * @return Map The params map.
 152  
      * @deprecated Remove in v1.0, use params() instead
 153  
      */
 154  
     public final Map getParams() {
 155  0
         return params;
 156  
     }
 157  
 
 158  
     /**
 159  
      * Get the list of {@link Param}s.
 160  
      *
 161  
      * @return List The params list.
 162  
      */
 163  
     public final List params() {
 164  1
         return paramsList;
 165  
     }
 166  
 
 167  
     /**
 168  
      * Add this param to this invoke.
 169  
      *
 170  
      * @param param The invoke parameter.
 171  
      */
 172  
     public final void addParam(final Param param) {
 173  2
         params.put(param.getName(), param.getExpr());
 174  2
         paramsList.add(param);
 175  2
     }
 176  
 
 177  
     /**
 178  
      * Get the Finalize for this Invoke.
 179  
      *
 180  
      * @return Finalize The Finalize for this Invoke.
 181  
      */
 182  
     public final Finalize getFinalize() {
 183  0
         return finalize;
 184  
     }
 185  
 
 186  
     /**
 187  
      * Set the Finalize for this Invoke.
 188  
      *
 189  
      * @param finalize The Finalize for this Invoke.
 190  
      */
 191  
     public final void setFinalize(final Finalize finalize) {
 192  1
         this.finalize = finalize;
 193  1
     }
 194  
 
 195  
     /**
 196  
      * Get the {@link PathResolver}.
 197  
      *
 198  
      * @return Returns the pathResolver.
 199  
      */
 200  
     public PathResolver getPathResolver() {
 201  2
         return pathResolver;
 202  
     }
 203  
 
 204  
     /**
 205  
      * Set the {@link PathResolver}.
 206  
      *
 207  
      * @param pathResolver The pathResolver to set.
 208  
      */
 209  
     public void setPathResolver(final PathResolver pathResolver) {
 210  1
         this.pathResolver = pathResolver;
 211  1
     }
 212  
 
 213  
     /**
 214  
      * Get the XML namespaces at this action node in the SCXML document.
 215  
      *
 216  
      * @return Returns the map of namespaces.
 217  
      */
 218  
     public final Map getNamespaces() {
 219  0
         return namespaces;
 220  
     }
 221  
 
 222  
     /**
 223  
      * Set the XML namespaces at this action node in the SCXML document.
 224  
      *
 225  
      * @param namespaces The document namespaces.
 226  
      */
 227  
     public final void setNamespaces(final Map namespaces) {
 228  1
         this.namespaces = namespaces;
 229  1
     }
 230  
 
 231  
 }
 232