001/** 002 * Copyright 2005-2018 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kns.web.struts.form; 017 018import org.apache.commons.lang.ArrayUtils; 019import org.apache.commons.lang.StringUtils; 020import org.kuali.rice.core.api.util.Truth; 021import org.kuali.rice.kns.lookup.LookupUtils; 022import org.kuali.rice.kns.lookup.Lookupable; 023import org.kuali.rice.kns.service.KNSServiceLocator; 024import org.kuali.rice.kns.web.ui.Field; 025import org.kuali.rice.kns.web.ui.Row; 026import org.kuali.rice.krad.bo.BusinessObject; 027import org.kuali.rice.krad.service.DataDictionaryService; 028import org.kuali.rice.krad.service.KRADServiceLocatorWeb; 029import org.kuali.rice.krad.util.ExternalizableBusinessObjectUtils; 030import org.kuali.rice.krad.util.KRADConstants; 031 032import javax.servlet.http.HttpServletRequest; 033import java.util.HashMap; 034import java.util.Iterator; 035import java.util.List; 036import java.util.Map; 037import java.util.TreeMap; 038 039/** 040 * This class is the action form for all lookups. 041 * 042 * @deprecated Use {@link org.kuali.rice.krad.lookup.LookupForm}. 043 */ 044@Deprecated 045public class LookupForm extends KualiForm { 046 private static final long serialVersionUID = 1L; 047 048 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LookupForm.class); 049 protected static final String HEADER_BAR_ENABLED_PARAM = "headerBarEnabled"; 050 protected static final String SEARCH_CRITERIA_ENABLED_PARAM = "searchCriteriaEnabled"; 051 052 private String formKey; 053 private Map<String, String> fields; 054 private Map<String, String> fieldsForLookup; 055 private String lookupableImplServiceName; 056 private String conversionFields; 057 private Map<String, String> fieldConversions; 058 private String businessObjectClassName; 059 private Lookupable lookupable; 060 private boolean hideReturnLink = false; 061 private boolean suppressActions = false; 062 private boolean multipleValues = false; 063 private String lookupAnchor; 064 private String readOnlyFields; 065 private List readOnlyFieldsList; 066 private String referencesToRefresh; 067 private boolean searchUsingOnlyPrimaryKeyValues; 068 private String primaryKeyFieldLabels; 069 private boolean showMaintenanceLinks = false; 070 private String docNum; 071 private String htmlDataType; 072 private String lookupObjectId; 073 private boolean lookupCriteriaEnabled = true; 074 private boolean supplementalActionsEnabled = false; 075 private boolean actionUrlsExist = false; 076 private boolean ddExtraButton = false; 077 private boolean headerBarEnabled = true; 078 private boolean disableSearchButtons = false; 079 private String isAdvancedSearch; 080 081 /** 082 * @see KualiForm#addRequiredNonEditableProperties() 083 */ 084 public void addRequiredNonEditableProperties(){ 085 super.addRequiredNonEditableProperties(); 086 registerRequiredNonEditableProperty(KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME); 087 registerRequiredNonEditableProperty(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE); 088 registerRequiredNonEditableProperty(KRADConstants.DISPATCH_REQUEST_PARAMETER); 089 registerRequiredNonEditableProperty(KRADConstants.DOC_FORM_KEY); 090 registerRequiredNonEditableProperty(KRADConstants.REFRESH_CALLER); 091 registerRequiredNonEditableProperty(KRADConstants.DOC_NUM); 092 registerRequiredNonEditableProperty(KRADConstants.REFERENCES_TO_REFRESH); 093 registerRequiredNonEditableProperty(KRADConstants.FORM_KEY); 094 registerRequiredNonEditableProperty(KRADConstants.CONVERSION_FIELDS_PARAMETER); 095 registerRequiredNonEditableProperty(KRADConstants.FIELDS_CONVERSION_PARAMETER); 096 registerRequiredNonEditableProperty(KRADConstants.HIDE_LOOKUP_RETURN_LINK); 097 registerRequiredNonEditableProperty(KRADConstants.MULTIPLE_VALUE); 098 registerRequiredNonEditableProperty(KRADConstants.BACK_LOCATION); 099 registerRequiredNonEditableProperty(KRADConstants.LOOKUP_ANCHOR); 100 registerRequiredNonEditableProperty("searchUsingOnlyPrimaryKeyValues"); 101 registerRequiredNonEditableProperty(KRADConstants.MULTIPLE_VALUE_LOOKUP_PREVIOUSLY_SELECTED_OBJ_IDS_PARAM); 102 registerRequiredNonEditableProperty(KRADConstants.TableRenderConstants.VIEWED_PAGE_NUMBER); 103 } 104 105 /** 106 * @return the htmlDataType 107 */ 108 public String getHtmlDataType() { 109 return this.htmlDataType; 110 } 111 112 /** 113 * @param htmlDataType the htmlDataType to set 114 */ 115 public void setHtmlDataType(String htmlDataType) { 116 this.htmlDataType = htmlDataType; 117 } 118 119 /** 120 * @return the docNum 121 */ 122 public String getDocNum() { 123 return this.docNum; 124 } 125 126 /** 127 * @param docNum the docNum to set 128 */ 129 public void setDocNum(String docNum) { 130 this.docNum = docNum; 131 } 132 133 /** 134 * Whether the results contain at least one row that is returnable. 135 */ 136 private boolean hasReturnableRow; 137 138 139 // used for internal purposes in populate 140 private Map requestParameters; 141 142 /** 143 * Stores the incoming request parameters so that they can be passed to the Lookupable implementation. 144 */ 145 @Override 146 public void postprocessRequestParameters(Map requestParameters) { 147 this.requestParameters = requestParameters; 148 super.postprocessRequestParameters(requestParameters); 149 } 150 151 /** 152 * Picks out business object name from the request to get retrieve a lookupable and set properties. 153 */ 154 public void populate(HttpServletRequest request) { 155 super.populate(request); 156 157 DataDictionaryService ddService = KRADServiceLocatorWeb.getDataDictionaryService(); 158 159 try { 160 Lookupable localLookupable = null; 161 if (StringUtils.isBlank(getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME)) && StringUtils.isBlank(getLookupableImplServiceName())) { 162 // get the business object class for the lookup 163 String localBusinessObjectClassName = getParameter(request, KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE); 164 if ( ExternalizableBusinessObjectUtils.isExternalizableBusinessObjectInterface(localBusinessObjectClassName) ) { 165 Class localBusinessObjectClass = Class.forName(localBusinessObjectClassName); 166 localBusinessObjectClassName = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(localBusinessObjectClass).getExternalizableBusinessObjectImplementation(localBusinessObjectClass).getName(); 167 } 168 setBusinessObjectClassName(localBusinessObjectClassName); 169 if (StringUtils.isBlank(localBusinessObjectClassName)) { 170 LOG.error("Business object class not passed to lookup."); 171 throw new RuntimeException("Business object class not passed to lookup."); 172 } 173 174 // call data dictionary service to get lookup impl for bo class 175 String lookupImplID = KNSServiceLocator.getBusinessObjectDictionaryService().getLookupableID(Class.forName(localBusinessObjectClassName)); 176 if (lookupImplID == null) { 177 lookupImplID = "kualiLookupable"; 178 } 179 180 setLookupableImplServiceName(lookupImplID); 181 } 182 183 localLookupable = this.getLookupable(getLookupableImplServiceName()); 184 185 if (localLookupable == null) { 186 LOG.error("Lookup impl not found for lookup impl name " + getLookupableImplServiceName()); 187 throw new RuntimeException("Lookup impl not found for lookup impl name " + getLookupableImplServiceName()); 188 } 189 190 // set parameters on lookupable, add Advanced Search parameter 191 Map<String, String[]> parameters = new TreeMap<String, String[]>(); 192 parameters.putAll(requestParameters); 193 parameters.put(KRADConstants.ADVANCED_SEARCH_FIELD, new String[]{isAdvancedSearch}); 194 localLookupable.setParameters(parameters); 195 requestParameters = null; 196 197 if (getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME) != null) { 198 setLookupableImplServiceName(getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME)); 199 } 200 201 if (getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME) != null) { 202 setLookupableImplServiceName(getParameter(request, KRADConstants.LOOKUPABLE_IMPL_ATTRIBUTE_NAME)); 203 } 204 205 // check the doc form key is empty before setting so we don't override a restored lookup form 206 if (request.getAttribute(KRADConstants.DOC_FORM_KEY) != null && StringUtils.isBlank(this.getFormKey())) { 207 setFormKey((String) request.getAttribute(KRADConstants.DOC_FORM_KEY)); 208 } 209 else if (getParameter(request, KRADConstants.DOC_FORM_KEY) != null && StringUtils.isBlank(this.getFormKey())) { 210 setFormKey(getParameter(request, KRADConstants.DOC_FORM_KEY)); 211 } 212 213 if (getParameter(request, KRADConstants.DOC_NUM) != null) { 214 setDocNum(getParameter(request, KRADConstants.DOC_NUM)); 215 } 216 217 String returnLocation = getParameter(request, "returnLocation"); 218 if (StringUtils.isNotBlank(returnLocation)) { 219 setBackLocation(returnLocation); 220 localLookupable.getLookupableHelperService().setBackLocation(returnLocation); 221 } 222 223 if (getParameter(request, "conversionFields") != null) { 224 setConversionFields(getParameter(request, "conversionFields")); 225 } 226 if (getParameter(request, KRADConstants.EXTRA_BUTTON_SOURCE) != null) { 227 //these are not sourced from the DD/Lookupable 228 ddExtraButton=false; 229 setExtraButtonSource(getParameter(request, KRADConstants.EXTRA_BUTTON_SOURCE)); 230 } 231 if (getParameter(request, KRADConstants.EXTRA_BUTTON_PARAMS) != null) { 232 setExtraButtonParams(getParameter(request, KRADConstants.EXTRA_BUTTON_PARAMS)); 233 } 234 String value = getParameter(request, "multipleValues"); 235 if (value != null) { 236 if ("YES".equals(value.toUpperCase())) { 237 setMultipleValues(true); 238 } 239 else { 240 setMultipleValues(new Boolean(getParameter(request, "multipleValues")).booleanValue()); 241 } 242 } 243 if (getParameter(request, KRADConstants.REFERENCES_TO_REFRESH) != null) { 244 setReferencesToRefresh(getParameter(request, KRADConstants.REFERENCES_TO_REFRESH)); 245 } 246 247 if (getParameter(request, "readOnlyFields") != null) { 248 setReadOnlyFields(getParameter(request, "readOnlyFields")); 249 setReadOnlyFieldsList(LookupUtils.translateReadOnlyFieldsToList(this.readOnlyFields)); 250 localLookupable.setReadOnlyFieldsList(getReadOnlyFieldsList()); 251 } 252 253 254 /* Show/Hide All Criteria and/or the Workflow Header Bar 255 * The default value of each of the following parameters is 'true' in order to always show both the criteria and the header bar. 256 * To hide the header bar use the URL parameter 'headerBarEnabled' and set the value to 'false'. 257 * To hide all the search criteria (including the buttons) set the URL parameter 'searchCriteriaEnabled' to 'false'. 258 */ 259 setHeaderBarEnabled(Truth.strToBooleanIgnoreCase(getParameter(request, HEADER_BAR_ENABLED_PARAM), Boolean.TRUE)); 260 setLookupCriteriaEnabled(Truth.strToBooleanIgnoreCase(getParameter(request, SEARCH_CRITERIA_ENABLED_PARAM), Boolean.TRUE)); 261 262 // init lookupable with bo class 263 localLookupable.setBusinessObjectClass((Class<? extends BusinessObject>) Class.forName(getBusinessObjectClassName())); 264 Map<String, String> fieldValues = new HashMap<String, String>(); 265 Map<String, String> formFields = getFields(); 266 Class boClass = Class.forName(getBusinessObjectClassName()); 267 268 for (Iterator iter = localLookupable.getRows().iterator(); iter.hasNext();) { 269 Row row = (Row) iter.next(); 270 271 for (Iterator iterator = row.getFields().iterator(); iterator.hasNext();) { 272 Field field = (Field) iterator.next(); 273 274 // check whether form already has value for field 275 if (formFields != null && formFields.containsKey(field.getPropertyName())) { 276 field.setPropertyValue(formFields.get(field.getPropertyName())); 277 } 278 279 // override values with request 280 if (getParameter(request, field.getPropertyName()) != null) { 281 if(!Field.MULTI_VALUE_FIELD_TYPES.contains(field.getFieldType())) { 282 field.setPropertyValue(getParameter(request, field.getPropertyName()).trim()); 283 } else { 284 //multi value, set to values 285 field.setPropertyValues(getParameterValues(request, field.getPropertyName())); 286 } 287 } 288 289 field.setPropertyValue(org.kuali.rice.krad.lookup.LookupUtils 290 .forceUppercase(boClass, field.getPropertyName(), field.getPropertyValue())); 291 fieldValues.put(field.getPropertyName(), field.getPropertyValue()); 292 //LOG.info("field name/value added was: " + field.getPropertyName() + field.getPropertyValue()); 293 localLookupable.applyFieldAuthorizationsFromNestedLookups(field); 294 } 295 } 296 297 if (localLookupable.checkForAdditionalFields(fieldValues)) { 298 for (Iterator iter = localLookupable.getRows().iterator(); iter.hasNext();) { 299 Row row = (Row) iter.next(); 300 301 for (Iterator iterator = row.getFields().iterator(); iterator.hasNext();) { 302 Field field = (Field) iterator.next(); 303 304 // check whether form already has value for field 305 if (formFields != null && formFields.containsKey(field.getPropertyName())) { 306 field.setPropertyValue(formFields.get(field.getPropertyName())); 307 } 308 309 // override values with request 310 if (getParameter(request, field.getPropertyName()) != null) { 311 if(!Field.MULTI_VALUE_FIELD_TYPES.contains(field.getFieldType())) { 312 field.setPropertyValue(getParameter(request, field.getPropertyName()).trim()); 313 } else { 314 //multi value, set to values 315 field.setPropertyValues(getParameterValues(request, field.getPropertyName())); 316 } 317 } 318 fieldValues.put(field.getPropertyName(), field.getPropertyValue()); 319 } 320 } 321 322 } 323 fieldValues.put(KRADConstants.DOC_FORM_KEY, this.getFormKey()); 324 fieldValues.put(KRADConstants.BACK_LOCATION, this.getBackLocation()); 325 if(this.getDocNum() != null){ 326 fieldValues.put(KRADConstants.DOC_NUM, this.getDocNum()); 327 } 328 if (StringUtils.isNotBlank(getReferencesToRefresh())) { 329 fieldValues.put(KRADConstants.REFERENCES_TO_REFRESH, this.getReferencesToRefresh()); 330 } 331 332 this.setFields(fieldValues); 333 334 setFieldConversions(LookupUtils.translateFieldConversions(this.conversionFields)); 335 localLookupable.setFieldConversions(getFieldConversions()); 336 if(StringUtils.isNotEmpty(localLookupable.getExtraButtonSource())) { 337 setExtraButtonSource(localLookupable.getExtraButtonSource()); 338 //also set the boolean so the jsp can use an action button 339 ddExtraButton=true; 340 } 341 if(StringUtils.isNotEmpty(localLookupable.getExtraButtonParams())) { 342 setExtraButtonParams(localLookupable.getExtraButtonParams()); 343 } 344 setLookupable(localLookupable); 345 setFieldsForLookup(fieldValues); 346 347 // 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) 348 if (!isShowMaintenanceLinks()) { 349 if (StringUtils.contains(getBackLocation(), "/"+ KRADConstants.PORTAL_ACTION) 350 || StringUtils.contains(getBackLocation(), "/index.html")) { 351 showMaintenanceLinks = true; 352 } 353 } 354 } 355 catch (ClassNotFoundException e) { 356 LOG.error("Business Object class " + getBusinessObjectClassName() + " not found"); 357 throw new RuntimeException("Business Object class " + getBusinessObjectClassName() + " not found", e); 358 } 359 } 360 361 /** 362 * @return Returns the lookupableImplServiceName. 363 */ 364 public String getLookupableImplServiceName() { 365 return lookupableImplServiceName; 366 } 367 368 protected Lookupable getLookupable(String beanName) { 369 return KNSServiceLocator.getLookupable(beanName); 370 } 371 372 /** 373 * @param lookupableImplServiceName The lookupableImplServiceName to set. 374 */ 375 public void setLookupableImplServiceName(String lookupableImplServiceName) { 376 this.lookupableImplServiceName = lookupableImplServiceName; 377 } 378 379 /** 380 * @return Returns the formKey. 381 */ 382 public String getFormKey() { 383 return formKey; 384 } 385 386 /** 387 * @param formKey The formKey to set. 388 */ 389 public void setFormKey(String formKey) { 390 this.formKey = formKey; 391 } 392 393 /** 394 * @return Returns the fields. 395 */ 396 public Map<String, String> getFields() { 397 return fields; 398 } 399 400 /** 401 * @param fields The fields to set. 402 */ 403 public void setFields(Map<String, String> fields) { 404 this.fields = fields; 405 } 406 407 /** 408 * @return Returns the conversionFields. 409 */ 410 public String getConversionFields() { 411 return conversionFields; 412 } 413 414 /** 415 * @param conversionFields The conversionFields to set. 416 */ 417 public void setConversionFields(String conversionFields) { 418 this.conversionFields = conversionFields; 419 } 420 421 /** 422 * @return Returns the fieldConversions. 423 */ 424 public Map<String, String> getFieldConversions() { 425 return fieldConversions; 426 } 427 428 /** 429 * @param fieldConversions The fieldConversions to set. 430 */ 431 public void setFieldConversions(Map<String, String> fieldConversions) { 432 this.fieldConversions = fieldConversions; 433 } 434 435 /** 436 * @return Returns the businessObjectClassName. 437 */ 438 public String getBusinessObjectClassName() { 439 return businessObjectClassName; 440 } 441 442 /** 443 * @param businessObjectClassName The businessObjectClassName to set. 444 */ 445 public void setBusinessObjectClassName(String businessObjectClassName) { 446 this.businessObjectClassName = businessObjectClassName; 447 } 448 449 450 /** 451 * @return Returns the kualiLookupable. 452 */ 453 public Lookupable getLookupable() { 454 return lookupable; 455 } 456 457 458 /** 459 * @param lookupable The kualiLookupable to set. 460 */ 461 public void setLookupable(Lookupable lookupable) { 462 this.lookupable = lookupable; 463 } 464 465 466 /** 467 * @return Returns the hideReturnLink. 468 */ 469 public boolean isHideReturnLink() { 470 return hideReturnLink; 471 } 472 473 /** 474 * @param suppressActions The suppressActions to set. 475 */ 476 public void setSuppressActions(boolean suppressActions) { 477 this.suppressActions = suppressActions; 478 } 479 480 /** 481 * @return Returns the suppressActions. 482 */ 483 public boolean isSuppressActions() { 484 return suppressActions; 485 } 486 487 488 /** 489 * @param hideReturnLink The hideReturnLink to set. 490 */ 491 public void setHideReturnLink(boolean hideReturnLink) { 492 this.hideReturnLink = hideReturnLink; 493 } 494 495 // TODO: remove these once DD changes have been made 496 public String getExtraButtonParams() { 497 return extraButtons.get(0).getExtraButtonParams(); 498 } 499 500 // TODO: remove these once DD changes have been made 501 public void setExtraButtonParams(String extraButtonParams) { 502 extraButtons.get(0).setExtraButtonParams( extraButtonParams ); 503 } 504 505 // TODO: remove these once DD changes have been made 506 public String getExtraButtonSource() { 507 return extraButtons.get(0).getExtraButtonSource(); 508 } 509 510 // TODO: remove these once DD changes have been made 511 public void setExtraButtonSource(String extraButtonSource) { 512 extraButtons.get(0).setExtraButtonSource( extraButtonSource ); 513 } 514 515 516 /** 517 * 518 * @return whether this form returns multiple values 519 */ 520 public boolean isMultipleValues() { 521 return multipleValues; 522 } 523 524 /** 525 * 526 * @param multipleValues - specify whether this form returns multiple values (i.e. a Collection) 527 */ 528 public void setMultipleValues(boolean multipleValues) { 529 this.multipleValues = multipleValues; 530 } 531 532 public String getLookupAnchor() { 533 return lookupAnchor; 534 } 535 536 public void setLookupAnchor(String lookupAnchor) { 537 this.lookupAnchor = lookupAnchor; 538 } 539 540 /** 541 * Gets the fieldsForLookup attribute. 542 * @return Returns the fieldsForLookup. 543 */ 544 public Map getFieldsForLookup() { 545 return fieldsForLookup; 546 } 547 548 /** 549 * Sets the fieldsForLookup attribute value. 550 * @param fieldsForLookup The fieldsForLookup to set. 551 */ 552 public void setFieldsForLookup(Map fieldsForLookup) { 553 this.fieldsForLookup = fieldsForLookup; 554 } 555 556 /** 557 * Gets the readOnlyFields attribute. 558 * @return Returns the readOnlyFields. 559 */ 560 public String getReadOnlyFields() { 561 return readOnlyFields; 562 } 563 564 /** 565 * Sets the readOnlyFields attribute value. 566 * @param readOnlyFields The readOnlyFields to set. 567 */ 568 public void setReadOnlyFields(String readOnlyFields) { 569 this.readOnlyFields = readOnlyFields; 570 } 571 572 /** 573 * Gets the readOnlyFieldsList attribute. 574 * @return Returns the readOnlyFieldsList. 575 */ 576 public List getReadOnlyFieldsList() { 577 return readOnlyFieldsList; 578 } 579 580 /** 581 * Sets the readOnlyFieldsList attribute value. 582 * @param readOnlyFieldsList The readOnlyFieldsList to set. 583 */ 584 public void setReadOnlyFieldsList(List readOnlyFieldsList) { 585 this.readOnlyFieldsList = readOnlyFieldsList; 586 } 587 588 public String getReferencesToRefresh() { 589 return referencesToRefresh; 590 } 591 592 public void setReferencesToRefresh(String referencesToRefresh) { 593 this.referencesToRefresh = referencesToRefresh; 594 } 595 596 public String getPrimaryKeyFieldLabels() { 597 return primaryKeyFieldLabels; 598 } 599 600 public void setPrimaryKeyFieldLabels(String primaryKeyFieldLabels) { 601 this.primaryKeyFieldLabels = primaryKeyFieldLabels; 602 } 603 604 public boolean isSearchUsingOnlyPrimaryKeyValues() { 605 return searchUsingOnlyPrimaryKeyValues; 606 } 607 608 public void setSearchUsingOnlyPrimaryKeyValues(boolean searchUsingOnlyPrimaryKeyValues) { 609 this.searchUsingOnlyPrimaryKeyValues = searchUsingOnlyPrimaryKeyValues; 610 } 611 612 /** 613 * If true the maintenance links (create new, edit, copy, delete) are displayed on the lookup 614 * 615 * @return showMaintenanceLinks. 616 */ 617 public boolean isShowMaintenanceLinks() { 618 return showMaintenanceLinks; 619 } 620 621 /** 622 * Sets the showMaintenanceLinks attribute value. 623 * @param showMaintenanceLinks The showMaintenanceLinks to set. 624 */ 625 public void setShowMaintenanceLinks(boolean showMaintenanceLinks) { 626 this.showMaintenanceLinks = showMaintenanceLinks; 627 } 628 629 /** 630 * Returns whether the results contain at least one row that is returnable 631 * 632 * @return 633 */ 634 public boolean isHasReturnableRow() { 635 return this.hasReturnableRow; 636 } 637 638 /** 639 * Sets whether the results contain at least one row that is returnable 640 * 641 * @param hasReturnableRow 642 */ 643 public void setHasReturnableRow(boolean hasReturnableRow) { 644 this.hasReturnableRow = hasReturnableRow; 645 } 646 647 /** 648 * @return the lookupObjectId 649 */ 650 public String getLookupObjectId() { 651 return this.lookupObjectId; 652 } 653 654 /** 655 * @param lookupObjectId the lookupObjectId to set 656 */ 657 public void setLookupObjectId(String lookupObjectId) { 658 this.lookupObjectId = lookupObjectId; 659 } 660 661 /** 662 * @return the lookupCriteriaEnabled 663 */ 664 public boolean isLookupCriteriaEnabled() { 665 return this.lookupCriteriaEnabled; 666 } 667 668 /** 669 * @param lookupCriteriaEnabled the lookupCriteriaEnabled to set 670 */ 671 public void setLookupCriteriaEnabled(boolean lookupCriteriaEnabled) { 672 this.lookupCriteriaEnabled = lookupCriteriaEnabled; 673 } 674 675 /** 676 * @return the supplementalActionsEnabled 677 */ 678 public boolean isSupplementalActionsEnabled() { 679 return this.supplementalActionsEnabled; 680 } 681 682 /** 683 * @param supplementalActionsEnabled the supplementalActionsEnabled to set 684 */ 685 public void setSupplementalActionsEnabled(boolean supplementalActionsEnabled) { 686 this.supplementalActionsEnabled = supplementalActionsEnabled; 687 } 688 689 690 /** 691 * @param actionUrlsExist the actionUrlsExist to set 692 */ 693 public void setActionUrlsExist(boolean actionUrlsExist) { 694 this.actionUrlsExist = actionUrlsExist; 695 } 696 697 /** 698 * @return the actionUrlsExist 699 */ 700 public boolean isActionUrlsExist() { 701 return actionUrlsExist; 702 } 703 704 /** 705 * @return the ddExtraButton 706 */ 707 public boolean isDdExtraButton() { 708 return this.ddExtraButton; 709 } 710 711 /** 712 * @param ddExtraButton the ddExtraButton to set 713 */ 714 public void setDdExtraButton(boolean ddExtraButton) { 715 this.ddExtraButton = ddExtraButton; 716 } 717 718 public boolean isHeaderBarEnabled() { 719 return headerBarEnabled; 720 } 721 722 public void setHeaderBarEnabled(boolean headerBarEnabled) { 723 this.headerBarEnabled = headerBarEnabled; 724 } 725 726 public boolean isDisableSearchButtons() { 727 return this.disableSearchButtons; 728 } 729 730 public void setDisableSearchButtons(boolean disableSearchButtons) { 731 this.disableSearchButtons = disableSearchButtons; 732 } 733 734 /** 735 * Retrieves the String value for the isAdvancedSearch property. 736 * 737 * <p> 738 * The isAdvancedSearch property is also used as a http request parameter. The property name must 739 * match <code>KRADConstants.ADVANCED_SEARCH_FIELD</code> for the button setup and javascript toggling of the value 740 * to work. 741 * </p> 742 * 743 * @return String "YES" if advanced search set, "NO" or null for basic search. 744 */ 745 public String getIsAdvancedSearch() { 746 return this.isAdvancedSearch; 747 } 748 749 /** 750 * Sets the isAdvancedSearch String value. 751 * 752 * @param advancedSearch - "YES" for advanced search, "NO" for basic search 753 */ 754 public void setIsAdvancedSearch(String advancedSearch) { 755 this.isAdvancedSearch = advancedSearch; 756 } 757 758 /** 759 * Determines whether the search/clear buttons should be rendering based on the form property 760 * and what is configured in the data dictionary for the lookup 761 * 762 * @return boolean true if the buttons should be rendered, false if they should not be 763 */ 764 public boolean getRenderSearchButtons() { 765 boolean renderSearchButtons = true; 766 767 if (disableSearchButtons 768 || KNSServiceLocator.getBusinessObjectDictionaryService().disableSearchButtonsInLookup( 769 getLookupable().getBusinessObjectClass())) { 770 renderSearchButtons = false; 771 } 772 773 return renderSearchButtons; 774 } 775}