Source Code Cross Referenced for FormImportHandler.java in  » Groupware » LibreSource » org » libresource » form » 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 » Groupware » LibreSource » org.libresource.form 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * LibreSource Community
003:         * Copyright (C) 2004-2007 Artenum SARL / INRIA
004:         * http://www.libresource.org - contact@artenum.com
005:         *
006:         * This software is not a free software; you can modify it under the
007:         * LibreSource Enterprise user license but you can't redistribute it.
008:         * See licenses details in LSE-user-license.txt 
009:         *
010:         * Initial authors :
011:         *
012:         * Guillaume Bort / INRIA
013:         * Francois Charoy / Universite Nancy 2
014:         * Julien Forest / Artenum
015:         * Claude Godart / Universite Henry Poincare
016:         * Florent Jouille / INRIA
017:         * Sebastien Jourdain / INRIA / Artenum
018:         * Yves Lerumeur / Artenum
019:         * Pascal Molli / Universite Henry Poincare
020:         * Gerald Oster / INRIA
021:         * Mariarosa Penzi / Artenum
022:         * Gerard Sookahet / Artenum
023:         * Raphael Tani / INRIA
024:         *
025:         * Contributors :
026:         *
027:         * Stephane Bagnier / Artenum
028:         * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
029:         */package org.libresource.form;
030:
031:        import org.libresource.Libresource;
032:
033:        import org.libresource.form.interfaces.LibresourceFormService;
034:
035:        import org.libresource.xml.ImportExportLogger;
036:        import org.libresource.xml.LibresourceImportHandler;
037:
038:        import org.xml.sax.Attributes;
039:
040:        import sun.misc.BASE64Decoder;
041:
042:        import java.io.ByteArrayInputStream;
043:        import java.io.ObjectInputStream;
044:
045:        import java.net.URI;
046:
047:        import java.util.Vector;
048:
049:        /**
050:         * Artenum Contribution
051:         *
052:         * @author <a href="mailto:jourdain@artenum.com">Sebastien Jourdain</a> - <a
053:         *         href="http://www.artenum.com">Artenum</a>
054:         */
055:        public class FormImportHandler extends LibresourceImportHandler {
056:            private URI node;
057:            private String name;
058:            private String description;
059:            private String resourceTypeToCreate;
060:            private String destination;
061:            private String redirect;
062:            private Vector fields;
063:            private boolean enteredInDefinition = false;
064:            private StringBuffer tmpContent;
065:            private LibresourceFormService libresourceFormService;
066:
067:            public void handleBeginElement(String name, Attributes attributes,
068:                    ImportExportLogger logger) throws Exception {
069:                if (name.equals("form:form")) {
070:                    enteredInDefinition = true;
071:                }
072:
073:                if (name.equals("form:name")) {
074:                    tmpContent = new StringBuffer();
075:                }
076:
077:                if (name.equals("form:description")) {
078:                    tmpContent = new StringBuffer();
079:                }
080:
081:                if (name.equals("form:resourceTypeToCreate")) {
082:                    tmpContent = new StringBuffer();
083:                }
084:
085:                if (name.equals("form:destination")) {
086:                    tmpContent = new StringBuffer();
087:                }
088:
089:                if (name.equals("form:redirect")) {
090:                    tmpContent = new StringBuffer();
091:                }
092:
093:                if (name.equals("form:fields")) {
094:                    tmpContent = new StringBuffer();
095:                }
096:            }
097:
098:            public boolean handleEndElement(String name,
099:                    ImportExportLogger logger) throws Exception {
100:                if (name.equals("form:form")) {
101:                    enteredInDefinition = false;
102:                    libresourceFormService.createForm(node, this .name);
103:                    libresourceFormService.editForm(node, this .name,
104:                            description, destination, resourceTypeToCreate,
105:                            redirect);
106:
107:                    // FIXME
108:                    libresourceFormService.setFormFields(node, fields);
109:
110:                    return true;
111:                }
112:
113:                if (name.equals("form:name")) {
114:                    this .name = tmpContent.toString().trim();
115:
116:                    return false;
117:                }
118:
119:                if (name.equals("form:description")) {
120:                    this .description = tmpContent.toString().trim();
121:
122:                    return false;
123:                }
124:
125:                if (name.equals("form:destination")) {
126:                    this .destination = tmpContent.toString().trim();
127:
128:                    return false;
129:                }
130:
131:                if (name.equals("form:resourceTypeToCreate")) {
132:                    this .resourceTypeToCreate = tmpContent.toString().trim();
133:
134:                    return false;
135:                }
136:
137:                if (name.equals("form:redirect")) {
138:                    this .redirect = tmpContent.toString().trim();
139:
140:                    return false;
141:                }
142:
143:                if (name.equals("form:fields")) {
144:                    ObjectInputStream stream = new ObjectInputStream(
145:                            new ByteArrayInputStream(new BASE64Decoder()
146:                                    .decodeBuffer(tmpContent.toString().trim())));
147:                    this .fields = (Vector) stream.readObject();
148:                    stream.close();
149:
150:                    return false;
151:                }
152:
153:                // FIXME fields
154:                return false;
155:            }
156:
157:            public void handleContent(String content, ImportExportLogger logger)
158:                    throws Exception {
159:                if (tmpContent != null) {
160:                    tmpContent.append(content);
161:                }
162:            }
163:
164:            public void init(URI node, ImportExportLogger logger)
165:                    throws Exception {
166:                this .node = node;
167:                enteredInDefinition = false;
168:                tmpContent = null;
169:                libresourceFormService = (LibresourceFormService) Libresource
170:                        .getService(FormConstants.SERVICE);
171:            }
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.