KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > database > CmsHtmlImportReport


1 /*
2  * File :
3  * Date :
4  * Version:
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.tools.database;
33
34 import org.opencms.jsp.CmsJspActionElement;
35 import org.opencms.workplace.CmsReport;
36 import org.opencms.workplace.CmsWorkplaceSettings;
37
38 import javax.servlet.http.HttpServletRequest JavaDoc;
39 import javax.servlet.http.HttpServletResponse JavaDoc;
40 import javax.servlet.jsp.JspException JavaDoc;
41 import javax.servlet.jsp.PageContext JavaDoc;
42
43 /**
44  * Provides an output window for a CmsReport.<p>
45  *
46  * @author Alexander Kandzior
47  *
48  * @version $Revision: 1.7 $
49  *
50  * @since 6.0.0
51  */

52 public class CmsHtmlImportReport extends CmsReport {
53
54     /** The dialog type. */
55     public static final String JavaDoc DIALOG_TYPE = "imp";
56
57     private CmsHtmlImport m_htmlImport;
58
59     /**
60      * Public constructor.<p>
61      *
62      * @param jsp an initialized JSP action element
63      */

64     public CmsHtmlImportReport(CmsJspActionElement jsp) {
65
66         super(jsp);
67     }
68
69     /**
70      * Public constructor with JSP variables.<p>
71      *
72      * @param context the JSP page context
73      * @param req the JSP request
74      * @param res the JSP response
75      */

76     public CmsHtmlImportReport(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
77
78         this(new CmsJspActionElement(context, req, res));
79     }
80
81     /**
82      * Performs the move report, will be called by the JSP page.<p>
83      *
84      * @throws JspException if problems including sub-elements occur
85      */

86     public void actionReport() throws JspException JavaDoc {
87
88         // save initialized instance of this class in request attribute for included sub-elements
89
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
90         switch (getAction()) {
91             case ACTION_REPORT_END:
92                 actionCloseDialog();
93                 break;
94             case ACTION_REPORT_UPDATE:
95                 setParamAction(REPORT_UPDATE);
96                 getJsp().include(FILE_REPORT_OUTPUT);
97                 break;
98             case ACTION_REPORT_BEGIN:
99             case ACTION_CONFIRMED:
100             default:
101                 CmsHtmlImportThread thread = new CmsHtmlImportThread(getCms(), m_htmlImport);
102                 setParamAction(REPORT_BEGIN);
103                 setParamThread(thread.getUUID().toString());
104                 getJsp().include(FILE_REPORT_OUTPUT);
105                 break;
106         }
107     }
108
109     /**
110      * Sets the htmlImport.<p>
111      *
112      * @param htmlImport the htmlImport to set
113      */

114     public void setHtmlImport(CmsHtmlImport htmlImport) {
115
116         m_htmlImport = htmlImport;
117     }
118
119     /**
120      * @see org.opencms.workplace.CmsWorkplace#initMessages()
121      */

122     protected void initMessages() {
123
124         addMessages(Messages.get().getBundleName());
125         super.initMessages();
126     }
127
128     /**
129      * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
130      */

131     protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest JavaDoc request) {
132
133         // fill the parameter values in the get/set methods
134
fillParamValues(request);
135         // set the dialog type
136
setParamDialogtype(DIALOG_TYPE);
137         // set the action for the JSP switch
138
if (DIALOG_CONFIRMED.equals(getParamAction())) {
139             setAction(ACTION_CONFIRMED);
140         } else if (REPORT_UPDATE.equals(getParamAction())) {
141             setAction(ACTION_REPORT_UPDATE);
142         } else if (REPORT_BEGIN.equals(getParamAction())) {
143             setAction(ACTION_REPORT_BEGIN);
144         } else if (REPORT_END.equals(getParamAction())) {
145             setAction(ACTION_REPORT_END);
146         } else if (DIALOG_CANCEL.equals(getParamAction())) {
147             setAction(ACTION_CANCEL);
148         } else {
149             setAction(ACTION_DEFAULT);
150             // add the title for the dialog
151
setParamTitle(Messages.get().getBundle(getLocale()).key(Messages.GUI_HTMLIMPORT_DIALOG_TITLE_0));
152         }
153     }
154 }
155
Popular Tags