View Javadoc

1   /**
2    * Copyright 2005-2012 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.document.search;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.joda.time.DateTime;
20  import org.joda.time.DateTimeZone;
21  import org.kuali.rice.core.api.CoreConstants;
22  import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
23  import org.kuali.rice.core.api.mo.ModelBuilder;
24  import org.kuali.rice.core.api.mo.ModelObjectUtils;
25  import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
26  import org.kuali.rice.core.api.util.jaxb.MultiValuedStringMapAdapter;
27  import org.kuali.rice.kew.api.document.DocumentStatus;
28  import org.kuali.rice.kew.api.document.DocumentStatusCategory;
29  import org.w3c.dom.Element;
30  
31  import javax.xml.bind.annotation.XmlAccessType;
32  import javax.xml.bind.annotation.XmlAccessorType;
33  import javax.xml.bind.annotation.XmlAnyElement;
34  import javax.xml.bind.annotation.XmlElement;
35  import javax.xml.bind.annotation.XmlElementWrapper;
36  import javax.xml.bind.annotation.XmlRootElement;
37  import javax.xml.bind.annotation.XmlType;
38  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
39  import java.io.Serializable;
40  import java.util.ArrayList;
41  import java.util.Collection;
42  import java.util.Collections;
43  import java.util.HashMap;
44  import java.util.List;
45  import java.util.Map;
46  
47  /**
48   * An immutable data transfer object implementation of the {@link DocumentSearchCriteriaContract}.  Instances of this
49   * class should be constructed using the nested {@link Builder} class.
50   *
51   * @author Kuali Rice Team (rice.collab@kuali.org)
52   */
53  @XmlRootElement(name = DocumentSearchCriteria.Constants.ROOT_ELEMENT_NAME)
54  @XmlAccessorType(XmlAccessType.NONE)
55  @XmlType(name = DocumentSearchCriteria.Constants.TYPE_NAME, propOrder = {
56      DocumentSearchCriteria.Elements.DOCUMENT_ID,
57      DocumentSearchCriteria.Elements.DOCUMENT_STATUSES,
58      DocumentSearchCriteria.Elements.DOCUMENT_STATUS_CATEGORIES,
59      DocumentSearchCriteria.Elements.TITLE,
60      DocumentSearchCriteria.Elements.APPLICATION_DOCUMENT_ID,
61      DocumentSearchCriteria.Elements.APPLICATION_DOCUMENT_STATUS,
62      DocumentSearchCriteria.Elements.INITIATOR_PRINCIPAL_NAME,
63      DocumentSearchCriteria.Elements.VIEWER_PRINCIPAL_NAME,
64      DocumentSearchCriteria.Elements.GROUP_VIEWER_ID,
65      DocumentSearchCriteria.Elements.GROUP_VIEWER_NAME,
66      DocumentSearchCriteria.Elements.APPROVER_PRINCIPAL_NAME,
67      DocumentSearchCriteria.Elements.ROUTE_NODE_NAME,
68      DocumentSearchCriteria.Elements.ROUTE_NODE_LOOKUP_LOGIC,
69      DocumentSearchCriteria.Elements.DOCUMENT_TYPE_NAME,
70      DocumentSearchCriteria.Elements.ADDITIONAL_DOCUMENT_TYPE_NAMES,
71      DocumentSearchCriteria.Elements.DATE_CREATED_FROM,
72      DocumentSearchCriteria.Elements.DATE_CREATED_TO,
73      DocumentSearchCriteria.Elements.DATE_LAST_MODIFIED_FROM,
74      DocumentSearchCriteria.Elements.DATE_LAST_MODIFIED_TO,
75      DocumentSearchCriteria.Elements.DATE_APPROVED_FROM,
76      DocumentSearchCriteria.Elements.DATE_APPROVED_TO,
77      DocumentSearchCriteria.Elements.DATE_FINALIZED_FROM,
78      DocumentSearchCriteria.Elements.DATE_FINALIZED_TO,
79      DocumentSearchCriteria.Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_FROM,
80      DocumentSearchCriteria.Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_TO,
81      DocumentSearchCriteria.Elements.DOCUMENT_ATTRIBUTE_VALUES,
82      DocumentSearchCriteria.Elements.SAVE_NAME,
83      DocumentSearchCriteria.Elements.START_AT_INDEX,
84      DocumentSearchCriteria.Elements.MAX_RESULTS,
85      DocumentSearchCriteria.Elements.IS_ADVANCED_SEARCH,
86      DocumentSearchCriteria.Elements.SEARCH_OPTIONS,
87      CoreConstants.CommonElements.FUTURE_ELEMENTS
88  })
89  public final class DocumentSearchCriteria extends AbstractDataTransferObject implements DocumentSearchCriteriaContract {
90  
91      private static final long serialVersionUID = -221440103480740497L;
92      
93      @XmlElement(name = Elements.DOCUMENT_ID, required = false)
94      private final String documentId;
95  
96      @XmlElementWrapper(name = Elements.DOCUMENT_STATUSES, required = false)
97      @XmlElement(name = Elements.DOCUMENT_STATUS, required = false)
98      private final List<DocumentStatus> documentStatuses;
99  
100     @XmlElementWrapper(name = Elements.DOCUMENT_STATUS_CATEGORIES, required = false)
101     @XmlElement(name = Elements.DOCUMENT_STATUS_CATEGORY, required = false)
102     private final List<DocumentStatusCategory> documentStatusCategories;
103 
104     @XmlElement(name = Elements.TITLE, required = false)
105     private final String title;
106 
107     @XmlElement(name = Elements.APPLICATION_DOCUMENT_ID, required = false)
108     private final String applicationDocumentId;
109 
110     @XmlElement(name = Elements.APPLICATION_DOCUMENT_STATUS, required = false)
111     private final String applicationDocumentStatus;
112 
113     @XmlElement(name = Elements.INITIATOR_PRINCIPAL_NAME, required = false)
114     private final String initiatorPrincipalName;
115 
116     @XmlElement(name = Elements.VIEWER_PRINCIPAL_NAME, required = false)
117     private final String viewerPrincipalName;
118 
119     @XmlElement(name = Elements.GROUP_VIEWER_ID, required = false)
120     private final String groupViewerId;
121 
122     @XmlElement(name = Elements.GROUP_VIEWER_NAME, required = false)
123     private final String groupViewerName;
124     
125     @XmlElement(name = Elements.APPROVER_PRINCIPAL_NAME, required = false)
126     private final String approverPrincipalName;
127 
128     @XmlElement(name = Elements.ROUTE_NODE_NAME, required = false)
129     private final String routeNodeName;
130 
131     @XmlElement(name = Elements.ROUTE_NODE_LOOKUP_LOGIC, required = false)
132     private final RouteNodeLookupLogic routeNodeLookupLogic;
133 
134     @XmlElement(name = Elements.DOCUMENT_TYPE_NAME, required = false)
135     private final String documentTypeName;
136 
137     @XmlElementWrapper(name = Elements.ADDITIONAL_DOCUMENT_TYPE_NAMES, required = false)
138     @XmlElement(name = Elements.ADDITIONAL_DOCUMENT_TYPE_NAME, required = false)
139     private final List<String> additionalDocumentTypeNames;
140 
141 
142     @XmlElement(name = Elements.DATE_CREATED_FROM, required = false)
143     @XmlJavaTypeAdapter(DateTimeAdapter.class)
144     private final DateTime dateCreatedFrom;
145 
146     @XmlElement(name = Elements.DATE_CREATED_TO, required = false)
147     @XmlJavaTypeAdapter(DateTimeAdapter.class)
148     private final DateTime dateCreatedTo;
149 
150     @XmlElement(name = Elements.DATE_LAST_MODIFIED_FROM, required = false)
151     @XmlJavaTypeAdapter(DateTimeAdapter.class)
152     private final DateTime dateLastModifiedFrom;
153 
154     @XmlElement(name = Elements.DATE_LAST_MODIFIED_TO, required = false)
155     @XmlJavaTypeAdapter(DateTimeAdapter.class)
156     private final DateTime dateLastModifiedTo;
157 
158     @XmlElement(name = Elements.DATE_APPROVED_FROM, required = false)
159     @XmlJavaTypeAdapter(DateTimeAdapter.class)
160     private final DateTime dateApprovedFrom;
161 
162     @XmlElement(name = Elements.DATE_APPROVED_TO, required = false)
163     @XmlJavaTypeAdapter(DateTimeAdapter.class)
164     private final DateTime dateApprovedTo;
165 
166     @XmlElement(name = Elements.DATE_FINALIZED_FROM, required = false)
167     @XmlJavaTypeAdapter(DateTimeAdapter.class)
168     private final DateTime dateFinalizedFrom;
169 
170     @XmlElement(name = Elements.DATE_FINALIZED_TO, required = false)
171     @XmlJavaTypeAdapter(DateTimeAdapter.class)
172     private final DateTime dateFinalizedTo;
173 
174     @XmlElement(name = Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_FROM, required = false)
175     @XmlJavaTypeAdapter(DateTimeAdapter.class)
176     private final DateTime dateApplicationDocumentStatusChangedFrom;
177 
178     @XmlElement(name = Elements.DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_TO, required = false)
179     @XmlJavaTypeAdapter(DateTimeAdapter.class)
180     private final DateTime dateApplicationDocumentStatusChangedTo;
181 
182     @XmlElement(name = Elements.DOCUMENT_ATTRIBUTE_VALUES, required = false)
183     @XmlJavaTypeAdapter(MultiValuedStringMapAdapter.class)
184     private final Map<String, List<String>> documentAttributeValues;
185 
186     @XmlElement(name = Elements.SAVE_NAME, required = false)
187     private final String saveName;
188 
189     @XmlElement(name = Elements.START_AT_INDEX, required = false)
190     private final Integer startAtIndex;
191 
192     @XmlElement(name = Elements.MAX_RESULTS, required = false)
193     private final Integer maxResults;
194 
195     @XmlElement(name = Elements.IS_ADVANCED_SEARCH, required = false)
196     private final String isAdvancedSearch;
197 
198     @XmlElement(name = Elements.SEARCH_OPTIONS, required = false)
199     @XmlJavaTypeAdapter(MultiValuedStringMapAdapter.class)
200     private final Map<String, List<String>> searchOptions;
201 
202     @SuppressWarnings("unused")
203     @XmlAnyElement
204     private final Collection<Element> _futureElements = null;
205 
206     /**
207      * Private constructor used only by JAXB.
208      */
209     private DocumentSearchCriteria() {
210         this.documentId = null;
211         this.documentStatuses = null;
212         this.documentStatusCategories = null;
213         this.title = null;
214         this.applicationDocumentId = null;
215         this.applicationDocumentStatus = null;
216         this.initiatorPrincipalName = null;
217         this.viewerPrincipalName = null;
218         this.groupViewerId = null;
219         this.groupViewerName = null;
220         this.approverPrincipalName = null;
221         this.routeNodeName = null;
222         this.routeNodeLookupLogic = null;
223         this.documentTypeName = null;
224         this.additionalDocumentTypeNames = null;
225         this.dateCreatedFrom = null;
226         this.dateCreatedTo = null;
227         this.dateLastModifiedFrom = null;
228         this.dateLastModifiedTo = null;
229         this.dateApprovedFrom = null;
230         this.dateApprovedTo = null;
231         this.dateFinalizedFrom = null;
232         this.dateFinalizedTo = null;
233         this.dateApplicationDocumentStatusChangedFrom = null;
234         this.dateApplicationDocumentStatusChangedTo = null;
235         this.documentAttributeValues = null;
236         this.searchOptions = null;
237         this.saveName = null;
238         this.startAtIndex = null;
239         this.maxResults = null;
240         this.isAdvancedSearch = null;
241     }
242 
243     private DocumentSearchCriteria(Builder builder) {
244         this.documentId = builder.getDocumentId();
245         this.documentStatuses = ModelObjectUtils.createImmutableCopy(builder.getDocumentStatuses());
246         this.documentStatusCategories = ModelObjectUtils.createImmutableCopy(builder.getDocumentStatusCategories());
247         this.title = builder.getTitle();
248         this.applicationDocumentId = builder.getApplicationDocumentId();
249         this.applicationDocumentStatus = builder.getApplicationDocumentStatus();
250         this.initiatorPrincipalName = builder.getInitiatorPrincipalName();
251         this.viewerPrincipalName = builder.getViewerPrincipalName();
252         this.groupViewerId = builder.getGroupViewerId();
253         this.groupViewerName = builder.getGroupViewerName();
254         this.approverPrincipalName = builder.getApproverPrincipalName();
255         this.routeNodeName = builder.getRouteNodeName();
256         this.routeNodeLookupLogic = builder.getRouteNodeLookupLogic();
257         this.documentTypeName = builder.getDocumentTypeName();
258         this.additionalDocumentTypeNames = ModelObjectUtils.createImmutableCopy(
259                 builder.getAdditionalDocumentTypeNames());
260         this.dateCreatedFrom = builder.getDateCreatedFrom();
261         this.dateCreatedTo = builder.getDateCreatedTo();
262         this.dateLastModifiedFrom = builder.getDateLastModifiedFrom();
263         this.dateLastModifiedTo = builder.getDateLastModifiedTo();
264         this.dateApprovedFrom = builder.getDateApprovedFrom();
265         this.dateApprovedTo = builder.getDateApprovedTo();
266         this.dateFinalizedFrom = builder.getDateFinalizedFrom();
267         this.dateFinalizedTo = builder.getDateFinalizedTo();
268         this.dateApplicationDocumentStatusChangedFrom = builder.getDateApplicationDocumentStatusChangedFrom();
269         this.dateApplicationDocumentStatusChangedTo = builder.getDateApplicationDocumentStatusChangedTo();
270         this.documentAttributeValues = ModelObjectUtils.createImmutableCopy(builder.getDocumentAttributeValues());
271         this.searchOptions = ModelObjectUtils.createImmutableCopy(builder.getSearchOptions());
272         this.saveName = builder.getSaveName();
273         this.startAtIndex = builder.getStartAtIndex();
274         this.maxResults = builder.getMaxResults();
275         this.isAdvancedSearch = builder.getIsAdvancedSearch();
276     }
277 
278     @Override
279     public String getDocumentId() {
280         return this.documentId;
281     }
282 
283     @Override
284     public List<DocumentStatus> getDocumentStatuses() {
285         return this.documentStatuses;
286     }
287 
288     @Override
289     public List<DocumentStatusCategory> getDocumentStatusCategories() {
290         return this.documentStatusCategories;
291     }
292 
293     @Override
294     public String getTitle() {
295         return this.title;
296     }
297 
298     @Override
299     public String getApplicationDocumentId() {
300         return this.applicationDocumentId;
301     }
302 
303     @Override
304     public String getApplicationDocumentStatus() {
305         return this.applicationDocumentStatus;
306     }
307 
308     @Override
309     public String getInitiatorPrincipalName() {
310         return this.initiatorPrincipalName;
311     }
312 
313     @Override
314     public String getViewerPrincipalName() {
315         return this.viewerPrincipalName;
316     }
317 
318     @Override
319     public String getGroupViewerId() {
320         return this.groupViewerId;
321     }
322     
323     @Override
324     public String getGroupViewerName() {
325         return this.groupViewerName;
326     }
327 
328     @Override
329     public String getApproverPrincipalName() {
330         return this.approverPrincipalName;
331     }
332 
333     @Override
334     public String getRouteNodeName() {
335         return this.routeNodeName;
336     }
337 
338     @Override
339     public RouteNodeLookupLogic getRouteNodeLookupLogic() {
340         return this.routeNodeLookupLogic;
341     }
342 
343     @Override
344     public String getDocumentTypeName() {
345         return this.documentTypeName;
346     }
347 
348     @Override
349     public List<String> getAdditionalDocumentTypeNames() {
350         return this.additionalDocumentTypeNames;
351     }
352 
353     @Override
354     public DateTime getDateCreatedFrom() {
355         return this.dateCreatedFrom;
356     }
357 
358     @Override
359     public DateTime getDateCreatedTo() {
360         return this.dateCreatedTo;
361     }
362 
363     @Override
364     public DateTime getDateLastModifiedFrom() {
365         return this.dateLastModifiedFrom;
366     }
367 
368     @Override
369     public DateTime getDateLastModifiedTo() {
370         return this.dateLastModifiedTo;
371     }
372 
373     @Override
374     public DateTime getDateApprovedFrom() {
375         return this.dateApprovedFrom;
376     }
377 
378     @Override
379     public DateTime getDateApprovedTo() {
380         return this.dateApprovedTo;
381     }
382 
383     @Override
384     public DateTime getDateFinalizedFrom() {
385         return this.dateFinalizedFrom;
386     }
387 
388     @Override
389     public DateTime getDateFinalizedTo() {
390         return this.dateFinalizedTo;
391     }
392 
393     @Override
394     public DateTime getDateApplicationDocumentStatusChangedFrom() {
395         return dateApplicationDocumentStatusChangedFrom;
396     }
397 
398     @Override
399     public DateTime getDateApplicationDocumentStatusChangedTo() {
400         return dateApplicationDocumentStatusChangedTo;
401     }
402 
403     @Override
404     public Map<String, List<String>> getDocumentAttributeValues() {
405         return this.documentAttributeValues;
406     }
407 
408     @Override
409     public Map<String, List<String>> getSearchOptions() {
410         return this.searchOptions;
411     }
412 
413     @Override
414     public String getSaveName() {
415         return saveName;
416     }
417 
418     @Override
419     public Integer getStartAtIndex() {
420         return this.startAtIndex;
421     }
422 
423     @Override
424     public Integer getMaxResults() {
425         return this.maxResults;
426     }
427 
428     @Override
429     public String getIsAdvancedSearch() {
430         return this.isAdvancedSearch;
431     }
432 
433     /**
434      * A builder which can be used to construct {@link DocumentSearchCriteria} instances.  Enforces the constraints of
435      * the {@link DocumentSearchCriteriaContract}.
436      */
437     public final static class Builder implements Serializable, ModelBuilder, DocumentSearchCriteriaContract {
438 
439         private String documentId;
440         private List<DocumentStatus> documentStatuses;
441         private List<DocumentStatusCategory> documentStatusCategories;
442         private String title;
443         private String applicationDocumentId;
444         private String applicationDocumentStatus;
445         private String initiatorPrincipalName;
446         private String viewerPrincipalName;
447         private String groupViewerId;
448         private String groupViewerName;
449         private String approverPrincipalName;
450         private String routeNodeName;
451         private RouteNodeLookupLogic routeNodeLookupLogic;
452         private String documentTypeName;
453         private List<String> additionalDocumentTypeNames;
454         private DateTime dateCreatedFrom;
455         private DateTime dateCreatedTo;
456         private DateTime dateLastModifiedFrom;
457         private DateTime dateLastModifiedTo;
458         private DateTime dateApprovedFrom;
459         private DateTime dateApprovedTo;
460         private DateTime dateFinalizedFrom;
461         private DateTime dateFinalizedTo;
462         private DateTime dateApplicationDocumentStatusChangedFrom;
463         private DateTime dateApplicationDocumentStatusChangedTo;
464         private Map<String, List<String>> documentAttributeValues;
465         private Map<String, List<String>> searchOptions;
466         private String saveName;
467         private Integer startAtIndex;
468         private Integer maxResults;
469         private String isAdvancedSearch;
470 
471         private Builder() {
472             setDocumentStatuses(new ArrayList<DocumentStatus>());
473             setDocumentStatusCategories(new ArrayList<DocumentStatusCategory>());
474             setAdditionalDocumentTypeNames(new ArrayList<String>());
475             setDocumentAttributeValues(new HashMap<String, List<String>>());
476             setSearchOptions(new HashMap<String, List<String>>());
477         }
478 
479         /**
480          * Creates an empty builder instance.  All collections on the new instance are initialized to empty collections.
481          *
482          * @return a new builder instance
483          */
484         public static Builder create() {
485             return new Builder();
486         }
487 
488         /**
489          * Creates a new builder instance initialized with copies of the properties from the given contract.
490          *
491          * @param contract the contract from which to copy properties
492          *
493          * @return a builder instance initialized with properties from the given contract
494          *
495          * @throws IllegalArgumentException if the given contract is null
496          */
497         public static Builder create(DocumentSearchCriteriaContract contract) {
498             if (contract == null) {
499                 throw new IllegalArgumentException("contract was null");
500             }
501             Builder builder = create();
502             builder.setDocumentId(contract.getDocumentId());
503             if (contract.getDocumentStatuses() != null) {
504                 builder.setDocumentStatuses(new ArrayList<DocumentStatus>(contract.getDocumentStatuses()));
505             }
506             if (contract.getDocumentStatusCategories() != null) {
507                 builder.setDocumentStatusCategories(new ArrayList<DocumentStatusCategory>(contract.getDocumentStatusCategories()));
508             }
509             builder.setTitle(contract.getTitle());
510             builder.setApplicationDocumentId(contract.getApplicationDocumentId());
511             builder.setApplicationDocumentStatus(contract.getApplicationDocumentStatus());
512             builder.setInitiatorPrincipalName(contract.getInitiatorPrincipalName());
513             builder.setViewerPrincipalName(contract.getViewerPrincipalName());
514             builder.setGroupViewerId(contract.getGroupViewerId());
515             builder.setGroupViewerName(contract.getGroupViewerName());
516             builder.setApproverPrincipalName(contract.getApproverPrincipalName());
517             builder.setRouteNodeName(contract.getRouteNodeName());
518             builder.setRouteNodeLookupLogic(contract.getRouteNodeLookupLogic());
519             builder.setDocumentTypeName(contract.getDocumentTypeName());
520             if (contract.getAdditionalDocumentTypeNames() != null) {
521                 builder.setAdditionalDocumentTypeNames(new ArrayList<String>(contract.getAdditionalDocumentTypeNames()));
522             }
523             builder.setDateCreatedFrom(contract.getDateCreatedFrom());
524             builder.setDateCreatedTo(contract.getDateCreatedTo());
525             builder.setDateLastModifiedFrom(contract.getDateLastModifiedFrom());
526             builder.setDateLastModifiedTo(contract.getDateLastModifiedTo());
527             builder.setDateApprovedFrom(contract.getDateApprovedFrom());
528             builder.setDateApprovedTo(contract.getDateApprovedTo());
529             builder.setDateFinalizedFrom(contract.getDateFinalizedFrom());
530             builder.setDateFinalizedTo(contract.getDateFinalizedTo());
531             builder.setDateApplicationDocumentStatusChangedFrom(contract.getDateApplicationDocumentStatusChangedFrom());
532             builder.setDateApplicationDocumentStatusChangedTo(contract.getDateApplicationDocumentStatusChangedTo());
533             if (contract.getDocumentAttributeValues() != null) {
534                 builder.setDocumentAttributeValues(new HashMap<String, List<String>>(contract.getDocumentAttributeValues()));
535             }
536             if (contract.getSearchOptions() != null) {
537                 builder.setSearchOptions(new HashMap<String, List<String>>(contract.getSearchOptions()));
538             }
539             builder.setSaveName(contract.getSaveName());
540             builder.setStartAtIndex(contract.getStartAtIndex());
541             builder.setMaxResults(contract.getMaxResults());
542             builder.setIsAdvancedSearch(contract.getIsAdvancedSearch());
543             return builder;
544         }
545 
546         @Override
547         public DocumentSearchCriteria build() {
548             if (StringUtils.isNotBlank(routeNodeName) && StringUtils.isBlank(documentTypeName)) {
549                 throw new IllegalStateException("documentTypeName must be set if routeNodeName is set.");
550             }
551             return new DocumentSearchCriteria(this);
552         }
553 
554         @Override
555         public String getDocumentId() {
556             return this.documentId;
557         }
558 
559         @Override
560         public List<DocumentStatus> getDocumentStatuses() {
561             return this.documentStatuses;
562         }
563 
564         @Override
565         public List<DocumentStatusCategory> getDocumentStatusCategories() {
566             return this.documentStatusCategories;
567         }
568 
569         @Override
570         public String getTitle() {
571             return this.title;
572         }
573 
574         @Override
575         public String getApplicationDocumentId() {
576             return this.applicationDocumentId;
577         }
578 
579         @Override
580         public String getApplicationDocumentStatus() {
581             return this.applicationDocumentStatus;
582         }
583 
584         @Override
585         public String getInitiatorPrincipalName() {
586             return this.initiatorPrincipalName;
587         }
588 
589         @Override
590         public String getViewerPrincipalName() {
591             return this.viewerPrincipalName;
592         }
593 
594         @Override
595         public String getGroupViewerId() {
596             return this.groupViewerId;
597         }
598 
599         @Override
600         public String getGroupViewerName() {
601             return this.groupViewerName;
602         }
603         
604         @Override
605         public String getApproverPrincipalName() {
606             return this.approverPrincipalName;
607         }
608 
609         @Override
610         public String getRouteNodeName() {
611             return this.routeNodeName;
612         }
613 
614         @Override
615         public RouteNodeLookupLogic getRouteNodeLookupLogic() {
616             return this.routeNodeLookupLogic;
617         }
618 
619         @Override
620         public String getDocumentTypeName() {
621             return this.documentTypeName;
622         }
623 
624         @Override
625         public List<String> getAdditionalDocumentTypeNames() {
626             return additionalDocumentTypeNames;
627         }
628 
629         @Override
630         public DateTime getDateCreatedFrom() {
631             return this.dateCreatedFrom;
632         }
633 
634         @Override
635         public DateTime getDateCreatedTo() {
636             return this.dateCreatedTo;
637         }
638 
639         @Override
640         public DateTime getDateLastModifiedFrom() {
641             return this.dateLastModifiedFrom;
642         }
643 
644         @Override
645         public DateTime getDateLastModifiedTo() {
646             return this.dateLastModifiedTo;
647         }
648 
649         @Override
650         public DateTime getDateApprovedFrom() {
651             return this.dateApprovedFrom;
652         }
653 
654         @Override
655         public DateTime getDateApprovedTo() {
656             return this.dateApprovedTo;
657         }
658 
659         @Override
660         public DateTime getDateFinalizedFrom() {
661             return this.dateFinalizedFrom;
662         }
663 
664         @Override
665         public DateTime getDateFinalizedTo() {
666             return this.dateFinalizedTo;
667         }
668 
669         @Override
670         public DateTime getDateApplicationDocumentStatusChangedFrom() {
671             return dateApplicationDocumentStatusChangedFrom;
672         }
673 
674         @Override
675         public DateTime getDateApplicationDocumentStatusChangedTo() {
676             return dateApplicationDocumentStatusChangedTo;
677         }
678 
679         @Override
680         public Map<String, List<String>> getDocumentAttributeValues() {
681             return this.documentAttributeValues;
682         }
683 
684         @Override
685         public Map<String, List<String>> getSearchOptions() {
686             return this.searchOptions;
687         }
688 
689         @Override
690         public String getSaveName() {
691             return this.saveName;
692         }
693 
694         @Override
695         public Integer getStartAtIndex() {
696             return this.startAtIndex;
697         }
698 
699         @Override
700         public Integer getMaxResults() {
701             return this.maxResults;
702         }
703 
704         @Override
705         public String getIsAdvancedSearch() {
706             return this.isAdvancedSearch;
707         }
708 
709         public void setDocumentId(String documentId) {
710             this.documentId = documentId;
711         }
712 
713         public void setDocumentStatuses(List<DocumentStatus> documentStatuses) {
714             this.documentStatuses = documentStatuses;
715         }
716 
717         public void setDocumentStatusCategories(List<DocumentStatusCategory> documentStatusCategories) {
718             this.documentStatusCategories = documentStatusCategories;
719         }
720 
721         public void setTitle(String title) {
722             this.title = title;
723         }
724 
725         public void setApplicationDocumentId(String applicationDocumentId) {
726             this.applicationDocumentId = applicationDocumentId;
727         }
728 
729         public void setApplicationDocumentStatus(String applicationDocumentStatus) {
730             this.applicationDocumentStatus = applicationDocumentStatus;
731         }
732 
733         public void setInitiatorPrincipalName(String initiatorPrincipalName) {
734             this.initiatorPrincipalName = initiatorPrincipalName;
735         }
736 
737         public void setViewerPrincipalName(String viewerPrincipalName) {
738             this.viewerPrincipalName = viewerPrincipalName;
739         }
740 
741         public void setGroupViewerId(String groupViewerId) {
742             this.groupViewerId = groupViewerId;
743         }
744         
745         public void setGroupViewerName (String groupViewerName) {
746             this.groupViewerName = groupViewerName;
747         }
748 
749         public void setApproverPrincipalName(String approverPrincipalName) {
750             this.approverPrincipalName = approverPrincipalName;
751         }
752 
753         public void setRouteNodeName(String routeNodeName) {
754             this.routeNodeName = routeNodeName;
755         }
756 
757         public void setRouteNodeLookupLogic(RouteNodeLookupLogic routeNodeLookupLogic) {
758             this.routeNodeLookupLogic = routeNodeLookupLogic;
759         }
760 
761         public void setDocumentTypeName(String documentTypeName) {
762             this.documentTypeName = documentTypeName;
763         }
764 
765         public void setAdditionalDocumentTypeNames(List<String> additionalDocumentTypeNames) {
766             this.additionalDocumentTypeNames = additionalDocumentTypeNames;
767         }
768 
769         public void setDateCreatedFrom(DateTime dateCreatedFrom) {
770             this.dateCreatedFrom = dateCreatedFrom;
771         }
772 
773         public void setDateCreatedTo(DateTime dateCreatedTo) {
774             this.dateCreatedTo = dateCreatedTo;
775         }
776 
777         public void setDateLastModifiedFrom(DateTime dateLastModifiedFrom) {
778             this.dateLastModifiedFrom = dateLastModifiedFrom;
779         }
780 
781         public void setDateLastModifiedTo(DateTime dateLastModifiedTo) {
782             this.dateLastModifiedTo = dateLastModifiedTo;
783         }
784 
785         public void setDateApprovedFrom(DateTime dateApprovedFrom) {
786             this.dateApprovedFrom = dateApprovedFrom;
787         }
788 
789         public void setDateApprovedTo(DateTime dateApprovedTo) {
790             this.dateApprovedTo = dateApprovedTo;
791         }
792 
793         public void setDateFinalizedFrom(DateTime dateFinalizedFrom) {
794             this.dateFinalizedFrom = dateFinalizedFrom;
795         }
796 
797         public void setDateFinalizedTo(DateTime dateFinalizedTo) {
798             this.dateFinalizedTo = dateFinalizedTo;
799         }
800 
801         public void setDateApplicationDocumentStatusChangedFrom(DateTime dateApplicationDocumentStatusChangedFrom) {
802             this.dateApplicationDocumentStatusChangedFrom = dateApplicationDocumentStatusChangedFrom;
803         }
804 
805         public void setDateApplicationDocumentStatusChangedTo(DateTime dateApplicationDocumentStatusChangedTo) {
806             this.dateApplicationDocumentStatusChangedTo = dateApplicationDocumentStatusChangedTo;
807         }
808 
809         public void setDocumentAttributeValues(Map<String, List<String>> documentAttributeValues) {
810             this.documentAttributeValues = documentAttributeValues;
811         }
812 
813         /**
814          * add document attribute value to an internal map
815          * @param name - the attribute name
816          * @param value - the attribute value
817          */
818         public void addDocumentAttributeValue(String name, String value) {
819             if (StringUtils.isBlank(value)) {
820                 throw new IllegalArgumentException("value was null or blank");
821             }
822             List<String> values = getDocumentAttributeValues().get(name);
823             if (values == null) {
824                 values = new ArrayList<String>();
825                 getDocumentAttributeValues().put(name, values);
826             }
827             values.add(value);
828         }
829 
830         public void setSearchOptions(Map<String, List<String>> searchOptions) {
831             this.searchOptions = searchOptions;
832         }
833 
834         public void setSaveName(String saveName) {
835             this.saveName = saveName;
836         }
837 
838         public void setStartAtIndex(Integer startAtIndex) {
839             this.startAtIndex = startAtIndex;
840         }
841 
842         public void setMaxResults(Integer maxResults) {
843             this.maxResults = maxResults;
844         }
845 
846         public void setIsAdvancedSearch(String isAdvancedSearch) {
847             this.isAdvancedSearch = isAdvancedSearch;
848         }
849 
850         /**
851          * Resets DateTimes to local TimeZone (preserving absolute time)
852          *
853          * @see <a href="http://jira.codehaus.org/browse/JACKSON-279">Modify Joda DateTime</a>
854          */
855         public void normalizeDateTimes() {
856             if (dateCreatedFrom != null) dateCreatedFrom = dateCreatedFrom.withZone(DateTimeZone.getDefault());
857             if (dateCreatedTo != null) dateCreatedTo = dateCreatedTo.withZone(DateTimeZone.getDefault());
858             if (dateLastModifiedFrom != null) dateLastModifiedFrom = dateLastModifiedFrom.withZone(DateTimeZone.getDefault());
859             if (dateLastModifiedTo != null) dateLastModifiedTo = dateLastModifiedTo.withZone(DateTimeZone.getDefault());
860             if (dateApprovedFrom != null) dateApprovedFrom = dateApprovedFrom.withZone(DateTimeZone.getDefault());
861             if (dateApprovedTo != null) dateApprovedTo = dateApprovedTo.withZone(DateTimeZone.getDefault());
862             if (dateFinalizedFrom != null) dateFinalizedFrom = dateFinalizedFrom.withZone(DateTimeZone.getDefault());
863             if (dateFinalizedTo != null) dateFinalizedTo = dateFinalizedTo.withZone(DateTimeZone.getDefault());
864             if (dateApplicationDocumentStatusChangedFrom != null) dateApplicationDocumentStatusChangedFrom = dateApplicationDocumentStatusChangedFrom.withZone(DateTimeZone.getDefault());
865             if (dateApplicationDocumentStatusChangedTo != null) dateApplicationDocumentStatusChangedTo = dateApplicationDocumentStatusChangedTo.withZone(DateTimeZone.getDefault());
866         }
867 
868     }
869 
870     /**
871      * Defines some internal constants used on this class.
872      */
873     static class Constants {
874         final static String ROOT_ELEMENT_NAME = "documentSearchCriteria";
875         final static String TYPE_NAME = "DocumentSearchCriteriaType";
876     }
877 
878     /**
879      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
880      */
881     static class Elements {
882         final static String DOCUMENT_ID = "documentId";
883         final static String DOCUMENT_STATUSES = "documentStatuses";
884         final static String DOCUMENT_STATUS = "documentStatus";
885         final static String DOCUMENT_STATUS_CATEGORIES = "documentStatusCategories";
886         final static String DOCUMENT_STATUS_CATEGORY = "documentStatusCategory";
887         final static String TITLE = "title";
888         final static String APPLICATION_DOCUMENT_ID = "applicationDocumentId";
889         final static String APPLICATION_DOCUMENT_STATUS = "applicationDocumentStatus";
890         final static String INITIATOR_PRINCIPAL_NAME = "initiatorPrincipalName";
891         final static String VIEWER_PRINCIPAL_NAME = "viewerPrincipalName";
892         final static String GROUP_VIEWER_ID = "groupViewerId";
893         final static String GROUP_VIEWER_NAME = "groupViewerName";
894         final static String APPROVER_PRINCIPAL_NAME = "approverPrincipalName";
895         final static String ROUTE_NODE_NAME = "routeNodeName";
896         final static String ROUTE_NODE_LOOKUP_LOGIC = "routeNodeLookupLogic";
897         final static String DOCUMENT_TYPE_NAME = "documentTypeName";
898         final static String ADDITIONAL_DOCUMENT_TYPE_NAMES = "additionalDocumentTypeNames";
899         final static String ADDITIONAL_DOCUMENT_TYPE_NAME = "additionalDocumentTypeName";
900         final static String DATE_CREATED_FROM = "dateCreatedFrom";
901         final static String DATE_CREATED_TO = "dateCreatedTo";
902         final static String DATE_LAST_MODIFIED_FROM = "dateLastModifiedFrom";
903         final static String DATE_LAST_MODIFIED_TO = "dateLastModifiedTo";
904         final static String DATE_APPROVED_FROM = "dateApprovedFrom";
905         final static String DATE_APPROVED_TO = "dateApprovedTo";
906         final static String DATE_FINALIZED_FROM = "dateFinalizedFrom";
907         final static String DATE_FINALIZED_TO = "dateFinalizedTo";
908         final static String DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_FROM = "dateApplicationDocumentStatusChangedFrom";
909         final static String DATE_APPLICATION_DOCUMENT_STATUS_CHANGED_TO = "dateApplicationDocumentStatusChangedTo";
910         final static String DOCUMENT_ATTRIBUTE_VALUES = "documentAttributeValues";
911         final static String SAVE_NAME = "saveName";
912         final static String START_AT_INDEX = "startAtIndex";
913         final static String MAX_RESULTS = "maxResults";
914         final static String IS_ADVANCED_SEARCH = "isAdvancedSearch";
915         final static String SEARCH_OPTIONS = "searchOptions";
916     }
917 
918 }