Source Code Cross Referenced for MoQuery.java in  » J2EE » WiSerFramework » de » ug2t » model » 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 » J2EE » WiSerFramework » de.ug2t.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @@
002:        // @@
003:        /*
004:         * Wi.Ser Framework
005:         *
006:         * Version: 1.8.1, 20-September-2007  
007:         * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library located in LGPL.txt in the 
021:         * license directory; if not, write to the 
022:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023:         * Boston, MA  02111-1307, USA.
024:         * 
025:         * If this agreement does not cover your requirements, please contact us
026:         * via email to get detailed information about the commercial license 
027:         * or our service offerings!
028:         *
029:         */
030:        // @@
031:        package de.ug2t.model;
032:
033:        import java.util.*;
034:        import java.util.regex.*;
035:
036:        import de.ug2t.connector.*;
037:        import de.ug2t.model.values.*;
038:
039:        public class MoQuery extends ACoDataGetter {
040:            private String pem_regExpStr_Node = null;
041:            private String pem_regExpStr_Attr = null;
042:            private String pem_regExpStr_Value = null;
043:            private String pem_regExpStr_Path = null;
044:
045:            protected String pdm_sep = "^";
046:
047:            private Pattern pem_nodePattern = null;
048:            private Pattern pem_attrPattern = null;
049:            private Pattern pem_valuePattern = null;
050:            private Pattern pem_pathPattern = null;
051:
052:            private ArrayList pem_result = null;
053:
054:            private IMoValueContainer pem_model = null;
055:
056:            public class MoQueryNodeDescriptor {
057:                public String pcm_path;
058:                public String pcm_name;
059:                public IMoValue pcm_value;
060:                public IMoValueContainer pcm_parent;
061:
062:                public MoQueryNodeDescriptor(String xName, String xPath,
063:                        IMoValue xValue, IMoValueContainer xParent) {
064:                    this .pcm_path = xPath;
065:                    this .pcm_name = xName;
066:                    this .pcm_value = xValue;
067:                    this .pcm_parent = xParent;
068:                }
069:
070:                public String toString() {
071:                    String l_res = this .pcm_name + MoQuery.this .pdm_sep
072:                            + this .pcm_path + MoQuery.this .pdm_sep;
073:                    if (this .pcm_value instanceof  IMoSingleValue)
074:                        l_res += ((IMoSingleValue) this .pcm_value)
075:                                .pcmf_getValue();
076:                    else
077:                        l_res += "-";
078:
079:                    return (l_res);
080:                }
081:            }
082:
083:            /**
084:             * 
085:             */
086:            public MoQuery() {
087:                return;
088:            }
089:
090:            public MoQuery(String xSep) {
091:                this .pdm_sep = xSep;
092:
093:                return;
094:            }
095:
096:            public void pcmf_resetQuery() {
097:                pem_regExpStr_Node = null;
098:                pem_regExpStr_Attr = null;
099:                pem_regExpStr_Value = null;
100:                pem_regExpStr_Path = null;
101:
102:                pem_nodePattern = null;
103:                pem_attrPattern = null;
104:                pem_valuePattern = null;
105:                pem_pathPattern = null;
106:            }
107:
108:            public boolean pcmf_setNodeExpr(String xExpr) {
109:                this .pem_regExpStr_Node = xExpr;
110:                if (xExpr == null || xExpr.equals(""))
111:                    this .pem_nodePattern = null;
112:                else
113:                    this .pem_nodePattern = Pattern
114:                            .compile(this .pem_regExpStr_Node);
115:
116:                if (this .pem_nodePattern != null)
117:                    return (true);
118:                else
119:                    return (false);
120:            }
121:
122:            public boolean pcmf_setAttrExpr(String xExpr) {
123:                this .pem_regExpStr_Attr = xExpr;
124:                if (xExpr == null || xExpr.equals(""))
125:                    this .pem_attrPattern = null;
126:                else
127:                    this .pem_attrPattern = Pattern
128:                            .compile(this .pem_regExpStr_Attr);
129:
130:                if (this .pem_attrPattern != null)
131:                    return (true);
132:                else
133:                    return (false);
134:            }
135:
136:            public boolean pcmf_setValueExpr(String xExpr) {
137:                this .pem_regExpStr_Value = xExpr;
138:                if (xExpr == null || xExpr.equals(""))
139:                    this .pem_valuePattern = null;
140:                else
141:                    this .pem_valuePattern = Pattern
142:                            .compile(this .pem_regExpStr_Value);
143:
144:                if (this .pem_valuePattern != null)
145:                    return (true);
146:                else
147:                    return (false);
148:            }
149:
150:            public boolean pcmf_setPathExpr(String xExpr) {
151:                this .pem_regExpStr_Path = xExpr;
152:
153:                if (xExpr == null || xExpr.equals(""))
154:                    this .pem_pathPattern = null;
155:                else
156:                    this .pem_pathPattern = Pattern
157:                            .compile(this .pem_regExpStr_Path);
158:
159:                if (this .pem_pathPattern != null)
160:                    return (true);
161:                else
162:                    return (false);
163:            }
164:
165:            public ArrayList pcmf_execQuery(IMoValueContainer xModel) {
166:                this .pem_model = xModel;
167:
168:                ArrayList l_res = new ArrayList();
169:                ArrayList l_all = new ArrayList();
170:
171:                Iterator l_itN = xModel.pcmf_getSubValueNameIt();
172:                Iterator l_itV = xModel.pcmf_getSubValueIt();
173:
174:                MoQueryNodeDescriptor l_desc = null;
175:                String l_path = "";
176:
177:                while (l_itN.hasNext()) {
178:                    l_desc = new MoQueryNodeDescriptor(l_itN.next().toString(),
179:                            l_path, (IMoValue) l_itV.next(), xModel);
180:                    l_all.add(l_desc);
181:
182:                    if (l_desc.pcm_value instanceof  IMoValueContainer)
183:                        this .pcmf_fillValueVect(
184:                                (IMoValueContainer) l_desc.pcm_value, l_all,
185:                                l_desc.pcm_name);
186:                }
187:
188:                Iterator l_allIt = l_all.iterator();
189:                boolean l_ok1 = false;
190:                boolean l_ok2 = false;
191:                boolean l_ok3 = false;
192:                boolean l_ok4 = false;
193:
194:                while (l_allIt.hasNext()) {
195:                    l_desc = (MoQueryNodeDescriptor) l_allIt.next();
196:                    if (this .pem_nodePattern != null) {
197:                        if (l_desc.pcm_value instanceof  IMoValueContainer) {
198:                            if (this .pem_nodePattern.matcher(l_desc.pcm_name)
199:                                    .matches())
200:                                l_ok1 = true;
201:                        }
202:                    } else
203:                        l_ok1 = true;
204:
205:                    if (this .pem_attrPattern != null) {
206:                        if (l_desc.pcm_value instanceof  IMoValueContainer == false) {
207:                            if (this .pem_attrPattern.matcher(l_desc.pcm_name)
208:                                    .matches())
209:                                l_ok2 = true;
210:                        }
211:                    } else
212:                        l_ok2 = true;
213:
214:                    if (this .pem_valuePattern != null) {
215:                        if (l_desc.pcm_value instanceof  IMoSingleValue) {
216:                            if (this .pem_valuePattern.matcher(
217:                                    ((IMoSingleValue) l_desc.pcm_value)
218:                                            .pcmf_getValue().toString())
219:                                    .matches())
220:                                l_ok3 = true;
221:                        }
222:                    } else
223:                        l_ok3 = true;
224:
225:                    if (this .pem_pathPattern != null) {
226:                        if (this .pem_pathPattern.matcher(l_desc.pcm_path)
227:                                .matches())
228:                            l_ok4 = true;
229:                    } else
230:                        l_ok4 = true;
231:
232:                    if (l_ok1 && l_ok2 && l_ok3 && l_ok4)
233:                        l_res.add(l_desc);
234:
235:                    l_ok1 = false;
236:                    l_ok2 = false;
237:                    l_ok3 = false;
238:                    l_ok4 = false;
239:                }
240:                this .pem_result = l_res;
241:
242:                return (l_res);
243:            };
244:
245:            public ArrayList pcmf_fillValueVect(IMoValueContainer xModel,
246:                    ArrayList xAll, String xPath) {
247:                Iterator l_itN = null;
248:                Iterator l_itV = null;
249:
250:                l_itN = xModel.pcmf_getSubValueNameIt();
251:                l_itV = xModel.pcmf_getSubValueIt();
252:
253:                MoQueryNodeDescriptor l_desc = null;
254:
255:                while (l_itN.hasNext()) {
256:                    l_desc = new MoQueryNodeDescriptor(l_itN.next().toString(),
257:                            xPath, (IMoValue) l_itV.next(), xModel);
258:                    xAll.add(l_desc);
259:                    if (l_desc.pcm_value instanceof  IMoValueContainer)
260:                        this .pcmf_fillValueVect(
261:                                (IMoValueContainer) l_desc.pcm_value, xAll,
262:                                xPath + "/" + l_desc.pcm_name);
263:                }
264:
265:                return (xAll);
266:            };
267:
268:            public Object pcmf_getObj(int xId) throws Exception {
269:                if (this .pem_result == null)
270:                    return (null);
271:
272:                return (this .pem_result.get(xId));
273:            }
274:
275:            public String pcmf_getString(int xId) throws Exception {
276:                if (this .pem_result == null)
277:                    return (null);
278:
279:                return (this .pem_result.get(xId).toString());
280:            }
281:
282:            public void pcmf_reload() throws Exception {
283:                this.pcmf_execQuery(this.pem_model);
284:
285:                return;
286:            };
287:
288:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.