Coverage Report - org.kuali.rice.kns.web.struts.form.LookupForm
 
Classes in this File Line Coverage Branch Coverage Complexity
LookupForm
0%
0/239
0%
0/86
1.734
 
 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.kns.web.struts.form;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.kns.lookup.LookupUtils;
 20  
 import org.kuali.rice.kns.lookup.Lookupable;
 21  
 import org.kuali.rice.kns.service.KNSServiceLocator;
 22  
 import org.kuali.rice.kns.web.ui.Field;
 23  
 import org.kuali.rice.kns.web.ui.Row;
 24  
 import org.kuali.rice.krad.service.DataDictionaryService;
 25  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 26  
 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
 27  
 import org.kuali.rice.krad.util.ExternalizableBusinessObjectUtils;
 28  
 import org.kuali.rice.krad.util.KRADConstants;
 29  
 
 30  
 import javax.servlet.http.HttpServletRequest;
 31  
 import java.util.HashMap;
 32  
 import java.util.Iterator;
 33  
 import java.util.List;
 34  
 import java.util.Map;
 35  
 
 36  
 /**
 37  
  * This class is the action form for all lookups.
 38  
  */
 39  0
 public class LookupForm extends KualiForm {
 40  
     private static final long serialVersionUID = 1L;
 41  
 
 42  0
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LookupForm.class);
 43  
 
 44  
     private String formKey;
 45  
     private Map<String, String> fields;
 46  
     private Map fieldsForLookup;
 47  
     private String lookupableImplServiceName;
 48  
     private String conversionFields;
 49  
     private Map fieldConversions;
 50  
     private String businessObjectClassName;
 51  
     private Lookupable lookupable;
 52  0
     private boolean hideReturnLink = false;
 53  0
     private boolean suppressActions = false;
 54  0
     private boolean multipleValues = false;
 55  
     private String lookupAnchor;
 56  
     private String readOnlyFields;
 57  
     private List readOnlyFieldsList;
 58  
     private String referencesToRefresh;
 59  
     private boolean searchUsingOnlyPrimaryKeyValues;
 60  
     private String primaryKeyFieldLabels;
 61  0
     private boolean showMaintenanceLinks = false;
 62  
     private String docNum;
 63  
     private String htmlDataType;
 64  
     private String lookupObjectId;
 65  0
         private boolean lookupCriteriaEnabled = true;
 66  0
     private boolean supplementalActionsEnabled = false;
 67  0
     private boolean actionUrlsExist = false;
 68  0
     private boolean ddExtraButton = false;
 69  0
         private boolean headerBarEnabled = true;
 70  0
         private boolean disableSearchButtons = false;
 71  
     
 72  
     /**
 73  
      * @see KualiForm#addRequiredNonEditableProperties()
 74  
      */
 75  
     public void addRequiredNonEditableProperties(){
 76  0
             super.addRequiredNonEditableProperties();
 77  0
             registerRequiredNonEditableProperty(KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME);
 78  0
             registerRequiredNonEditableProperty(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE);
 79  0
             registerRequiredNonEditableProperty(KRADConstants.DISPATCH_REQUEST_PARAMETER);
 80  0
             registerRequiredNonEditableProperty(KRADConstants.DOC_FORM_KEY);
 81  0
             registerRequiredNonEditableProperty(KRADConstants.REFRESH_CALLER);
 82  0
             registerRequiredNonEditableProperty(KRADConstants.DOC_NUM);
 83  0
             registerRequiredNonEditableProperty(KRADConstants.REFERENCES_TO_REFRESH);
 84  0
             registerRequiredNonEditableProperty(KRADConstants.FORM_KEY);
 85  0
             registerRequiredNonEditableProperty(KRADConstants.CONVERSION_FIELDS_PARAMETER);
 86  0
             registerRequiredNonEditableProperty(KRADConstants.FIELDS_CONVERSION_PARAMETER);
 87  0
             registerRequiredNonEditableProperty(KRADConstants.HIDE_LOOKUP_RETURN_LINK);
 88  0
             registerRequiredNonEditableProperty(KRADConstants.MULTIPLE_VALUE);
 89  0
             registerRequiredNonEditableProperty(KRADConstants.BACK_LOCATION);
 90  0
             registerRequiredNonEditableProperty(KRADConstants.LOOKUP_ANCHOR);
 91  0
             registerRequiredNonEditableProperty("searchUsingOnlyPrimaryKeyValues");
 92  0
             registerRequiredNonEditableProperty(KRADConstants.MULTIPLE_VALUE_LOOKUP_PREVIOUSLY_SELECTED_OBJ_IDS_PARAM);
 93  0
             registerRequiredNonEditableProperty(KRADConstants.TableRenderConstants.VIEWED_PAGE_NUMBER);
 94  0
     }
 95  
     
 96  
     /**
 97  
          * @return the htmlDataType
 98  
          */
 99  
         public String getHtmlDataType() {
 100  0
                 return this.htmlDataType;
 101  
         }
 102  
 
 103  
         /**
 104  
          * @param htmlDataType the htmlDataType to set
 105  
          */
 106  
         public void setHtmlDataType(String htmlDataType) {
 107  0
                 this.htmlDataType = htmlDataType;
 108  0
         }
 109  
 
 110  
         /**
 111  
          * @return the docNum
 112  
          */
 113  
         public String getDocNum() {
 114  0
                 return this.docNum;
 115  
         }
 116  
 
 117  
         /**
 118  
          * @param docNum the docNum to set
 119  
          */
 120  
         public void setDocNum(String docNum) {
 121  0
                 this.docNum = docNum;
 122  0
         }
 123  
 
 124  
         /**
 125  
      * Whether the results contain at least one row that is returnable.
 126  
      */
 127  
     private boolean hasReturnableRow;
 128  
     
 129  
     
 130  
     // used for internal purposes in populate
 131  
     private Map requestParameters;
 132  
     
 133  
     /**
 134  
      * Stores the incoming request parameters so that they can be passed to the Lookupable implementation.
 135  
      */
 136  
     @Override
 137  
     public void postprocessRequestParameters(Map requestParameters) {
 138  0
         this.requestParameters = requestParameters;
 139  0
         super.postprocessRequestParameters(requestParameters);
 140  0
     }
 141  
 
 142  
     /**
 143  
      * Picks out business object name from the request to get retrieve a lookupable and set properties.
 144  
      */
 145  
     public void populate(HttpServletRequest request) {
 146  0
         super.populate(request);
 147  
 
 148  0
         DataDictionaryService ddService = KRADServiceLocatorWeb.getDataDictionaryService();
 149  
 
 150  
         try {
 151  0
             Lookupable localLookupable = null;
 152  0
             if (StringUtils.isBlank(getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME)) && StringUtils.isBlank(getLookupableImplServiceName())) {
 153  
                 // get the business object class for the lookup
 154  0
                 String localBusinessObjectClassName = getParameter(request, KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE);
 155  0
                 if ( ExternalizableBusinessObjectUtils.isExternalizableBusinessObjectInterface(localBusinessObjectClassName) ) {
 156  0
                         Class localBusinessObjectClass = Class.forName(localBusinessObjectClassName);
 157  0
                         localBusinessObjectClassName = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(localBusinessObjectClass).getExternalizableBusinessObjectImplementation(localBusinessObjectClass).getName();
 158  
                 }
 159  0
                 setBusinessObjectClassName(localBusinessObjectClassName);
 160  0
                 if (StringUtils.isBlank(localBusinessObjectClassName)) {
 161  0
                     LOG.error("Business object class not passed to lookup.");
 162  0
                     throw new RuntimeException("Business object class not passed to lookup.");
 163  
                 }
 164  
 
 165  
                 // call data dictionary service to get lookup impl for bo class
 166  0
                 String lookupImplID = KRADServiceLocatorWeb.getBusinessObjectDictionaryService().getLookupableID(Class.forName(localBusinessObjectClassName));
 167  0
                 if (lookupImplID == null) {
 168  0
                     lookupImplID = "kualiLookupable";
 169  
                 }
 170  
 
 171  0
                 setLookupableImplServiceName(lookupImplID);
 172  
             }
 173  0
             localLookupable = KNSServiceLocator.getLookupable(getLookupableImplServiceName());
 174  
 
 175  0
             if (localLookupable == null) {
 176  0
                 LOG.error("Lookup impl not found for lookup impl name " + getLookupableImplServiceName());
 177  0
                 throw new RuntimeException("Lookup impl not found for lookup impl name " + getLookupableImplServiceName());
 178  
             }
 179  
 
 180  
                         // set parameters on lookupable
 181  0
             localLookupable.setParameters(requestParameters);
 182  0
             requestParameters = null;
 183  
             
 184  0
             if (getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME) != null) {
 185  0
                 setLookupableImplServiceName(getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME));
 186  
             }
 187  
 
 188  0
             if (getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME) != null) {
 189  0
                 setLookupableImplServiceName(getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME));
 190  
             }
 191  
 
 192  
             // check the doc form key is empty before setting so we don't override a restored lookup form
 193  0
             if (request.getAttribute(KRADConstants.DOC_FORM_KEY) != null && StringUtils.isBlank(this.getFormKey())) {
 194  0
                 setFormKey((String) request.getAttribute(KRADConstants.DOC_FORM_KEY));
 195  
             }
 196  0
             else if (getParameter(request, KRADConstants.DOC_FORM_KEY) != null && StringUtils.isBlank(this.getFormKey())) {
 197  0
                 setFormKey(getParameter(request, KRADConstants.DOC_FORM_KEY));
 198  
             }
 199  
             
 200  0
             if (getParameter(request, KRADConstants.DOC_NUM) != null) {
 201  0
                 setDocNum(getParameter(request, KRADConstants.DOC_NUM));
 202  
            }
 203  
 
 204  0
             String returnLocation = getParameter(request, "returnLocation");
 205  0
             if (StringUtils.isNotBlank(returnLocation)) {
 206  0
                 setBackLocation(returnLocation);
 207  0
                 localLookupable.getLookupableHelperService().setBackLocation(returnLocation);
 208  
             }
 209  
 
 210  0
             if (getParameter(request, "conversionFields") != null) {
 211  0
                 setConversionFields(getParameter(request, "conversionFields"));
 212  
             }
 213  0
             if (getParameter(request, KRADConstants.EXTRA_BUTTON_SOURCE) != null) {
 214  
                     //these are not sourced from the DD/Lookupable
 215  0
                     ddExtraButton=false;
 216  0
                 setExtraButtonSource(getParameter(request, KRADConstants.EXTRA_BUTTON_SOURCE));
 217  
             }
 218  0
             if (getParameter(request, KRADConstants.EXTRA_BUTTON_PARAMS) != null) {
 219  0
                 setExtraButtonParams(getParameter(request, KRADConstants.EXTRA_BUTTON_PARAMS));
 220  
             }
 221  0
             String value = getParameter(request, "multipleValues");
 222  0
             if (value != null) {
 223  0
                 if ("YES".equals(value.toUpperCase())) {
 224  0
                     setMultipleValues(true);
 225  
                 }
 226  
                 else {
 227  0
                     setMultipleValues(new Boolean(getParameter(request, "multipleValues")).booleanValue());
 228  
                 }
 229  
             }
 230  0
             if (getParameter(request, KRADConstants.REFERENCES_TO_REFRESH) != null) {
 231  0
                 setReferencesToRefresh(getParameter(request, KRADConstants.REFERENCES_TO_REFRESH));
 232  
             }
 233  
 
 234  0
             if (getParameter(request, "readOnlyFields") != null) {
 235  0
                 setReadOnlyFields(getParameter(request, "readOnlyFields"));
 236  0
                 setReadOnlyFieldsList(LookupUtils.translateReadOnlyFieldsToList(this.readOnlyFields));
 237  0
                 localLookupable.setReadOnlyFieldsList(getReadOnlyFieldsList());
 238  
             }
 239  
 
 240  
             // init lookupable with bo class
 241  0
             localLookupable.setBusinessObjectClass(Class.forName(getBusinessObjectClassName()));
 242  0
             Map<String, String> fieldValues = new HashMap<String, String>();
 243  0
             Map<String, String> formFields = getFields();
 244  0
             Class boClass = Class.forName(getBusinessObjectClassName());
 245  
 
 246  0
             for (Iterator iter = localLookupable.getRows().iterator(); iter.hasNext();) {
 247  0
                 Row row = (Row) iter.next();
 248  
 
 249  0
                 for (Iterator iterator = row.getFields().iterator(); iterator.hasNext();) {
 250  0
                     Field field = (Field) iterator.next();
 251  
 
 252  
                     // check whether form already has value for field
 253  0
                     if (formFields != null && formFields.containsKey(field.getPropertyName())) {
 254  0
                         field.setPropertyValue(formFields.get(field.getPropertyName()));
 255  
                     }
 256  
 
 257  
                     // override values with request
 258  0
                     if (getParameter(request, field.getPropertyName()) != null) {
 259  0
                             if(!Field.MULTI_VALUE_FIELD_TYPES.contains(field.getFieldType())) {
 260  0
                                     field.setPropertyValue(getParameter(request, field.getPropertyName()).trim());
 261  
                             } else {
 262  
                                     //multi value, set to values
 263  0
                                     field.setPropertyValues(getParameterValues(request, field.getPropertyName()));
 264  
                             }
 265  
                     }
 266  
 
 267  0
                             field.setPropertyValue(org.kuali.rice.krad.lookup.LookupUtils
 268  
                             .forceUppercase(boClass, field.getPropertyName(), field.getPropertyValue()));
 269  0
                         fieldValues.put(field.getPropertyName(), field.getPropertyValue());
 270  
                         //LOG.info("field name/value added was: " + field.getPropertyName() + field.getPropertyValue());
 271  0
                         localLookupable.applyFieldAuthorizationsFromNestedLookups(field);
 272  0
                 }
 273  0
             }
 274  
 
 275  0
             if (localLookupable.checkForAdditionalFields(fieldValues)) {
 276  0
                 for (Iterator iter = localLookupable.getRows().iterator(); iter.hasNext();) {
 277  0
                     Row row = (Row) iter.next();
 278  
 
 279  0
                     for (Iterator iterator = row.getFields().iterator(); iterator.hasNext();) {
 280  0
                         Field field = (Field) iterator.next();
 281  
 
 282  
                         // check whether form already has value for field
 283  0
                         if (formFields != null && formFields.containsKey(field.getPropertyName())) {
 284  0
                             field.setPropertyValue(formFields.get(field.getPropertyName()));
 285  
                         }
 286  
 
 287  
                         // override values with request
 288  0
                         if (getParameter(request, field.getPropertyName()) != null) {
 289  0
                                 if(!Field.MULTI_VALUE_FIELD_TYPES.contains(field.getFieldType())) {
 290  0
                                         field.setPropertyValue(getParameter(request, field.getPropertyName()).trim());
 291  
                                 } else {
 292  
                                         //multi value, set to values
 293  0
                                         field.setPropertyValues(getParameterValues(request, field.getPropertyName()));
 294  
                                 }
 295  
                         }
 296  0
                         fieldValues.put(field.getPropertyName(), field.getPropertyValue());
 297  0
                     }
 298  0
                 }
 299  
                
 300  
             }
 301  0
             fieldValues.put(KRADConstants.DOC_FORM_KEY, this.getFormKey());
 302  0
             fieldValues.put(KRADConstants.BACK_LOCATION, this.getBackLocation());
 303  0
             if(this.getDocNum() != null){
 304  0
                     fieldValues.put(KRADConstants.DOC_NUM, this.getDocNum());
 305  
             }
 306  0
             if (StringUtils.isNotBlank(getReferencesToRefresh())) {
 307  0
                 fieldValues.put(KRADConstants.REFERENCES_TO_REFRESH, this.getReferencesToRefresh());
 308  
             }
 309  
 
 310  0
             this.setFields(fieldValues);
 311  
 
 312  0
             setFieldConversions(LookupUtils.translateFieldConversions(this.conversionFields));
 313  0
             localLookupable.setFieldConversions(getFieldConversions());
 314  0
             if(StringUtils.isNotEmpty(localLookupable.getExtraButtonSource())) {
 315  0
                     setExtraButtonSource(localLookupable.getExtraButtonSource());
 316  
                     //also set the boolean so the jsp can use an action button
 317  0
                     ddExtraButton=true;
 318  
             }
 319  0
             if(StringUtils.isNotEmpty(localLookupable.getExtraButtonParams())) {
 320  0
                     setExtraButtonParams(localLookupable.getExtraButtonParams());
 321  
             }
 322  0
             setLookupable(localLookupable);
 323  0
             setFieldsForLookup(fieldValues);
 324  
 
 325  
             // if showMaintenanceLinks is not already true, only show maintenance links if the lookup was called from the portal (or index.html for the generated applications)
 326  0
             if (!isShowMaintenanceLinks()) {
 327  0
                     if (StringUtils.contains(getBackLocation(), "/"+ KRADConstants.PORTAL_ACTION)
 328  
                                     || StringUtils.contains(getBackLocation(), "/index.html")) {
 329  0
                             showMaintenanceLinks = true;
 330  
                     }
 331  
             }
 332  
         }
 333  0
         catch (ClassNotFoundException e) {
 334  0
             LOG.error("Business Object class " + getBusinessObjectClassName() + " not found");
 335  0
             throw new RuntimeException("Business Object class " + getBusinessObjectClassName() + " not found", e);
 336  0
         }
 337  0
     }
 338  
 
 339  
     /**
 340  
      * @return Returns the lookupableImplServiceName.
 341  
      */
 342  
     public String getLookupableImplServiceName() {
 343  0
         return lookupableImplServiceName;
 344  
     }
 345  
 
 346  
     /**
 347  
      * @param lookupableImplServiceName The lookupableImplServiceName to set.
 348  
      */
 349  
     public void setLookupableImplServiceName(String lookupableImplServiceName) {
 350  0
         this.lookupableImplServiceName = lookupableImplServiceName;
 351  0
     }
 352  
 
 353  
     /**
 354  
      * @return Returns the formKey.
 355  
      */
 356  
     public String getFormKey() {
 357  0
         return formKey;
 358  
     }
 359  
 
 360  
     /**
 361  
      * @param formKey The formKey to set.
 362  
      */
 363  
     public void setFormKey(String formKey) {
 364  0
         this.formKey = formKey;
 365  0
     }
 366  
 
 367  
     /**
 368  
      * @return Returns the fields.
 369  
      */
 370  
     public Map<String, String> getFields() {
 371  0
         return fields;
 372  
     }
 373  
 
 374  
     /**
 375  
      * @param fields The fields to set.
 376  
      */
 377  
     public void setFields(Map<String, String> fields) {
 378  0
         this.fields = fields;
 379  0
     }
 380  
 
 381  
     /**
 382  
      * @return Returns the conversionFields.
 383  
      */
 384  
     public String getConversionFields() {
 385  0
         return conversionFields;
 386  
     }
 387  
 
 388  
     /**
 389  
      * @param conversionFields The conversionFields to set.
 390  
      */
 391  
     public void setConversionFields(String conversionFields) {
 392  0
         this.conversionFields = conversionFields;
 393  0
     }
 394  
 
 395  
     /**
 396  
      * @return Returns the fieldConversions.
 397  
      */
 398  
     public Map getFieldConversions() {
 399  0
         return fieldConversions;
 400  
     }
 401  
 
 402  
     /**
 403  
      * @param fieldConversions The fieldConversions to set.
 404  
      */
 405  
     public void setFieldConversions(Map fieldConversions) {
 406  0
         this.fieldConversions = fieldConversions;
 407  0
     }
 408  
 
 409  
     /**
 410  
      * @return Returns the businessObjectClassName.
 411  
      */
 412  
     public String getBusinessObjectClassName() {
 413  0
         return businessObjectClassName;
 414  
     }
 415  
 
 416  
     /**
 417  
      * @param businessObjectClassName The businessObjectClassName to set.
 418  
      */
 419  
     public void setBusinessObjectClassName(String businessObjectClassName) {
 420  0
         this.businessObjectClassName = businessObjectClassName;
 421  0
     }
 422  
 
 423  
 
 424  
     /**
 425  
      * @return Returns the kualiLookupable.
 426  
      */
 427  
     public Lookupable getLookupable() {
 428  0
         return lookupable;
 429  
     }
 430  
 
 431  
 
 432  
     /**
 433  
      * @param lookupable The kualiLookupable to set.
 434  
      */
 435  
     public void setLookupable(Lookupable lookupable) {
 436  0
         this.lookupable = lookupable;
 437  0
     }
 438  
 
 439  
 
 440  
     /**
 441  
      * @return Returns the hideReturnLink.
 442  
      */
 443  
     public boolean isHideReturnLink() {
 444  0
         return hideReturnLink;
 445  
     }
 446  
 
 447  
     /**
 448  
      * @param suppressActions The suppressActions to set.
 449  
      */
 450  
     public void setSuppressActions(boolean suppressActions) {
 451  0
         this.suppressActions = suppressActions;
 452  0
     }
 453  
 
 454  
     /**
 455  
      * @return Returns the suppressActions.
 456  
      */
 457  
     public boolean isSuppressActions() {
 458  0
         return suppressActions;
 459  
     }
 460  
 
 461  
 
 462  
     /**
 463  
      * @param hideReturnLink The hideReturnLink to set.
 464  
      */
 465  
     public void setHideReturnLink(boolean hideReturnLink) {
 466  0
         this.hideReturnLink = hideReturnLink;
 467  0
     }
 468  
 
 469  
     // TODO: remove these once DD changes have been made
 470  
     public String getExtraButtonParams() {
 471  0
         return extraButtons.get(0).getExtraButtonParams();
 472  
     }
 473  
 
 474  
     // TODO: remove these once DD changes have been made
 475  
     public void setExtraButtonParams(String extraButtonParams) {
 476  0
         extraButtons.get(0).setExtraButtonParams( extraButtonParams );
 477  0
     }
 478  
 
 479  
     // TODO: remove these once DD changes have been made
 480  
     public String getExtraButtonSource() {
 481  0
         return extraButtons.get(0).getExtraButtonSource();
 482  
     }
 483  
 
 484  
     // TODO: remove these once DD changes have been made
 485  
     public void setExtraButtonSource(String extraButtonSource) {
 486  0
         extraButtons.get(0).setExtraButtonSource( extraButtonSource );
 487  0
     }
 488  
 
 489  
 
 490  
     /**
 491  
      *
 492  
      * @return whether this form returns multiple values
 493  
      */
 494  
     public boolean isMultipleValues() {
 495  0
         return multipleValues;
 496  
     }
 497  
 
 498  
     /**
 499  
      *
 500  
      * @param multipleValues - specify whether this form returns multiple values (i.e. a Collection)
 501  
      */
 502  
     public void setMultipleValues(boolean multipleValues) {
 503  0
         this.multipleValues = multipleValues;
 504  0
     }
 505  
 
 506  
     public String getLookupAnchor() {
 507  0
         return lookupAnchor;
 508  
     }
 509  
 
 510  
     public void setLookupAnchor(String lookupAnchor) {
 511  0
         this.lookupAnchor = lookupAnchor;
 512  0
     }
 513  
 
 514  
     /**
 515  
      * Gets the fieldsForLookup attribute.
 516  
      * @return Returns the fieldsForLookup.
 517  
      */
 518  
     public Map getFieldsForLookup() {
 519  0
         return fieldsForLookup;
 520  
     }
 521  
 
 522  
     /**
 523  
      * Sets the fieldsForLookup attribute value.
 524  
      * @param fieldsForLookup The fieldsForLookup to set.
 525  
      */
 526  
     public void setFieldsForLookup(Map fieldsForLookup) {
 527  0
         this.fieldsForLookup = fieldsForLookup;
 528  0
     }
 529  
 
 530  
     /**
 531  
      * Gets the readOnlyFields attribute.
 532  
      * @return Returns the readOnlyFields.
 533  
      */
 534  
     public String getReadOnlyFields() {
 535  0
         return readOnlyFields;
 536  
     }
 537  
 
 538  
     /**
 539  
      * Sets the readOnlyFields attribute value.
 540  
      * @param readOnlyFields The readOnlyFields to set.
 541  
      */
 542  
     public void setReadOnlyFields(String readOnlyFields) {
 543  0
         this.readOnlyFields = readOnlyFields;
 544  0
     }
 545  
 
 546  
     /**
 547  
      * Gets the readOnlyFieldsList attribute.
 548  
      * @return Returns the readOnlyFieldsList.
 549  
      */
 550  
     public List getReadOnlyFieldsList() {
 551  0
         return readOnlyFieldsList;
 552  
     }
 553  
 
 554  
     /**
 555  
      * Sets the readOnlyFieldsList attribute value.
 556  
      * @param readOnlyFieldsList The readOnlyFieldsList to set.
 557  
      */
 558  
     public void setReadOnlyFieldsList(List readOnlyFieldsList) {
 559  0
         this.readOnlyFieldsList = readOnlyFieldsList;
 560  0
     }
 561  
 
 562  
     public String getReferencesToRefresh() {
 563  0
         return referencesToRefresh;
 564  
     }
 565  
 
 566  
     public void setReferencesToRefresh(String referencesToRefresh) {
 567  0
         this.referencesToRefresh = referencesToRefresh;
 568  0
     }
 569  
 
 570  
     public String getPrimaryKeyFieldLabels() {
 571  0
         return primaryKeyFieldLabels;
 572  
     }
 573  
 
 574  
     public void setPrimaryKeyFieldLabels(String primaryKeyFieldLabels) {
 575  0
         this.primaryKeyFieldLabels = primaryKeyFieldLabels;
 576  0
     }
 577  
 
 578  
     public boolean isSearchUsingOnlyPrimaryKeyValues() {
 579  0
         return searchUsingOnlyPrimaryKeyValues;
 580  
     }
 581  
 
 582  
     public void setSearchUsingOnlyPrimaryKeyValues(boolean searchUsingOnlyPrimaryKeyValues) {
 583  0
         this.searchUsingOnlyPrimaryKeyValues = searchUsingOnlyPrimaryKeyValues;
 584  0
     }
 585  
 
 586  
     /**
 587  
      * Gets the showMaintenanceLinks attribute.
 588  
      * @return Returns the showMaintenanceLinks.
 589  
      */
 590  
     public boolean isShowMaintenanceLinks() {
 591  0
         return showMaintenanceLinks;
 592  
     }
 593  
 
 594  
     /**
 595  
      * Sets the showMaintenanceLinks attribute value.
 596  
      * @param showMaintenanceLinks The showMaintenanceLinks to set.
 597  
      */
 598  
     public void setShowMaintenanceLinks(boolean showMaintenanceLinks) {
 599  0
         this.showMaintenanceLinks = showMaintenanceLinks;
 600  0
     }
 601  
 
 602  
     /**
 603  
      * Returns whether the results contain at least one row that is returnable
 604  
      * 
 605  
      * @return
 606  
      */
 607  
     public boolean isHasReturnableRow() {
 608  0
         return this.hasReturnableRow;
 609  
     }
 610  
 
 611  
     /**
 612  
      * Sets whether the results contain at least one row that is returnable
 613  
      * 
 614  
      * @param hasReturnableRow
 615  
      */
 616  
     public void setHasReturnableRow(boolean hasReturnableRow) {
 617  0
         this.hasReturnableRow = hasReturnableRow;
 618  0
     }
 619  
 
 620  
         /**
 621  
          * @return the lookupObjectId
 622  
          */
 623  
         public String getLookupObjectId() {
 624  0
                 return this.lookupObjectId;
 625  
         }
 626  
 
 627  
         /**
 628  
          * @param lookupObjectId the lookupObjectId to set
 629  
          */
 630  
         public void setLookupObjectId(String lookupObjectId) {
 631  0
                 this.lookupObjectId = lookupObjectId;
 632  0
         }
 633  
 
 634  
         /**
 635  
          * @return the lookupCriteriaEnabled
 636  
          */
 637  
         public boolean isLookupCriteriaEnabled() {
 638  0
                 return this.lookupCriteriaEnabled;
 639  
         }
 640  
 
 641  
         /**
 642  
          * @param lookupCriteriaEnabled the lookupCriteriaEnabled to set
 643  
          */
 644  
         public void setLookupCriteriaEnabled(boolean lookupCriteriaEnabled) {
 645  0
                 this.lookupCriteriaEnabled = lookupCriteriaEnabled;
 646  0
         }
 647  
 
 648  
         /**
 649  
          * @return the supplementalActionsEnabled
 650  
          */
 651  
         public boolean isSupplementalActionsEnabled() {
 652  0
                 return this.supplementalActionsEnabled;
 653  
         }
 654  
 
 655  
         /**
 656  
          * @param supplementalActionsEnabled the supplementalActionsEnabled to set
 657  
          */
 658  
         public void setSupplementalActionsEnabled(boolean supplementalActionsEnabled) {
 659  0
                 this.supplementalActionsEnabled = supplementalActionsEnabled;
 660  0
         }
 661  
 
 662  
 
 663  
         /**
 664  
          * @param actionUrlsExist the actionUrlsExist to set
 665  
          */
 666  
         public void setActionUrlsExist(boolean actionUrlsExist) {
 667  0
                 this.actionUrlsExist = actionUrlsExist;
 668  0
         }
 669  
 
 670  
         /**
 671  
          * @return the actionUrlsExist
 672  
          */
 673  
         public boolean isActionUrlsExist() {
 674  0
                 return actionUrlsExist;
 675  
         }
 676  
 
 677  
         /**
 678  
          * @return the ddExtraButton
 679  
          */
 680  
         public boolean isDdExtraButton() {
 681  0
                 return this.ddExtraButton;
 682  
         }
 683  
 
 684  
         /**
 685  
          * @param ddExtraButton the ddExtraButton to set
 686  
          */
 687  
         public void setDdExtraButton(boolean ddExtraButton) {
 688  0
                 this.ddExtraButton = ddExtraButton;
 689  0
         }
 690  
 
 691  
         public boolean isHeaderBarEnabled() {
 692  0
                 return headerBarEnabled;
 693  
         }
 694  
 
 695  
         public void setHeaderBarEnabled(boolean headerBarEnabled) {
 696  0
                 this.headerBarEnabled = headerBarEnabled;
 697  0
         }        
 698  
 
 699  
         public boolean isDisableSearchButtons() {
 700  0
                 return this.disableSearchButtons;
 701  
         }
 702  
 
 703  
         public void setDisableSearchButtons(boolean disableSearchButtons) {
 704  0
                 this.disableSearchButtons = disableSearchButtons;
 705  0
         }
 706  
         
 707  
         /**
 708  
          * Determines whether the search/clear buttons should be rendering based on the form property
 709  
          * and what is configured in the data dictionary for the lookup
 710  
          * 
 711  
          * @return boolean true if the buttons should be rendered, false if they should not be
 712  
          */
 713  
         public boolean getRenderSearchButtons() {
 714  0
                 boolean renderSearchButtons = true;
 715  
 
 716  0
                 if (disableSearchButtons
 717  
                                 || KRADServiceLocatorWeb.getBusinessObjectDictionaryService().disableSearchButtonsInLookup(
 718  
                                                 getLookupable().getBusinessObjectClass())) {
 719  0
                         renderSearchButtons = false;
 720  
                 }
 721  
 
 722  0
                 return renderSearchButtons;
 723  
         }
 724  
 }