Coverage Report - org.kuali.rice.kew.docsearch.DocSearchCriteriaDTO
 
Classes in this File Line Coverage Branch Coverage Complexity
DocSearchCriteriaDTO
0%
0/231
0%
0/192
2.033
 
 1  
 /*
 2  
  * Copyright 2005-2007 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.docsearch;
 18  
 
 19  
 import org.apache.commons.collections.CollectionUtils;
 20  
 import org.apache.commons.lang.StringUtils;
 21  
 import org.kuali.rice.kew.engine.node.RouteNode;
 22  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 23  
 import org.kuali.rice.kew.util.KEWConstants;
 24  
 import org.kuali.rice.kns.web.ui.Field;
 25  
 import org.kuali.rice.kns.web.ui.Row;
 26  
 import org.kuali.rice.krad.bo.BusinessObject;
 27  
 import org.kuali.rice.krad.bo.BusinessObjectBase;
 28  
 
 29  
 import java.util.ArrayList;
 30  
 import java.util.HashSet;
 31  
 import java.util.List;
 32  
 import java.util.Set;
 33  
 
 34  
 
 35  
 /**
 36  
  * Model bean representing document searches.  Persisted each search as part of the users saved searches.
 37  
  *
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  
 public class DocSearchCriteriaDTO extends BusinessObjectBase implements BusinessObject, DocumentRouteHeaderEBO {
 41  
 
 42  
     private static final long serialVersionUID = -5738747438282249790L;
 43  
 
 44  
     public static final String ADVANCED_SEARCH_INDICATOR_STRING = "YES";
 45  
     public static final String SUPER_USER_SEARCH_INDICATOR_STRING = "YES";
 46  
     public static final int DEFAULT_PAGE_SIZE = 10;
 47  
 
 48  
     private String namedSearch; // if populated the name of the search that they want to save
 49  
     private Integer pageSize; // the number of items to display on a page of results
 50  
     private String documentId; // id generated by KEW
 51  
     private String docRouteStatus; // route status of the document
 52  
     private String appDocStatus; // application document status
 53  
     private String docTitle; // document title provided by the application
 54  
     private String appDocId; // application provided ID - defaults to documentId
 55  
     private String overrideInd; // flag to indicate overridden business values - set by app
 56  
     private String initiator; // network Id of the person who initiated the document
 57  
     private String viewer; // network Id of the person who is currently viewing the document
 58  
     private String workgroupViewerNamespace; //group namespace of the group that has had an action request to the document
 59  
     private String workgroupViewerName; // workgroup Id that has had an action request to the document
 60  
     private String approver; // network Id of the person who is approving the document
 61  
     private String docRouteNodeId; // current level of routing, i.e. which route method is the document currently in
 62  
     private String docRouteNodeLogic; // exactly, before or after
 63  
     private String docVersion; // document version
 64  
     private String docTypeFullName; // the fullname for the document's docType
 65  
     private String workgroupViewerId;
 66  
 
 67  
     //date range properties
 68  
     private String fromDateCreated; // the begin range for DateCreated
 69  
     private String fromDateLastModified; // the begin range for LastModified
 70  
     private String fromDateApproved; // the begin range for Approved
 71  
     private String fromDateFinalized; // the begin range for Finalized
 72  
     private String fromStatusTransitionDate;  // the begin range for app doc status transition
 73  
     private String toDateCreated; // the end range for created
 74  
     private String toDateLastModified; // the end range for last modified
 75  
     private String toDateApproved; // the end range for approved
 76  
     private String toDateFinalized; // the end range for finalized
 77  
     private String toStatusTransitionDate;  // the end range for app doc status transition
 78  
     private java.sql.Timestamp dateCreated; //fake date for DD
 79  
     
 80  
     // criteria processing
 81  0
     private List<Row> searchableAttributeRows = new ArrayList<Row>();
 82  
 
 83  
     // searchable attribute properties
 84  0
     private List<SearchAttributeCriteriaComponent> searchableAttributes = new ArrayList<SearchAttributeCriteriaComponent>();
 85  
 
 86  
     //properties to preserve view from saved and history searches as well as generate results
 87  
     private String isAdvancedSearch;
 88  0
     private String superUserSearch = "NO";
 89  
 
 90  
     // used as an "out" parameter to indicate the threshold for the search
 91  0
     private Integer threshold = Integer.valueOf(DocumentSearchGenerator.DEFAULT_SEARCH_RESULT_CAP);
 92  0
     private Integer fetchLimit = Integer.valueOf(0);
 93  
 
 94  
     // used as an "out" parameter to indicate that the rows fetched for this criteria are over the indicated threshold
 95  0
     private boolean isOverThreshold = false;
 96  
 
 97  
     // used as an "out" prameter to indicate the number of rows that were filtered for security
 98  0
     private int securityFilteredRows = 0;
 99  
 
 100  
     // below used when doing a document search from API
 101  0
     private boolean overridingUserSession = false;
 102  0
     private boolean saveSearchForUser = false;
 103  
 
 104  0
     private boolean onlyDocTypeFilled = false;
 105  
     
 106  
     public DocSearchCriteriaDTO() {
 107  0
         super();
 108  0
     }
 109  
 
 110  
     /**
 111  
          * This overridden method ...
 112  
          * 
 113  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#isStandardCriteriaConsideredEmpty(boolean)
 114  
          */
 115  
     public boolean isStandardCriteriaConsideredEmpty(boolean excludeDocumentTypeName) {
 116  0
         boolean docTypeNameIsEmpty = org.apache.commons.lang.StringUtils.isEmpty(this.docTypeFullName);
 117  0
         boolean standardFieldsAreEmpty = ((org.apache.commons.lang.StringUtils.isEmpty(documentId)) &&
 118  
         /* (org.apache.commons.lang.StringUtils.isEmpty(overrideInd)) && */
 119  
         (org.apache.commons.lang.StringUtils.isEmpty(initiator)) && (org.apache.commons.lang.StringUtils.isEmpty(workgroupViewerName)) &&
 120  
         /* (org.apache.commons.lang.StringUtils.isEmpty(docRouteNodeLogic)) && */
 121  
         (org.apache.commons.lang.StringUtils.isEmpty(docVersion)) && (org.apache.commons.lang.StringUtils.isEmpty(fromDateCreated)) && (org.apache.commons.lang.StringUtils.isEmpty(toDateCreated)) && (org.apache.commons.lang.StringUtils.isEmpty(appDocId)) && (org.apache.commons.lang.StringUtils.isEmpty(approver)) && (org.apache.commons.lang.StringUtils.isEmpty(docRouteNodeId)) && (org.apache.commons.lang.StringUtils.isEmpty(docRouteStatus)) && (org.apache.commons.lang.StringUtils.isEmpty(docTitle)) && (org.apache.commons.lang.StringUtils.isEmpty(viewer)) && (org.apache.commons.lang.StringUtils.isEmpty(fromDateApproved)) && (org.apache.commons.lang.StringUtils.isEmpty(toDateApproved)) && (org.apache.commons.lang.StringUtils.isEmpty(fromDateFinalized)) && (org.apache.commons.lang.StringUtils.isEmpty(toDateFinalized)) && (org.apache.commons.lang.StringUtils.isEmpty(fromDateLastModified)) && (org.apache.commons.lang.StringUtils.isEmpty(toDateLastModified)));
 122  0
         if (excludeDocumentTypeName) {
 123  0
             return standardFieldsAreEmpty;
 124  
         } else {
 125  0
             return docTypeNameIsEmpty && standardFieldsAreEmpty;
 126  
         }
 127  
     }
 128  
 
 129  
     /**
 130  
          * This overridden method ...
 131  
          * 
 132  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocRouteNodeLogic()
 133  
          */
 134  
     public String getDocRouteNodeLogic() {
 135  0
         return docRouteNodeLogic;
 136  
     }
 137  
 
 138  
     public void setDocRouteNodeLogic(String docRouteLevelLogic) {
 139  0
         this.docRouteNodeLogic = docRouteLevelLogic;
 140  0
     }
 141  
 
 142  
     /**
 143  
          * This overridden method ...
 144  
          * 
 145  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getAppDocId()
 146  
          */
 147  
     public String getAppDocId() {
 148  0
         return appDocId;
 149  
     }
 150  
 
 151  
     public void setAppDocId(String appDocId) {
 152  0
         this.appDocId = appDocId;
 153  0
     }
 154  
 
 155  
     /**
 156  
          * This overridden method ...
 157  
          * 
 158  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getApprover()
 159  
          */
 160  
     public String getApprover() {
 161  0
         return approver;
 162  
     }
 163  
 
 164  
     public void setApprover(String approver) {
 165  0
         this.approver = approver;
 166  0
     }
 167  
 
 168  
     /**
 169  
          * This overridden method ...
 170  
          * 
 171  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocRouteNodeId()
 172  
          */
 173  
     public String getDocRouteNodeId() {
 174  0
         return docRouteNodeId;
 175  
     }
 176  
 
 177  
     public void setDocRouteNodeId(String docRouteLevel) {
 178  0
         this.docRouteNodeId = docRouteLevel;
 179  0
     }
 180  
 
 181  
     /**
 182  
          * This overridden method ...
 183  
          * 
 184  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocRouteStatus()
 185  
          */
 186  
     public String getDocRouteStatus() {
 187  0
         return docRouteStatus;
 188  
     }
 189  
 
 190  
     public void setDocRouteStatus(String docRouteStatus) {
 191  0
         this.docRouteStatus = docRouteStatus;
 192  0
     }
 193  
 
 194  
     /**
 195  
          * This overridden method ...
 196  
          * 
 197  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getAppDocStatus()
 198  
          */
 199  
     public String getAppDocStatus() {
 200  0
         return appDocStatus;
 201  
     }
 202  
 
 203  
     public void setAppDocStatus(String appDocStatus) {
 204  0
         this.appDocStatus = appDocStatus;
 205  0
     }
 206  
 
 207  
     /**
 208  
          * This overridden method ...
 209  
          * 
 210  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocTitle()
 211  
          */
 212  
     public String getDocTitle() {
 213  0
         return docTitle;
 214  
     }
 215  
 
 216  
     public void setDocTitle(String docTitle) {
 217  0
         this.docTitle = docTitle;
 218  0
     }
 219  
 
 220  
     /**
 221  
          * This overridden method ...
 222  
          * 
 223  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocTypeFullName()
 224  
          */
 225  
     public String getDocTypeFullName() {
 226  0
         return docTypeFullName;
 227  
     }
 228  
 
 229  
     public void setDocTypeFullName(String docTypeFullName) {
 230  0
         this.docTypeFullName = docTypeFullName;
 231  0
     }
 232  
 
 233  
     /**
 234  
          * This overridden method ...
 235  
          * 
 236  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocVersion()
 237  
          */
 238  
     public String getDocVersion() {
 239  0
         return docVersion;
 240  
     }
 241  
 
 242  
     public void setDocVersion(String docVersion) {
 243  0
         this.docVersion = docVersion;
 244  0
     }
 245  
 
 246  
     /**
 247  
          * This overridden method ...
 248  
          * 
 249  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getInitiator()
 250  
          */
 251  
     public String getInitiator() {
 252  0
         return initiator;
 253  
     }
 254  
 
 255  
     public void setInitiator(String initiator) {
 256  0
         this.initiator = initiator;
 257  0
     }
 258  
 
 259  
     /**
 260  
          * This overridden method ...
 261  
          * 
 262  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getOverrideInd()
 263  
          */
 264  
     public String getOverrideInd() {
 265  0
         return overrideInd;
 266  
     }
 267  
 
 268  
     public void setOverrideInd(String overrideInd) {
 269  0
         this.overrideInd = overrideInd;
 270  0
     }
 271  
 
 272  
     /**
 273  
          * This overridden method ...
 274  
          * 
 275  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocumentId()
 276  
          */
 277  
     public String getDocumentId() {
 278  0
         return documentId;
 279  
     }
 280  
 
 281  
     public void setDocumentId(String documentId) {
 282  0
         this.documentId = documentId;
 283  0
     }
 284  
 
 285  
     /**
 286  
          * This overridden method ...
 287  
          * 
 288  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getViewer()
 289  
          */
 290  
     public String getViewer() {
 291  0
         return viewer;
 292  
     }
 293  
 
 294  
     public void setViewer(String viewer) {
 295  0
         this.viewer = viewer;
 296  0
     }
 297  
 
 298  
     /**
 299  
          * This overridden method ...
 300  
          * 
 301  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getPageSize()
 302  
          */
 303  
     public Integer getPageSize() {
 304  0
         return pageSize;
 305  
     }
 306  
 
 307  
     public void setPageSize(Integer pageSize) {
 308  0
         this.pageSize = pageSize;
 309  0
     }
 310  
 
 311  
     /**
 312  
          * This overridden method ...
 313  
          * 
 314  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getFromDateApproved()
 315  
          */
 316  
     public String getFromDateApproved() {
 317  0
         return fromDateApproved;
 318  
     }
 319  
 
 320  
     /**
 321  
          * This overridden method ...
 322  
          * 
 323  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getFromDateCreated()
 324  
          */
 325  
     public String getFromDateCreated() {
 326  0
         return fromDateCreated;
 327  
     }
 328  
 
 329  
     /**
 330  
          * This overridden method ...
 331  
          * 
 332  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getFromDateFinalized()
 333  
          */
 334  
     public String getFromDateFinalized() {
 335  0
         return fromDateFinalized;
 336  
     }
 337  
 
 338  
     /**
 339  
          * This overridden method ...
 340  
          * 
 341  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getFromDateLastModified()
 342  
          */
 343  
     public String getFromDateLastModified() {
 344  0
         return fromDateLastModified;
 345  
     }
 346  
 
 347  
     public String getFromStatusTransitionDate() {
 348  0
         return fromStatusTransitionDate;
 349  
     }
 350  
     /**
 351  
          * This overridden method ...
 352  
          * 
 353  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getToDateApproved()
 354  
          */
 355  
     public String getToDateApproved() {
 356  0
         return toDateApproved;
 357  
     }
 358  
 
 359  
     /**
 360  
          * This overridden method ...
 361  
          * 
 362  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getToDateCreated()
 363  
          */
 364  
     public String getToDateCreated() {
 365  0
         return toDateCreated;
 366  
     }
 367  
 
 368  
     /**
 369  
          * This overridden method ...
 370  
          * 
 371  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getToDateFinalized()
 372  
          */
 373  
     public String getToDateFinalized() {
 374  0
         return toDateFinalized;
 375  
     }
 376  
 
 377  
     /**
 378  
          * This overridden method ...
 379  
          * 
 380  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getToDateLastModified()
 381  
          */
 382  
     public String getToDateLastModified() {
 383  0
         return toDateLastModified;
 384  
     }
 385  
 
 386  
     public String getToStatusTransitionDate() {
 387  0
         return toStatusTransitionDate;
 388  
     }
 389  
     public void setFromDateApproved(String fromDateApproved) {
 390  0
         this.fromDateApproved = safeTrimmer(fromDateApproved);
 391  0
     }
 392  
 
 393  
     public void setFromDateCreated(String fromDateCreated) {
 394  0
         this.fromDateCreated = safeTrimmer(fromDateCreated);
 395  0
     }
 396  
 
 397  
     public void setFromDateFinalized(String fromDateFinalized) {
 398  0
         this.fromDateFinalized = safeTrimmer(fromDateFinalized);
 399  0
     }
 400  
 
 401  
     public void setFromDateLastModified(String fromDateLastModified) {
 402  0
         this.fromDateLastModified = safeTrimmer(fromDateLastModified);
 403  0
     }
 404  
 
 405  
     public void setFromStatusTransitionDate(String fromStatusTransitionDate) {
 406  0
         this.fromStatusTransitionDate = safeTrimmer(fromStatusTransitionDate);
 407  0
     }
 408  
 
 409  
     public void setToDateApproved(String toDateApproved) {
 410  0
         this.toDateApproved = safeTrimmer(toDateApproved);
 411  0
     }
 412  
 
 413  
     public void setToDateCreated(String toDateCreated) {
 414  0
         this.toDateCreated = safeTrimmer(toDateCreated);
 415  0
     }
 416  
 
 417  
     public void setToDateFinalized(String toDateFinalized) {
 418  0
         this.toDateFinalized = safeTrimmer(toDateFinalized);
 419  0
     }
 420  
 
 421  
     public void setToDateLastModified(String toDateLastModified) {
 422  0
         this.toDateLastModified = safeTrimmer(toDateLastModified);
 423  0
     }
 424  
 
 425  
     public void setToStatusTransitionDate(String toStatusTransitionDate) {
 426  0
         this.toStatusTransitionDate = safeTrimmer(toStatusTransitionDate);
 427  0
     }
 428  
 
 429  
     private String safeTrimmer(String value) {
 430  0
         if (!org.apache.commons.lang.StringUtils.isEmpty(value)) {
 431  0
             return value.trim();
 432  
         }
 433  0
         return value;
 434  
     }
 435  
 
 436  
     /**
 437  
          * This overridden method ...
 438  
          * 
 439  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getNamedSearch()
 440  
          */
 441  
     public String getNamedSearch() {
 442  0
         return namedSearch;
 443  
     }
 444  
 
 445  
     public void setNamedSearch(String namedSearch) {
 446  0
         this.namedSearch = namedSearch;
 447  0
     }
 448  
 
 449  
     /**
 450  
          * This overridden method ...
 451  
          * 
 452  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDocumentSearchAbbreviatedString()
 453  
          */
 454  
     public String getDocumentSearchAbbreviatedString() {
 455  0
         StringBuffer abbreviatedString = new StringBuffer();
 456  0
         String dateApprovedString = getRangeString(this.toDateApproved, this.fromDateApproved);
 457  0
         String dateCreatedString = getRangeString(this.toDateCreated, this.fromDateCreated);
 458  0
         String dateLastModifiedString = getRangeString(this.toDateLastModified, this.fromDateLastModified);
 459  0
         String dateFinalizedString = getRangeString(this.toDateFinalized, this.fromDateFinalized);
 460  0
         String dateStatusTransitionString = getRangeString(this.toStatusTransitionDate, this.fromStatusTransitionDate);
 461  0
         if (appDocId != null && !"".equals(appDocId.trim())) {
 462  0
             abbreviatedString.append("Application Document Id=").append(appDocId).append("; ");
 463  
         }
 464  0
         if (approver != null && !"".equals(approver.trim())) {
 465  0
             abbreviatedString.append("Approver=").append(approver).append("; ");
 466  
         }
 467  0
         if (docRouteNodeId != null && !"".equals(docRouteNodeId.trim())) {
 468  0
             RouteNode routeNode = KEWServiceLocator.getRouteNodeService().findRouteNodeById(docRouteNodeId);
 469  0
             abbreviatedString.append("Document Route Node=").append(routeNode.getRouteNodeName()).append("; ");
 470  
         }
 471  0
         if (docRouteStatus != null && !"".equals(docRouteStatus.trim())) {
 472  0
             abbreviatedString.append("Document Route Status=").append(docRouteStatus).append("; ");
 473  
         }
 474  0
         if (docTitle != null && !"".equals(docTitle.trim())) {
 475  0
             abbreviatedString.append("Document Title=").append(docTitle).append("; ");
 476  
         }
 477  0
         if (docTypeFullName != null && !"".equals(docTypeFullName.trim())) {
 478  0
             abbreviatedString.append("Document Type=").append(docTypeFullName).append("; ");
 479  
         }
 480  0
         if (initiator != null && !"".equals(initiator.trim())) {
 481  0
             abbreviatedString.append("Initiator=").append(initiator).append("; ");
 482  
         }
 483  0
         if (documentId != null) {
 484  0
             abbreviatedString.append("Document Id=").append(documentId).append("; ");
 485  
         }
 486  0
         if (viewer != null && !"".equals(viewer.trim())) {
 487  0
             abbreviatedString.append("Viewer=").append(viewer).append("; ");
 488  
         }
 489  0
         if (workgroupViewerName != null) {
 490  0
             abbreviatedString.append("Group Viewer=").append(workgroupViewerName).append(";");
 491  
         }
 492  0
         if (dateLastModifiedString != null) {
 493  0
             abbreviatedString.append("Date Last Modified=").append(dateLastModifiedString).append("; ");
 494  
         }
 495  0
         if (dateFinalizedString != null) {
 496  0
             abbreviatedString.append("Date Finalized=").append(dateFinalizedString).append("; ");
 497  
         }
 498  0
         if (dateCreatedString != null) {
 499  0
             abbreviatedString.append("Date Created=").append(dateCreatedString).append("; ");
 500  
         }
 501  0
         if (dateApprovedString != null) {
 502  0
             abbreviatedString.append("Date Approved=").append(dateApprovedString).append("; ");
 503  
         }
 504  0
         if (dateStatusTransitionString != null) {
 505  0
             abbreviatedString.append("Date Status Transition=").append(dateStatusTransitionString).append("; ");
 506  
         }
 507  
 
 508  0
         Set<String> alreadyAddedRangeAttributes = new HashSet<String>();
 509  0
         for (SearchAttributeCriteriaComponent searchableAttribute : searchableAttributes)
 510  
         {
 511  0
             if (!org.apache.commons.lang.StringUtils.isEmpty(searchableAttribute.getValue()))
 512  
             {
 513  
                 // single value entered
 514  0
                 if (searchableAttribute.isRangeSearch())
 515  
                 {
 516  
                     // if search attribute criteria component is member of a range we must find it's potential matching partner to build the string
 517  0
                     if (!alreadyAddedRangeAttributes.contains(searchableAttribute.getSavedKey()))
 518  
                     {
 519  
                         // the key has not been processed yet
 520  0
                         String lowerSearchAttributeRangeValue = (searchableAttribute.getFormKey().startsWith(KEWConstants.SearchableAttributeConstants.RANGE_LOWER_BOUND_PROPERTY_PREFIX)) ? searchableAttribute.getValue() : null;
 521  0
                         String upperSearchAttributeRangeValue = (searchableAttribute.getFormKey().startsWith(KEWConstants.SearchableAttributeConstants.RANGE_UPPER_BOUND_PROPERTY_PREFIX)) ? searchableAttribute.getValue() : null;
 522  
                         // loop through the attributes to find this search attribute criteria components potential match
 523  0
                         for (SearchAttributeCriteriaComponent searchableAttribute1 : searchableAttributes)
 524  
                         {
 525  0
                             if ((searchableAttribute1.getSavedKey().equals(searchableAttribute.getSavedKey())) && (!(searchableAttribute1.getFormKey().equals(searchableAttribute.getFormKey()))))
 526  
                             {
 527  
                                 // we found the other side of the range
 528  0
                                 if (lowerSearchAttributeRangeValue == null)
 529  
                                 {
 530  0
                                     lowerSearchAttributeRangeValue = (searchableAttribute1.getFormKey().startsWith(KEWConstants.SearchableAttributeConstants.RANGE_LOWER_BOUND_PROPERTY_PREFIX)) ? searchableAttribute1.getValue() : null;
 531  
                                 }
 532  0
                                 if (upperSearchAttributeRangeValue == null)
 533  
                                 {
 534  0
                                     upperSearchAttributeRangeValue = (searchableAttribute1.getFormKey().startsWith(KEWConstants.SearchableAttributeConstants.RANGE_UPPER_BOUND_PROPERTY_PREFIX)) ? searchableAttribute1.getValue() : null;
 535  
                                 }
 536  
                                 break;
 537  
                             }
 538  
                         }
 539  
                         // we should have valid values for the 'to' and 'from' range field values by now
 540  0
                         abbreviatedString.append(searchableAttribute.getSavedKey()).append("=").append(getRangeString(lowerSearchAttributeRangeValue, upperSearchAttributeRangeValue)).append(";");
 541  0
                         alreadyAddedRangeAttributes.add(searchableAttribute.getSavedKey());
 542  0
                     }
 543  
                 } else
 544  
                 {
 545  0
                     abbreviatedString.append(searchableAttribute.getSavedKey()).append("=").append(searchableAttribute.getValue()).append(";");
 546  
                 }
 547  0
             } else if (!CollectionUtils.isEmpty(searchableAttribute.getValues()))
 548  
             {
 549  
                 // multiple values entered
 550  0
                 StringBuffer tempAbbreviatedString = new StringBuffer();
 551  0
                 tempAbbreviatedString.append(searchableAttribute.getSavedKey()).append("=");
 552  0
                 boolean firstValue = true;
 553  0
                 for (String value : searchableAttribute.getValues())
 554  
                 {
 555  0
                     if (StringUtils.isNotBlank(value))
 556  
                     {
 557  0
                         if (firstValue)
 558  
                         {
 559  0
                             tempAbbreviatedString.append(value);
 560  0
                             firstValue = false;
 561  
                         } else
 562  
                         {
 563  0
                             tempAbbreviatedString.append(" or ").append(value);
 564  
                         }
 565  
                     }
 566  
                 }
 567  0
                 String testString = tempAbbreviatedString.toString().replaceAll("=", "").replaceAll(" or ", "");
 568  0
                 if (testString.trim().length() > 0)
 569  
                 {
 570  0
                     abbreviatedString.append(tempAbbreviatedString).append(";");
 571  
                 }
 572  0
             }
 573  
         }
 574  
 
 575  0
         return abbreviatedString.toString();
 576  
     }
 577  
 
 578  
     private String getRangeString(String to, String from) {
 579  0
         String dateString = null;
 580  0
         if (to != null && !"".equals(to.trim()) && from != null && !"".equals(from.trim())) {
 581  0
             dateString = "(" + from + " - " + to + ")";
 582  
         } else {
 583  0
             if (to != null && !"".equals(to.trim())) {
 584  0
                 dateString = "to " + to;
 585  0
             } else if (from != null && !"".equals(from.trim())) {
 586  0
                 dateString = "from " + from;
 587  
             } else {
 588  
                 //
 589  
             }
 590  
         }
 591  0
         return dateString;
 592  
     }
 593  
 
 594  
     /**
 595  
      * TODO this is here for historic reasons and has been replaced by a managed state in the CriteriaDTO... eliminate
 596  
      * @deprecated
 597  
      */
 598  
     public boolean isAdvancedSearch() {
 599  0
         return ((appDocId != null && !"".equals(appDocId.trim())) || (approver != null && !"".equals(approver.trim())) || (docRouteNodeId != null && !"".equals(docRouteNodeId.trim())) || (docRouteStatus != null && !"".equals(docRouteStatus.trim())) || (docTitle != null && !"".equals(docTitle.trim())) || (viewer != null && !"".equals(viewer.trim())) || (fromDateApproved != null && !"".equals(fromDateApproved.trim())) || (toDateApproved != null && !"".equals(toDateApproved.trim())) || (toDateFinalized != null && !"".equals(toDateFinalized.trim())) || (fromDateFinalized != null && !"".equals(fromDateFinalized.trim())) || (toDateLastModified != null && !"".equals(toDateLastModified.trim())) || (fromDateLastModified != null && !"".equals(fromDateLastModified.trim())));
 600  
     }
 601  
 
 602  
     /**
 603  
          * This overridden method ...
 604  
          * 
 605  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getWorkgroupViewerName()
 606  
          */
 607  
     public String getWorkgroupViewerName() {
 608  0
         return workgroupViewerName;
 609  
     }
 610  
 
 611  
     public void setWorkgroupViewerName(String workgroupViewerName) {
 612  0
         this.workgroupViewerName = workgroupViewerName;
 613  0
     }
 614  
 
 615  
     /**
 616  
          * This overridden method ...
 617  
          * 
 618  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getIsAdvancedSearch()
 619  
          */
 620  
     public String getIsAdvancedSearch() {
 621  0
         return isAdvancedSearch;
 622  
     }
 623  
 
 624  
     public void setIsAdvancedSearch(String isAdvancedSearch) {
 625  0
         this.isAdvancedSearch = isAdvancedSearch;
 626  0
     }
 627  
 
 628  
     /**
 629  
          * This overridden method ...
 630  
          * 
 631  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getSuperUserSearch()
 632  
          */
 633  
     public String getSuperUserSearch() {
 634  0
         return superUserSearch;
 635  
     }
 636  
 
 637  
     public void setSuperUserSearch(String superUserSearch) {
 638  0
         this.superUserSearch = superUserSearch;
 639  0
     }
 640  
     
 641  
 
 642  
     /**
 643  
          * This overridden method ...
 644  
          * 
 645  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#isOverThreshold()
 646  
          */
 647  
     public boolean isOverThreshold() {
 648  0
         return isOverThreshold;
 649  
     }
 650  
 
 651  
     public void setOverThreshold(boolean isOverThreshold) {
 652  0
         this.isOverThreshold = isOverThreshold;
 653  0
     }
 654  
 
 655  
     /**
 656  
          * This overridden method ...
 657  
          * 
 658  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getSecurityFilteredRows()
 659  
          */
 660  
     public int getSecurityFilteredRows() {
 661  0
         return securityFilteredRows;
 662  
     }
 663  
 
 664  
     public void setSecurityFilteredRows(int securityFilteredRows) {
 665  0
         this.securityFilteredRows = securityFilteredRows;
 666  0
     }
 667  
 
 668  
     /**
 669  
          * This overridden method ...
 670  
          * 
 671  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getThreshold()
 672  
          */
 673  
     public Integer getThreshold() {
 674  0
         return this.threshold;
 675  
     }
 676  
 
 677  
     public void setThreshold(Integer threshold) {
 678  0
         this.threshold = threshold;
 679  0
     }
 680  
 
 681  
     /**
 682  
          * This overridden method ...
 683  
          * 
 684  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getFetchLimit()
 685  
          */
 686  
     public Integer getFetchLimit() {
 687  0
         return this.fetchLimit;
 688  
     }
 689  
 
 690  
     public void setFetchLimit(Integer fetchLimit) {
 691  0
         this.fetchLimit = fetchLimit;
 692  0
     }
 693  
 
 694  
     public void addSearchableAttribute(SearchAttributeCriteriaComponent searchableAttribute) {
 695  0
         searchableAttributes.add(searchableAttribute);
 696  0
     }
 697  
 
 698  
     /**
 699  
      * @param searchableAttributes The searchableAttributes to set.
 700  
      */
 701  
     public void setSearchableAttributes(List<SearchAttributeCriteriaComponent> searchableAttributes) {
 702  0
         this.searchableAttributes = searchableAttributes;
 703  0
     }
 704  
 
 705  
     /**
 706  
          * This overridden method ...
 707  
          * 
 708  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getSearchableAttributes()
 709  
          */
 710  
     public List<SearchAttributeCriteriaComponent> getSearchableAttributes() {
 711  0
         return searchableAttributes;
 712  
     }
 713  
 
 714  
     public void setSearchableAttributeRows(List<Row> searchableAttributeRows) {
 715  0
         this.searchableAttributeRows = searchableAttributeRows;
 716  0
     }
 717  
 
 718  
     /**
 719  
          * This overridden method ...
 720  
          * 
 721  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getSearchableAttributeRows()
 722  
          */
 723  
     public List<Row> getSearchableAttributeRows() {
 724  0
         return searchableAttributeRows;
 725  
     }
 726  
 
 727  
     /**
 728  
          * This overridden method ...
 729  
          * 
 730  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getProcessedSearchableAttributeRows()
 731  
          */
 732  
     public List<Row> getProcessedSearchableAttributeRows() {
 733  0
         return searchableAttributeRows;
 734  
     }
 735  
 
 736  
     public void addSearchableAttributeRow(Row row) {
 737  0
         searchableAttributeRows.add(row);
 738  0
     }
 739  
 
 740  
     /**
 741  
          * This overridden method ...
 742  
          * 
 743  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getSearchableAttributeRow(int)
 744  
          */
 745  
     public Row getSearchableAttributeRow(int index) {
 746  0
         while (getSearchableAttributeRows().size() <= index) {
 747  0
             Row row = new Row(new ArrayList<Field>());
 748  0
             getSearchableAttributeRows().add(row);
 749  0
         }
 750  0
         return (Row) getSearchableAttributeRows().get(index);
 751  
     }
 752  
 
 753  
     public void setSearchableAttributeRow(int index, Row row) {
 754  0
         searchableAttributeRows.set(index, row);
 755  0
     }
 756  
 
 757  
     /**
 758  
          * This overridden method ...
 759  
          * 
 760  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#isOverridingUserSession()
 761  
          */
 762  
     public boolean isOverridingUserSession() {
 763  0
         return this.overridingUserSession;
 764  
     }
 765  
 
 766  
     public void setOverridingUserSession(boolean overridingUserSession) {
 767  0
         this.overridingUserSession = overridingUserSession;
 768  0
     }
 769  
 
 770  
         /**
 771  
          * This overridden method ...
 772  
          * 
 773  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#isSaveSearchForUser()
 774  
          */
 775  
         public boolean isSaveSearchForUser() {
 776  0
                 return this.saveSearchForUser;
 777  
         }
 778  
 
 779  
         public void setSaveSearchForUser(boolean saveSearchForUser) {
 780  0
                 this.saveSearchForUser = saveSearchForUser;
 781  0
         }
 782  
 
 783  
     /**
 784  
          * @deprecated
 785  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getWorkgroupViewerNamespace()
 786  
          */
 787  
     public String getWorkgroupViewerNamespace() {
 788  0
         return this.workgroupViewerNamespace;
 789  
     }
 790  
     /**
 791  
      * 
 792  
      * @deprecated
 793  
      * @param workgroupViewerNamespace
 794  
      */
 795  
     public void setWorkgroupViewerNamespace(String workgroupViewerNamespace) {
 796  0
         this.workgroupViewerNamespace = workgroupViewerNamespace;
 797  0
     }
 798  
 
 799  
         /**
 800  
          * This overridden method ...
 801  
          * 
 802  
          * @see org.kuali.rice.krad.bo.BusinessObject#refresh()
 803  
          */
 804  
         public void refresh() {
 805  
                 // TODO chris - THIS METHOD NEEDS JAVADOCS
 806  
                 
 807  0
         }
 808  
 
 809  
         /**
 810  
          * This overridden method ...
 811  
          * 
 812  
          * @see org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO#getDateCreated()
 813  
          */
 814  
         public java.sql.Timestamp getDateCreated() {
 815  0
                 return this.dateCreated;
 816  
         }
 817  
 
 818  
         /**
 819  
          * @param dateCreated the dateCreated to set
 820  
          */
 821  
         public void setDateCreated(java.sql.Timestamp dateCreated) {
 822  0
                 this.dateCreated = dateCreated;
 823  0
         }
 824  
 
 825  
         /**
 826  
          * @return the onlyDocTypeFilled
 827  
          */
 828  
         public boolean isOnlyDocTypeFilled() {
 829  0
                 return this.onlyDocTypeFilled;
 830  
         }
 831  
 
 832  
         /**
 833  
          * @param onlyDocTypeFilled the onlyDocTypeFilled to set
 834  
          */
 835  
         public void setOnlyDocTypeFilled(boolean onlyDocTypeFilled) {
 836  0
                 this.onlyDocTypeFilled = onlyDocTypeFilled;
 837  0
         }
 838  
 
 839  
         /**
 840  
          * @return the workgroupViewerId
 841  
          */
 842  
         public String getWorkgroupViewerId() {
 843  0
                 return this.workgroupViewerId;
 844  
         }
 845  
 
 846  
         /**
 847  
          * @param workgroupViewerId the workgroupViewerId to set
 848  
          */
 849  
         public void setWorkgroupViewerId(String workgroupViewerId) {
 850  0
                 this.workgroupViewerId = workgroupViewerId;
 851  0
         }
 852  
 
 853  
 
 854  
 }