View Javadoc

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.krad.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  public class DataDictionaryDocumentSearchCustomizer implements SearchableAttribute, DocumentSearchCustomizer {
35  
36      private SearchableAttribute searchableAttribute;
37      private DocumentSearchCustomizer documentSearchCustomizer;
38  
39      public DataDictionaryDocumentSearchCustomizer() {
40          this(new DataDictionarySearchableAttribute(), new NullDocumentSearchCustomizer());
41      }
42  
43      public DataDictionaryDocumentSearchCustomizer(SearchableAttribute searchableAttribute,
44              DocumentSearchCustomizer documentSearchCustomizer) {
45          this.searchableAttribute = searchableAttribute;
46          this.documentSearchCustomizer = documentSearchCustomizer;
47      }
48  
49      @Override
50      public final String generateSearchContent(ExtensionDefinition extensionDefinition,
51              String documentTypeName,
52              WorkflowAttributeDefinition attributeDefinition) {
53          return getSearchableAttribute().generateSearchContent(extensionDefinition, documentTypeName,
54                  attributeDefinition);
55      }
56  
57      @Override
58      public final List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
59              DocumentWithContent documentWithContent) {
60          return getSearchableAttribute().extractDocumentAttributes(extensionDefinition, documentWithContent);
61      }
62  
63      @Override
64      public final List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
65              String documentTypeName) {
66          return getSearchableAttribute().getSearchFields(extensionDefinition, documentTypeName);
67      }
68  
69      @Override
70      public final List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
71              DocumentSearchCriteria documentSearchCriteria) {
72          return getSearchableAttribute().validateDocumentAttributeCriteria(extensionDefinition, documentSearchCriteria);
73      }
74  
75      @Override
76      public final DocumentSearchCriteria customizeCriteria(DocumentSearchCriteria documentSearchCriteria) {
77          return getDocumentSearchCustomizer().customizeCriteria(documentSearchCriteria);
78      }
79  
80      @Override
81      public final DocumentSearchCriteria customizeClearCriteria(DocumentSearchCriteria documentSearchCriteria) {
82          return getDocumentSearchCustomizer().customizeClearCriteria(documentSearchCriteria);
83      }
84  
85      @Override
86      public final DocumentSearchResultValues customizeResults(DocumentSearchCriteria documentSearchCriteria,
87              List<DocumentSearchResult> defaultResults) {
88          return getDocumentSearchCustomizer().customizeResults(documentSearchCriteria, defaultResults);
89      }
90  
91      @Override
92      public DocumentSearchResultSetConfiguration customizeResultSetConfiguration(
93              DocumentSearchCriteria documentSearchCriteria) {
94          return getDocumentSearchCustomizer().customizeResultSetConfiguration(documentSearchCriteria);
95      }
96  
97      @Override
98      public final boolean isCustomizeCriteriaEnabled(String documentTypeName) {
99          return getDocumentSearchCustomizer().isCustomizeCriteriaEnabled(documentTypeName);
100     }
101 
102     @Override
103     public final boolean isCustomizeClearCriteriaEnabled(String documentTypeName) {
104         return getDocumentSearchCustomizer().isCustomizeClearCriteriaEnabled(documentTypeName);
105     }
106 
107     @Override
108     public final boolean isCustomizeResultsEnabled(String documentTypeName) {
109         return getDocumentSearchCustomizer().isCustomizeResultsEnabled(documentTypeName);
110     }
111 
112     @Override
113     public final boolean isCustomizeResultSetFieldsEnabled(String documentTypeName) {
114         return getDocumentSearchCustomizer().isCustomizeResultSetFieldsEnabled(documentTypeName);
115     }
116 
117 	protected SearchableAttribute getSearchableAttribute() {
118         return this.searchableAttribute;
119 	}
120 
121     public void setSearchableAttribute(SearchableAttribute searchableAttribute) {
122         this.searchableAttribute = searchableAttribute;
123     }
124 
125     protected DocumentSearchCustomizer getDocumentSearchCustomizer() {
126         return this.documentSearchCustomizer;
127     }
128 
129     public void setDocumentSearchCustomizer(DocumentSearchCustomizer documentSearchCustomizer) {
130         this.documentSearchCustomizer = documentSearchCustomizer;
131     }
132 
133 
134 }