Source Code Cross Referenced for ReportViewBuilder.java in  » Report » jmagallanes-1.0 » com » calipso » reportgenerator » common » 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 » jmagallanes 1.0 » com.calipso.reportgenerator.common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.reportgenerator.common;
002:
003:        import com.calipso.reportgenerator.reportdefinitions.*;
004:        import com.calipso.reportgenerator.reportdefinitions.types.DimensionPropertyOrderType;
005:        import com.calipso.reportgenerator.reportdefinitions.types.DimensionPropertyLocationType;
006:        import com.calipso.reportgenerator.reportdefinitions.types.DimensionDefinitionOrderType;
007:
008:        import java.util.Map;
009:        import java.util.Iterator;
010:        import java.util.Date;
011:        import java.util.List;
012:        import java.text.SimpleDateFormat;
013:
014:        /**
015:         * Calipso Software
016:         * User: jbassino
017:         * Date: 02-dic-2005
018:         * Time: 15:02:54
019:         */
020:        public class ReportViewBuilder {
021:            public static ViewParameterValues getViewParameterValues(
022:                    Map paramValues) {
023:                paramValues = ReportMap.setParametersToSimpleType(paramValues);
024:                ViewParameterValues values = new ViewParameterValues();
025:                Iterator it = paramValues.entrySet().iterator();
026:                while (it.hasNext()) {
027:                    Map.Entry entry = (Map.Entry) it.next();
028:                    ViewParameterValue param = new ViewParameterValue();
029:                    param.setViewParamName(entry.getKey().toString());
030:                    if (entry.getValue() instanceof  Date) {
031:                        SimpleDateFormat format = new SimpleDateFormat(
032:                                "yyyyMMdd");
033:                        param.setViewParamValue(format.format(((Date) entry
034:                                .getValue())));
035:                    } else {
036:                        param.setViewParamValue(entry.getValue().toString());
037:                    }
038:                    values.addViewParameterValue(param);
039:                }
040:                return values;
041:            }
042:
043:            public static ReportView getDefaultReportViewHeader(String ID,
044:                    String userID, String description, ReportResult reportResult) {
045:                ReportView reportView = new ReportView();
046:                reportView.setId(ID);
047:                reportView.setUserName(userID);
048:                reportView.setUserID(userID);
049:                reportView.setVisibleTotals(reportResult.getReportSpec()
050:                        .isVisibleTotals());
051:                reportView.setReportDefinitionId(reportResult.getReportSpec()
052:                        .getDefinitionId());
053:                reportView.setViewParameterValues(ReportViewBuilder
054:                        .getViewParameterValues(reportResult.getParamValues()));
055:                reportView.setDescription(description);
056:                //reportView.setDefault();
057:                return reportView;
058:            }
059:
060:            public static ReportView getDefaultReportView(String ID,
061:                    String userID, String description, ReportResult reportResult) {
062:                ReportView reportView = getDefaultReportViewHeader(ID, userID,
063:                        description, reportResult);
064:                buildDimensionsProperties(reportView, reportResult);
065:                buildMetricsProperties(reportView, reportResult);
066:                return reportView;
067:            }
068:
069:            private static void buildDimensionsProperties(
070:                    ReportView reportView, ReportResult reportResult) {
071:                List dimensions = reportResult.getReportQuery().getDimensions();
072:                DimensionProperties dimensionsProperties = new DimensionProperties();
073:                reportView.setDimensionProperties(dimensionsProperties);
074:                DimensionProperty dimensionProperty;
075:                QueryDimension queryDimension;
076:                for (int i = 0; i < dimensions.size(); i++) {
077:                    queryDimension = (QueryDimension) dimensions.get(i);
078:                    dimensionProperty = new DimensionProperty();
079:                    dimensionsProperties
080:                            .addDimensionProperty(dimensionProperty);
081:                    dimensionProperty
082:                            .setDimensionName(queryDimension.getName());
083:                    dimensionProperty.setWidth(75);
084:                    dimensionProperty
085:                            .setOrder(getDimensionPropertyOrder(queryDimension
086:                                    .getOrder()));
087:                    dimensionProperty
088:                            .setLocation(getDimensionPropertyLocation(queryDimension
089:                                    .getLocation().toString()));
090:                    dimensionProperty.setUbication(queryDimension.getIndex());
091:                    dimensionProperty.setRankMetricName(queryDimension
092:                            .getRankMetricName());
093:                }
094:            }
095:
096:            private static void buildMetricsProperties(ReportView reportView,
097:                    ReportResult result) {
098:                List metrics = result.getReportQuery().getMetrics();
099:                MetricProperties metricProperties = new MetricProperties();
100:                reportView.setMetricProperties(metricProperties);
101:                MetricProperty metricProperty;
102:                QueryMetric queryMetric;
103:                for (int i = 0; i < metrics.size(); i++) {
104:                    queryMetric = (QueryMetric) metrics.get(i);
105:                    metricProperty = new MetricProperty();
106:                    metricProperties.addMetricProperty(metricProperty);
107:                    metricProperty.setMetricName(queryMetric.getName());
108:                    metricProperty.setVisible(queryMetric.getVisible());
109:                }
110:            }
111:
112:            public static DimensionPropertyOrderType getDimensionPropertyOrder(
113:                    DimensionDefinitionOrderType order) {
114:                if (order == null) {
115:                    return DimensionPropertyOrderType.A;
116:                } else {
117:                    if (order.toString().equalsIgnoreCase(
118:                            DimensionPropertyOrderType.A.toString())) {
119:                        return DimensionPropertyOrderType.A;
120:                    } else if (order.toString().equalsIgnoreCase(
121:                            DimensionPropertyOrderType.D.toString())) {
122:                        return DimensionPropertyOrderType.D;
123:                    }
124:                }
125:                return null;
126:            }
127:
128:            /**
129:             * Cnvierte un Location a otro Location del tipo destino
130:             * @param location
131:             * @return
132:             */
133:            public static DimensionPropertyLocationType getDimensionPropertyLocation(
134:                    String location) {
135:                if (location
136:                        .equalsIgnoreCase(DimensionPropertyLocationType.COLUMN
137:                                .toString())) {
138:                    return DimensionPropertyLocationType.COLUMN;
139:                } else if (location
140:                        .equalsIgnoreCase(DimensionPropertyLocationType.PAGE
141:                                .toString())) {
142:                    return DimensionPropertyLocationType.PAGE;
143:                } else if (location
144:                        .equalsIgnoreCase(DimensionPropertyLocationType.ROW
145:                                .toString())) {
146:                    return DimensionPropertyLocationType.ROW;
147:                }
148:                return null;
149:            }
150:
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.