Source Code Cross Referenced for SearchableAttributeFloatValue.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » docsearch » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » edu.iu.uis.eden.docsearch 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2006 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package edu.iu.uis.eden.docsearch;
018:
019:        import java.math.BigDecimal;
020:        import java.sql.ResultSet;
021:        import java.sql.SQLException;
022:        import java.text.DecimalFormat;
023:        import java.text.NumberFormat;
024:        import java.util.HashMap;
025:        import java.util.Map;
026:        import java.util.regex.Matcher;
027:        import java.util.regex.Pattern;
028:
029:        import org.apache.commons.lang.StringUtils;
030:
031:        import edu.iu.uis.eden.WorkflowPersistable;
032:        import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
033:        import edu.iu.uis.eden.util.Utilities;
034:
035:        /**
036:         *
037:         * @author delyea
038:         */
039:        public class SearchableAttributeFloatValue implements 
040:                WorkflowPersistable, SearchableAttributeValue {
041:
042:            private static final long serialVersionUID = -6682101853805320760L;
043:
044:            private static final String ATTRIBUTE_DATABASE_TABLE_NAME = "EN_DOC_HDR_EXT_FLT_T";
045:            private static final boolean DEFAULT_WILDCARD_ALLOWANCE_POLICY = false;
046:            private static final boolean ALLOWS_RANGE_SEARCH = true;
047:            private static final boolean ALLOWS_CASE_INSENSITIVE_SEARCH = false;
048:            private static final String DEFAULT_VALIDATION_REGEX_EXPRESSION = "[-+]?[0-9]*\\.?[0-9]+";
049:            private static final String ATTRIBUTE_XML_REPRESENTATION = SearchableAttribute.DATA_TYPE_FLOAT;
050:            private static final String DEFAULT_FORMAT_PATTERN = "";
051:
052:            private Long searchableAttributeValueId;
053:            private String searchableAttributeKey;
054:            private BigDecimal searchableAttributeValue;
055:            protected String ojbConcreteClass; // attribute needed for OJB polymorphism - do not alter!
056:
057:            private Long routeHeaderId;
058:            private DocumentRouteHeaderValue routeHeader;
059:
060:            /**
061:             * Default constructor.
062:             */
063:            public SearchableAttributeFloatValue() {
064:                super ();
065:                this .ojbConcreteClass = this .getClass().getName();
066:            }
067:
068:            /* (non-Javadoc)
069:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#setupAttributeValue(java.lang.String)
070:             */
071:            public void setupAttributeValue(String value) {
072:                this 
073:                        .setSearchableAttributeValue(convertStringToBigDecimal(value));
074:            }
075:
076:            private BigDecimal convertStringToBigDecimal(String value) {
077:                if (Utilities.isEmpty(value)) {
078:                    return null;
079:                } else {
080:                    return new BigDecimal(value);
081:                }
082:            }
083:
084:            /* (non-Javadoc)
085:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#setupAttributeValue(java.sql.ResultSet, java.lang.String)
086:             */
087:            public void setupAttributeValue(ResultSet resultSet,
088:                    String columnName) throws SQLException {
089:                this .setSearchableAttributeValue(resultSet
090:                        .getBigDecimal(columnName));
091:            }
092:
093:            /* (non-Javadoc)
094:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#getSearchableAttributeDisplayValue()
095:             */
096:            public String getSearchableAttributeDisplayValue() {
097:                return getSearchableAttributeDisplayValue(new HashMap<String, String>());
098:            }
099:
100:            /* (non-Javadoc)
101:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#getSearchableAttributeDisplayValue(java.util.Map)
102:             */
103:            public String getSearchableAttributeDisplayValue(
104:                    Map<String, String> displayParameters) {
105:                NumberFormat format = DecimalFormat.getInstance();
106:                String pattern = ((DecimalFormat) format).toPattern();
107:                ((DecimalFormat) format)
108:                        .applyPattern(getFormatPatternToUse(displayParameters
109:                                .get(DISPLAY_FORMAT_PATTERN_MAP_KEY)));
110:                return format.format(getSearchableAttributeValue()
111:                        .doubleValue());
112:            }
113:
114:            private String getFormatPatternToUse(String parameterFormatPattern) {
115:                if (StringUtils.isNotBlank(parameterFormatPattern)) {
116:                    return parameterFormatPattern;
117:                }
118:                return DEFAULT_FORMAT_PATTERN;
119:            }
120:
121:            /* (non-Javadoc)
122:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#getAttributeDataType()
123:             */
124:            public String getAttributeDataType() {
125:                return ATTRIBUTE_XML_REPRESENTATION;
126:            }
127:
128:            /* (non-Javadoc)
129:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#getAttributeTableName()
130:             */
131:            public String getAttributeTableName() {
132:                return ATTRIBUTE_DATABASE_TABLE_NAME;
133:            }
134:
135:            /* (non-Javadoc)
136:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#allowsWildcardsByDefault()
137:             */
138:            public boolean allowsWildcards() {
139:                return DEFAULT_WILDCARD_ALLOWANCE_POLICY;
140:            }
141:
142:            /* (non-Javadoc)
143:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#allowsCaseInsensitivity()
144:             */
145:            public boolean allowsCaseInsensitivity() {
146:                return ALLOWS_CASE_INSENSITIVE_SEARCH;
147:            }
148:
149:            /* (non-Javadoc)
150:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#allowsRangeSearches()
151:             */
152:            public boolean allowsRangeSearches() {
153:                return ALLOWS_RANGE_SEARCH;
154:            }
155:
156:            /* (non-Javadoc)
157:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#isPassesDefaultValidation()
158:             */
159:            public boolean isPassesDefaultValidation(String valueEntered) {
160:                Pattern pattern = Pattern
161:                        .compile(DEFAULT_VALIDATION_REGEX_EXPRESSION);
162:                Matcher matcher = pattern.matcher(valueEntered);
163:                return (matcher.matches());
164:            }
165:
166:            /* (non-Javadoc)
167:             * @see edu.iu.uis.eden.docsearch.SearchableAttributeValue#isRangeValid(java.lang.String, java.lang.String)
168:             */
169:            public Boolean isRangeValid(String lowerValue, String upperValue) {
170:                if (allowsRangeSearches()) {
171:                    BigDecimal lower = convertStringToBigDecimal(lowerValue);
172:                    BigDecimal upper = convertStringToBigDecimal(upperValue);
173:                    if ((lower != null) && (upper != null)) {
174:                        return (lower.compareTo(upper) <= 0);
175:                    }
176:                    return true;
177:                }
178:                return null;
179:            }
180:
181:            public String getOjbConcreteClass() {
182:                return ojbConcreteClass;
183:            }
184:
185:            public void setOjbConcreteClass(String ojbConcreteClass) {
186:                this .ojbConcreteClass = ojbConcreteClass;
187:            }
188:
189:            public DocumentRouteHeaderValue getRouteHeader() {
190:                return routeHeader;
191:            }
192:
193:            public void setRouteHeader(DocumentRouteHeaderValue routeHeader) {
194:                this .routeHeader = routeHeader;
195:            }
196:
197:            public Long getRouteHeaderId() {
198:                return routeHeaderId;
199:            }
200:
201:            public void setRouteHeaderId(Long routeHeaderId) {
202:                this .routeHeaderId = routeHeaderId;
203:            }
204:
205:            public String getSearchableAttributeKey() {
206:                return searchableAttributeKey;
207:            }
208:
209:            public void setSearchableAttributeKey(String searchableAttributeKey) {
210:                this .searchableAttributeKey = searchableAttributeKey;
211:            }
212:
213:            public BigDecimal getSearchableAttributeValue() {
214:                return searchableAttributeValue;
215:            }
216:
217:            public void setSearchableAttributeValue(
218:                    BigDecimal searchableAttributeValue) {
219:                this .searchableAttributeValue = searchableAttributeValue;
220:            }
221:
222:            /**
223:             * @deprecated USE method setSearchableAttributeValue(BigDecimal) instead
224:             */
225:            public void setSearchableAttributeValue(Float floatValueToTranslate) {
226:                this .searchableAttributeValue = null;
227:                if (floatValueToTranslate != null) {
228:                    this .searchableAttributeValue = new BigDecimal(
229:                            floatValueToTranslate.toString());
230:                }
231:            }
232:
233:            public Long getSearchableAttributeValueId() {
234:                return searchableAttributeValueId;
235:            }
236:
237:            public void setSearchableAttributeValueId(
238:                    Long searchableAttributeValueId) {
239:                this .searchableAttributeValueId = searchableAttributeValueId;
240:            }
241:
242:            /* (non-Javadoc)
243:             * @see edu.iu.uis.eden.WorkflowPersistable#copy(boolean)
244:             */
245:            @Deprecated
246:            public Object copy(boolean preserveKeys) {
247:                return null;
248:            }
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.