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


001:        package com.calipso.reportgenerator.reportcalculator;
002:
003:        import com.calipso.reportgenerator.common.InfoException;
004:        import com.calipso.reportgenerator.common.LanguageTraslator;
005:
006:        import java.util.Iterator;
007:        import java.util.LinkedList;
008:        import java.util.Date;
009:        import java.util.Collection;
010:        import java.io.Serializable;
011:        import java.io.ObjectOutputStream;
012:        import java.io.IOException;
013:        import java.io.ObjectInputStream;
014:
015:        /**
016:         * Contiene la matriz de datos, administra el llenado de un Cube a partir
017:         *  de una CubeQuery y evalúa las acciones
018:         * @see Matrix
019:         * @see Cube
020:         */
021:        public class Pivot implements  Serializable {
022:
023:            protected Matrix matrix;
024:
025:            //private CubeQuery lastQuery;
026:
027:            /**
028:             * Devuelve la matriz
029:             * @return la matriz
030:             */
031:            public Matrix getMatrix() {
032:                return matrix;
033:            }
034:
035:            /**
036:             * Asigna una matriz
037:             * @param matrix
038:             */
039:            public void setMatrix(Matrix matrix) {
040:                this .matrix = matrix;
041:            }
042:
043:            /**
044:             * Llena el Cube
045:             * @param pivotClient
046:             * @throws InfoException Si se produce un erro al llenar el pivotClient
047:             */
048:            public void fill(PivotClient pivotClient) throws InfoException {
049:                try {
050:                    pivotClient.reset();
051:                    Iterator iterator;
052:                    System.out.println(LanguageTraslator.traslate("492")
053:                            + new Date());
054:                    iterator = matrix.iterator();
055:                    try {
056:                        while (iterator.hasNext()) {
057:                            pivotClient.fillWith((Object[]) iterator.next());
058:                        }
059:                        System.out.println(LanguageTraslator.traslate("493")
060:                                + new Date());
061:                        pivotClient.afterFill();
062:                    } catch (Exception e) {
063:                        throw new InfoException(
064:                                com.calipso.reportgenerator.common.LanguageTraslator
065:                                        .traslate("105"), e);
066:                    }
067:                } catch (OutOfMemoryError e) {
068:                    throw new InfoException(
069:                            com.calipso.reportgenerator.common.LanguageTraslator
070:                                    .traslate("326"), e);
071:                }
072:            }
073:
074:            /**
075:             * Resuelve la ejecución de una acción devolviendo todos los rows asociados
076:             * @param action
077:             * @param cube
078:             * @param metric
079:             * @param dimensions
080:             * @param values
081:             * @return Object
082:             */
083:            public Object executeAction(CubeAction action, Cube cube,
084:                    int metric, int[] dimensions, Object[] values)
085:                    throws InfoException {
086:                LinkedList involved;
087:                Object[] row;
088:
089:                involved = new LinkedList();
090:                Iterator iterator;
091:
092:                iterator = matrix.iterator();
093:                while (iterator.hasNext()) {
094:                    row = (Object[]) iterator.next();
095:                    if (matches(row, cube, dimensions, values)) {
096:                        involved.add(row);
097:                    }
098:                }
099:                return action.executeOn(involved, cube, metric, dimensions,
100:                        values);
101:            }
102:
103:            /**
104:             * Resuelve si una row cumple con los filtros de la query
105:             * @param row
106:             * @param cube
107:             * @param dimensions
108:             * @param values
109:             * @return true si cumple con los filtros
110:             */
111:            private boolean matches(Object[] row, Cube cube, int[] dimensions,
112:                    Object[] values) {
113:                int index;
114:                int lenght;
115:                int dimension;
116:                Object value;
117:
118:                if (cube.getQuery().matches(row)
119:                        && cube.getQuery().valuesEnabled(row)) {
120:                    lenght = dimensions.length;
121:                    for (index = 0; index < lenght; ++index) {
122:                        dimension = dimensions[index];
123:                        value = values[index];
124:                        if (row[dimension] != value) {
125:                            return false;
126:                        }
127:                    }
128:                    return true;
129:                } else {
130:                    return false;
131:                }
132:            }
133:
134:            /**
135:             * Resuelve la serialización
136:             * @param stream
137:             * @throws IOException
138:             */
139:            public void writeTo(ObjectOutputStream stream) throws IOException {
140:
141:                stream.writeObject(matrix);
142:            }
143:
144:            /**
145:             * Resuelve la des-serialización
146:             * @param stream
147:             * @throws IOException
148:             * @throws ClassNotFoundException
149:             */
150:            public void readFrom(ObjectInputStream stream) throws IOException,
151:                    ClassNotFoundException {
152:                matrix = (Matrix) stream.readObject();
153:            }
154:
155:            public Collection getDimensionValues(int index)
156:                    throws InfoException {
157:                throw new InfoException("592");
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.