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.workflow.attribute;
017
018import org.kuali.rice.core.api.uif.RemotableAttributeError;
019import org.kuali.rice.core.api.uif.RemotableAttributeField;
020import org.kuali.rice.kew.api.document.DocumentWithContent;
021import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
022import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
023import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
024import org.kuali.rice.kew.api.document.search.DocumentSearchResult;
025import org.kuali.rice.kew.api.extension.ExtensionDefinition;
026import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute;
027import org.kuali.rice.kew.framework.document.search.DocumentSearchCustomizer;
028import org.kuali.rice.kew.framework.document.search.DocumentSearchResultSetConfiguration;
029import org.kuali.rice.kew.framework.document.search.DocumentSearchResultValues;
030import org.kuali.rice.kew.framework.document.search.NullDocumentSearchCustomizer;
031
032import java.util.List;
033
034/**
035 * @deprecated Only used by KNS classes, no replacement.
036 */
037@Deprecated
038public class DataDictionaryDocumentSearchCustomizer implements SearchableAttribute, DocumentSearchCustomizer {
039
040    private SearchableAttribute searchableAttribute;
041    private DocumentSearchCustomizer documentSearchCustomizer;
042
043    public DataDictionaryDocumentSearchCustomizer() {
044        this(new DataDictionarySearchableAttribute(), new NullDocumentSearchCustomizer());
045    }
046
047    public DataDictionaryDocumentSearchCustomizer(SearchableAttribute searchableAttribute,
048            DocumentSearchCustomizer documentSearchCustomizer) {
049        this.searchableAttribute = searchableAttribute;
050        this.documentSearchCustomizer = documentSearchCustomizer;
051    }
052
053    @Override
054    public final String generateSearchContent(ExtensionDefinition extensionDefinition,
055            String documentTypeName,
056            WorkflowAttributeDefinition attributeDefinition) {
057        return getSearchableAttribute().generateSearchContent(extensionDefinition, documentTypeName,
058                attributeDefinition);
059    }
060
061    @Override
062    public final List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
063            DocumentWithContent documentWithContent) {
064        return getSearchableAttribute().extractDocumentAttributes(extensionDefinition, documentWithContent);
065    }
066
067    @Override
068    public final List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
069            String documentTypeName) {
070        return getSearchableAttribute().getSearchFields(extensionDefinition, documentTypeName);
071    }
072
073    @Override
074    public final List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
075            DocumentSearchCriteria documentSearchCriteria) {
076        return getSearchableAttribute().validateDocumentAttributeCriteria(extensionDefinition, documentSearchCriteria);
077    }
078
079    @Override
080    public final DocumentSearchCriteria customizeCriteria(DocumentSearchCriteria documentSearchCriteria) {
081        return getDocumentSearchCustomizer().customizeCriteria(documentSearchCriteria);
082    }
083
084    @Override
085    public final DocumentSearchCriteria customizeClearCriteria(DocumentSearchCriteria documentSearchCriteria) {
086        return getDocumentSearchCustomizer().customizeClearCriteria(documentSearchCriteria);
087    }
088
089    @Override
090    public final DocumentSearchResultValues customizeResults(DocumentSearchCriteria documentSearchCriteria,
091            List<DocumentSearchResult> defaultResults) {
092        return getDocumentSearchCustomizer().customizeResults(documentSearchCriteria, defaultResults);
093    }
094
095    @Override
096    public DocumentSearchResultSetConfiguration customizeResultSetConfiguration(
097            DocumentSearchCriteria documentSearchCriteria) {
098        return getDocumentSearchCustomizer().customizeResultSetConfiguration(documentSearchCriteria);
099    }
100
101    @Override
102    public final boolean isCustomizeCriteriaEnabled(String documentTypeName) {
103        return getDocumentSearchCustomizer().isCustomizeCriteriaEnabled(documentTypeName);
104    }
105
106    @Override
107    public final boolean isCustomizeClearCriteriaEnabled(String documentTypeName) {
108        return getDocumentSearchCustomizer().isCustomizeClearCriteriaEnabled(documentTypeName);
109    }
110
111    @Override
112    public final boolean isCustomizeResultsEnabled(String documentTypeName) {
113        return getDocumentSearchCustomizer().isCustomizeResultsEnabled(documentTypeName);
114    }
115
116    @Override
117    public final boolean isCustomizeResultSetFieldsEnabled(String documentTypeName) {
118        return getDocumentSearchCustomizer().isCustomizeResultSetFieldsEnabled(documentTypeName);
119    }
120
121        protected SearchableAttribute getSearchableAttribute() {
122        return this.searchableAttribute;
123        }
124
125    public void setSearchableAttribute(SearchableAttribute searchableAttribute) {
126        this.searchableAttribute = searchableAttribute;
127    }
128
129    protected DocumentSearchCustomizer getDocumentSearchCustomizer() {
130        return this.documentSearchCustomizer;
131    }
132
133    public void setDocumentSearchCustomizer(DocumentSearchCustomizer documentSearchCustomizer) {
134        this.documentSearchCustomizer = documentSearchCustomizer;
135    }
136
137
138}