001/* 002 * (C) Copyright 2006-2009 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Nuxeo - initial API and implementation 018 * 019 * $Id$ 020 */ 021package org.nuxeo.ecm.platform.web.common.admin; 022 023import org.nuxeo.ecm.core.management.api.AdministrativeStatus; 024 025import java.util.Calendar; 026 027/** 028 * Simple Helper class to hold {@link AdministrativeStatus} flags used by the Web Layer. 029 * 030 * @author tiry 031 */ 032public class AdminStatusHelper { 033 034 static boolean adminMessageActivated; 035 036 static String adminMessage; 037 038 static Calendar adminMessageModificationDate; 039 040 static boolean instanceInMaintenanceMode; 041 042 static String maintenanceMessage; 043 044 public static boolean isAdminMessageActivated() { 045 return adminMessageActivated; 046 } 047 048 public static String getAdminMessage() { 049 return adminMessage; 050 } 051 052 /** 053 * @since 5.7.3 054 */ 055 public static Calendar getAdminMessageModificationDate() { 056 return adminMessageModificationDate; 057 } 058 059 public static boolean isInstanceInMaintenanceMode() { 060 return instanceInMaintenanceMode; 061 } 062 063 public static String getMaintenanceMessage() { 064 return maintenanceMessage; 065 } 066 067 public static boolean displayAdminMessage() { 068 return adminMessageActivated && adminMessage != null && adminMessage.length() > 0; 069 } 070 071 public static boolean accessRestrictedToAdministrators() { 072 return instanceInMaintenanceMode; 073 } 074 075}