Source Code Cross Referenced for ConsoleMacroServlet.java in  » Workflow-Engines » JFolder » org » jfolder » console » web » admin » macro » studio » 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 » JFolder » org.jfolder.console.web.admin.macro.studio 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.console.web.admin.macro.studio;
009:
010:        //base classes
011:        import java.io.ByteArrayInputStream;
012:        import java.io.IOException;
013:        import java.util.ArrayList;
014:        import javax.servlet.ServletException;
015:        import javax.xml.parsers.ParserConfigurationException;
016:        import org.w3c.dom.Document;
017:        import org.xml.sax.SAXException;
018:
019:        //project specific classes
020:        import org.jfolder.common.UnexpectedSystemException;
021:        import org.jfolder.common.files.VirtualFileSystemFile;
022:        import org.jfolder.common.files.VirtualFileSystemHolder;
023:        import org.jfolder.common.tagging.ConceptRollupTag;
024:        import org.jfolder.common.tagging.ConceptTag;
025:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
026:        import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
027:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
028:        import org.jfolder.common.tagging.ConceptTagPreferences;
029:        import org.jfolder.common.tagging.ConceptTagSetContext;
030:        import org.jfolder.common.tagging.ConceptTagSetHolder;
031:        import org.jfolder.common.tagging.RootConceptTagHolder;
032:        import org.jfolder.common.utils.misc.MiscHelper;
033:        import org.jfolder.common.utils.web.ParameterSet;
034:        import org.jfolder.common.utils.xml.XMLHelper;
035:        import org.jfolder.common.web.template.ConsoleParameterContext;
036:        import org.jfolder.common.web.template.PageSetupContext;
037:        import org.jfolder.common.web.template.SubmitActionContext;
038:        import org.jfolder.common.web.template.SubmitActionParameters;
039:        import org.jfolder.console.base.BaseRcthStudioServlet;
040:        import org.jfolder.console.base.BaseRcthStudioSettings;
041:        import org.jfolder.console.base.ConsolePageContext;
042:        import org.jfolder.console.base.ConsolePageSession;
043:        import org.jfolder.console.macro.ConsoleMacroTagHelper;
044:        import org.jfolder.project.model.ProjectSystem;
045:        import org.jfolder.security.model.UserHolder;
046:        import org.jfolder.security.model.UserIdentity;
047:
048:        //other classes
049:
050:        public class ConsoleMacroServlet extends BaseRcthStudioServlet {
051:
052:            public ConsoleMacroServlet() {
053:            }
054:
055:            protected boolean checkAccess(ConsolePageSession inCps)
056:                    throws IOException, ServletException {
057:
058:                boolean outValue = false;
059:
060:                outValue = (inCps.isAdministrator());
061:
062:                return outValue;
063:            }
064:
065:            public ConsolePageContext subProcess(ConsolePageSession inCps,
066:                    UserHolder inUser, ParameterSet inPs,
067:                    SubmitActionContext inSac, BaseRcthStudioSettings inBrss)
068:                    throws IOException, ServletException {
069:
070:                //
071:
072:                ConsoleMacroContext outValue = null;
073:
074:                String currentHighlightHandle = null;
075:                //
076:                Boolean currentTreeDeleteNotAdd = null;
077:                String currentTreeHandle = null;
078:                //
079:                byte binaryContent[] = null;
080:                String binaryContentName = null;
081:                String binaryContentMimeType = null;
082:
083:                if (inSac.isAction(SubmitActionParameters.OPEN)) {
084:                    //String appType = inSac.getFirstParameter();
085:                    //String appName = inSac.getSecondParameter();
086:                    //String fileType = inSac.getThirdParameter();
087:                    //String directory = inSac.getFourthParameter();
088:                    //String fileName = inSac.getFifthParameter();
089:                    //
090:                    inCps.getMessageHolder().setInformationHeader("Welcome");
091:                    //
092:                    //ProjectSystem projectSystem =
093:                    //    inCs.getProjectSystem(appType, appName);
094:                    //
095:                    //VirtualFileSystemHolder pageVsh = projectSystem.getWebPages();
096:                    //
097:                    //VirtualFileSystemHolder localVsh =
098:                    //    pageVsh.getOrCreateAbsoluteDirectory(directory);
099:                    //
100:                    //VirtualFileSystemFile localPage = localVsh.getFile(fileName);
101:                    //byte pageContent[] = localPage.getContent();
102:                    //
103:                    RootConceptTagHolder localRcth = ConsoleMacroTagHelper
104:                            .getEmptyMacro();
105:                    //    ConceptRollupTag.getRootHolderFromList(pageContent);
106:                    MiscHelper
107:                            .println("ConMacServ localRcth.isErrorPresent() = "
108:                                    + localRcth.isErrorPresent());
109:                    localRcth.validate();
110:                    //
111:                    inCps.setCurrentApplication(null, "ConsoleMacro.zip", null,
112:                            null, null, localRcth, null, null);
113:                    //
114:                } else if (inSac.isAction(SubmitActionParameters.DO_NOTHING)) {
115:                } else if (inSac.isAction(SubmitActionParameters.IMPORT)) {
116:                    //
117:                    String fileSource = inSac
118:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
119:                    byte fileContent[] = inPs.getParameterAsUpload(fileSource);
120:                    String fileName = inPs.getUploadParameterName(fileSource);
121:                    //
122:                    RootConceptTagHolder localRcth = ConceptRollupTag
123:                            .getRootHolderFromList(fileContent);
124:                    //
125:                    inCps.setCurrentApplication(null, fileName, null, null,
126:                            null, localRcth, null, null);
127:                } else if (inSac.isAction(SubmitActionParameters.EXPORT)) {
128:                    binaryContent = ConceptRollupTag.getRollupFromList(inCps
129:                            .getCurrentApplicationRootHolder(), null);
130:                    binaryContentName = inCps.getCurrentApplicationName();
131:                    binaryContentMimeType = "application/download";
132:                } else if (inSac.isAction(SubmitActionParameters.ADD,
133:                        SubmitActionParameters.CONCEPT_TAG)) {
134:                    //
135:                    //
136:                    accountForRcthTextChanges(inCps, inPs);
137:                    //
138:                    //
139:                    String parentCode = inSac
140:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
141:                    int addIndex = Integer
142:                            .parseInt(inSac
143:                                    .getParameter(ConsoleParameterContext.SECOND_INPUT));
144:                    //
145:                    String ctNs = inSac
146:                            .getParameter(ConsoleParameterContext.THIRD_INPUT);
147:                    if (ctNs.length() == 0) {
148:                        ctNs = null;
149:                    }
150:                    String ctName = inSac
151:                            .getParameter(ConsoleParameterContext.FOURTH_INPUT);
152:                    //
153:                    RootConceptTagHolder localRcth = inCps
154:                            .getCurrentApplicationRootHolder();
155:                    ConceptTagCharacteristic localCtchar = localRcth
156:                            .getCharacteristic(parentCode);
157:                    //
158:                    ConceptTagPreferences localCtp = localRcth.getPreferences();
159:                    //
160:                    ConceptTagSetHolder ctsh = localCtp.getSetHolder();
161:                    Class ctClass = ctsh.getConceptTagClass(ctNs, ctName);
162:                    ConceptTag ct = (ConceptTag) MiscHelper
163:                            .newInstance(ctClass);
164:                    //
165:                    localCtchar.addValue(addIndex, ct, false);
166:                    //boolean localValidate = localCtp//
167:                    //localRcth
168:                    localRcth.validate();
169:                    //
170:                    //
171:                    //
172:                    currentTreeHandle = parentCode
173:                            + localCtp.getHandleConjunction() + addIndex;
174:                    currentTreeDeleteNotAdd = new Boolean(false);
175:                    //outValue.adjustNumericHandleWithCommonStems(
176:                    //    fullHandle, inSac.getCommonStems(), false, localCtp);
177:                } else if (inSac.isAction(SubmitActionParameters.REPLACE,
178:                        SubmitActionParameters.CONCEPT_TAG)) {
179:                    //
180:                    //
181:                    accountForRcthTextChanges(inCps, inPs);
182:                    //
183:                    //
184:                    String parentCode = inSac
185:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
186:                    int addIndex = Integer
187:                            .parseInt(inSac
188:                                    .getParameter(ConsoleParameterContext.SECOND_INPUT));
189:                    //
190:                    String ctNs = inSac
191:                            .getParameter(ConsoleParameterContext.THIRD_INPUT);
192:                    if (ctNs.length() == 0) {
193:                        ctNs = null;
194:                    }
195:                    String ctName = inSac
196:                            .getParameter(ConsoleParameterContext.FOURTH_INPUT);
197:                    //
198:                    RootConceptTagHolder localRcth = inCps
199:                            .getCurrentApplicationRootHolder();
200:                    ConceptTagCharacteristic localCtchar = localRcth
201:                            .getCharacteristic(parentCode);
202:                    //
203:                    ConceptTagPreferences localCtp = localRcth.getPreferences();
204:                    //
205:                    ConceptTagSetHolder ctsh = localCtp.getSetHolder();
206:                    Class ctClass = ctsh.getConceptTagClass(ctNs, ctName);
207:                    ConceptTag ct = (ConceptTag) MiscHelper
208:                            .newInstance(ctClass);
209:                    //
210:                    localCtchar.replaceValueAndRemoveLocalFiles(addIndex, ct,
211:                            false);
212:                    //boolean localValidate = localCtp//
213:                    //localRcth
214:                    localRcth.validate();
215:                    //
216:                    //
217:                    //
218:                    currentTreeHandle = parentCode
219:                            + localCtp.getHandleConjunction() + addIndex;
220:                    currentTreeDeleteNotAdd = null;
221:                    //outValue.adjustNumericHandleWithCommonStems(
222:                    //    fullHandle, inSac.getCommonStems(), false, localCtp);
223:                } else if (inSac.isAction(SubmitActionParameters.ADD,
224:                        SubmitActionParameters.TEXT)) {
225:                    //
226:                    //
227:                    accountForRcthTextChanges(inCps, inPs);
228:                    //
229:                    //
230:                    String parentCode = inSac
231:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
232:                    int addIndex = Integer
233:                            .parseInt(inSac
234:                                    .getParameter(ConsoleParameterContext.SECOND_INPUT));
235:                    //
236:                    String value = inSac
237:                            .getParameter(ConsoleParameterContext.THIRD_INPUT);
238:                    //
239:                    RootConceptTagHolder localRcth = inCps
240:                            .getCurrentApplicationRootHolder();
241:                    ConceptTagCharacteristic localCtchar = localRcth
242:                            .getCharacteristic(parentCode);
243:                    //
244:                    ConceptTagPreferences localCtp = localRcth.getPreferences();
245:                    //
246:                    //
247:                    localCtchar.addValue(addIndex, value);
248:                    localRcth.validate();
249:                    //
250:                    //
251:                    //
252:                    currentTreeHandle = parentCode
253:                            + localCtp.getHandleConjunction() + addIndex;
254:                    currentTreeDeleteNotAdd = new Boolean(false);
255:                    //outValue.adjustNumericHandleWithCommonStems(
256:                    //    fullHandle, inSac.getCommonStems(), false, localCtp);
257:                } else if (inSac.isAction(SubmitActionParameters.REPLACE,
258:                        SubmitActionParameters.TEXT)) {
259:                    //
260:                    //
261:                    accountForRcthTextChanges(inCps, inPs);
262:                    //
263:                    //
264:                    String parentCode = inSac
265:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
266:                    int addIndex = Integer
267:                            .parseInt(inSac
268:                                    .getParameter(ConsoleParameterContext.SECOND_INPUT));
269:                    //
270:                    String value = inSac
271:                            .getParameter(ConsoleParameterContext.THIRD_INPUT);
272:                    //
273:                    RootConceptTagHolder localRcth = inCps
274:                            .getCurrentApplicationRootHolder();
275:                    ConceptTagCharacteristic localCtchar = localRcth
276:                            .getCharacteristic(parentCode);
277:                    //
278:                    ConceptTagPreferences localCtp = localRcth.getPreferences();
279:                    //
280:                    //
281:                    localCtchar
282:                            .replaceValueAndRemoveLocalFiles(addIndex, value);
283:                    localRcth.validate();
284:                    //
285:                    //
286:                    //
287:                    currentTreeHandle = parentCode
288:                            + localCtp.getHandleConjunction() + addIndex;
289:                    currentTreeDeleteNotAdd = null;
290:                    //outValue.adjustNumericHandleWithCommonStems(
291:                    //    fullHandle, inSac.getCommonStems(), false, localCtp);
292:                } else if (inSac.isAction(SubmitActionParameters.SAVE)) {
293:
294:                    throw UnexpectedSystemException.notImplemented();
295:                    //byte localRcthContent[] = ConceptRollupTag.getRollupFromList(
296:                    //    inCs.getCurrentApplicationRootHolder(), null);
297:                    //
298:                    //ProjectSystem projectSystem =
299:                    //    inCs.getCurrentApplicationProjectSystem();
300:                    ////
301:                    //VirtualFileSystemHolder pageVsh = projectSystem.getWebPages();
302:                    ////
303:                    //VirtualFileSystemHolder localVsh =
304:                    //    pageVsh.getOrCreateAbsoluteDirectory(
305:                    //        inCs.getCurrentApplicationWebDocDirectory());
306:                    //
307:                    //byte localOrigContent[] =
308:                    //    localVsh.getFile(
309:                    //        inCs.getCurrentApplicationWebDocFile()).getContent();
310:                    //RootConceptTagHolder localOrigRcth =
311:                    //    ConceptRollupTag.getRootHolderFromList(localOrigContent);
312:                    //MiscHelper.println("DevWebPagSer dir = "
313:                    //    + inCs.getCurrentApplicationWebDocDirectory());
314:                    //MiscHelper.println("DevWebPagSer file = "
315:                    //    + inCs.getCurrentApplicationWebDocFile());
316:                    //MiscHelper.println("DevWebPagSer origContentLength = "
317:                    //    + localOrigContent.length);
318:                    //MiscHelper.println("DevWebPagSer currContentLength = "
319:                    //    + localRcthContent.length);
320:                    //MiscHelper.println("DevWebPagSer origContent = "
321:                    //    + localOrigRcth.getXMLRepresentation());
322:                    //MiscHelper.println("DevWebPagSer currContent = "
323:                    //+ inCs.getCurrentApplicationRootHolder().getXMLRepresentation());
324:                    //
325:                    //localVsh.updateFile(
326:                    //    inCs.getCurrentApplicationWebDocFile(), localRcthContent);
327:                    //
328:                    //UserIdentity ui = inCs.getUserHolder().getUserIdentity();
329:                    //saveProjectSystem(projectSystem, ui);
330:                } else if (inSac.isAction(SubmitActionParameters.MOVE)) {
331:                    currentHighlightHandle = inSac
332:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
333:                    //inCs.setCurrentApplication()
334:                    accountForRcthTextChanges(inCps, inPs);
335:                }
336:                //else if (commonActions(inCs, inUser, inPs, inSac)) {
337:                //    //MiscHelper.println("common actions executed");
338:                //}
339:                //else if (inSac.isAction(SubmitActionParameters.OPEN)) {
340:                //    
341:                //    inCs.setStudioFrameState(
342:                //        BaseStudioFrameServlet.HIGH_LEVEL_MODE);
343:                //    
344:                //    String appName = inSac.getFirstParameter();
345:                //    inCs.setOpenApplication(appName);
346:                //    
347:                //    //ProjectApplicationSet was = inCs.getProjectApplicationSet();
348:                //    ProjectSystem wa = inCs.getUserProjectSystem(appName);
349:                //    //ProjectScript ws = wa.getScript();
350:                //    ////MiscHelper.println();
351:                //    //String content = ws.getContent();
352:                //    ////MiscHelper.println("CONTENT = " + content);
353:                //    //Document doc = XMLHelper.loadDocument(content);
354:                //    //RootConceptTagHolder rsth =
355:                //    //    WorkflowTemplateTagHelper.getRootConceptTagHolder(
356:                //    //        doc, null, null, ws.getName());
357:                //    //
358:                //    ////MiscHelper.println("ValueLength = "
359:                //    ////    
360:                //+ rsth.getConceptTagCharacteristic().getValueLength());
361:                //    ////MiscHelper.println("Frame,rsth = " + rsth);
362:                //    //inCs.setRootHolder(rsth);
363:                //    
364:                //    //MiscHelper.println(
365:                //"WebStudioFrame Remove following statement"
366:                //    //    + (new java.util.Date()));
367:                //    //for (int i = 0; i < 100; i++) {
368:                //    //    rsth.revalidate();
369:                //    //}
370:                //    //MiscHelper.println(
371:                //"WebStudioFrame Remove previous statement"
372:                //    //    + (new java.util.Date()));
373:                //}
374:                //else if (inSac.isAction(SubmitActionParameters.UPDATE,
375:                //    SubmitActionParameters.COORDINATES)) {
376:                //    
377:                //    //MiscHelper.println("PARAMETER1 = "
378:                //    //    + inSac.getFirstParameter());
379:                //    //MiscHelper.println("PARAMETER2 = "
380:                //    //    + inSac.getSecondParameter());
381:                //    //MiscHelper.println("PARAMETER3 = "
382:                //    //+ inSac.getThirdParameter());
383:                //    
384:                //    processDeltaCoorAction(
385:                //        inCs.getRootHolder(), inSac.getFirstParameter(),
386:                //        Integer.parseInt(inSac.getSecondParameter()),
387:                //        Integer.parseInt(inSac.getThirdParameter()));
388:                //}
389:                else {
390:                    inSac.unknownAction();
391:                }
392:
393:                //
394:                outValue = ConsoleMacroContext.newInstance(inCps);
395:                //
396:                if (currentHighlightHandle != null) {
397:                    outValue.setHighlightHandle(currentHighlightHandle);
398:                }
399:                //
400:                if (currentTreeHandle != null) {
401:                    RootConceptTagHolder localRcth = inCps
402:                            .getCurrentApplicationRootHolder();
403:                    ConceptTagPreferences localCtp = localRcth.getPreferences();
404:                    //
405:                    if (currentTreeDeleteNotAdd != null) {
406:                        outValue.adjustNumericHandleWithCommonStems(
407:                                currentTreeHandle, inSac.getCommonStems(),
408:                                currentTreeDeleteNotAdd.booleanValue(),
409:                                localCtp);
410:                    } else {
411:                        outValue.adjustNumericHandleWithCommonStems(
412:                                currentTreeHandle, inSac.getCommonStems(),
413:                                false, localCtp);
414:                        outValue.adjustNumericHandleWithCommonStems(
415:                                currentTreeHandle, inSac.getCommonStems(),
416:                                true, localCtp);
417:                    }
418:                }
419:                //
420:                if (binaryContent != null && binaryContentName != null
421:                        && binaryContentMimeType != null) {
422:                    outValue.setOutputText(false);
423:                    outValue.getOutputStream().write(binaryContent, 0,
424:                            binaryContent.length);
425:                    outValue.setOutputFileName(binaryContentName);
426:                    outValue.setMimeType(binaryContentMimeType);
427:                }
428:
429:                return outValue;
430:            }
431:
432:            protected void saveChanges(ConsolePageSession inCps,
433:                    UserHolder inUser, ParameterSet inPs,
434:                    SubmitActionContext inSac) {
435:                //
436:                throw UnexpectedSystemException.notImplemented();
437:            }
438:        }
ww__w_.j___a_v__a2___s___.___c_o___m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.