Coverage Report - org.kuali.rice.kew.api.document.search.DocumentSearchCriteriaContract
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentSearchCriteriaContract
N/A
N/A
1
 
 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.document.search;
 17  
 
 18  
 import org.joda.time.DateTime;
 19  
 import org.kuali.rice.kew.api.document.DocumentStatus;
 20  
 import org.kuali.rice.kew.api.document.DocumentStatusCategory;
 21  
 
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 /**
 26  
  * Defines the contract for criteria used to perform lookups of workflow document data.  None of the elements that can
 27  
  * be defined on the criteria are required.  Therefore, any method on this class may return a null value, though in the
 28  
  * case of collections, an empty collection will be returned instead.
 29  
  *
 30  
  * <p>In general, the different  values on the criteria allow the standard lookup "operators" as defined by
 31  
  * {@link org.kuali.rice.core.api.search.SearchOperator} unless otherwise noted.  The primary place where this differs
 32  
  * is on principal name-based criteria (see below).</p>
 33  
  *
 34  
  * <p><On criteria which contains a principal name, the rules are as follows:</p>
 35  
  *
 36  
  * <ul>
 37  
  *   <li>only literal principal names that resolve to a valid principal are allowed</li>
 38  
  *   <li>however, if the principal names don't resolve to valid prinicpals, this simply means the lookup will return no results</li>
 39  
  *   <li>"!" is allowed before a principal name</li>
 40  
  *   <li>when wanting to search for more than one principal, "|" and "&&" is allowed though they cannot be used together</li>
 41  
  * </ul>
 42  
  *
 43  
  * <p>Wildcards, ranges, and other "inequality" operators (such as ">", "<", etc.) are not permitted on principal names.</p>
 44  
  *
 45  
  * <p>In cases where a criteria element takes a list of values, this should be treated as an implicit "OR" by the lookup
 46  
  * implementation.  This is true of document attribute values as well, which are passed as a map keyed off the
 47  
  * document attribute name with a list of values representing the document attribute values to be searched for.</p>
 48  
  *
 49  
  * <p>The optional "save name" on the search defines a name under which the criteria can be stored so that it can be
 50  
  * recalled and reused later.</p>
 51  
  *
 52  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 53  
  */
 54  
 public interface DocumentSearchCriteriaContract {
 55  
 
 56  
     /**
 57  
      * Returns the document id criteria to search against when executing the document search.
 58  
      *
 59  
      * @return the document id criteria
 60  
      */
 61  
     String getDocumentId();
 62  
 
 63  
     /**
 64  
      * Returns an unmodifiable list of document statuses to search against when executing the document search.  If there
 65  
      * is more than one of these, then the search should treat this as an "OR" case (i.e. search for documents with one
 66  
      * or more of these statuses).
 67  
      *
 68  
      * @return the document status criteria
 69  
      */
 70  
     List<DocumentStatus> getDocumentStatuses();
 71  
 
 72  
     /**
 73  
      * Returns an unmodifiable list of document status categories to search against when executing the document search.
 74  
      * If there is more than one of these, then the search should treat this as an "OR" case (i.e. search for documents
 75  
      * that have a status contained in one or more of these categories).
 76  
      *
 77  
      * @return the document status category criteria
 78  
      */
 79  
     List<DocumentStatusCategory> getDocumentStatusCategories();
 80  
 
 81  
     /**
 82  
      * Returns the document title criteria to search against when executing the document search.
 83  
      *
 84  
      * @return the title criteria
 85  
      */
 86  
     String getTitle();
 87  
 
 88  
     /**
 89  
      * Returns the application document id criteria to search against when executing the document search.
 90  
      *
 91  
      * @return the application document id criteria
 92  
      */
 93  
     String getApplicationDocumentId();
 94  
 
 95  
     /**
 96  
      * Returns the application document status criteria to search against when executing the document search.
 97  
      *
 98  
      * @return the application document status criteria
 99  
      */
 100  
     String getApplicationDocumentStatus();
 101  
 
 102  
     /**
 103  
      * Returns the criteria for the principal name of the document initiator to search against when executing the
 104  
      * document search.  Follows the rules for principal name criteria (see class-level documentation).
 105  
      *
 106  
      * @return the initiator principal name criteria
 107  
      */
 108  
     String getInitiatorPrincipalName();
 109  
 
 110  
     /**
 111  
      * Returns the criteria for the principal name of a "viewer" of a document (someone who received an action request
 112  
      * related to the document) to search against when executing the document search.  Follows the rules for principal
 113  
      * name criteria (see class-level documentation).
 114  
      *
 115  
      * @return the viewer principal name criteria
 116  
      */
 117  
     String getViewerPrincipalName();
 118  
 
 119  
     /**
 120  
      * Returns the criteria for the id of a group who is a "viewer" of a document (a group who received an action request
 121  
      * related to the document) to search against when executing the document search.  Group id criteria follows rules
 122  
      * similar to principal name criteria:
 123  
      *
 124  
      * <ul>
 125  
      *   <li>only literal group ids that resolve to a valid group are allowed</li>
 126  
      *   <li>however, if the group ids don't resolve to valid groups, this simply means the search will return no results</li>
 127  
      *   <li>"!" is allowed before a group id</li>
 128  
      *   <li>when wanting to search on more than one viewer group id, use of "|" and "&&" is allowed, though they cannot be used together</li>
 129  
      * </ul>
 130  
      *
 131  
      * @return the viewer principal name criteria
 132  
      */
 133  
     String getViewerGroupId();
 134  
 
 135  
     /**
 136  
      * Returns the criteria for the principal name of an "approver" of a document (someone who took action against
 137  
      * the document) to search against when executing the document search.  Follows the rules for principal name
 138  
      * criteria (see class-level documentation).
 139  
      *
 140  
      * @return the viewer principal name criteria
 141  
      */
 142  
     String getApproverPrincipalName();
 143  
 
 144  
     /**
 145  
      * Returns the route node name criteria to search against when executing the document search.  By default this will
 146  
      * match only documents which are at the node with the given name, unless {@link #getRouteNodeLookupLogic()} returns
 147  
      * a non-null value that specifies different criteria for how the route node-based lookup should be performed.
 148  
      *
 149  
      * @return the route node name criteria
 150  
      */
 151  
     String getRouteNodeName();
 152  
 
 153  
     /**
 154  
      * Returns the logic that should be used when performing a document search against the route name.  This essentially
 155  
      * allows for the criteria to specify whether or not it should look at documents which are currently before, exactly
 156  
      * at, or after the specified route node.  This value only has an effect if the route node name is also defined
 157  
      * on this criteria.
 158  
      *
 159  
      * @return the route node lookup logic to use in conjunction with the route node name criteria
 160  
      */
 161  
     RouteNodeLookupLogic getRouteNodeLookupLogic();
 162  
 
 163  
     /**
 164  
      * Returns the document type name criteria to search against when executing the document search.  If the document
 165  
      * type name matches a single document type exactly, this might trigger document search customizations which are
 166  
      * tied to that document type (assuming the document type has such customizations configured).
 167  
      *
 168  
      * <p>In order for the map of document attribute values to be properly searchable, this document type name should
 169  
      * result to a valid document type.  This is because the document type itself defines information about custom
 170  
      * document attributes and the parameters around how searches against those attributes can be executed.</p>
 171  
      *
 172  
      * <p>Note that searches against a document type name should be document type hierarchy-aware.  Meaning that the
 173  
      * search should also return results for any documents that have document types that are children of the specified
 174  
      * document type name (assuming that the specified document type name is valid and not wildcarded at all).</p>
 175  
      *
 176  
      * @return the document type name criteria
 177  
      */
 178  
     String getDocumentTypeName();
 179  
 
 180  
     /**
 181  
      * Returns an optional list of additional document type name criteria against which to search.  The search should
 182  
      * effectively return all documents that have a document type name within the set of the main document type name on
 183  
      * the criteria as well as any additional document type names.
 184  
      *
 185  
      * <p>As with {@link #getDocumentTypeName()}, the additional document type name criteria is document type hierarchy
 186  
      * aware.</p>
 187  
      *
 188  
      * @return the list of additional document type names to use on the search criteria
 189  
      */
 190  
     List<String> getAdditionalDocumentTypeNames();
 191  
 
 192  
     /**
 193  
      * Returns the inclusive lower end of the date created criteria to search against when executing the document search.
 194  
      *
 195  
      * @return the date created "from" criteria
 196  
      */
 197  
     DateTime getDateCreatedFrom();
 198  
 
 199  
     /**
 200  
      * Returns the inclusive upper end of the date created criteria to search against when executing the document search.
 201  
      *
 202  
      * @return the date created "to" criteria
 203  
      */
 204  
     DateTime getDateCreatedTo();
 205  
 
 206  
     /**
 207  
      * Returns the inclusive lower end of the date last modified criteria to search against when executing the document search.
 208  
      *
 209  
      * @return the date last modified "from" criteria
 210  
      */
 211  
     DateTime getDateLastModifiedFrom();
 212  
 
 213  
     /**
 214  
      * Returns the inclusive upper end of the date last modified criteria to search against when executing the document search.
 215  
      *
 216  
      * @return the date last modified "to" criteria
 217  
      */
 218  
     DateTime getDateLastModifiedTo();
 219  
 
 220  
     /**
 221  
      * Returns the inclusive lower end of the date approved criteria to search against when executing the document search.
 222  
      *
 223  
      * @return the date approved "from" criteria
 224  
      */
 225  
     DateTime getDateApprovedFrom();
 226  
 
 227  
     /**
 228  
      * Returns the inclusive upper end of the date approved criteria to search against when executing the document search.
 229  
      *
 230  
      * @return the date approved "tp" criteria
 231  
      */
 232  
     DateTime getDateApprovedTo();
 233  
 
 234  
     /**
 235  
      * Returns the inclusive lower end of the date finalized criteria to search against when executing the document search.
 236  
      *
 237  
      * @return the date finalized "from" criteria
 238  
      */
 239  
     DateTime getDateFinalizedFrom();
 240  
 
 241  
     /**
 242  
      * Returns the inclusive upper end of the date finalized criteria to search against when executing the document search.
 243  
      *
 244  
      * @return the date finalized "to" criteria
 245  
      */
 246  
     DateTime getDateFinalizedTo();
 247  
 
 248  
     /**
 249  
      * Returns the inclusive lower end of the date of application document status change criteria to search against when executing the document search.
 250  
      *
 251  
      * @return the date application document status changed "from" criteria
 252  
      */
 253  
     DateTime getDateApplicationDocumentStatusChangedFrom();
 254  
 
 255  
     /**
 256  
      * Returns the inclusive upper end of the date of application document status change criteria to search against when executing the document search.
 257  
      *
 258  
      * @return the date application document status changed "to" criteria
 259  
      */
 260  
     DateTime getDateApplicationDocumentStatusChangedTo();
 261  
 
 262  
     /**
 263  
      * Returns a map of document attribute values to search against when executing the document search.  The key of the
 264  
      * map is the name of the document attribute, while the list of values contains values of those attributes to search
 265  
      * against.  These individual attribute values support the different search operations where appropriate.  The
 266  
      * resulting List of criteria values however should ultimately be "or"-ed together when executing the document
 267  
      * search.
 268  
      *
 269  
      * <p>In order for the document attribute values to be processed as part of the criteria during the search, the
 270  
      * {@link #getDocumentTypeName()} must return a valid name of a document type which is configured to understand the
 271  
      * attributes passed as part of the document attribute values map.</p>
 272  
      * @return
 273  
      */
 274  
     Map<String, List<String>> getDocumentAttributeValues();
 275  
 
 276  
     /**
 277  
      * Return the name under which to save this criteria so that it can be recalled and used again in the future.  If no
 278  
      * save name is specified, then this criteria will not be saved for future use.
 279  
      * @return
 280  
      */
 281  
     String getSaveName();
 282  
 
 283  
     /**
 284  
      * Returns the 0-based index in the result set at which to start returning results from a document search which is
 285  
      * performed using this criteria.  If not specified, results from the search should be returned starting at the
 286  
      * beginning of the result set.  If this index is larger then the total number of results returned by the actual
 287  
      * search, then no values should be returned.
 288  
      *
 289  
      * @return the index in the result set at which to begin returning results
 290  
      */
 291  
         Integer getStartAtIndex();
 292  
 
 293  
     /**
 294  
      * Returns the requested maximum number of documents that should be returned from a document search performed using this
 295  
      * criteria.  If not specified, it is up to the document search implementation to decide how many results to return.
 296  
      * It is likely in such cases that the implementation will use a default result cap in order to prevent too many
 297  
      * documents from being returned.
 298  
      *
 299  
      * <p>It is important to note that this value is meant simply as a request to the document search for the number of
 300  
      * results to return.  The implementation may return fewer results then requested if it decides to impose it's own
 301  
      * internal cap on results.</p>
 302  
      *
 303  
      * @return the requested number of maximum document results that should be returned from the search
 304  
      */
 305  
         Integer getMaxResults();
 306  
 
 307  
 }