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; 029 030import org.opencms.file.CmsObject; 031import org.opencms.main.OpenCms; 032import org.opencms.security.CmsRole; 033 034import java.util.Locale; 035 036/** 037 * Abstract superclass for workplace apps.<p> 038 */ 039public abstract class A_CmsWorkplaceAppConfiguration implements I_CmsWorkplaceAppConfiguration { 040 041 /** 042 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getAppCategory() 043 */ 044 public String getAppCategory() { 045 046 return CmsWorkplaceAppManager.MAIN_CATEGORY_ID; 047 } 048 049 /** 050 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getButtonStyle() 051 */ 052 public String getButtonStyle() { 053 054 return null; 055 } 056 057 /** 058 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getHelpText(java.util.Locale) 059 */ 060 public String getHelpText(Locale locale) { 061 062 return ""; 063 } 064 065 /** 066 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getName(java.util.Locale) 067 */ 068 public String getName(Locale locale) { 069 070 return getId(); 071 } 072 073 /** 074 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getOrder() 075 */ 076 public int getOrder() { 077 078 return 0; 079 } 080 081 /** 082 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getPriority() 083 */ 084 public int getPriority() { 085 086 return I_CmsWorkplaceAppConfiguration.DEFAULT_PRIORIY; 087 } 088 089 /** 090 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getRequiredRole() 091 */ 092 public CmsRole getRequiredRole() { 093 094 return CmsRole.WORKPLACE_USER; 095 } 096 097 /** 098 * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getVisibility(org.opencms.file.CmsObject) 099 */ 100 public CmsAppVisibilityStatus getVisibility(CmsObject cms) { 101 102 CmsAppVisibilityStatus visibility; 103 if (OpenCms.getRoleManager().hasRole(cms, getRequiredRole())) { 104 visibility = new CmsAppVisibilityStatus(true, true, ""); 105 } else { 106 visibility = new CmsAppVisibilityStatus( 107 false, 108 false, 109 Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( 110 Messages.GUI_WORKPLACE_ACCESS_DENIED_MESSAGE_0)); 111 } 112 return visibility; 113 } 114}