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, 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.ui.apps.linkvalidation;
029
030import org.opencms.file.CmsObject;
031import org.opencms.main.OpenCms;
032import org.opencms.security.CmsRole;
033import org.opencms.ui.CmsCssIcon;
034import org.opencms.ui.apps.CmsAppVisibilityStatus;
035import org.opencms.ui.apps.CmsWorkplaceAppManager;
036import org.opencms.ui.apps.I_CmsFolderAppCategory;
037import org.opencms.ui.apps.Messages;
038
039import java.util.Locale;
040
041import com.vaadin.server.Resource;
042
043/**
044 * Class for the folder for the link validation tools.<p>
045 */
046public class CmsLinkValidationFolder implements I_CmsFolderAppCategory {
047
048    /** The app icon resource (size 32x32). */
049    public static final CmsCssIcon ICON = new CmsCssIcon("oc-icon-32-link");
050
051    /**Folder id.*/
052    public static final String ID = "link-validation";
053
054    /**
055     * @see org.opencms.ui.apps.I_CmsFolderAppCategory#getButtonStyle()
056     */
057    public String getButtonStyle() {
058
059        return null;
060    }
061
062    /**
063     * @see org.opencms.ui.apps.I_CmsFolderAppCategory#getHelpText(java.util.Locale)
064     */
065    public String getHelpText(Locale locale) {
066
067        return Messages.get().getBundle(locale).key(Messages.GUI_LINKVALIDATION_ADMIN_TOOL_NAME_HELP_0);
068    }
069
070    /**
071     * @see org.opencms.ui.apps.I_CmsFolderAppCategory#getIcon()
072     */
073    public Resource getIcon() {
074
075        return ICON;
076    }
077
078    /**
079     * @see org.opencms.ui.apps.I_CmsAppCategory#getId()
080     */
081    public String getId() {
082
083        return ID;
084    }
085
086    /**
087     * @see org.opencms.ui.apps.I_CmsAppCategory#getName(java.util.Locale)
088     */
089    public String getName(Locale locale) {
090
091        return Messages.get().getBundle(locale).key(Messages.GUI_LINKVALIDATION_ADMIN_TOOL_NAME_0);
092    }
093
094    /**
095     * @see org.opencms.ui.apps.I_CmsAppCategory#getOrder()
096     */
097    public int getOrder() {
098
099        return 20;
100    }
101
102    /**
103     * @see org.opencms.ui.apps.I_CmsAppCategory#getParentId()
104     */
105    public String getParentId() {
106
107        return CmsWorkplaceAppManager.MAIN_CATEGORY_ID;
108    }
109
110    /**
111     * @see org.opencms.ui.apps.I_CmsAppCategory#getPriority()
112     */
113    public int getPriority() {
114
115        return 20;
116    }
117
118    /**
119     * @see org.opencms.ui.apps.I_CmsFolderAppCategory#getVisibility(org.opencms.file.CmsObject)
120     */
121    public CmsAppVisibilityStatus getVisibility(CmsObject cms) {
122
123        CmsAppVisibilityStatus status = OpenCms.getRoleManager().hasRole(cms, CmsRole.WORKPLACE_USER)
124        ? CmsAppVisibilityStatus.ACTIVE
125        : CmsAppVisibilityStatus.INVISIBLE;
126        return status;
127    }
128
129}