Source Code Cross Referenced for ReportXslFile.java in  » ERP-CRM-Financial » sakai » org » theospi » portfolio » reports » 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 » ERP CRM Financial » sakai » org.theospi.portfolio.reports.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.theospi.portfolio.reports.model;
002:
003:        import org.apache.commons.logging.Log;
004:        import org.apache.commons.logging.LogFactory;
005:        import org.sakaiproject.content.api.ContentHostingService;
006:        import org.sakaiproject.content.api.ContentResource;
007:        import org.sakaiproject.exception.IdUnusedException;
008:        import org.sakaiproject.exception.PermissionException;
009:        import org.sakaiproject.exception.TypeException;
010:        import org.sakaiproject.metaobj.shared.model.Id;
011:        import org.theospi.portfolio.shared.model.OspException;
012:
013:        import java.io.ByteArrayOutputStream;
014:        import java.io.IOException;
015:        import java.io.InputStream;
016:
017:        public class ReportXslFile {
018:
019:            protected final transient Log logger = LogFactory
020:                    .getLog(getClass());
021:            /** the link to the report definition */
022:            private ReportDefinitionXmlFile reportDef;
023:            private String reportXslFileRef = null;
024:            private String reportDefId;
025:            private Id reportXslFileId;
026:            private byte[] xslFile;
027:
028:            /**
029:             * the getter for the reportId property
030:             */
031:            public ReportXslFile() {
032:
033:            }
034:
035:            public String getReportDefId() {
036:                return reportDefId;
037:            }
038:
039:            public void setReportDefId(String reportDefId) {
040:                this .reportDefId = reportDefId;
041:            }
042:
043:            public ReportXslFile(ReportXsl reportXsl,
044:                    ContentHostingService contentHosting) {
045:                try {
046:                    String id = reportXsl.getXslLink();
047:                    ContentResource resource = contentHosting.getResource(id);
048:                    setXslFile(readStreamToBytes(resource.streamContent()));
049:                    setReportXslFileRef(reportXsl.getXslLink());
050:                } catch (PermissionException pe) {
051:                    logger
052:                            .warn(
053:                                    "Failed loading content: no permission to view file",
054:                                    pe);
055:                    throw new OspException(
056:                            "Permission Error loading the following xsl file:"
057:                                    + reportXsl.getXslLink());
058:                } catch (TypeException te) {
059:                    logger.warn("Wrong type", te);
060:                    throw new OspException(
061:                            "Error loading the following xsl file:"
062:                                    + reportXsl.getXslLink());
063:                } catch (IdUnusedException iue) {
064:                    logger.warn("UnusedId: ", iue);
065:                    throw new OspException(
066:                            "Error loading the following xsl file:"
067:                                    + reportXsl.getXslLink());
068:                } catch (Exception e) {
069:                    e.printStackTrace();
070:                    throw new OspException(
071:                            "Error loading the following xsl file:"
072:                                    + reportXsl.getXslLink());
073:                }
074:            }
075:
076:            public String getReportXslFileRef() {
077:                return reportXslFileRef;
078:            }
079:
080:            public void setReportXslFileRef(String reportXslFileRef) {
081:                this .reportXslFileRef = reportXslFileRef;
082:            }
083:
084:            public byte[] getXslFile() {
085:                return xslFile;
086:            }
087:
088:            public void setXslFile(byte[] xslFile) {
089:                this .xslFile = xslFile;
090:            }
091:
092:            private byte[] readStreamToBytes(InputStream inStream)
093:                    throws IOException {
094:                ByteArrayOutputStream bytes = new ByteArrayOutputStream();
095:                byte data[] = new byte[10 * 1024];
096:
097:                int count;
098:                while ((count = inStream.read(data, 0, 10 * 1024)) != -1) {
099:                    bytes.write(data, 0, count);
100:                }
101:                byte[] tmp = bytes.toByteArray();
102:                bytes.close();
103:                return tmp;
104:            }
105:
106:            public ReportDefinitionXmlFile getReportDef() {
107:                return reportDef;
108:            }
109:
110:            public void setReportDef(ReportDefinitionXmlFile reportDef) {
111:                this .reportDef = reportDef;
112:            }
113:
114:            public Id getReportXslFileId() {
115:                return reportXslFileId;
116:            }
117:
118:            public void setReportXslFileId(Id reportXslFileId) {
119:                this.reportXslFileId = reportXslFileId;
120:            }
121:
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.