View Javadoc
1   /**
2    * Copyright 2005-2014 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.workflow.attribute;
17  
18  import org.kuali.rice.core.api.uif.RemotableAttributeError;
19  import org.kuali.rice.core.api.uif.RemotableAttributeField;
20  import org.kuali.rice.kew.api.document.DocumentWithContent;
21  import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
22  import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
23  import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
24  import org.kuali.rice.kew.api.document.search.DocumentSearchResult;
25  import org.kuali.rice.kew.api.extension.ExtensionDefinition;
26  import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute;
27  import org.kuali.rice.kew.framework.document.search.DocumentSearchCustomizer;
28  import org.kuali.rice.kew.framework.document.search.DocumentSearchResultSetConfiguration;
29  import org.kuali.rice.kew.framework.document.search.DocumentSearchResultValues;
30  import org.kuali.rice.kew.framework.document.search.NullDocumentSearchCustomizer;
31  
32  import java.util.List;
33  
34  /**
35   * @deprecated Only used by KNS classes, no replacement.
36   */
37  @Deprecated
38  public class DataDictionaryDocumentSearchCustomizer implements SearchableAttribute, DocumentSearchCustomizer {
39  
40      private SearchableAttribute searchableAttribute;
41      private DocumentSearchCustomizer documentSearchCustomizer;
42  
43      public DataDictionaryDocumentSearchCustomizer() {
44          this(new DataDictionarySearchableAttribute(), new NullDocumentSearchCustomizer());
45      }
46  
47      public DataDictionaryDocumentSearchCustomizer(SearchableAttribute searchableAttribute,
48              DocumentSearchCustomizer documentSearchCustomizer) {
49          this.searchableAttribute = searchableAttribute;
50          this.documentSearchCustomizer = documentSearchCustomizer;
51      }
52  
53      @Override
54      public final String generateSearchContent(ExtensionDefinition extensionDefinition,
55              String documentTypeName,
56              WorkflowAttributeDefinition attributeDefinition) {
57          return getSearchableAttribute().generateSearchContent(extensionDefinition, documentTypeName,
58                  attributeDefinition);
59      }
60  
61      @Override
62      public final List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
63              DocumentWithContent documentWithContent) {
64          return getSearchableAttribute().extractDocumentAttributes(extensionDefinition, documentWithContent);
65      }
66  
67      @Override
68      public final List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
69              String documentTypeName) {
70          return getSearchableAttribute().getSearchFields(extensionDefinition, documentTypeName);
71      }
72  
73      @Override
74      public final List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
75              DocumentSearchCriteria documentSearchCriteria) {
76          return getSearchableAttribute().validateDocumentAttributeCriteria(extensionDefinition, documentSearchCriteria);
77      }
78  
79      @Override
80      public final DocumentSearchCriteria customizeCriteria(DocumentSearchCriteria documentSearchCriteria) {
81          return getDocumentSearchCustomizer().customizeCriteria(documentSearchCriteria);
82      }
83  
84      @Override
85      public final DocumentSearchCriteria customizeClearCriteria(DocumentSearchCriteria documentSearchCriteria) {
86          return getDocumentSearchCustomizer().customizeClearCriteria(documentSearchCriteria);
87      }
88  
89      @Override
90      public final DocumentSearchResultValues customizeResults(DocumentSearchCriteria documentSearchCriteria,
91              List<DocumentSearchResult> defaultResults) {
92          return getDocumentSearchCustomizer().customizeResults(documentSearchCriteria, defaultResults);
93      }
94  
95      @Override
96      public DocumentSearchResultSetConfiguration customizeResultSetConfiguration(
97              DocumentSearchCriteria documentSearchCriteria) {
98          return getDocumentSearchCustomizer().customizeResultSetConfiguration(documentSearchCriteria);
99      }
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 }