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


001:        package org.osbl.agent.model.action;
002:
003:        import ognl.Ognl;
004:        import ognl.OgnlException;
005:
006:        import org.osbl.agent.model.Action;
007:        import org.osbl.agent.model.Rule;
008:        import org.osbl.agent.model.RuleContext;
009:
010:        /**
011:         * The Class SetPropertyAction.
012:         * 
013:         * @author Sebastian Nozzi.
014:         */
015:        public class SetPropertyAction implements  Action {
016:
017:            /** The bean meta class name. */
018:            private String beanMetaClassName;
019:
020:            /** The property meta name. */
021:            private String propertyMetaName;
022:
023:            /** The value to set. */
024:            private Object valueToSet;
025:
026:            /**
027:             * Gets the bean meta class name.
028:             * 
029:             * @return the bean meta class name
030:             */
031:            public String getBeanMetaClassName() {
032:                return beanMetaClassName;
033:            }
034:
035:            /**
036:             * Sets the bean meta class name.
037:             * 
038:             * @param beanMetaClassName the new bean meta class name
039:             */
040:            public void setBeanMetaClassName(String beanMetaClassName) {
041:                this .beanMetaClassName = beanMetaClassName;
042:            }
043:
044:            /**
045:             * Gets the property meta name.
046:             * 
047:             * @return the property meta name
048:             */
049:            public String getPropertyMetaName() {
050:                return propertyMetaName;
051:            }
052:
053:            /**
054:             * Sets the property meta name.
055:             * 
056:             * @param propertyMetaName the new property meta name
057:             */
058:            public void setPropertyMetaName(String propertyMetaName) {
059:                this .propertyMetaName = propertyMetaName;
060:            }
061:
062:            /**
063:             * Gets the value to set.
064:             * 
065:             * @return the value to set
066:             */
067:            public Object getValueToSet() {
068:                return valueToSet;
069:            }
070:
071:            /**
072:             * Sets the value to set.
073:             * 
074:             * @param valueToSet the new value to set
075:             */
076:            public void setValueToSet(Object valueToSet) {
077:                this .valueToSet = valueToSet;
078:            }
079:
080:            /* (non-Javadoc)
081:             * @see org.osbl.agent.model.Action#execute(org.osbl.agent.model.RuleContext)
082:             */
083:            public void execute(RuleContext context) {
084:
085:                // "subject" is the instance that will have a property changed
086:                Object subject = context.getTargetObject();
087:
088:                try {
089:                    // Use OGNL to set a value, using "subject" as our root object.
090:                    // "valueToSet" is a field in this class.
091:
092:                    // Since "valueToSet" can, in turn, be an expression itself, we evaluate
093:                    // it with Ognl, and then pass the computed value to setValue...
094:
095:                    // This allows things like "preis <- preis + 1"
096:
097:                    if (valueToSet instanceof  String) {
098:                        System.out.println("this.valueToSet is: "
099:                                + this .valueToSet);
100:                        // treat this.valueToSet as an expression, explicitly calling getValue(String, Object) 
101:                        // since there is also a getValue(Object, Object) which is NOT the one we want.
102:                        Object valueToSet = Ognl.getValue(
103:                                (String) this .valueToSet, context, subject);
104:                        Ognl.setValue(propertyMetaName, context, subject,
105:                                valueToSet);
106:                    } else {
107:                        // valueToSet could be anything
108:
109:                        Ognl.setValue(propertyMetaName, context, subject,
110:                                valueToSet);
111:                    }
112:
113:                } catch (OgnlException e) {
114:                    // TODO Auto-generated catch block
115:                    e.printStackTrace();
116:                }
117:            }
118:
119:            /* (non-Javadoc)
120:             * @see java.lang.Object#equals(java.lang.Object)
121:             */
122:            public boolean equals(Object obj) {
123:
124:                if (this  == obj)
125:                    return true;
126:
127:                if (obj instanceof  SetPropertyAction == false)
128:                    return false;
129:
130:                SetPropertyAction other = (SetPropertyAction) obj;
131:
132:                if (!Rule.propertyEquals(beanMetaClassName,
133:                        other.beanMetaClassName))
134:                    return false;
135:
136:                if (!Rule.propertyEquals(propertyMetaName,
137:                        other.propertyMetaName))
138:                    return false;
139:
140:                if (!Rule.propertyEquals(valueToSet, other.valueToSet))
141:                    return false;
142:
143:                return true;
144:            }
145:
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.