Source Code Cross Referenced for SubReportParameters.java in  » Report » pentaho-report » org » pentaho » reportdesigner » crm » report » 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 » Report » pentaho report » org.pentaho.reportdesigner.crm.report.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-2007 Pentaho Corporation.  All rights reserved.
003:         * This software was developed by Pentaho Corporation and is provided under the terms
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005:         * this file except in compliance with the license. If you need a copy of the license,
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
007:         *
008:         * Software distributed under the Mozilla Public License is distributed on an "AS IS"
009:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to
010:         * the license for the specific language governing your rights and limitations.
011:         *
012:         * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
013:         */
014:        package org.pentaho.reportdesigner.crm.report.model;
015:
016:        import org.gjt.xpp.XmlPullNode;
017:        import org.jetbrains.annotations.NotNull;
018:        import org.pentaho.reportdesigner.crm.report.PropertyKeys;
019:        import org.pentaho.reportdesigner.lib.common.xml.XMLConstants;
020:        import org.pentaho.reportdesigner.lib.common.xml.XMLContext;
021:        import org.pentaho.reportdesigner.lib.common.xml.XMLExternalizable;
022:        import org.pentaho.reportdesigner.lib.common.xml.XMLUtils;
023:        import org.pentaho.reportdesigner.lib.common.xml.XMLWriter;
024:
025:        import java.io.IOException;
026:        import java.util.ArrayList;
027:        import java.util.HashMap;
028:
029:        /**
030:         * User: Martin
031:         * Date: 17.02.2007
032:         * Time: 15:19:26
033:         */
034:        public class SubReportParameters implements  XMLExternalizable {
035:            private boolean globalImport;
036:            private boolean globalExport;
037:            @NotNull
038:            private HashMap<String, SubReportParameter> importParameters;
039:            @NotNull
040:            private HashMap<String, SubReportParameter> exportParameters;
041:
042:            public SubReportParameters() {
043:                importParameters = new HashMap<String, SubReportParameter>();
044:                exportParameters = new HashMap<String, SubReportParameter>();
045:            }
046:
047:            public SubReportParameters(boolean globalImport, @NotNull
048:            ArrayList<SubReportParameter> importParameterList,
049:                    boolean globalExport, @NotNull
050:                    ArrayList<SubReportParameter> exportParameterList) {
051:                //noinspection ConstantConditions
052:                if (importParameterList == null) {
053:                    throw new IllegalArgumentException(
054:                            "importParameterList must not be null");
055:                }
056:                //noinspection ConstantConditions
057:                if (exportParameterList == null) {
058:                    throw new IllegalArgumentException(
059:                            "exportParameterList must not be null");
060:                }
061:
062:                this .globalExport = globalExport;
063:                this .globalImport = globalImport;
064:                importParameters = new HashMap<String, SubReportParameter>();
065:                for (SubReportParameter subReportParameter : importParameterList) {
066:                    importParameters.put(subReportParameter.getKey(),
067:                            subReportParameter);
068:                }
069:                exportParameters = new HashMap<String, SubReportParameter>();
070:                for (SubReportParameter subReportParameter : exportParameterList) {
071:                    exportParameters.put(subReportParameter.getKey(),
072:                            subReportParameter);
073:                }
074:            }
075:
076:            private SubReportParameters(@NotNull
077:            HashMap<String, SubReportParameter> importParameters, @NotNull
078:            HashMap<String, SubReportParameter> exportParameters,
079:                    boolean globalImport, boolean globalExport) {
080:                //noinspection ConstantConditions
081:                if (importParameters == null) {
082:                    throw new IllegalArgumentException(
083:                            "importParameters must not be null");
084:                }
085:                //noinspection ConstantConditions
086:                if (exportParameters == null) {
087:                    throw new IllegalArgumentException(
088:                            "exportParameters must not be null");
089:                }
090:                this .exportParameters = exportParameters;
091:                this .globalExport = globalExport;
092:                this .globalImport = globalImport;
093:                this .importParameters = importParameters;
094:            }
095:
096:            @NotNull
097:            public HashMap<String, SubReportParameter> getExportParameters() {
098:                return new HashMap<String, SubReportParameter>(exportParameters);
099:            }
100:
101:            @NotNull
102:            public SubReportParameters addExportParameters(@NotNull
103:            SubReportParameter parameter) {
104:                //noinspection ConstantConditions
105:                if (parameter == null) {
106:                    throw new IllegalArgumentException(
107:                            "parameter must not be null");
108:                }
109:                HashMap<String, SubReportParameter> parameters = getImportParameters();
110:                parameters.put(parameter.getKey(), parameter);
111:                return new SubReportParameters(importParameters, parameters,
112:                        globalImport, globalExport);
113:            }
114:
115:            public boolean isGlobalExport() {
116:                return globalExport;
117:            }
118:
119:            @NotNull
120:            public SubReportParameters setGlobalExport(boolean globalExport) {
121:                return new SubReportParameters(importParameters,
122:                        exportParameters, globalImport, globalExport);
123:            }
124:
125:            public boolean isGlobalImport() {
126:                return globalImport;
127:            }
128:
129:            @NotNull
130:            public SubReportParameters setGlobalImport(boolean globalImport) {
131:                return new SubReportParameters(importParameters,
132:                        exportParameters, globalImport, globalExport);
133:            }
134:
135:            @NotNull
136:            public HashMap<String, SubReportParameter> getImportParameters() {
137:                return new HashMap<String, SubReportParameter>(importParameters);
138:            }
139:
140:            @NotNull
141:            public SubReportParameters addImportParameter(@NotNull
142:            SubReportParameter parameter) {
143:                //noinspection ConstantConditions
144:                if (parameter == null) {
145:                    throw new IllegalArgumentException(
146:                            "parameter must not be null");
147:                }
148:                HashMap<String, SubReportParameter> parameters = getImportParameters();
149:                parameters.put(parameter.getKey(), parameter);
150:                return new SubReportParameters(parameters, exportParameters,
151:                        globalImport, globalExport);
152:            }
153:
154:            public void externalizeObject(@NotNull
155:            XMLWriter xmlWriter, @NotNull
156:            XMLContext xmlContext) throws IOException {
157:                xmlWriter.writeProperty(PropertyKeys.GLOBAL_IMPORT, Boolean
158:                        .toString(globalImport));
159:                xmlWriter.writeProperty(PropertyKeys.GLOBAL_EXPORT, Boolean
160:                        .toString(globalExport));
161:
162:                for (SubReportParameter styleExpression : importParameters
163:                        .values()) {
164:                    xmlWriter.startElement(PropertyKeys.IMPORT_PARAMETER);
165:                    styleExpression.externalizeObject(xmlWriter, xmlContext);
166:                    xmlWriter.closeElement(PropertyKeys.IMPORT_PARAMETER);
167:                }
168:
169:                for (SubReportParameter styleExpression : exportParameters
170:                        .values()) {
171:                    xmlWriter.startElement(PropertyKeys.EXPORT_PARAMETER);
172:                    styleExpression.externalizeObject(xmlWriter, xmlContext);
173:                    xmlWriter.closeElement(PropertyKeys.EXPORT_PARAMETER);
174:                }
175:            }
176:
177:            public void readObject(@NotNull
178:            XmlPullNode node, @NotNull
179:            XMLContext xmlContext) throws Exception {
180:                while (!node.isFinished()) {
181:                    Object childNodeList = node.readNextChild();
182:                    if (childNodeList instanceof  XmlPullNode) {
183:                        XmlPullNode child = (XmlPullNode) childNodeList;
184:
185:                        if (XMLConstants.PROPERTY.equals(child.getRawName())
186:                                && PropertyKeys.GLOBAL_IMPORT
187:                                        .equals(child
188:                                                .getAttributeValueFromRawName(XMLConstants.NAME))) {
189:                            globalImport = Boolean.valueOf(
190:                                    XMLUtils.readProperty(
191:                                            PropertyKeys.GLOBAL_IMPORT, child))
192:                                    .booleanValue();
193:                        } else if (XMLConstants.PROPERTY.equals(child
194:                                .getRawName())
195:                                && PropertyKeys.GLOBAL_EXPORT
196:                                        .equals(child
197:                                                .getAttributeValueFromRawName(XMLConstants.NAME))) {
198:                            globalExport = Boolean.valueOf(
199:                                    XMLUtils.readProperty(
200:                                            PropertyKeys.GLOBAL_EXPORT, child))
201:                                    .booleanValue();
202:                        } else if (PropertyKeys.IMPORT_PARAMETER.equals(child
203:                                .getRawName())) {
204:                            SubReportParameter subReportParameter = new SubReportParameter(
205:                                    "", "");
206:                            subReportParameter.readObject(child, xmlContext);
207:                            importParameters.put(subReportParameter.getKey(),
208:                                    subReportParameter);
209:                        } else if (PropertyKeys.EXPORT_PARAMETER.equals(child
210:                                .getRawName())) {
211:                            SubReportParameter subReportParameter = new SubReportParameter(
212:                                    "", "");
213:                            subReportParameter.readObject(child, xmlContext);
214:                            exportParameters.put(subReportParameter.getKey(),
215:                                    subReportParameter);
216:                        }
217:                    }
218:                }
219:            }
220:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.