Coverage Report - org.kuali.rice.kew.api.action.RoutingReportCriteria
 
Classes in this File Line Coverage Branch Coverage Complexity
RoutingReportCriteria
0%
0/45
0%
0/4
1.143
RoutingReportCriteria$1
N/A
N/A
1.143
RoutingReportCriteria$Builder
0%
0/64
0%
0/6
1.143
RoutingReportCriteria$Constants
0%
0/1
N/A
1.143
RoutingReportCriteria$Elements
0%
0/1
N/A
1.143
 
 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 java.io.Serializable;
 19  
 import java.util.ArrayList;
 20  
 import java.util.Collection;
 21  
 import java.util.Collections;
 22  
 import java.util.List;
 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  
 
 30  
 import org.kuali.rice.core.api.CoreConstants;
 31  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 32  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 33  
 import org.w3c.dom.Element;
 34  
 
 35  
 @XmlRootElement(name = RoutingReportCriteria.Constants.ROOT_ELEMENT_NAME)
 36  
 @XmlAccessorType(XmlAccessType.NONE)
 37  
 @XmlType(name = RoutingReportCriteria.Constants.TYPE_NAME, propOrder = {
 38  
         RoutingReportCriteria.Elements.DOCUMENT_ID,
 39  
         RoutingReportCriteria.Elements.TARGET_NODE_NAME,
 40  
         RoutingReportCriteria.Elements.TARGET_PRINCIPAL_IDS,
 41  
         RoutingReportCriteria.Elements.ROUTING_PRINCIPAL_ID,
 42  
         RoutingReportCriteria.Elements.DOCUMENT_TYPE_NAME,
 43  
         RoutingReportCriteria.Elements.XML_CONTENT,
 44  
         RoutingReportCriteria.Elements.RULE_TEMPLATE_NAMES,
 45  
         RoutingReportCriteria.Elements.NODE_NAMES,
 46  
         RoutingReportCriteria.Elements.ACTIONS_TO_TAKE,
 47  
         RoutingReportCriteria.Elements.ACTIVATE_REQUESTS,
 48  
         RoutingReportCriteria.Elements.FLATTEN_NODES,
 49  
         CoreConstants.CommonElements.FUTURE_ELEMENTS})
 50  0
 public final class RoutingReportCriteria extends AbstractDataTransferObject implements RoutingReportCriteriaContract {
 51  
 
 52  
     @XmlElement(name = Elements.DOCUMENT_ID, required = false)
 53  
     private final String documentId;
 54  
     @XmlElement(name = Elements.TARGET_NODE_NAME, required = false)
 55  
     private final String targetNodeName;
 56  
     @XmlElement(name = Elements.TARGET_PRINCIPAL_IDS, required = false)
 57  
     private final List<String> targetPrincipalIds;
 58  
     @XmlElement(name = Elements.ROUTING_PRINCIPAL_ID, required = false)
 59  
     private final String routingPrincipalId;
 60  
     @XmlElement(name = Elements.DOCUMENT_TYPE_NAME, required = false)
 61  
     private final String documentTypeName;
 62  
     @XmlElement(name = Elements.XML_CONTENT, required = false)
 63  
     private final String xmlContent;
 64  
     @XmlElement(name = Elements.RULE_TEMPLATE_NAMES, required = false)
 65  
     private final List<String> ruleTemplateNames;
 66  
     @XmlElement(name = Elements.NODE_NAMES, required = false)
 67  
     private final List<String> nodeNames;
 68  
     @XmlElement(name = Elements.ACTIONS_TO_TAKE, required = false)
 69  
     private final List<RoutingReportActionToTake> actionsToTake;
 70  
     @XmlElement(name = Elements.ACTIVATE_REQUESTS, required = false)
 71  
     private final boolean activateRequests;
 72  
     @XmlElement(name = Elements.FLATTEN_NODES, required = false)
 73  
     private final boolean flattenNodes;
 74  0
     @SuppressWarnings("unused")
 75  
     @XmlAnyElement
 76  
     private final Collection<Element> _futureElements = null;
 77  
 
 78  
     /**
 79  
      * Private constructor used only by JAXB.
 80  
      */
 81  0
     private RoutingReportCriteria() {
 82  0
         this.documentId = null;
 83  0
         this.targetNodeName = null;
 84  0
         this.targetPrincipalIds = null;
 85  0
         this.routingPrincipalId = null;
 86  0
         this.documentTypeName = null;
 87  0
         this.xmlContent = null;
 88  0
         this.ruleTemplateNames = null;
 89  0
         this.nodeNames = null;
 90  0
         this.actionsToTake = null;
 91  0
         this.flattenNodes = false;
 92  0
         this.activateRequests = false;
 93  0
     }
 94  
 
 95  0
     private RoutingReportCriteria(Builder builder) {
 96  0
         this.documentId = builder.getDocumentId();
 97  0
         this.targetNodeName = builder.getTargetNodeName();
 98  0
         this.targetPrincipalIds = builder.getTargetPrincipalIds();
 99  0
         this.routingPrincipalId = builder.getRoutingPrincipalId();
 100  0
         this.documentTypeName = builder.getDocumentTypeName();
 101  0
         this.xmlContent = builder.getXmlContent();
 102  0
         this.ruleTemplateNames = builder.getRuleTemplateNames();
 103  0
         this.nodeNames = builder.getNodeNames();
 104  0
         if (builder.getActionsToTake() != null) {
 105  0
             List<RoutingReportActionToTake> actions = new ArrayList<RoutingReportActionToTake>();
 106  0
             for (RoutingReportActionToTake.Builder actionBuilder : builder.getActionsToTake()) {
 107  0
                 actions.add(actionBuilder.build());
 108  
             }
 109  0
             this.actionsToTake = actions;
 110  0
         } else {
 111  0
             this.actionsToTake = Collections.emptyList();
 112  
         }
 113  0
         this.flattenNodes = builder.isFlattenNodes();
 114  0
         this.activateRequests = builder.isActivateRequests();
 115  0
     }
 116  
 
 117  
     @Override
 118  
     public String getDocumentId() {
 119  0
         return this.documentId;
 120  
     }
 121  
 
 122  
     @Override
 123  
     public String getTargetNodeName() {
 124  0
         return this.targetNodeName;
 125  
     }
 126  
 
 127  
     @Override
 128  
     public List<String> getTargetPrincipalIds() {
 129  0
         return this.targetPrincipalIds;
 130  
     }
 131  
 
 132  
     @Override
 133  
     public String getRoutingPrincipalId() {
 134  0
         return this.routingPrincipalId;
 135  
     }
 136  
 
 137  
     @Override
 138  
     public String getDocumentTypeName() {
 139  0
         return this.documentTypeName;
 140  
     }
 141  
 
 142  
     @Override
 143  
     public String getXmlContent() {
 144  0
         return this.xmlContent;
 145  
     }
 146  
 
 147  
     @Override
 148  
     public List<String> getRuleTemplateNames() {
 149  0
         return this.ruleTemplateNames;
 150  
     }
 151  
 
 152  
     @Override
 153  
     public List<String> getNodeNames() {
 154  0
         return this.nodeNames;
 155  
     }
 156  
 
 157  
     @Override
 158  
     public List<RoutingReportActionToTake> getActionsToTake() {
 159  0
         return this.actionsToTake;
 160  
     }
 161  
 
 162  
     @Override
 163  
     public boolean isActivateRequests() {
 164  0
         return this.activateRequests;
 165  
     }
 166  
 
 167  
     @Override
 168  
     public boolean isFlattenNodes() {
 169  0
         return this.flattenNodes;
 170  
     }
 171  
 
 172  
     /**
 173  
      * A builder which can be used to construct {@link RoutingReportCriteria} instances.  Enforces the constraints of
 174  
      * the {@link RoutingReportCriteriaContract}.
 175  
      */
 176  0
     public final static class Builder implements Serializable, ModelBuilder, RoutingReportCriteriaContract {
 177  
 
 178  
         private String documentId;
 179  
         private String targetNodeName;
 180  
         private List<String> targetPrincipalIds;
 181  
         private String routingPrincipalId;
 182  
         private String documentTypeName;
 183  
         private String xmlContent;
 184  
         private List<String> ruleTemplateNames;
 185  
         private List<String> nodeNames;
 186  
         private List<RoutingReportActionToTake.Builder> actionsToTake;
 187  
         private boolean activateRequests;
 188  
         private boolean flattenNodes;
 189  
 
 190  0
         private Builder(String documentId, String targetNodeName) {
 191  0
             this.setDocumentId(documentId);
 192  0
             this.setTargetNodeName(targetNodeName);
 193  0
         }
 194  
 
 195  0
         private Builder(String documentTypeName) {
 196  0
             this.setDocumentTypeName(documentTypeName);
 197  0
         }
 198  
 
 199  
         public static Builder createByDocumentTypeName(String documentTypeName) {
 200  0
             return new Builder(documentTypeName);
 201  
         }
 202  
 
 203  
         public static Builder createByDocumentId(String documentId) {
 204  0
             return new Builder(documentId, null);
 205  
         }
 206  
 
 207  
         public static Builder createByDocumentIdAndTargetNodeName(String documentId, String targetNodeName) {
 208  0
             return new Builder(documentId, targetNodeName);
 209  
         }
 210  
 
 211  
         public static Builder create(RoutingReportCriteriaContract contract) {
 212  0
             if (contract == null) {
 213  0
                 throw new IllegalArgumentException("contract was null");
 214  
             }
 215  0
             Builder builder =
 216  
                     createByDocumentIdAndTargetNodeName(contract.getDocumentId(), contract.getTargetNodeName());
 217  0
             builder.setDocumentId(contract.getDocumentId());
 218  0
             builder.setTargetNodeName(contract.getTargetNodeName());
 219  0
             builder.setTargetPrincipalIds(contract.getTargetPrincipalIds());
 220  0
             builder.setRoutingPrincipalId(contract.getRoutingPrincipalId());
 221  0
             builder.setDocumentTypeName(contract.getDocumentTypeName());
 222  0
             builder.setXmlContent(contract.getXmlContent());
 223  0
             builder.setRuleTemplateNames(contract.getRuleTemplateNames());
 224  0
             builder.setNodeNames(contract.getNodeNames());
 225  0
             if (contract.getActionsToTake() != null) {
 226  0
                 List<RoutingReportActionToTake.Builder> actionsToTake = new ArrayList<RoutingReportActionToTake.Builder>();
 227  0
                 for (RoutingReportActionToTakeContract action : contract.getActionsToTake()) {
 228  0
                     actionsToTake.add(RoutingReportActionToTake.Builder.create(action));
 229  
                 }
 230  0
                 builder.setActionsToTake(actionsToTake);
 231  
             }
 232  0
             builder.setActivateRequests(contract.isActivateRequests());
 233  0
             builder.setFlattenNodes(contract.isFlattenNodes());
 234  
 
 235  0
             return builder;
 236  
         }
 237  
 
 238  
         public RoutingReportCriteria build() {
 239  0
             return new RoutingReportCriteria(this);
 240  
         }
 241  
 
 242  
         @Override
 243  
         public String getDocumentId() {
 244  0
             return this.documentId;
 245  
         }
 246  
 
 247  
         @Override
 248  
         public String getTargetNodeName() {
 249  0
             return this.targetNodeName;
 250  
         }
 251  
 
 252  
         @Override
 253  
         public List<String> getTargetPrincipalIds() {
 254  0
             return this.targetPrincipalIds;
 255  
         }
 256  
 
 257  
         @Override
 258  
         public String getRoutingPrincipalId() {
 259  0
             return this.routingPrincipalId;
 260  
         }
 261  
 
 262  
         @Override
 263  
         public String getDocumentTypeName() {
 264  0
             return this.documentTypeName;
 265  
         }
 266  
 
 267  
         @Override
 268  
         public String getXmlContent() {
 269  0
             return this.xmlContent;
 270  
         }
 271  
 
 272  
         @Override
 273  
         public List<String> getRuleTemplateNames() {
 274  0
             return this.ruleTemplateNames;
 275  
         }
 276  
 
 277  
         @Override
 278  
         public List<String> getNodeNames() {
 279  0
             return this.nodeNames;
 280  
         }
 281  
 
 282  
         @Override
 283  
         public List<RoutingReportActionToTake.Builder> getActionsToTake() {
 284  0
             return this.actionsToTake;
 285  
         }
 286  
 
 287  
         @Override
 288  
         public boolean isActivateRequests() {
 289  0
             return this.activateRequests;
 290  
         }
 291  
 
 292  
         @Override
 293  
         public boolean isFlattenNodes() {
 294  0
             return this.flattenNodes;
 295  
         }
 296  
 
 297  
         public void setDocumentId(String documentId) {
 298  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 299  0
             this.documentId = documentId;
 300  0
         }
 301  
 
 302  
         public void setTargetNodeName(String targetNodeName) {
 303  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 304  0
             this.targetNodeName = targetNodeName;
 305  0
         }
 306  
 
 307  
         public void setTargetPrincipalIds(List<String> targetPrincipalIds) {
 308  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 309  0
             this.targetPrincipalIds = Collections.unmodifiableList(targetPrincipalIds);
 310  0
         }
 311  
 
 312  
         public void setRoutingPrincipalId(String routingPrincipalId) {
 313  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 314  0
             this.routingPrincipalId = routingPrincipalId;
 315  0
         }
 316  
 
 317  
         public void setDocumentTypeName(String documentTypeName) {
 318  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 319  0
             this.documentTypeName = documentTypeName;
 320  0
         }
 321  
 
 322  
         public void setXmlContent(String xmlContent) {
 323  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 324  0
             this.xmlContent = xmlContent;
 325  0
         }
 326  
 
 327  
         public void setRuleTemplateNames(List<String> ruleTemplateNames) {
 328  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 329  0
             this.ruleTemplateNames = Collections.unmodifiableList(ruleTemplateNames);
 330  0
         }
 331  
 
 332  
         public void setNodeNames(List<String> nodeNames) {
 333  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 334  0
             this.nodeNames = Collections.unmodifiableList(nodeNames);
 335  0
         }
 336  
 
 337  
         public void setActionsToTake(List<RoutingReportActionToTake.Builder> actionsToTake) {
 338  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 339  0
             this.actionsToTake = Collections.unmodifiableList(actionsToTake);
 340  0
         }
 341  
 
 342  
         public void setActivateRequests(boolean activateRequests) {
 343  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 344  0
             this.activateRequests = activateRequests;
 345  0
         }
 346  
 
 347  
         public void setFlattenNodes(boolean flattenNodes) {
 348  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 349  0
             this.flattenNodes = flattenNodes;
 350  0
         }
 351  
     }
 352  
 
 353  
     /**
 354  
      * Defines some internal constants used on this class.
 355  
      */
 356  0
     static class Constants {
 357  
 
 358  
         final static String ROOT_ELEMENT_NAME = "routingReportCriteria";
 359  
         final static String TYPE_NAME = "RoutingReportCriteriaType";
 360  
     }
 361  
 
 362  
     /**
 363  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled
 364  
      * to XML.
 365  
      */
 366  0
     static class Elements {
 367  
 
 368  
         final static String DOCUMENT_ID = "documentId";
 369  
         final static String TARGET_NODE_NAME = "targetNodeName";
 370  
         final static String TARGET_PRINCIPAL_IDS = "targetPrincipalIds";
 371  
         final static String ROUTING_PRINCIPAL_ID = "routingPrincipalId";
 372  
         final static String DOCUMENT_TYPE_NAME = "documentTypeName";
 373  
         final static String XML_CONTENT = "xmlContent";
 374  
         final static String RULE_TEMPLATE_NAMES = "ruleTemplateNames";
 375  
         final static String NODE_NAMES = "nodeNames";
 376  
         final static String ACTIONS_TO_TAKE = "actionsToTake";
 377  
         final static String ACTIVATE_REQUESTS = "activateRequests";
 378  
         final static String FLATTEN_NODES = "flattenNodes";
 379  
     }
 380  
 }