Coverage Report - org.kuali.rice.kew.api.document.DocumentDetail
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentDetail
0%
0/21
N/A
1.476
DocumentDetail$1
N/A
N/A
1.476
DocumentDetail$Builder
0%
0/37
0%
0/10
1.476
DocumentDetail$Constants
0%
0/2
N/A
1.476
DocumentDetail$Elements
0%
0/1
N/A
1.476
 
 1  
 /*
 2  
  * Copyright 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/ecl1.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.document;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.util.ArrayList;
 20  
 import java.util.Collection;
 21  
 import java.util.List;
 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.XmlElementWrapper;
 28  
 import javax.xml.bind.annotation.XmlRootElement;
 29  
 import javax.xml.bind.annotation.XmlType;
 30  
 
 31  
 import org.apache.commons.lang.builder.EqualsBuilder;
 32  
 import org.apache.commons.lang.builder.HashCodeBuilder;
 33  
 import org.apache.commons.lang.builder.ToStringBuilder;
 34  
 import org.kuali.rice.core.api.CoreConstants;
 35  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 36  
 import org.kuali.rice.core.api.mo.ModelObjectComplete;
 37  
 import org.kuali.rice.kew.api.action.ActionRequest;
 38  
 import org.kuali.rice.kew.api.action.ActionTaken;
 39  
 import org.w3c.dom.Element;
 40  
 
 41  
 @XmlRootElement(name = DocumentDetail.Constants.ROOT_ELEMENT_NAME)
 42  
 @XmlAccessorType(XmlAccessType.NONE)
 43  
 @XmlType(name = DocumentDetail.Constants.TYPE_NAME, propOrder = {
 44  
     DocumentDetail.Elements.DOCUMENT,
 45  
     DocumentDetail.Elements.ACTION_REQUESTS,
 46  
     DocumentDetail.Elements.ACTIONS_TAKEN,
 47  
     DocumentDetail.Elements.ROUTE_NODE_INSTANCES,
 48  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 49  
 })
 50  0
 public final class DocumentDetail implements ModelObjectComplete, DocumentDetailContract {
 51  
 
 52  
         private static final long serialVersionUID = -8569515693892958719L;
 53  
 
 54  
         @XmlElement(name = Elements.DOCUMENT, required = true)
 55  
     private final Document document;
 56  
     
 57  
     @XmlElementWrapper(name = Elements.ACTION_REQUESTS, required = true)
 58  
     @XmlElement(name = Elements.ACTION_REQUEST, required = false)
 59  
     private final List<ActionRequest> actionRequests;
 60  
     
 61  
     @XmlElementWrapper(name = Elements.ACTIONS_TAKEN, required = true)
 62  
     @XmlElement(name = Elements.ACTION_TAKEN, required = false)
 63  
     private final List<ActionTaken> actionsTaken;
 64  
     
 65  
     @XmlElementWrapper(name = Elements.ROUTE_NODE_INSTANCES, required = true)
 66  
     @XmlElement(name = Elements.ROUTE_NODE_INSTANCES, required = true)
 67  
     private final List<RouteNodeInstance> routeNodeInstances;
 68  
     
 69  0
     @SuppressWarnings("unused")
 70  
     @XmlAnyElement
 71  
     private final Collection<Element> _futureElements = null;
 72  
 
 73  
     /**
 74  
      * Private constructor used only by JAXB.
 75  
      */
 76  0
     private DocumentDetail() {
 77  0
         this.document = null;
 78  0
         this.actionRequests = null;
 79  0
         this.actionsTaken = null;
 80  0
         this.routeNodeInstances = null;
 81  0
     }
 82  
 
 83  0
     private DocumentDetail(Builder builder) {
 84  0
         this.document = builder.getDocument();
 85  0
         this.actionRequests = builder.getActionRequests();
 86  0
         this.actionsTaken = builder.getActionsTaken();
 87  0
         this.routeNodeInstances = builder.getRouteNodeInstances();
 88  0
     }
 89  
 
 90  
     @Override
 91  
     public Document getDocument() {
 92  0
         return this.document;
 93  
     }
 94  
 
 95  
     @Override
 96  
     public List<ActionRequest> getActionRequests() {
 97  0
         return this.actionRequests;
 98  
     }
 99  
 
 100  
     @Override
 101  
     public List<ActionTaken> getActionsTaken() {
 102  0
         return this.actionsTaken;
 103  
     }
 104  
 
 105  
     @Override
 106  
     public List<RouteNodeInstance> getRouteNodeInstances() {
 107  0
         return this.routeNodeInstances;
 108  
     }
 109  
 
 110  
     @Override
 111  
     public int hashCode() {
 112  0
         return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 113  
     }
 114  
 
 115  
     @Override
 116  
     public boolean equals(Object object) {
 117  0
         return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 118  
     }
 119  
 
 120  
     @Override
 121  
     public String toString() {
 122  0
         return ToStringBuilder.reflectionToString(this);
 123  
     }
 124  
 
 125  
 
 126  
     /**
 127  
      * A builder which can be used to construct {@link DocumentDetail} instances.  Enforces the constraints of the {@link DocumentDetailContract}.
 128  
      */
 129  0
     public final static class Builder implements Serializable, ModelBuilder, DocumentDetailContract {
 130  
 
 131  
                 private static final long serialVersionUID = 3108177943363491329L;
 132  
 
 133  
                 private Document document;
 134  
         private List<ActionRequest> actionRequests;
 135  
         private List<ActionTaken> actionsTaken;
 136  
         private List<RouteNodeInstance> routeNodeInstances;
 137  
 
 138  0
         private Builder() {
 139  
             // TODO modify this constructor as needed to pass any required values and invoke the appropriate 'setter' methods
 140  0
         }
 141  
 
 142  
         public static Builder create(Document document) {
 143  0
             Builder builder = new Builder();
 144  0
             builder.setDocument(document);
 145  0
             builder.setActionRequests(new ArrayList<ActionRequest>());
 146  0
             builder.setActionsTaken(new ArrayList<ActionTaken>());
 147  0
             builder.setRouteNodeInstances(new ArrayList<RouteNodeInstance>());
 148  0
             return builder;
 149  
         }
 150  
 
 151  
         public static Builder create(DocumentDetailContract contract) {
 152  0
             if (contract == null) {
 153  0
                 throw new IllegalArgumentException("contract was null");
 154  
             }
 155  0
             Builder builder = create(contract.getDocument());
 156  0
             builder.setActionRequests(contract.getActionRequests());
 157  0
             builder.setActionsTaken(contract.getActionsTaken());
 158  0
             builder.setRouteNodeInstances(contract.getRouteNodeInstances());
 159  0
             return builder;
 160  
         }
 161  
 
 162  
         public DocumentDetail build() {
 163  0
             return new DocumentDetail(this);
 164  
         }
 165  
 
 166  
         @Override
 167  
         public Document getDocument() {
 168  0
             return this.document;
 169  
         }
 170  
 
 171  
         @Override
 172  
         public List<ActionRequest> getActionRequests() {
 173  0
             return this.actionRequests;
 174  
         }
 175  
 
 176  
         @Override
 177  
         public List<ActionTaken> getActionsTaken() {
 178  0
             return this.actionsTaken;
 179  
         }
 180  
 
 181  
         @Override
 182  
         public List<RouteNodeInstance> getRouteNodeInstances() {
 183  0
             return this.routeNodeInstances;
 184  
         }
 185  
 
 186  
         public void setDocument(Document document) {
 187  0
             if (document == null) {
 188  0
                     throw new IllegalArgumentException("document was null");
 189  
             }
 190  0
             this.document = document;
 191  0
         }
 192  
 
 193  
         public void setActionRequests(List<ActionRequest> actionRequests) {
 194  0
             if (actionRequests == null) {
 195  0
                     throw new IllegalArgumentException("actionRequests was null");
 196  
             }
 197  0
             this.actionRequests = actionRequests;
 198  0
         }
 199  
 
 200  
         public void setActionsTaken(List<ActionTaken> actionsTaken) {
 201  0
                 if (actionsTaken == null) {
 202  0
                     throw new IllegalArgumentException("actionsTaken was null");
 203  
             }
 204  0
             this.actionsTaken = actionsTaken;
 205  0
         }
 206  
 
 207  
         public void setRouteNodeInstances(List<RouteNodeInstance> routeNodeInstances) {
 208  0
                 if (routeNodeInstances == null) {
 209  0
                     throw new IllegalArgumentException("routeNodeInstances was null");
 210  
             }
 211  0
             this.routeNodeInstances = routeNodeInstances;
 212  0
         }
 213  
 
 214  
     }
 215  
 
 216  
     /**
 217  
      * Defines some internal constants used on this class.
 218  
      */
 219  0
     static class Constants {
 220  
         final static String ROOT_ELEMENT_NAME = "documentDetail";
 221  
         final static String TYPE_NAME = "DocumentDetailType";
 222  0
         final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] {CoreConstants.CommonElements.FUTURE_ELEMENTS };
 223  
     }
 224  
 
 225  
     /**
 226  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 227  
      */
 228  0
     static class Elements {
 229  
         final static String DOCUMENT = "document";
 230  
         final static String ACTION_REQUESTS = "actionRequests";
 231  
         final static String ACTION_REQUEST = "actionRequest";
 232  
         final static String ACTIONS_TAKEN = "actionsTaken";
 233  
         final static String ACTION_TAKEN = "actionTaken";
 234  
         final static String ROUTE_NODE_INSTANCES = "routeNodeInstances";
 235  
         final static String ROUTE_NODE_INSTANCE = "routeNodeInstance";
 236  
     }
 237  
 
 238  
 }
 239