Coverage Report - org.kuali.rice.kew.docsearch.DocSearchDTO
 
Classes in this File Line Coverage Branch Coverage Complexity
DocSearchDTO
0%
0/79
0%
0/16
1.273
 
 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 java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.List;
 22  
 
 23  
 import org.apache.commons.lang.StringUtils;
 24  
 import org.kuali.rice.kew.util.KEWConstants;
 25  
 import org.kuali.rice.kew.web.KeyValueSort;
 26  
 import org.kuali.rice.kew.web.RowStyleable;
 27  
 
 28  
 
 29  
 /**
 30  
  * Bean that representing a row displayed in a document search.
 31  
  *
 32  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 33  
  */
 34  
 public class DocSearchDTO implements Serializable, RowStyleable {
 35  
 
 36  
         private static final long serialVersionUID = 7850758046316186962L;
 37  
         private static final String URL_SUFFIX = "?" + KEWConstants.COMMAND_PARAMETER + "=" + KEWConstants.DOCSEARCH_COMMAND + "&" + KEWConstants.DOCUMENT_ID_PARAMETER + "=";
 38  
 
 39  
         private String documentId;
 40  
         private String docRouteStatusCode;
 41  
         private java.sql.Timestamp dateCreated;
 42  
         private String documentTitle;
 43  
         private String activeIndicatorCode;
 44  
         private String docTypeName;
 45  
         private String docTypeLabel;
 46  
         private String initiatorNetworkId;
 47  
         private String initiatorWorkflowId;
 48  
         private String initiatorName;
 49  
         private String initiatorEmailAddress;
 50  
         private String initiatorLastName;
 51  
         private String initiatorFirstName;
 52  
     private String initiatorTransposedName;
 53  
         private String docTypeHandlerUrl;
 54  
         private String rowStyleClass;
 55  
         private String superUserSearch;
 56  
         private String appDocStatus;
 57  
 
 58  0
         private List<KeyValueSort> searchableAttributes = new ArrayList<KeyValueSort>();
 59  
 
 60  0
         public DocSearchDTO() {
 61  0
         }
 62  
 
 63  
         public String getSuperUserSearch() {
 64  0
         return superUserSearch;
 65  
     }
 66  
     public void setSuperUserSearch(String superUserSearch) {
 67  0
         this.superUserSearch = superUserSearch;
 68  0
     }
 69  
         public String getDocRouteStatusCode() {
 70  0
                 return docRouteStatusCode;
 71  
         }
 72  
 
 73  
         public String getDocumentTitle() {
 74  0
                 return documentTitle;
 75  
         }
 76  
 
 77  
         public String getDocumentId() {
 78  0
                 return documentId;
 79  
         }
 80  
 
 81  
         public void setDocRouteStatusCode(String docRouteStatusCode) {
 82  0
                 this.docRouteStatusCode = docRouteStatusCode;
 83  0
         }
 84  
 
 85  
         public void setDocumentTitle(String documentTitle) {
 86  0
                 this.documentTitle = documentTitle;
 87  0
         }
 88  
 
 89  
         public void setDocumentId(String documentId) {
 90  0
                 this.documentId = documentId;
 91  0
         }
 92  
 
 93  
         public String getActiveIndicatorCode() {
 94  0
                 return activeIndicatorCode;
 95  
         }
 96  
 
 97  
         public String getDocTypeName() {
 98  0
     return docTypeName;
 99  
   }
 100  
 
 101  
   public void setDocTypeName(String docTypeName) {
 102  0
     this.docTypeName = docTypeName;
 103  0
   }
 104  
 
 105  
   public String getDocTypeLabel() {
 106  0
                 return docTypeLabel;
 107  
         }
 108  
 
 109  
         public String getDocTypeHandlerUrl() {
 110  0
                 return docTypeHandlerUrl;
 111  
         }
 112  
 
 113  
         public String getInitiatorWorkflowId() {
 114  0
                 return initiatorWorkflowId;
 115  
         }
 116  
 
 117  
         public String getInitiatorEmailAddress() {
 118  0
                 return initiatorEmailAddress;
 119  
         }
 120  
 
 121  
         public String getInitiatorName() {
 122  0
                 return initiatorName;
 123  
         }
 124  
 
 125  
         public void setActiveIndicatorCode(String activeIndicatorCode) {
 126  0
                 this.activeIndicatorCode = activeIndicatorCode;
 127  0
         }
 128  
 
 129  
         public void setDocTypeLabel(String docTypeLabel) {
 130  0
                 this.docTypeLabel = docTypeLabel;
 131  0
         }
 132  
 
 133  
         public void setDocTypeHandlerUrl(String docTypeHandlerUrl) {
 134  0
                 this.docTypeHandlerUrl = docTypeHandlerUrl;
 135  0
         }
 136  
 
 137  
         public void setInitiatorWorkflowId(String initiatorEmplId) {
 138  0
                 this.initiatorWorkflowId = initiatorEmplId;
 139  0
         }
 140  
 
 141  
         public void setInitiatorEmailAddress(String initiatorEmailAddress) {
 142  0
                 this.initiatorEmailAddress = initiatorEmailAddress;
 143  0
         }
 144  
 
 145  
         public void setInitiatorName(String initiatorName) {
 146  0
                 this.initiatorName = initiatorName;
 147  0
         }
 148  
 
 149  
         public java.sql.Timestamp getDateCreated() {
 150  0
                 return dateCreated;
 151  
         }
 152  
 
 153  
         public void setDateCreated(java.sql.Timestamp dateCreated) {
 154  0
                 this.dateCreated = dateCreated;
 155  0
         }
 156  
 
 157  
         public String getInitiatorNetworkId() {
 158  0
                 return initiatorNetworkId;
 159  
         }
 160  
 
 161  
         public void setInitiatorNetworkId(String string) {
 162  0
                 initiatorNetworkId = string;
 163  0
         }
 164  
 
 165  
         public String getInitiatorFirstName() {
 166  0
                 return initiatorFirstName;
 167  
         }
 168  
 
 169  
         public String getInitiatorLastName() {
 170  0
                 return initiatorLastName;
 171  
         }
 172  
 
 173  
         public void setInitiatorFirstName(String initiatorFirstName) {
 174  0
                 this.initiatorFirstName = initiatorFirstName;
 175  0
         }
 176  
 
 177  
         public void setInitiatorLastName(String initiatorLastName) {
 178  0
                 this.initiatorLastName = initiatorLastName;
 179  0
         }
 180  
 
 181  
         public String getAppDocStatus() {
 182  0
                 return this.appDocStatus;
 183  
         }
 184  
 
 185  
         public void setAppDocStatus(String appDocStatus) {
 186  0
                 this.appDocStatus = appDocStatus;
 187  0
         }
 188  
 
 189  
     public String getDocRouteStatusCodeDesc() {
 190  0
         if (this.docRouteStatusCode == null || org.kuali.rice.kew.util.CodeTranslator.getRouteStatusLabel(docRouteStatusCode) == null || "".equalsIgnoreCase(org.kuali.rice.kew.util.CodeTranslator.getRouteStatusLabel(docRouteStatusCode))) {
 191  0
             return KEWConstants.UNKNOWN_STATUS;
 192  
         } else {
 193  0
             return org.kuali.rice.kew.util.CodeTranslator.getRouteStatusLabel(docRouteStatusCode);
 194  
         }
 195  
     }
 196  
 
 197  
     public String getDocHandlerUrl() {
 198  0
         if (StringUtils.isBlank(getDocTypeHandlerUrl())) {
 199  0
             return "";
 200  
         } else {
 201  0
             if (isUsingSuperUserSearch()) {
 202  0
                 return "SuperUser.do?command=displayFrame&documentId=" + this.getDocumentId();
 203  
             } else {
 204  0
                 return this.getDocTypeHandlerUrl() + URL_SUFFIX + this.getDocumentId();
 205  
             }
 206  
         }
 207  
     }
 208  
 
 209  
     public boolean isUsingSuperUserSearch() {
 210  0
             return DocSearchCriteriaDTO.SUPER_USER_SEARCH_INDICATOR_STRING.equalsIgnoreCase(superUserSearch);
 211  
     }
 212  
 
 213  
     public String getRowStyleClass() {
 214  0
         return rowStyleClass;
 215  
     }
 216  
 
 217  
     public void setRowStyleClass(String rowStyleClass) {
 218  0
         this.rowStyleClass = rowStyleClass;
 219  0
     }
 220  
 
 221  
     public String getInitiatorTransposedName() {
 222  0
         return initiatorTransposedName;
 223  
     }
 224  
 
 225  
     public void setInitiatorTransposedName(String initiatorTransposedName) {
 226  0
         this.initiatorTransposedName = initiatorTransposedName;
 227  0
     }
 228  
 
 229  
     /**
 230  
      * Method for the JSP to use to pull in searchable attributes by name
 231  
      * instead of by index location which is unreliable
 232  
      *
 233  
      * @param key Key of KeyValueSort trying to be retrieved
 234  
      * @return  the matching KeyValueSort in list of searchable attributes or an empty KeyValueSort
 235  
      */
 236  
     public KeyValueSort getSearchableAttribute(String key) {
 237  0
             KeyValueSort returnPair = new KeyValueSort("","","",null);
 238  0
             if (key == null) {
 239  0
                     return returnPair;
 240  
             }
 241  0
         for (KeyValueSort searchableAttribute : searchableAttributes)
 242  
         {
 243  0
             if (key.equals(searchableAttribute.getKey()))
 244  
             {
 245  0
                 returnPair = searchableAttribute;
 246  0
                 break;
 247  
             }
 248  
         }
 249  0
             return returnPair;
 250  
     }
 251  
 
 252  
     public void addSearchableAttribute(KeyValueSort searchableAttribute) {
 253  0
             searchableAttributes.add(searchableAttribute);
 254  0
     }
 255  
         /**
 256  
          * @param searchableAttributes The searchableAttributes to set.
 257  
          */
 258  
         public void setSearchableAttributes(List<KeyValueSort> searchableAttributes) {
 259  0
                 this.searchableAttributes = searchableAttributes;
 260  0
         }
 261  
         /**
 262  
          * @return Returns the searchableAttributes.
 263  
          */
 264  
         public List<KeyValueSort> getSearchableAttributes() {
 265  0
                 return searchableAttributes;
 266  
         }
 267  
 }