001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.workplace.tools.content.check;
029
030import org.opencms.file.CmsObject;
031import org.opencms.main.CmsException;
032import org.opencms.workplace.CmsDialog;
033import org.opencms.workplace.CmsWorkplace;
034import org.opencms.workplace.tools.CmsToolManager;
035import org.opencms.workplace.tools.CmsToolRootHandler;
036import org.opencms.workplace.tools.I_CmsToolHandler;
037
038import java.util.HashMap;
039import java.util.List;
040import java.util.Map;
041
042/**
043 * Abstract class for a CmsContentCheck.<p>
044 *
045 * @since 6.1.2
046 */
047public abstract class A_CmsContentCheck implements I_CmsContentCheck, I_CmsToolHandler {
048
049    /** Closelink path. */
050    private static final String CLOSELINK = "/contenttools/checkconfig";
051
052    /**
053     * @see org.opencms.workplace.tools.content.check.I_CmsContentCheck#executeContentCheck(org.opencms.file.CmsObject, org.opencms.workplace.tools.content.check.CmsContentCheckResource)
054     */
055    public abstract CmsContentCheckResource executeContentCheck(CmsObject cms, CmsContentCheckResource testResource)
056    throws CmsException;
057
058    /**
059     * @see org.opencms.workplace.tools.I_CmsToolHandler#getConfirmationMessage()
060     */
061    public String getConfirmationMessage() {
062
063        return null;
064    }
065
066    /**
067     * @see org.opencms.workplace.tools.content.check.I_CmsContentCheck#getDialogParameterName()
068     */
069    public abstract String getDialogParameterName();
070
071    /**
072     * @see org.opencms.workplace.tools.I_CmsToolHandler#getDisabledHelpText()
073     */
074    public String getDisabledHelpText() {
075
076        return null;
077    }
078
079    /**
080     * @see org.opencms.workplace.tools.I_CmsToolHandler#getGroup()
081     */
082    public String getGroup() {
083
084        return org.opencms.workplace.tools.content.Messages.get().getBundle().key(
085            org.opencms.workplace.tools.content.Messages.GUI_CHECKCONTENT_CONFIGURATION_ADMIN_TOOL_NAME_0);
086    }
087
088    /**
089     * @see org.opencms.workplace.tools.I_CmsToolHandler#getHelpText()
090     */
091    public abstract String getHelpText();
092
093    /**
094     * @see org.opencms.workplace.tools.I_CmsToolHandler#getIconPath()
095     */
096    public abstract String getIconPath();
097
098    /**
099     * @see org.opencms.workplace.tools.I_CmsToolHandler#getLink()
100     */
101
102    public abstract String getLink();
103
104    /**
105     * @see org.opencms.workplace.tools.content.check.I_CmsContentCheck#getMessageBundles()
106     */
107    public abstract List getMessageBundles();
108
109    /**
110     * @see org.opencms.workplace.tools.I_CmsToolHandler#getName()
111     */
112    public abstract String getName();
113
114    /**
115     * @see org.opencms.workplace.tools.I_CmsToolHandler#getParameters(org.opencms.workplace.CmsWorkplace)
116     */
117    public Map getParameters(CmsWorkplace wp) {
118
119        Map parameters = new HashMap();
120        parameters.put(CmsDialog.PARAM_CLOSELINK, CmsToolManager.linkForToolPath(wp.getJsp(), CLOSELINK));
121
122        return parameters;
123    }
124
125    /**
126     * @see org.opencms.workplace.tools.I_CmsToolHandler#getPath()
127     */
128    public abstract String getPath();
129
130    /**
131     * @see org.opencms.workplace.tools.I_CmsToolHandler#getPosition()
132     */
133    public abstract float getPosition();
134
135    /**
136     * @see org.opencms.workplace.tools.I_CmsToolHandler#getShortName()
137     */
138    public abstract String getShortName();
139
140    /**
141     * @see org.opencms.workplace.tools.I_CmsToolHandler#getSmallIconPath()
142     */
143    public String getSmallIconPath() {
144
145        return null;
146    }
147
148    /**
149     * @see org.opencms.workplace.tools.content.check.I_CmsContentCheck#init(org.opencms.file.CmsObject)
150     */
151    public abstract void init(CmsObject cms) throws CmsException;
152
153    /**
154     * @see org.opencms.workplace.tools.content.check.I_CmsContentCheck#isActive()
155     */
156    public abstract boolean isActive();
157
158    /**
159     * @see org.opencms.workplace.tools.I_CmsToolHandler#isEnabled(org.opencms.file.CmsObject)
160     */
161    public boolean isEnabled(CmsObject cms) {
162
163        return true;
164    }
165
166    /**
167     * @see org.opencms.workplace.tools.I_CmsToolHandler#isEnabled(org.opencms.workplace.CmsWorkplace)
168     */
169    public boolean isEnabled(CmsWorkplace wp) {
170
171        return true;
172    }
173
174    /**
175     * @see org.opencms.workplace.tools.I_CmsToolHandler#isVisible(org.opencms.file.CmsObject)
176     */
177    public boolean isVisible(CmsObject cms) {
178
179        return true;
180    }
181
182    /**
183     * @see org.opencms.workplace.tools.I_CmsToolHandler#isVisible(org.opencms.workplace.CmsWorkplace)
184     */
185    public boolean isVisible(CmsWorkplace wp) {
186
187        return true;
188    }
189
190    /**
191     * @see org.opencms.workplace.tools.content.check.I_CmsContentCheck#setActive(boolean)
192     */
193    public abstract void setActive(boolean value);
194
195    /**
196     * @see org.opencms.workplace.tools.I_CmsToolHandler#setup(org.opencms.file.CmsObject, org.opencms.workplace.tools.CmsToolRootHandler, java.lang.String)
197     */
198    public boolean setup(CmsObject cms, CmsToolRootHandler root, String resourcePath) {
199
200        return true;
201    }
202}