Source Code Cross Referenced for New_processAbstractExpression.java in  » Workflow-Engines » osbl-1_0 » newprocess » diagram » expressions » 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 » newprocess.diagram.expressions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package newprocess.diagram.expressions;
002:
003:        import java.math.BigDecimal;
004:        import java.math.BigInteger;
005:
006:        import java.util.Collection;
007:        import java.util.Collections;
008:        import java.util.Iterator;
009:        import java.util.Map;
010:
011:        import newprocess.diagram.part.New_processDiagramEditorPlugin;
012:
013:        import org.eclipse.core.runtime.IStatus;
014:        import org.eclipse.core.runtime.Platform;
015:        import org.eclipse.core.runtime.Status;
016:
017:        import org.eclipse.emf.ecore.EClassifier;
018:        import org.eclipse.emf.ecore.EObject;
019:        import org.eclipse.emf.ecore.EStructuralFeature;
020:        import org.eclipse.emf.ecore.ETypedElement;
021:
022:        import org.eclipse.emf.ecore.util.EcoreUtil;
023:
024:        /**
025:         * @generated
026:         */
027:        public abstract class New_processAbstractExpression {
028:            /**
029:             * @generated
030:             */
031:            private static final boolean DISABLED_NO_IMPL_EXCEPTION_LOG = Boolean
032:                    .valueOf(
033:                            Platform
034:                                    .getDebugOption(New_processDiagramEditorPlugin
035:                                            .getInstance().getBundle()
036:                                            .getSymbolicName()
037:                                            + "/debug/disableNoExprImplExceptionLog"))
038:                    .booleanValue();
039:            /**
040:             * @generated
041:             */
042:            private String body;
043:            /**
044:             * @generated
045:             */
046:            private EClassifier context;
047:            /**
048:             * @generated
049:             */
050:            private Map env;
051:            /**
052:             * @generated
053:             */
054:            private IStatus status = Status.OK_STATUS;
055:
056:            /**
057:             * @generated
058:             */
059:            protected New_processAbstractExpression(EClassifier context) {
060:                this .context = context;
061:            }
062:
063:            /**
064:             * @generated
065:             */
066:            protected New_processAbstractExpression(String body,
067:                    EClassifier context, Map env) {
068:                this .body = body;
069:                this .context = context;
070:                this .env = env;
071:            }
072:
073:            /**
074:             * @generated
075:             */
076:            protected void setStatus(int severity, String message,
077:                    Throwable throwable) {
078:                String pluginID = New_processDiagramEditorPlugin.ID;
079:                this .status = new Status(severity, pluginID, -1,
080:                        (message != null) ? message : "", throwable); //$NON-NLS-1$
081:                if (!this .status.isOK()) {
082:                    New_processDiagramEditorPlugin
083:                            .getInstance()
084:                            .logError(
085:                                    "Expression problem:" + message + "body:" + body, throwable); //$NON-NLS-1$ //$NON-NLS-2$
086:
087:                }
088:            }
089:
090:            /**
091:             * @generated
092:             */
093:            protected abstract Object doEvaluate(Object context, Map env);
094:
095:            /**
096:             * @generated
097:             */
098:            public Object evaluate(Object context) {
099:                return evaluate(context, Collections.EMPTY_MAP);
100:            }
101:
102:            /**
103:             * @generated
104:             */
105:            public Object evaluate(Object context, Map env) {
106:                if (context().isInstance(context)) {
107:                    try {
108:                        return doEvaluate(context, env);
109:                    } catch (Exception e) {
110:                        if (DISABLED_NO_IMPL_EXCEPTION_LOG
111:                                && e instanceof  NoImplException) {
112:                            return null;
113:                        }
114:                        New_processDiagramEditorPlugin.getInstance().logError(
115:                                "Expression evaluation failure: " + body, e);
116:                    }
117:                }
118:                return null;
119:            }
120:
121:            /**
122:             * @generated
123:             */
124:            public IStatus getStatus() {
125:                return status;
126:            }
127:
128:            /**
129:             * @generated
130:             */
131:            public String body() {
132:                return body;
133:            }
134:
135:            /**
136:             * @generated
137:             */
138:            public EClassifier context() {
139:                return context;
140:            }
141:
142:            /**
143:             * @generated
144:             */
145:            public Map environment() {
146:                return env;
147:            }
148:
149:            /**
150:             * @generated
151:             */
152:            public void assignTo(EStructuralFeature feature, EObject target) {
153:                Object value = evaluate(target);
154:                value = (value != null) ? performCast(value, feature) : null;
155:                if (feature.isMany()) {
156:                    Collection destCollection = (Collection) target
157:                            .eGet(feature);
158:                    destCollection.clear();
159:                    if (value instanceof  Collection) {
160:                        Collection valueCollection = (Collection) value;
161:                        for (Iterator it = valueCollection.iterator(); it
162:                                .hasNext();) {
163:                            destCollection.add(performCast(it.next(), feature));
164:                        }
165:                    } else {
166:                        destCollection.add(value);
167:                    }
168:                    return;
169:                }
170:                target.eSet(feature, value);
171:            }
172:
173:            /**
174:             * @generated
175:             */
176:            protected Object performCast(Object value, ETypedElement targetType) {
177:                if (targetType.getEType() == null
178:                        || targetType.getEType().getInstanceClass() == null) {
179:                    return value;
180:                }
181:                Class targetClass = targetType.getEType().getInstanceClass();
182:                if (value != null && value instanceof  Number) {
183:                    Number num = (Number) value;
184:                    Class valClass = value.getClass();
185:                    Class targetWrapperClass = targetClass;
186:                    if (targetClass.isPrimitive()) {
187:                        targetWrapperClass = EcoreUtil
188:                                .wrapperClassFor(targetClass);
189:                    }
190:                    if (valClass.equals(targetWrapperClass)) {
191:                        return value;
192:                    }
193:                    if (Number.class.isAssignableFrom(targetWrapperClass)) {
194:                        if (targetWrapperClass.equals(Byte.class))
195:                            return new Byte(num.byteValue());
196:                        if (targetWrapperClass.equals(Integer.class))
197:                            return new Integer(num.intValue());
198:                        if (targetWrapperClass.equals(Short.class))
199:                            return new Short(num.shortValue());
200:                        if (targetWrapperClass.equals(Long.class))
201:                            return new Long(num.longValue());
202:                        if (targetWrapperClass.equals(BigInteger.class))
203:                            return BigInteger.valueOf(num.longValue());
204:                        if (targetWrapperClass.equals(Float.class))
205:                            return new Float(num.floatValue());
206:                        if (targetWrapperClass.equals(Double.class))
207:                            return new Double(num.doubleValue());
208:                        if (targetWrapperClass.equals(BigDecimal.class))
209:                            return new BigDecimal(num.doubleValue());
210:                    }
211:                }
212:                return value;
213:            }
214:
215:            /**
216:             * @generated
217:             */
218:            public static final New_processAbstractExpression createNullExpression(
219:                    EClassifier context) {
220:                return new New_processAbstractExpression(context) {
221:                    protected Object doEvaluate(Object context, Map env) {
222:                        // TODO - log entry about not provider available for this expression
223:                        return null;
224:                    }
225:                };
226:            }
227:
228:            /**
229:             * @generated
230:             */
231:            public static class NoImplException extends RuntimeException {
232:                /**
233:                 * @generated
234:                 */
235:                public NoImplException(String message) {
236:                    super(message);
237:                }
238:            }
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.