Source Code Cross Referenced for Subscription.java in  » Report » pentaho-report » com » pentaho » repository » subscribe » 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 » com.pentaho.repository.subscribe 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 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. The Original Code is the Pentaho 
007:         * BI Platform.  The Initial Developer is Pentaho Corporation.
008:         *
009:         * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
011:         * the license for the specific language governing your rights and limitations.
012:         *
013:         * @created Oct 7, 2005 
014:         * @author James Dixon
015:         */
016:
017:        package com.pentaho.repository.subscribe;
018:
019:        import java.util.ArrayList;
020:        import java.util.HashMap;
021:        import java.util.List;
022:        import java.util.Map;
023:
024:        import org.dom4j.Document;
025:        import org.pentaho.commons.connection.memory.MemoryMetaData;
026:        import org.pentaho.core.system.PentahoSystem;
027:
028:        public class Subscription {
029:
030:            protected static final int ClassVersionNumber = 6;
031:
032:            public static final int TYPE_PERSONAL = 1;
033:
034:            public static final int TYPE_ROLE = 2;
035:
036:            public static final int TYPE_GROUP = 3;
037:
038:            public static final int COLUMN_USER = 0;
039:
040:            public static final int COLUMN_ID = 1;
041:
042:            public static final int COLUMN_DESTINATION = 2;
043:
044:            public static final int COLUMN_CONTENT_ID = 3;
045:
046:            public static final int COLUMN_TITLE = 4;
047:
048:            public static final int COLUMN_SOLUTION = 5;
049:
050:            public static final int COLUMN_PATH = 6;
051:
052:            public static final int COLUMN_ACTION = 7;
053:
054:            private static final String baseHeaders[] = {
055:                    "user", "id", "destination", "contentid", "title", "solution", "path", "action" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ 
056:
057:            private String id;
058:
059:            private int type;
060:
061:            private String user;
062:
063:            private String title;
064:
065:            private SubscribeContent content;
066:
067:            private Map parameters;
068:
069:            private List schedules;
070:
071:            private String destination;
072:
073:            private int revision = -1; // Hibernate Revision
074:
075:            public static MemoryMetaData getMetadata(String parameterNames[]) {
076:                Object columnHeaders[][] = new Object[1][];
077:                String headerNames[] = new String[baseHeaders.length
078:                        + parameterNames.length];
079:                for (int i = 0; i < baseHeaders.length; i++) {
080:                    headerNames[i] = baseHeaders[i];
081:                }
082:                int offset = baseHeaders.length;
083:                for (int i = 0; i < parameterNames.length; i++) {
084:                    headerNames[offset + i] = parameterNames[i];
085:                }
086:                columnHeaders[0] = headerNames;
087:                return new MemoryMetaData(columnHeaders, null);
088:            }
089:
090:            protected Subscription() {
091:                // Needed for Hibernate to instantiate and set properties.
092:            }
093:
094:            public Subscription(String subscriptionId, String user,
095:                    String title, SubscribeContent content, String destination,
096:                    int type) {
097:                this .user = user;
098:                this .title = title;
099:                this .content = content;
100:                this .type = type;
101:                this .destination = destination;
102:                parameters = new HashMap();
103:                schedules = new ArrayList();
104:                id = subscriptionId;
105:            }
106:
107:            public Subscription(String subscriptionId, String user,
108:                    String title, SubscribeContent content, String destination,
109:                    int type, Map parameters) {
110:                this .user = user;
111:                this .title = title;
112:                this .content = content;
113:                this .type = type;
114:                this .parameters = parameters;
115:                this .destination = destination;
116:                schedules = new ArrayList();
117:                id = subscriptionId;
118:            }
119:
120:            public boolean equals(Object other) {
121:                if (this  == other) {
122:                    return true;
123:                }
124:                if (!(other instanceof  Subscription)) {
125:                    return false;
126:                }
127:                final Subscription that = (Subscription) other;
128:                return this .getId().equals(that.getId());
129:            }
130:
131:            public int hashCode() {
132:                return getId().hashCode();
133:            }
134:
135:            /**
136:             * @return Returns the revision.
137:             */
138:            public int getRevision() {
139:                return revision;
140:            }
141:
142:            /**
143:             * @param revision
144:             *            The revision to set. This is set by hibernate.
145:             */
146:            protected void setRevision(int revision) {
147:                this .revision = revision;
148:            }
149:
150:            public void addSchedule(Schedule sched) {
151:                schedules.add(sched);
152:            }
153:
154:            public List getSchedules() {
155:                return schedules;
156:            }
157:
158:            public String getUser() {
159:                return user;
160:            }
161:
162:            public String getTitle() {
163:                return title;
164:            }
165:
166:            public String getDestination() {
167:                return destination;
168:            }
169:
170:            public SubscribeContent getContent() {
171:                return content;
172:            }
173:
174:            public Map getParameters() {
175:                return parameters;
176:            }
177:
178:            public String getId() {
179:                return id;
180:            }
181:
182:            protected void setId(String value) {
183:                id = value;
184:            }
185:
186:            public int getType() {
187:                return type;
188:            }
189:
190:            public Document asDocument() {
191:                return null;
192:            }
193:
194:            public String asXml() {
195:                return null;
196:            }
197:
198:            protected void setContent(SubscribeContent content) {
199:                this .content = content;
200:            }
201:
202:            public void setDestination(String destination) {
203:                this .destination = destination;
204:            }
205:
206:            protected void setParameters(Map parameters) {
207:                this .parameters = parameters;
208:            }
209:
210:            protected void setSchedules(List schedules) {
211:                this .schedules = schedules;
212:            }
213:
214:            public void setTitle(String title) {
215:                this .title = title;
216:            }
217:
218:            protected void setType(int type) {
219:                this .type = type;
220:            }
221:
222:            protected void setUser(String user) {
223:                this .user = user;
224:            }
225:
226:            public Object[] toResultRow(String parameterNames[]) {
227:                Object[] result = new Object[baseHeaders.length
228:                        + parameterNames.length];
229:
230:                // expand the subscription into results
231:                result[COLUMN_USER] = this .getUser();
232:                result[COLUMN_ID] = this .getId();
233:                result[COLUMN_DESTINATION] = this .getDestination();
234:                result[COLUMN_CONTENT_ID] = this .getContent()
235:                        .getActionReference();
236:                PentahoSystem.ActionInfo contentInfo = PentahoSystem
237:                        .parseActionString(this .getContent()
238:                                .getActionReference());
239:                result[COLUMN_TITLE] = this .getTitle();
240:                result[COLUMN_SOLUTION] = contentInfo.getSolutionName();
241:                result[COLUMN_PATH] = contentInfo.getPath();
242:                if (parameters != null) {
243:                    result[COLUMN_ACTION] = parameters.get("action"); //$NON-NLS-1$
244:                    if (result[COLUMN_ACTION] == null) {
245:                        result[COLUMN_ACTION] = contentInfo.getActionName();
246:                    }
247:                } else {
248:                    result[COLUMN_ACTION] = contentInfo.getActionName();
249:                }
250:
251:                int offset = baseHeaders.length;
252:                for (int i = 0; i < parameterNames.length; i++) {
253:                    result[offset + i] = parameters.get(parameterNames[i]);
254:                }
255:
256:                return result;
257:
258:            }
259:
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.