Coverage Report - org.kuali.rice.kew.dto.RouteHeaderDTO
 
Classes in this File Line Coverage Branch Coverage Complexity
RouteHeaderDTO
0%
0/99
0%
0/18
1.19
 
 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.dto;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.Calendar;
 22  
 import java.util.List;
 23  
 
 24  
 import org.kuali.rice.core.util.KeyValue;
 25  
 import org.kuali.rice.core.util.ConcreteKeyValue;
 26  
 
 27  
 /**
 28  
  * Transport object for the DocumentRouteHeaderValue.  Represents a document to the
 29  
  * client programmer
 30  
  *
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  */
 33  
 public class RouteHeaderDTO implements Serializable {
 34  
 
 35  
     static final long serialVersionUID = -677289794727007572L;
 36  
 
 37  
     private String documentId;
 38  
     private String docRouteStatus;
 39  
     private Calendar dateCreated;
 40  
     private Calendar dateLastModified;
 41  
     private Calendar dateApproved;
 42  
     private Calendar dateFinalized;
 43  
     private String docTitle;
 44  
     private String appDocId;
 45  
     private String initiatorPrincipalId;
 46  
     private String routedByPrincipalId;
 47  
     private Integer docRouteLevel;
 48  
     private String currentRouteNodeNames;
 49  
     private Integer docVersion;
 50  
     private String docTypeName;
 51  
     private String documentUrl;
 52  
     private String appDocStatus;
 53  
     private Calendar appDocStatusDate;
 54  
     private boolean fyiRequested;
 55  
     private boolean ackRequested;
 56  
     private boolean approveRequested;
 57  
     private boolean completeRequested;
 58  
     private boolean userBlanketApprover;
 59  
     private String docTypeId;
 60  
     private ValidActionsDTO validActions;
 61  
 
 62  0
     private NoteDTO[] notes = null;
 63  0
     private NoteDTO[] notesToDelete = null;
 64  
     
 65  
 //    private String docStatusPolicy;
 66  
 
 67  
     /**
 68  
      * Probably needs to be an array for web services
 69  
      */
 70  0
     private List<KeyValue> variables = new ArrayList<KeyValue>();
 71  
 
 72  0
     public RouteHeaderDTO() { }
 73  
 
 74  
     public String getCurrentRouteNodeNames() {
 75  0
         return currentRouteNodeNames;
 76  
     }
 77  
 
 78  
     public void setCurrentRouteNodeNames(String currentRouteNodeNames) {
 79  0
         this.currentRouteNodeNames = currentRouteNodeNames;
 80  0
     }
 81  
 
 82  
     public String getAppDocId() {
 83  0
         return appDocId;
 84  
     }
 85  
 
 86  
     public void setAppDocId(String appDocId) {
 87  0
         this.appDocId = appDocId;
 88  0
     }
 89  
 
 90  
     public Calendar getDateApproved() {
 91  0
         return dateApproved;
 92  
     }
 93  
 
 94  
     public void setDateApproved(Calendar dateApproved) {
 95  0
         this.dateApproved = dateApproved;
 96  0
     }
 97  
 
 98  
     public Calendar getDateCreated() {
 99  0
         return dateCreated;
 100  
     }
 101  
 
 102  
     public void setDateCreated(Calendar dateCreated) {
 103  0
         this.dateCreated = dateCreated;
 104  0
     }
 105  
 
 106  
     public Calendar getDateFinalized() {
 107  0
         return dateFinalized;
 108  
     }
 109  
 
 110  
     public void setDateFinalized(Calendar dateFinalized) {
 111  0
         this.dateFinalized = dateFinalized;
 112  0
     }
 113  
 
 114  
     public Calendar getDateLastModified() {
 115  0
         return dateLastModified;
 116  
     }
 117  
 
 118  
     public void setDateLastModified(Calendar dateLastModified) {
 119  0
         this.dateLastModified = dateLastModified;
 120  0
     }
 121  
 
 122  
     public Integer getDocRouteLevel() {
 123  0
         return docRouteLevel;
 124  
     }
 125  
 
 126  
     public void setDocRouteLevel(Integer docRouteLevel) {
 127  0
         this.docRouteLevel = docRouteLevel;
 128  0
     }
 129  
 
 130  
     public String getDocRouteStatus() {
 131  0
         return docRouteStatus;
 132  
     }
 133  
 
 134  
     public void setDocRouteStatus(String docRouteStatus) {
 135  0
         this.docRouteStatus = docRouteStatus;
 136  0
     }
 137  
 
 138  
     public String getAppDocStatus() {
 139  0
         return appDocStatus;
 140  
     }
 141  
 
 142  
     public void setAppDocStatus(String appDocStatus) {
 143  0
         this.appDocStatus = appDocStatus;
 144  0
     }
 145  
 
 146  
     public Calendar getAppDocStatusDate() {
 147  0
         return appDocStatusDate;
 148  
     }
 149  
 
 150  
     public void setAppDocStatusDate(Calendar date) {
 151  0
         this.appDocStatusDate = date;
 152  0
     }
 153  
     
 154  
 //    public String getDocStatusPolicy() {
 155  
 //        return docStatusPolicy;
 156  
 //    }
 157  
 //
 158  
 //    public void setDocStatusPolicy(String policy) {
 159  
 //        this.docStatusPolicy = policy;
 160  
 //    }
 161  
 
 162  
     public String getDocTitle() {
 163  0
         return docTitle;
 164  
     }
 165  
 
 166  
     public void setDocTitle(String docTitle) {
 167  0
         this.docTitle = docTitle;
 168  0
     }
 169  
 
 170  
     /**
 171  
      * @deprecated this is unreliable user docTypeId to retrieve document type
 172  
      */
 173  
     public String getDocTypeName() {
 174  0
         return docTypeName;
 175  
     }
 176  
 
 177  
     /**
 178  
      * @deprecated this is unreliable user docTypeId to retrieve document type
 179  
      */
 180  
     public void setDocTypeName(String docTypeName) {
 181  0
         this.docTypeName = docTypeName;
 182  0
     }
 183  
 
 184  
     public String getDocumentUrl() {
 185  0
         return documentUrl;
 186  
     }
 187  
 
 188  
     public void setDocumentUrl(String documentUrl) {
 189  0
         this.documentUrl = documentUrl;
 190  0
     }
 191  
 
 192  
     public Integer getDocVersion() {
 193  0
         return docVersion;
 194  
     }
 195  
 
 196  
     public void setDocVersion(Integer docVersion) {
 197  0
         this.docVersion = docVersion;
 198  0
     }
 199  
 
 200  
     public String getInitiatorPrincipalId() {
 201  0
                 return this.initiatorPrincipalId;
 202  
         }
 203  
 
 204  
         public void setInitiatorPrincipalId(String initiatorPrincipalId) {
 205  0
                 this.initiatorPrincipalId = initiatorPrincipalId;
 206  0
         }
 207  
 
 208  
         public String getRoutedByPrincipalId() {
 209  0
                 return this.routedByPrincipalId;
 210  
         }
 211  
 
 212  
         public void setRoutedByPrincipalId(String routedByPrincipalId) {
 213  0
                 this.routedByPrincipalId = routedByPrincipalId;
 214  0
         }
 215  
 
 216  
         public String getDocumentId() {
 217  0
         return documentId;
 218  
     }
 219  
 
 220  
     public void setDocumentId(String documentId) {
 221  0
         this.documentId = documentId;
 222  0
     }
 223  
     public boolean isAckRequested() {
 224  0
         return ackRequested;
 225  
     }
 226  
     public void setAckRequested(boolean ackRequested) {
 227  0
         this.ackRequested = ackRequested;
 228  0
     }
 229  
     public boolean isApproveRequested() {
 230  0
         return approveRequested;
 231  
     }
 232  
     public void setApproveRequested(boolean approveRequested) {
 233  0
         this.approveRequested = approveRequested;
 234  0
     }
 235  
     public boolean isCompleteRequested() {
 236  0
         return completeRequested;
 237  
     }
 238  
     public void setCompleteRequested(boolean completeRequested) {
 239  0
         this.completeRequested = completeRequested;
 240  0
     }
 241  
     public boolean isFyiRequested() {
 242  0
         return fyiRequested;
 243  
     }
 244  
     public void setFyiRequested(boolean fyiRequested) {
 245  0
         this.fyiRequested = fyiRequested;
 246  0
     }
 247  
     public boolean isUserBlanketApprover() {
 248  0
         return userBlanketApprover;
 249  
     }
 250  
     public void setUserBlanketApprover(boolean userBlanketApprover) {
 251  0
         this.userBlanketApprover = userBlanketApprover;
 252  0
     }
 253  
 
 254  
 
 255  
     public String getDocTypeId() {
 256  0
         return docTypeId;
 257  
     }
 258  
 
 259  
     public void setDocTypeId(String docTypeId) {
 260  0
         this.docTypeId = docTypeId;
 261  0
     }
 262  
 
 263  
 
 264  
    //  ** Modify for adding notes to web service. Modify Date: April 7, 2006
 265  
     public NoteDTO[] getNotes() {
 266  0
                 return notes;
 267  
         }
 268  
 
 269  
         public void setNotes(NoteDTO[] notes) {
 270  0
                 this.notes = notes;
 271  0
         }
 272  
 
 273  
         public NoteDTO[] getNotesToDelete() {
 274  0
                 return notesToDelete;
 275  
         }
 276  
 
 277  
         public void setNotesToDelete(NoteDTO[] notesToDelete) {
 278  0
                 this.notesToDelete = notesToDelete;
 279  0
         }
 280  
         // ** Modify Ends
 281  
 
 282  
     private KeyValue findVariable(String name) {
 283  0
             for (KeyValue kvp : variables) {
 284  0
             if (isEqual(kvp.getKey(), name)) {
 285  0
                 return kvp;
 286  
             }
 287  
         }
 288  0
         return null;
 289  
     }
 290  
     public String getVariable(String name) {
 291  0
         KeyValue kvp = findVariable(name);
 292  0
         if (kvp == null) return null;
 293  0
         return kvp.getValue();
 294  
     }
 295  
 
 296  
     public void setVariable(String name, String value) {
 297  0
         final KeyValue kvp = findVariable(name);
 298  0
         if (kvp == null) {
 299  0
             if (value == null) {
 300  0
                 return;
 301  
             }
 302  0
             variables.add(new ConcreteKeyValue(name, value));
 303  
         } else {
 304  
             
 305  
                 // values do not need to be removed from the VO
 306  
             // in fact they CAN'T be, as the DocumentRouteHeaderValue
 307  
             // must observe the null value so the removal actually
 308  
             // propagates (otherwise DocumentRouteHeaderValue can't
 309  
             // guess what you wanted to remove...the alternative is
 310  
             // to just reset all the vars wholesale but that requires
 311  
             // a slightly more complicated implementation (to distinguish
 312  
             // non-variable state in the state table) and is fraught
 313  
             // with peril in general)
 314  
             //if (value == null) {
 315  
             //    LOG.error("Removing value: " + kvp.getKey() + "=" + kvp.getValue());
 316  
             //    variables.remove(kvp);
 317  
             //} else {
 318  0
                         variables.remove(kvp);
 319  0
                         variables.add(new ConcreteKeyValue(kvp.getKey(), value));
 320  
             //}
 321  
         }
 322  0
     }
 323  
 
 324  
     public List<KeyValue> getVariables() {
 325  0
         return variables;
 326  
     }
 327  
 
 328  
     public ValidActionsDTO getValidActions() {
 329  0
         return validActions;
 330  
     }
 331  
 
 332  
     public void setValidActions(ValidActionsDTO validActions) {
 333  0
         this.validActions = validActions;
 334  0
     }
 335  
     
 336  
     private boolean isEqual(String a, String b) {
 337  0
         return ((a == null && b == null) || (a != null && a.equals(b)));
 338  
     }
 339  
 
 340  
 }