Source Code Cross Referenced for PropertyCondition.java in  » Workflow-Engines » osbl-1_0 » org » osbl » agent » model » condition » 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 » Workflow Engines » osbl 1_0 » org.osbl.agent.model.condition 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.osbl.agent.model.condition;
002:
003:        import org.osbl.agent.model.Condition;
004:        import org.osbl.agent.model.Rule;
005:        import org.osbl.agent.model.RuleContext;
006:
007:        /**
008:         * This evaluates a condition related to one of the fields, or properties,
009:         * of the subject instance (passed in the {@link org.osbl.agent.model.RuleContext runtime-context}).
010:         * 
011:         * Thus, the specified propertyMeta MUST be a valid property of the subject class.
012:         * 
013:         * Users of this condition specify the property via a {@link org.conform.PropertyMeta propertyMeta},
014:         * specify the value to compare to, and provide an suitable {@link Operator operator} for the
015:         * evaluation of this two operands.
016:         * 
017:         * @author Sebastian Nozzi.
018:         */
019:        public class PropertyCondition implements  Condition {
020:
021:            /** The operator. */
022:            private Operator operator;
023:
024:            /** The value to compare to. */
025:            private Object valueToCompareTo;
026:
027:            /** The bean meta class name. */
028:            private String beanMetaClassName;
029:
030:            /** The property meta name. */
031:            private String propertyMetaName;
032:
033:            /**
034:             * Gets the operator.
035:             * 
036:             * @return the operator
037:             */
038:            public Operator getOperator() {
039:                return operator;
040:            }
041:
042:            /**
043:             * Sets the operator.
044:             * 
045:             * @param operator the new operator
046:             */
047:            public void setOperator(Operator operator) {
048:                this .operator = operator;
049:            }
050:
051:            /**
052:             * Gets the bean meta class name.
053:             * 
054:             * @return the bean meta class name
055:             */
056:            public String getBeanMetaClassName() {
057:                return beanMetaClassName;
058:            }
059:
060:            /**
061:             * Sets the bean meta class name.
062:             * 
063:             * @param beanMetaClassName the new bean meta class name
064:             */
065:            public void setBeanMetaClassName(String beanMetaClassName) {
066:                this .beanMetaClassName = beanMetaClassName;
067:            }
068:
069:            /**
070:             * Gets the property meta name.
071:             * 
072:             * @return the property meta name
073:             */
074:            public String getPropertyMetaName() {
075:                return propertyMetaName;
076:            }
077:
078:            /**
079:             * Sets the property meta name.
080:             * 
081:             * @param propertyMetaName the new property meta name
082:             */
083:            public void setPropertyMetaName(String propertyMetaName) {
084:                this .propertyMetaName = propertyMetaName;
085:            }
086:
087:            /**
088:             * Gets the value to compare to in the evaluation (the right operand).
089:             * 
090:             * @return the value to compare to
091:             */
092:            public Object getValueToCompareTo() {
093:                return valueToCompareTo;
094:            }
095:
096:            /**
097:             * Sets the value to compare to in the evaluation (the right operand).
098:             * 
099:             * @param valueToCompareTo the new value to compare to
100:             */
101:            public void setValueToCompareTo(Object valueToCompareTo) {
102:                this .valueToCompareTo = valueToCompareTo;
103:            }
104:
105:            /**
106:             * Uses the specified operator to perform an evaluation using the specified
107:             * propertyMeta and the valueToCompareTo as operands, returning the result
108:             * of such evaluation.
109:             * 
110:             * If the valueToCompareTo is not set or null, returns false without evaluation.
111:             * 
112:             * @param context the context
113:             * 
114:             * @return true, if evaluate
115:             * 
116:             * @see org.osbl.agent.model.condition.Condition#evaluate(org.osbl.agent.model.RuleContext)
117:             */
118:            public boolean evaluate(RuleContext context) {
119:
120:                Object value = getValueToCompareTo();
121:
122:                // Only compare if there is something to compare against
123:                if (value != null) {
124:
125:                    // Let the operator do the evaluation...
126:                    // The name of the propertyMeta is a property of our subjectInstance.
127:                    return operator.evaluate(propertyMetaName, (String) value,
128:                            context);
129:
130:                }
131:
132:                return false;
133:            }
134:
135:            /* (non-Javadoc)
136:             * @see java.lang.Object#equals(java.lang.Object)
137:             */
138:            public boolean equals(Object obj) {
139:
140:                if (this  == obj)
141:                    return true;
142:
143:                if (obj instanceof  PropertyCondition == false)
144:                    return false;
145:
146:                PropertyCondition other = (PropertyCondition) obj;
147:
148:                if (!Rule.propertyEquals(operator, other.operator))
149:                    return false;
150:
151:                if (!Rule.propertyEquals(beanMetaClassName,
152:                        other.beanMetaClassName))
153:                    return false;
154:
155:                if (!Rule.propertyEquals(propertyMetaName,
156:                        other.propertyMetaName))
157:                    return false;
158:
159:                if (!Rule.propertyEquals(valueToCompareTo,
160:                        other.valueToCompareTo))
161:                    return false;
162:
163:                return true;
164:            }
165:
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.