KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > link > CmsPointerLinkValidatorReport


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.link;
33
34 import org.opencms.jsp.CmsJspActionElement;
35 import org.opencms.report.I_CmsReportThread;
36 import org.opencms.workplace.CmsWorkplaceSettings;
37 import org.opencms.workplace.list.A_CmsListReport;
38 import org.opencms.workplace.threads.CmsPointerLinkValidatorThread;
39 import org.opencms.workplace.tools.CmsToolManager;
40
41 import java.util.HashMap JavaDoc;
42 import java.util.Map JavaDoc;
43
44 import javax.servlet.http.HttpServletRequest JavaDoc;
45 import javax.servlet.http.HttpServletResponse JavaDoc;
46 import javax.servlet.jsp.JspException JavaDoc;
47 import javax.servlet.jsp.PageContext JavaDoc;
48
49 /**
50  * Provides an output window for a CmsReport.<p>
51  *
52  * @author Jan Baudisch
53  *
54  * @version $Revision: 1.8 $
55  *
56  * @since 6.0.0
57  */

58 public class CmsPointerLinkValidatorReport extends A_CmsListReport {
59
60     /** The dialog type. */
61     public static final String JavaDoc DIALOG_TYPE = "imp";
62
63     /**
64      * Public constructor.<p>
65      *
66      * @param jsp an initialized JSP action element
67      */

68     public CmsPointerLinkValidatorReport(CmsJspActionElement jsp) {
69
70         super(jsp);
71     }
72
73     /**
74      * Public constructor with JSP variables.<p>
75      *
76      * @param context the JSP page context
77      * @param req the JSP request
78      * @param res the JSP response
79      */

80     public CmsPointerLinkValidatorReport(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
81
82         this(new CmsJspActionElement(context, req, res));
83     }
84
85     /**
86      * Performs the pointer link validation report, will be called by the JSP page.<p>
87      *
88      * @throws JspException if problems including sub-elements occur
89      */

90     public void actionReport() throws JspException JavaDoc {
91
92         // save initialized instance of this class in request attribute for included sub-elements
93
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
94         switch (getAction()) {
95             case ACTION_REPORT_END:
96                 actionCloseDialog();
97                 break;
98             case ACTION_REPORT_UPDATE:
99                 setParamAction(REPORT_UPDATE);
100                 getJsp().include(FILE_REPORT_OUTPUT);
101                 break;
102             case ACTION_REPORT_BEGIN:
103             case ACTION_CONFIRMED:
104             default:
105                 CmsPointerLinkValidatorThread thread = new CmsPointerLinkValidatorThread(getCms());
106                 setParamAction(REPORT_BEGIN);
107                 setParamThread(thread.getUUID().toString());
108                 Map JavaDoc params = new HashMap JavaDoc(1);
109                 params.put(PARAM_CLOSELINK, CmsToolManager.linkForToolPath(getJsp(), "/linkchecking"));
110                 getJsp().include(FILE_REPORT_OUTPUT, null, params);
111                 break;
112         }
113     }
114
115     /**
116      *
117      * @see org.opencms.workplace.list.A_CmsListReport#initializeThread()
118      */

119     public I_CmsReportThread initializeThread() {
120
121         return new CmsPointerLinkValidatorThread(getCms());
122     }
123
124     /**
125      * @see org.opencms.workplace.CmsWorkplace#initMessages()
126      */

127     protected void initMessages() {
128
129         addMessages(Messages.get().getBundleName());
130         super.initMessages();
131     }
132
133     /**
134      * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
135      */

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