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