|
From: Rashmi B. <ra...@us...> - 2005-04-19 00:39:26
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10744 Modified Files: FormatHelper.java PDFServlet.java pocOLAPConstants.java Log Message: PDF related changes Index: FormatHelper.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/FormatHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FormatHelper.java 14 Apr 2005 22:32:08 -0000 1.1 --- FormatHelper.java 19 Apr 2005 00:39:16 -0000 1.2 *************** *** 4,24 **** Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ --- 4,24 ---- Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ *************** *** 27,43 **** package com.pocolap.servlets; ! import javax.servlet.http.HttpServletRequest ; import javax.servlet.http.HttpServletResponse ; import javax.servlet.ServletException ; import org.apache.log4j.Logger; ! import java.util.HashMap; import com.pocolap.schema.CrossTabDef; import com.pocolap.selectors.Selector ; ! import com.pocolap.xtab.filter.FilterList ; ! import com.pocolap.xtab.layout.SpreadSheet; import java.io.ByteArrayOutputStream; import javax.servlet.ServletOutputStream; ! import com.pocolap.xtab.format.FormatPDF ; /** --- 27,43 ---- package com.pocolap.servlets; ! import javax.servlet.http.HttpServletRequest ; import javax.servlet.http.HttpServletResponse ; import javax.servlet.ServletException ; import org.apache.log4j.Logger; ! import java.util.HashMap; import com.pocolap.schema.CrossTabDef; import com.pocolap.selectors.Selector ; ! import com.pocolap.xtab.filter.FilterList ; ! import com.pocolap.xtab.layout.SpreadSheet; import java.io.ByteArrayOutputStream; import javax.servlet.ServletOutputStream; ! import com.pocolap.xtab.format.FormatPDF ; /** *************** *** 46,64 **** * @author Rashmi Banthia */ ! public class FormatHelper implements ServletHelper { ! private HashMap parameters ; static Logger logger = Logger.getLogger(SavedReportHelper.class); ! protected Selector acrossselector ; ! protected Selector downselector ; ! protected FilterList[] filterlist ; ! /** Creates a new instance of SavedReportHelper */ ! public FormatHelper() { } ! /** * processRequest processes request for ACTION_FORMAT and sets session variables. ! * * @param req HttpServletRequest from the webserver * @param res HttpServletResponse from the webserver --- 46,64 ---- * @author Rashmi Banthia */ ! public class FormatHelper implements ServletHelper { ! private HashMap parameters ; static Logger logger = Logger.getLogger(SavedReportHelper.class); ! protected Selector acrossselector ; ! protected Selector downselector ; ! protected FilterList[] filterlist ; ! /** Creates a new instance of SavedReportHelper */ ! public FormatHelper() { } ! /** * processRequest processes request for ACTION_FORMAT and sets session variables. ! * * @param req HttpServletRequest from the webserver * @param res HttpServletResponse from the webserver *************** *** 66,104 **** */ public String processRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException { ! String page = null ; parameters = (HashMap)req.getParameterMap(); String errclass = getClass().getName()+".processRequest(HttpServletRequest,HttpServletResponse): "; ! ! String action = (String)req.getParameter(pocOLAPConstants.XTAB_ACTION); ! ! if (action.equalsIgnoreCase(pocOLAPConstants.ACTION_FORMAT)) { ! String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); ! Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); ! FilterList[] flist = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute("SPREADSHEET"); ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet); ! ! req.getSession().setAttribute("PDFBAOS",baos); ! page = "PDFServlet"; ! } return page ; } ! ! public ByteArrayOutputStream createPDF(CrossTabDef curr, ! Selector down, Selector across, FilterList[] filterlist , SpreadSheet spsheet ){ ! ! ByteArrayOutputStream baos = new FormatPDF().createPDF(curr,down,across,filterlist,spsheet); ! return baos ; } ! ! } \ No newline at end of file --- 66,104 ---- */ public String processRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException { ! String page = null ; parameters = (HashMap)req.getParameterMap(); String errclass = getClass().getName()+".processRequest(HttpServletRequest,HttpServletResponse): "; ! ! String action = (String)req.getParameter(pocOLAPConstants.XTAB_ACTION); ! ! if (action.equalsIgnoreCase(pocOLAPConstants.ACTION_FORMAT)) { ! String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); ! Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); ! FilterList[] flist = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute(pocOLAPConstants.ATTR_SPREADSHEET); ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet); ! ! req.getSession().setAttribute(pocOLAPConstants.ATTR_BAOS,baos); ! page = pocOLAPConstants.SERVLET_PDF; ! } return page ; } ! ! public ByteArrayOutputStream createPDF(CrossTabDef curr, ! Selector down, Selector across, FilterList[] filterlist , SpreadSheet spsheet ){ ! ! ByteArrayOutputStream baos = new FormatPDF().createPDF(curr,down,across,filterlist,spsheet); ! return baos ; } ! ! } Index: PDFServlet.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/PDFServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PDFServlet.java 14 Apr 2005 22:32:08 -0000 1.1 --- PDFServlet.java 19 Apr 2005 00:39:17 -0000 1.2 *************** *** 4,27 **** Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ! package com.pocolap.servlets; --- 4,27 ---- Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ! package com.pocolap.servlets; *************** *** 34,57 **** import java.io.PrintWriter; import java.io.IOException; ! import org.apache.log4j.Logger ; public class PDFServlet extends HttpServlet { ! static Logger logger = Logger.getLogger(PDFServlet.class); ! public PDFServlet() { super(); } ! public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String errclass = getClass().getName()+".doGet(HttpServletRequest,HttpServletResponse): "; ! ByteArrayOutputStream baosPDF = null; ! ! baosPDF = (ByteArrayOutputStream) req.getSession().getAttribute("PDFBAOS"); ! resp.setContentType("application/pdf"); resp.setContentLength(baosPDF.size()); --- 34,57 ---- import java.io.PrintWriter; import java.io.IOException; ! import org.apache.log4j.Logger ; public class PDFServlet extends HttpServlet { ! static Logger logger = Logger.getLogger(PDFServlet.class); ! public PDFServlet() { super(); } ! public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String errclass = getClass().getName()+".doGet(HttpServletRequest,HttpServletResponse): "; ! ByteArrayOutputStream baosPDF = null; ! ! baosPDF = (ByteArrayOutputStream) req.getSession().getAttribute(pocOLAPConstants.ATTR_BAOS); ! resp.setContentType("application/pdf"); resp.setContentLength(baosPDF.size()); *************** *** 64,72 **** out.flush(); } ! catch(IOException ioe) { logger.error(errclass + ioe.getMessage()); } ! } ! } --- 64,72 ---- out.flush(); } ! catch(IOException ioe) { logger.error(errclass + ioe.getMessage()); } ! } ! } Index: pocOLAPConstants.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/pocOLAPConstants.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pocOLAPConstants.java 14 Apr 2005 22:31:28 -0000 1.9 --- pocOLAPConstants.java 19 Apr 2005 00:39:17 -0000 1.10 *************** *** 4,24 **** Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ --- 4,24 ---- Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ *************** *** 27,37 **** /** ! * pocOLAPConstants contains the constants required. ! * * @author Rashmi Banthia * */ ! public final class pocOLAPConstants { ! /**Action is used to tell the servlet what was requested. This is the name used * by the <com.pocolap.tags.Action> tag.*/ --- 27,37 ---- /** ! * pocOLAPConstants contains the constants required. ! * * @author Rashmi Banthia * */ ! public final class pocOLAPConstants { ! /**Action is used to tell the servlet what was requested. This is the name used * by the <com.pocolap.tags.Action> tag.*/ *************** *** 74,94 **** public static final String ACTION_COMBINE_CHANGE = ELEMENT_FILTER_COMBINE; public static final String ACTION_FILTER_SET = "fltr.set"; ! public static final String ACTION_FILTER_PREFIX = "fltr" ; public static final String ACTION_ADMN_PREFIX = "admn" ; public static final String ACTION_ADMN_DISPLAYLOG4J = "admn.displaylog4j"; public static final String ACTION_ADMN_REINIT = "admn.reinit"; ! public static final String ACTION_LOAD_REPT = "load.rept" ; ! public static final String ACTION_FORMAT_PDF = "PDF" ; public static final String ACTION_FORMAT = "format" ; ! /*ATTRs are used for session attribute names*/ public static final String ATTR_REPT_LIST = "reptlist"; public static final String ATTR_REPT_SELECTED = "selrept"; public static final String ATTR_SCHEMA = "currschema"; //XTabSchema ! /**ATTR_DOWNSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ public static final String ATTR_DOWNSELECTOR = ELEMENT_SELECTOR_DOWN; //Vector of Strings ! /**ATTR_ACROSSSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ --- 74,94 ---- public static final String ACTION_COMBINE_CHANGE = ELEMENT_FILTER_COMBINE; public static final String ACTION_FILTER_SET = "fltr.set"; ! public static final String ACTION_FILTER_PREFIX = "fltr" ; public static final String ACTION_ADMN_PREFIX = "admn" ; public static final String ACTION_ADMN_DISPLAYLOG4J = "admn.displaylog4j"; public static final String ACTION_ADMN_REINIT = "admn.reinit"; ! public static final String ACTION_LOAD_REPT = "load.rept" ; ! public static final String ACTION_FORMAT_PDF = "PDF" ; public static final String ACTION_FORMAT = "format" ; ! /*ATTRs are used for session attribute names*/ public static final String ATTR_REPT_LIST = "reptlist"; public static final String ATTR_REPT_SELECTED = "selrept"; public static final String ATTR_SCHEMA = "currschema"; //XTabSchema ! /**ATTR_DOWNSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ public static final String ATTR_DOWNSELECTOR = ELEMENT_SELECTOR_DOWN; //Vector of Strings ! /**ATTR_ACROSSSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ *************** *** 100,103 **** --- 100,106 ---- public static final String ATTR_FILTER_ACTION = "faction"; //String public static final String ATTR_DETAIL_ITEM = "ditem"; //Integer + public static final String ATTR_SPREADSHEET = "SPREADSHEET" ; + //PDF ByteArrayOutputStream + public static final String ATTR_BAOS = "PDFBAOS" ; /** Items for ResourceServlet **/ *************** *** 106,111 **** public static final String VALUE_RESOURCE_TYPE_BINARY = "image"; public static final String VALUE_RESOURCE_TYPE_TEXT = "html"; ! ! /** In web.xml, only param-names starting with "whs_" will be * considered WareHouse Schema files */ public static final String CONFIG_FILE_TAG = "whs_"; --- 109,114 ---- public static final String VALUE_RESOURCE_TYPE_BINARY = "image"; public static final String VALUE_RESOURCE_TYPE_TEXT = "html"; ! ! /** In web.xml, only param-names starting with "whs_" will be * considered WareHouse Schema files */ public static final String CONFIG_FILE_TAG = "whs_"; *************** *** 114,125 **** public static final String SERVLET = "servlets/XTabMain"; public static final String SERVLET_RESOURCES = "servlets/Resources"; ! public static final String PAGE_MAIN = "ReptPage.jsp"; public static final String PAGE_FILTER_VIEW = "FilterView.jsp"; public static final String PAGE_FILTER_DETAILS = "FilterDetail.jsp"; public static final String PAGE_ADMIN = "Admin.jsp"; ! public static final String DEFAULT_NULL_OPTION_LABEL = "Select a table"; public static final String NULL_VALUE = "null"; ! } \ No newline at end of file --- 117,129 ---- public static final String SERVLET = "servlets/XTabMain"; public static final String SERVLET_RESOURCES = "servlets/Resources"; ! public static final String SERVLET_PDF = "PDFServlet"; ! public static final String PAGE_MAIN = "ReptPage.jsp"; public static final String PAGE_FILTER_VIEW = "FilterView.jsp"; public static final String PAGE_FILTER_DETAILS = "FilterDetail.jsp"; public static final String PAGE_ADMIN = "Admin.jsp"; ! public static final String DEFAULT_NULL_OPTION_LABEL = "Select a table"; public static final String NULL_VALUE = "null"; ! } |