Source Code Cross Referenced for ColumnExpression.java in  » Database-Client » SQL-Workbench » workbench » storage » filter » 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 » Database Client » SQL Workbench » workbench.storage.filter 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ColumnExpression.java
003:         *
004:         * This file is part of SQL Workbench/J, http://www.sql-workbench.net
005:         *
006:         * Copyright 2002-2008, Thomas Kellerer
007:         * No part of this code maybe reused without the permission of the author
008:         *
009:         * To contact the author please send an email to: support@sql-workbench.net
010:         *
011:         */
012:        package workbench.storage.filter;
013:
014:        import java.util.Map;
015:
016:        /**
017:         * A class to define the filter criteria for a single column 
018:         * 
019:         * @author support@sql-workbench.net
020:         */
021:        public class ColumnExpression implements  FilterExpression,
022:                ExpressionValue {
023:            private String columnName;
024:            private Object filterValue;
025:            private ColumnComparator comparator;
026:            private boolean ignoreCase;
027:
028:            /**
029:             * Default constructor needed for XML serialisation.
030:             */
031:            public ColumnExpression() {
032:            }
033:
034:            /**
035:             * Define the filter for a column
036:             * 
037:             * @param column the column name
038:             * @param comparator the comparator to be used to compare the reference value against the actual values
039:             * @param filterValue the filter value to compare against the actual values
040:             * 
041:             * @see #setFilterValue(Object)
042:             * @see #setComparator(ColumnComparator)
043:             */
044:            public ColumnExpression(String column, ColumnComparator comparator,
045:                    Object filterValue) {
046:                setComparator(comparator);
047:                setFilterValue(filterValue);
048:                setColumnName(column);
049:            }
050:
051:            /**
052:             * Define a "generic" column filter
053:             * 
054:             * @param comparator the comparator to be used to compare the reference value against the actual values
055:             * @param filterValue the filter value to compare against the actual values
056:             * 
057:             * @see #setFilterValue(Object)
058:             * @see #setComparator(ColumnComparator)
059:             */
060:            public ColumnExpression(ColumnComparator comparator,
061:                    Object filterValue) {
062:                setComparator(comparator);
063:                setFilterValue(filterValue);
064:                setColumnName("*");
065:            }
066:
067:            public Object getFilterValue() {
068:                return filterValue;
069:            }
070:
071:            public void setFilterValue(Object value) {
072:                this .filterValue = value;
073:            }
074:
075:            public ColumnComparator getComparator() {
076:                return comparator;
077:            }
078:
079:            public void setComparator(ColumnComparator comp) {
080:                this .comparator = comp;
081:            }
082:
083:            public boolean equals(Object other) {
084:                try {
085:                    ColumnExpression def = (ColumnExpression) other;
086:                    if (this .filterValue == null || def.filterValue == null)
087:                        return false;
088:                    boolean result = this .filterValue.equals(def.filterValue);
089:                    if (result) {
090:                        result = this .comparator.equals(def.comparator);
091:                    }
092:                    return result;
093:                } catch (Throwable th) {
094:                    return false;
095:                }
096:            }
097:
098:            public boolean evaluate(Object value) {
099:                if (value != null && !comparator.supportsType(value.getClass()))
100:                    return false;
101:                return comparator.evaluate(filterValue, value, this .ignoreCase);
102:            }
103:
104:            public boolean evaluate(Map columnValues) {
105:                Object value = columnValues.get(this .columnName);
106:                return evaluate(value);
107:            }
108:
109:            public String getColumnName() {
110:
111:                return this .columnName;
112:            }
113:
114:            public void setColumnName(String column) {
115:                this .columnName = (column == null ? null : column.toLowerCase());
116:            }
117:
118:            public String toString() {
119:                return "[" + columnName + "] " + this .comparator.getOperator()
120:                        + " " + comparator.getValueExpression(this .filterValue);
121:            }
122:
123:            public boolean isIgnoreCase() {
124:                return ignoreCase;
125:            }
126:
127:            public void setIgnoreCase(boolean ignoreCase) {
128:                this .ignoreCase = ignoreCase;
129:            }
130:
131:            public boolean isColumnSpecific() {
132:                return true;
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.