01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.workflow.attribute;
17:
18: import java.math.BigDecimal;
19: import java.util.ArrayList;
20: import java.util.Iterator;
21: import java.util.List;
22:
23: import edu.iu.uis.eden.docsearch.SearchableAttributeFloatValue;
24: import edu.iu.uis.eden.docsearch.SearchableAttributeValue;
25:
26: /**
27: * This class...
28: */
29: public class KualiDocumentTotalAmountXMLSearchAttributeImpl extends
30: KualiXmlSearchableAttributeImpl {
31: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
32: .getLogger(KualiDocumentTotalAmountXMLSearchAttributeImpl.class);
33:
34: private static final String FIELD_DEF_NAME = "";
35:
36: /**
37: * This method will take the search storage values from the {@link org.kuali.workflow.attribute.KualiXmlSearchableAttributeImpl}
38: * method and either add or translate
39: */
40: @Override
41: public List getSearchStorageValues(String docContent) {
42: List<SearchableAttributeValue> newSearchAttributeValues = new ArrayList();
43: List<SearchableAttributeValue> super List = super
44: .getSearchStorageValues(docContent);
45: if (super List.isEmpty()) {
46: SearchableAttributeFloatValue attValue = generateZeroDollarSearchableAttributeValue();
47: newSearchAttributeValues.add(attValue);
48: } else {
49: for (Iterator iter = super List.iterator(); iter.hasNext();) {
50: SearchableAttributeValue searchableValue = (SearchableAttributeValue) iter
51: .next();
52: if ((FIELD_DEF_NAME.equals(searchableValue
53: .getSearchableAttributeKey()))
54: && (searchableValue
55: .getSearchableAttributeValue() == null)) {
56: searchableValue.setupAttributeValue("0.00");
57: }
58: newSearchAttributeValues.add(searchableValue);
59: }
60: }
61: return newSearchAttributeValues;
62: }
63:
64: private SearchableAttributeFloatValue generateZeroDollarSearchableAttributeValue() {
65: SearchableAttributeFloatValue sav = new SearchableAttributeFloatValue();
66: sav.setSearchableAttributeKey(FIELD_DEF_NAME);
67: sav.setSearchableAttributeValue(BigDecimal.ZERO);
68: return sav;
69: }
70:
71: }
|