CCM NG: Part of the ongoing migration to a database based configuration system
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3790 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
c024ac5593
commit
97567275e2
|
|
@ -26,7 +26,7 @@ import com.arsdigita.bebop.parameters.BitSetParameter;
|
|||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.util.Traversal;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.SystemInformation;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
|
@ -625,7 +625,7 @@ public class Page extends SimpleComponent implements Container {
|
|||
m_panel.generateXML(state, page);
|
||||
}
|
||||
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()
|
||||
if (KernelConfig.getConfig().isDebugEnabled()
|
||||
&& debugStructure(state.getRequest())) {
|
||||
|
||||
Element structure = page.newChildElement("bebop:structure",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
|
||||
import com.arsdigita.bebop.util.Attributes;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ public class SimpleComponent extends Completable
|
|||
if (m_attr != null) {
|
||||
m_attr.exportAttributes(target);
|
||||
}
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled() ||
|
||||
if (KernelConfig.getConfig().isDebugEnabled() ||
|
||||
Bebop.getConfig().showClassName()) {
|
||||
target.addAttribute("bebop:classname", getClass().getName(),
|
||||
BEBOP_XML_NS);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.arsdigita.bebop.Bebop;
|
|||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.globalization.Globalization;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.templating.PresentationManager;
|
||||
import com.arsdigita.templating.Templating;
|
||||
import com.arsdigita.templating.XSLParameterGenerator;
|
||||
|
|
@ -454,7 +454,7 @@ public class PageTransformer implements PresentationManager {
|
|||
}
|
||||
|
||||
// copy and paste from BasePresentationManager
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
Document origDoc = (Document) req.getAttribute(
|
||||
"com.arsdigita.xml.Document");
|
||||
Debugger.addDebugger(new TransformationDebugger(template.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package com.arsdigita.dispatcher;
|
||||
|
||||
//import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.ParameterProvider;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
|
|
@ -1135,7 +1135,7 @@ public final class DispatcherHelper implements DispatcherConstants {
|
|||
* @return The negotiated locale
|
||||
*/
|
||||
public static Locale getNegotiatedLocale() {
|
||||
LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
// Set the preferedLocale to the default locale (first entry in the
|
||||
// config parameter list)
|
||||
|
|
|
|||
|
|
@ -5,11 +5,15 @@
|
|||
package com.arsdigita.globalization;
|
||||
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
|
@ -19,7 +23,6 @@ import javax.servlet.http.HttpSession;
|
|||
*/
|
||||
public class GlobalizationHelper {
|
||||
|
||||
public static final String LANG_INDEPENDENT = LegacyKernelConfig.getConfig().getLanguagesIndependentCode();
|
||||
private static final String LANG_PARAM = "lang";
|
||||
|
||||
// Don't instantiate
|
||||
|
|
@ -27,30 +30,32 @@ public class GlobalizationHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method returns the best matching locate for the request. In contrast to
|
||||
* the other methods available this one will also respect the supported_languages
|
||||
* config entry.
|
||||
* This method returns the best matching locate for the request. In contrast
|
||||
* to the other methods available this one will also respect the
|
||||
* supported_languages config entry.
|
||||
*
|
||||
* @return The negotiated locale
|
||||
*/
|
||||
public static java.util.Locale getNegotiatedLocale() {
|
||||
LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
// Set the preferedLocale to the default locale (first entry in the config parameter list)
|
||||
java.util.Locale preferedLocale = getPrefferedLocale();
|
||||
|
||||
// The ACCEPTED_LANGUAGES from the client
|
||||
Enumeration locales = null;
|
||||
Enumeration<java.util.Locale> locales = null;
|
||||
|
||||
// Try to get the RequestContext
|
||||
try {
|
||||
|
||||
// Get the SerrvletRequest
|
||||
ServletRequest request = ((ServletRequest) DispatcherHelper.getRequest());
|
||||
ServletRequest request = ((ServletRequest) DispatcherHelper
|
||||
.getRequest());
|
||||
|
||||
// Get the selected locale from the request, if any
|
||||
java.util.Locale selectedLocale = getSelectedLocale(request);
|
||||
if (selectedLocale != null && kernelConfig.hasLanguage(selectedLocale.getLanguage())) {
|
||||
if (selectedLocale != null && kernelConfig.hasLanguage(
|
||||
selectedLocale.getLanguage())) {
|
||||
preferedLocale = selectedLocale;
|
||||
} else {
|
||||
|
||||
|
|
@ -81,8 +86,10 @@ public class GlobalizationHelper {
|
|||
//
|
||||
// }
|
||||
private static Locale getPrefferedLocale() {
|
||||
LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
java.util.Locale preferedLocale = new java.util.Locale(kernelConfig.getDefaultLanguage(), "", "");
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
java.util.Locale preferedLocale = new java.util.Locale(kernelConfig
|
||||
.getDefaultLanguage(), "", "");
|
||||
return preferedLocale;
|
||||
}
|
||||
|
||||
|
|
@ -112,12 +119,10 @@ public class GlobalizationHelper {
|
|||
// Save the request parameter as session value
|
||||
session.setAttribute(LANG_PARAM, selectedRequestLang);
|
||||
}
|
||||
} else {
|
||||
// If there is a session stored language, use it
|
||||
} else // If there is a session stored language, use it
|
||||
if (selectedSessionLang != null) {
|
||||
selectedLocale = scanLocale(selectedSessionLang);
|
||||
}
|
||||
}
|
||||
|
||||
return selectedLocale;
|
||||
}
|
||||
|
|
@ -126,6 +131,7 @@ public class GlobalizationHelper {
|
|||
* Create a Locale from a browser provides language string
|
||||
*
|
||||
* @param lang A string encoded locale, as provided by browsers
|
||||
*
|
||||
* @return A java.util.Locale representation of the language string
|
||||
*/
|
||||
private static java.util.Locale scanLocale(String lang) {
|
||||
|
|
@ -135,7 +141,8 @@ public class GlobalizationHelper {
|
|||
// Split the string and create the Locale object
|
||||
StringTokenizer paramValues = new StringTokenizer(lang, "_");
|
||||
if (paramValues.countTokens() > 1) {
|
||||
return new java.util.Locale(paramValues.nextToken(), paramValues.nextToken());
|
||||
return new java.util.Locale(paramValues.nextToken(), paramValues
|
||||
.nextToken());
|
||||
} else {
|
||||
return new java.util.Locale(paramValues.nextToken());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@
|
|||
*/
|
||||
package com.arsdigita.kernel;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import org.libreccm.configuration.Configuration;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.configuration.Setting;
|
||||
|
||||
import java.util.StringJoiner;
|
||||
|
|
@ -36,6 +39,9 @@ import java.util.StringJoiner;
|
|||
descKey = "kernel.config.description")
|
||||
public final class KernelConfig {
|
||||
|
||||
private static final String EMAIL = "email";
|
||||
private static final String SCREEN_NAME = "screen_name";
|
||||
|
||||
@Setting(descKey = "kernel.config.debug_enabled")
|
||||
private boolean debugEnabled = false;
|
||||
|
||||
|
|
@ -46,7 +52,7 @@ public final class KernelConfig {
|
|||
private boolean dataPermissionCheckEnabled = true;
|
||||
|
||||
@Setting(descKey = "kernel.config.primary_user_identifier")
|
||||
private String primaryUserIdentifier = "email";
|
||||
private String primaryUserIdentifier = EMAIL;
|
||||
|
||||
@Setting(descKey = "kernel.config.sso_enabled")
|
||||
private boolean ssoEnabled = false;
|
||||
|
|
@ -64,6 +70,13 @@ public final class KernelConfig {
|
|||
@Setting(descKey = "kernel.config.default_language")
|
||||
private String defaultLanguage = "en";
|
||||
|
||||
public static KernelConfig getConfig() {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
return confManager.findConfiguration(KernelConfig.class);
|
||||
}
|
||||
|
||||
public KernelConfig() {
|
||||
super();
|
||||
}
|
||||
|
|
@ -98,8 +111,8 @@ public final class KernelConfig {
|
|||
}
|
||||
|
||||
public void setPrimaryUserIdentifier(final String primaryUserIdentifier) {
|
||||
if ("screen_name".equals(primaryUserIdentifier)
|
||||
|| "email".equals(primaryUserIdentifier)) {
|
||||
if (SCREEN_NAME.equals(primaryUserIdentifier)
|
||||
|| EMAIL.equals(primaryUserIdentifier)) {
|
||||
this.primaryUserIdentifier = primaryUserIdentifier;
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
|
|
@ -108,6 +121,14 @@ public final class KernelConfig {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean emailIsPrimaryIdentifier() {
|
||||
return EMAIL.equals(primaryUserIdentifier);
|
||||
}
|
||||
|
||||
public boolean screenNameIsPrimaryIdentifier() {
|
||||
return SCREEN_NAME.equals(primaryUserIdentifier);
|
||||
}
|
||||
|
||||
public boolean isSsoEnabled() {
|
||||
return ssoEnabled;
|
||||
}
|
||||
|
|
@ -156,6 +177,10 @@ public final class KernelConfig {
|
|||
supportedLanguages.remove(language);
|
||||
}
|
||||
|
||||
public boolean hasLanguage(final String language) {
|
||||
return supportedLanguages.contains(language);
|
||||
}
|
||||
|
||||
public String getDefaultLanguage() {
|
||||
return defaultLanguage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,203 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.kernel;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
import com.arsdigita.util.parameter.EnumerationParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Justin Ross
|
||||
* @see com.arsdigita.kernel.Kernel
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class LegacyKernelConfig extends AbstractConfig {
|
||||
|
||||
/** A logger instance. */
|
||||
private static final Logger s_log = Logger.getLogger(LegacyKernelConfig.class);
|
||||
|
||||
/** Singelton config object. */
|
||||
private static LegacyKernelConfig s_conf;
|
||||
|
||||
/**
|
||||
* Gain a LegacyKernelConfig object.
|
||||
*
|
||||
* Singelton pattern, don't instantiate a LegacyKernelConfig object using the
|
||||
constructor directly!
|
||||
* @return
|
||||
*/
|
||||
public static synchronized LegacyKernelConfig getConfig() {
|
||||
if (s_conf == null) {
|
||||
s_conf = new LegacyKernelConfig();
|
||||
s_conf.load();
|
||||
}
|
||||
|
||||
return s_conf;
|
||||
}
|
||||
|
||||
/** TODO: should be renamed waf.kernel.debug" */
|
||||
private static Parameter m_debug = new BooleanParameter
|
||||
("waf.debug", Parameter.REQUIRED, Boolean.FALSE);
|
||||
/** Whether WEB development support should be activated (true) or not. */
|
||||
// Handled in OLD initializer c.ad.webdevsupport.LegacyInitializer
|
||||
private static Parameter m_webdevSupport = new BooleanParameter
|
||||
("waf.webdev_support", Parameter.REQUIRED, Boolean.FALSE);
|
||||
private final Parameter m_permissions = new BooleanParameter
|
||||
("waf.kernel.data_permission_check_enabled", Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
/** User Login by screen name or email address */
|
||||
private final EnumerationParameter m_identifier = new EnumerationParameter
|
||||
("waf.kernel.primary_user_identifier", Parameter.REQUIRED,
|
||||
"email");
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_SSO = new BooleanParameter
|
||||
("waf.kernel.sso_login", Parameter.REQUIRED, Boolean.FALSE);
|
||||
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_remember = new BooleanParameter
|
||||
("waf.kernel.remember_login", Parameter.REQUIRED, Boolean.TRUE);
|
||||
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_secureLogin = new BooleanParameter
|
||||
("waf.kernel.secure_login", Parameter.REQUIRED, Boolean.FALSE);
|
||||
|
||||
/** String containing the supported languages.
|
||||
The first one is considered default. */
|
||||
private final Parameter m_supportedLanguages = new StringParameter
|
||||
("waf.kernel.supported_languages", Parameter.REQUIRED,
|
||||
"en,de,fr,nl,it,pt,es");
|
||||
private final Parameter m_languageIndependentItems = new BooleanParameter
|
||||
("waf.kernel.language_independent_items", Parameter.REQUIRED, Boolean.FALSE);
|
||||
private final Parameter m_languageIndependentCode = new StringParameter
|
||||
("waf.kernel.language_independent_code", Parameter.OPTIONAL,
|
||||
"--");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public LegacyKernelConfig() {
|
||||
|
||||
// Add recognised Login user identification to enumeration parameter
|
||||
m_identifier.put("email", "email");
|
||||
m_identifier.put("screen_name", "screenName");
|
||||
|
||||
|
||||
register(m_debug);
|
||||
register(m_webdevSupport);
|
||||
register(m_permissions);
|
||||
register(m_identifier);
|
||||
register(m_SSO);
|
||||
register(m_remember);
|
||||
register(m_secureLogin);
|
||||
register(m_supportedLanguages);
|
||||
register(m_languageIndependentItems);
|
||||
register(m_languageIndependentCode);
|
||||
|
||||
loadInfo();
|
||||
}
|
||||
|
||||
|
||||
public final boolean isDebugEnabled() {
|
||||
return ((Boolean) get(m_debug)).booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true, if WEB developer support should be activated.
|
||||
*/
|
||||
public final boolean isWebdevSupportActive() {
|
||||
return ((Boolean) get(m_webdevSupport)).booleanValue();
|
||||
}
|
||||
|
||||
public final boolean isDataPermissionCheckEnabled() {
|
||||
return ((Boolean) get(m_permissions)).booleanValue();
|
||||
}
|
||||
|
||||
public final String getPrimaryUserIdentifier() {
|
||||
return (String) get(m_identifier);
|
||||
}
|
||||
|
||||
public final boolean emailIsPrimaryIdentifier() {
|
||||
return "email".equals(get(m_identifier));
|
||||
}
|
||||
|
||||
public final boolean screenNameIsPrimaryIdentifier() {
|
||||
return !emailIsPrimaryIdentifier();
|
||||
}
|
||||
|
||||
public final boolean isSSOenabled() {
|
||||
return ((Boolean) get(m_SSO)).booleanValue();
|
||||
}
|
||||
|
||||
// XXX Move this to WebConfig.
|
||||
public final boolean isLoginRemembered() {
|
||||
return ((Boolean) get(m_remember)).booleanValue();
|
||||
}
|
||||
|
||||
public final boolean isSecureLoginRequired() {
|
||||
return ((Boolean) get(m_secureLogin)).booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the defaultLanguage flag.
|
||||
*/
|
||||
public final String getDefaultLanguage() {
|
||||
return ((String) get(m_supportedLanguages)).trim().substring(0, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the supportedLanguages as String.
|
||||
*/
|
||||
public final String getSupportedLanguages() {
|
||||
return (String) get(m_supportedLanguages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the supportedLanguages as StringTokenizer.
|
||||
*/
|
||||
public final StringTokenizer getSupportedLanguagesTokenizer() {
|
||||
return new StringTokenizer(this.getSupportedLanguages(), ",", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the languagesIndependentCode as String.
|
||||
*/
|
||||
public final String getLanguagesIndependentCode() {
|
||||
return (String) get(m_languageIndependentCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true, if language lang is part of supported langs
|
||||
*/
|
||||
public final boolean hasLanguage(String lang) {
|
||||
return ((String) get(m_supportedLanguages)).contains(lang);
|
||||
}
|
||||
|
||||
public final boolean languageIndependentItems() {
|
||||
return ((Boolean) get(m_languageIndependentItems)).booleanValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* Copyright (C) 2011 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.notification;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.IntegerParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* LegacyNotificationConfig
|
||||
*
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
* @version $Id: LegacyNotificationConfig.java $
|
||||
*/
|
||||
public class LegacyNotificationConfig extends AbstractConfig {
|
||||
|
||||
/** Private Logger instance. */
|
||||
private static final Logger s_log = Logger.getLogger(LegacyNotificationConfig.class);
|
||||
|
||||
/** Private Object to hold one's own instance to return to users. */
|
||||
private static LegacyNotificationConfig s_conf;
|
||||
|
||||
/**
|
||||
* Returns the singleton configuration record for the content section
|
||||
* environment.
|
||||
*
|
||||
* @return The <code>ContentSectionConfig</code> record; it cannot be null
|
||||
*/
|
||||
public static synchronized LegacyNotificationConfig getInstance() {
|
||||
if (s_conf == null) {
|
||||
s_conf = new LegacyNotificationConfig();
|
||||
s_conf.load();
|
||||
}
|
||||
|
||||
return s_conf;
|
||||
}
|
||||
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Set of parameters controlling Overdue Task alerts:
|
||||
// Currently there is no way to persist it nor to persist on a per section base.
|
||||
// Therefore Initializer has to create overdue task alert mechanism using a
|
||||
// configuration applied to every content section.
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Request manager's delay in seconds.
|
||||
*/
|
||||
private IntegerParameter m_requestManagerDelay = new IntegerParameter
|
||||
("waf.notification.request_manager_delay", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Request manager's period in seconds
|
||||
*/
|
||||
private IntegerParameter m_requestManagerPeriod = new IntegerParameter
|
||||
("waf.notification.request_manager_period", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Digest queue's delay in seconds.
|
||||
*/
|
||||
private IntegerParameter m_digestQueueDelay = new IntegerParameter
|
||||
("waf.notification.digest_queue_delay", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Digest queue's period in seconds
|
||||
*/
|
||||
private IntegerParameter m_digestQueuePeriod = new IntegerParameter
|
||||
("waf.notification.digest_queue_period", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Simple queue's delay in seconds.
|
||||
*/
|
||||
private IntegerParameter m_simpleQueueDelay = new IntegerParameter
|
||||
("waf.notification.simple_queue_delay", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Simple queue's period in seconds
|
||||
*/
|
||||
private IntegerParameter m_simpleQueuePeriod = new IntegerParameter
|
||||
("waf.notification.simple_queue_period", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Do not use it directly! Singleton design pattern!
|
||||
*/
|
||||
public LegacyNotificationConfig() {
|
||||
s_log.debug("Executing NotificationConfig Constructor.");
|
||||
register(m_requestManagerDelay);
|
||||
register(m_requestManagerPeriod);
|
||||
register(m_simpleQueueDelay);
|
||||
register(m_simpleQueuePeriod);
|
||||
register(m_digestQueueDelay);
|
||||
register(m_digestQueuePeriod);
|
||||
s_log.debug("NotificationConfig register executed.");
|
||||
|
||||
s_log.debug("Executing NotificationConfig loadinfo.");
|
||||
loadInfo();
|
||||
s_log.debug("Leaving NotificationConfig Constructor.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve request manager's delay in seconds.
|
||||
* @return delay, in seconds.
|
||||
*/
|
||||
public int getRequestManagerDelay() {
|
||||
s_log.debug("m_requestManagerDelay retrieved.");
|
||||
// return ((Integer) get(m_requestManagerDelay)).intValue();
|
||||
return 900;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve request manager's period in seconds
|
||||
* @return period, in seconds
|
||||
*/
|
||||
public int getRequestManagerPeriod() {
|
||||
s_log.debug("m_requestManagerPeriod retrieved.");
|
||||
// return ((Integer) get(m_requestManagerPeriod)).intValue();
|
||||
return 900;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve digest queue's delay in seconds.
|
||||
* @return delay, in seconds.
|
||||
*/
|
||||
public int getDigestQueueDelay() {
|
||||
s_log.debug("m_digestQueueDelay retrieved.");
|
||||
// return ((Integer) get(m_digestQueueDelay)).intValue();
|
||||
return 900;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve digest queue's period in seconds
|
||||
* @return period, in seconds
|
||||
*/
|
||||
public int getDigestQueuePeriod() {
|
||||
s_log.debug("m_digestQueuePeriod retrieved.");
|
||||
// return ((Integer) get(m_digestQueuePeriod)).intValue();
|
||||
return 900;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve simple queue's delay in seconds.
|
||||
* @return delay, in seconds.
|
||||
*/
|
||||
public int getSimpleQueueDelay() {
|
||||
s_log.debug("m_simpleQueueDelay retrieved.");
|
||||
// return ((Integer) get(m_simpleQueueDelay)).intValue();
|
||||
return 900;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve simple queue's period in seconds
|
||||
* @return period, in seconds
|
||||
*/
|
||||
public int getSimpleQueuePeriod() {
|
||||
s_log.debug("m_simpleQueuePeriod retrieved.");
|
||||
// return ((Integer) get(m_simpleQueuePeriod)).intValue();
|
||||
return 900;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Copyright (C) 2011 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
|
||||
* Copyright (C) 2016 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
@ -13,178 +13,164 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.notification;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.IntegerParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.configuration.Configuration;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.configuration.Setting;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* NotificationConfig
|
||||
*
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
* @version $Id: NotificationConfig.java $
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class NotificationConfig extends AbstractConfig {
|
||||
@Configuration(
|
||||
descBundle = "com.arsdigita.notification.NotificationConfigDescription",
|
||||
descKey = "notification.config.description")
|
||||
public final class NotificationConfig {
|
||||
|
||||
/** Private Logger instance. */
|
||||
private static final Logger s_log = Logger.getLogger(NotificationConfig.class);
|
||||
@Setting(descKey = "notification.config.request_manager_delay")
|
||||
private Integer requestManagerDelay = 900;
|
||||
|
||||
/** Private Object to hold one's own instance to return to users. */
|
||||
private static NotificationConfig s_conf;
|
||||
@Setting(descKey = "notification.config.request_manager_period")
|
||||
private Integer requestManagerPeriod = 900;
|
||||
|
||||
/**
|
||||
* Returns the singleton configuration record for the content section
|
||||
* environment.
|
||||
*
|
||||
* @return The <code>ContentSectionConfig</code> record; it cannot be null
|
||||
*/
|
||||
public static synchronized NotificationConfig getInstance() {
|
||||
if (s_conf == null) {
|
||||
s_conf = new NotificationConfig();
|
||||
s_conf.load();
|
||||
@Setting(descKey = "notification.config.digest_queue_delay")
|
||||
private Integer digestQueueDelay = 900;
|
||||
|
||||
@Setting(descKey = "notification.config.digest_queue_period")
|
||||
private Integer digestQueuePeriod = 900;
|
||||
|
||||
@Setting(descKey = "notification.config.simple_queue_delay")
|
||||
private Integer simpleQueueDelay = 900;
|
||||
|
||||
@Setting(descKey = "notification.config.simple_queue_period")
|
||||
private Integer simpleQueuePeriod = 900;
|
||||
|
||||
public static NotificationConfig getConfig() {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
return confManager.findConfiguration(NotificationConfig.class);
|
||||
}
|
||||
|
||||
return s_conf;
|
||||
}
|
||||
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Set of parameters controlling Overdue Task alerts:
|
||||
// Currently there is no way to persist it nor to persist on a per section base.
|
||||
// Therefore Initializer has to create overdue task alert mechanism using a
|
||||
// configuration applied to every content section.
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Request manager's delay in seconds.
|
||||
*/
|
||||
private IntegerParameter m_requestManagerDelay = new IntegerParameter
|
||||
("waf.notification.request_manager_delay", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Request manager's period in seconds
|
||||
*/
|
||||
private IntegerParameter m_requestManagerPeriod = new IntegerParameter
|
||||
("waf.notification.request_manager_period", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Digest queue's delay in seconds.
|
||||
*/
|
||||
private IntegerParameter m_digestQueueDelay = new IntegerParameter
|
||||
("waf.notification.digest_queue_delay", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Digest queue's period in seconds
|
||||
*/
|
||||
private IntegerParameter m_digestQueuePeriod = new IntegerParameter
|
||||
("waf.notification.digest_queue_period", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Simple queue's delay in seconds.
|
||||
*/
|
||||
private IntegerParameter m_simpleQueueDelay = new IntegerParameter
|
||||
("waf.notification.simple_queue_delay", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Simple queue's period in seconds
|
||||
*/
|
||||
private IntegerParameter m_simpleQueuePeriod = new IntegerParameter
|
||||
("waf.notification.simple_queue_period", Parameter.REQUIRED,
|
||||
new Integer(900));
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Do not use it directly! Singleton design pattern!
|
||||
*/
|
||||
public NotificationConfig() {
|
||||
s_log.debug("Executing NotificationConfig Constructor.");
|
||||
register(m_requestManagerDelay);
|
||||
register(m_requestManagerPeriod);
|
||||
register(m_simpleQueueDelay);
|
||||
register(m_simpleQueuePeriod);
|
||||
register(m_digestQueueDelay);
|
||||
register(m_digestQueuePeriod);
|
||||
s_log.debug("NotificationConfig register executed.");
|
||||
|
||||
s_log.debug("Executing NotificationConfig loadinfo.");
|
||||
loadInfo();
|
||||
s_log.debug("Leaving NotificationConfig Constructor.");
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve request manager's delay in seconds.
|
||||
* @return delay, in seconds.
|
||||
*/
|
||||
public int getRequestManagerDelay() {
|
||||
s_log.debug("m_requestManagerDelay retrieved.");
|
||||
// return ((Integer) get(m_requestManagerDelay)).intValue();
|
||||
return 900;
|
||||
public Integer getRequestManagerDelay() {
|
||||
return requestManagerDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve request manager's period in seconds
|
||||
* @return period, in seconds
|
||||
*/
|
||||
public int getRequestManagerPeriod() {
|
||||
s_log.debug("m_requestManagerPeriod retrieved.");
|
||||
// return ((Integer) get(m_requestManagerPeriod)).intValue();
|
||||
return 900;
|
||||
public void setRequestManagerDelay(final Integer requestManagerDelay) {
|
||||
this.requestManagerDelay = requestManagerDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve digest queue's delay in seconds.
|
||||
* @return delay, in seconds.
|
||||
*/
|
||||
public int getDigestQueueDelay() {
|
||||
s_log.debug("m_digestQueueDelay retrieved.");
|
||||
// return ((Integer) get(m_digestQueueDelay)).intValue();
|
||||
return 900;
|
||||
public Integer getRequestManagerPeriod() {
|
||||
return requestManagerPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve digest queue's period in seconds
|
||||
* @return period, in seconds
|
||||
*/
|
||||
public int getDigestQueuePeriod() {
|
||||
s_log.debug("m_digestQueuePeriod retrieved.");
|
||||
// return ((Integer) get(m_digestQueuePeriod)).intValue();
|
||||
return 900;
|
||||
public void setRequestManagerPeriod(final Integer requestManagerPeriod) {
|
||||
this.requestManagerPeriod = requestManagerPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve simple queue's delay in seconds.
|
||||
* @return delay, in seconds.
|
||||
*/
|
||||
public int getSimpleQueueDelay() {
|
||||
s_log.debug("m_simpleQueueDelay retrieved.");
|
||||
// return ((Integer) get(m_simpleQueueDelay)).intValue();
|
||||
return 900;
|
||||
public Integer getDigestQueueDelay() {
|
||||
return digestQueueDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve simple queue's period in seconds
|
||||
* @return period, in seconds
|
||||
*/
|
||||
public int getSimpleQueuePeriod() {
|
||||
s_log.debug("m_simpleQueuePeriod retrieved.");
|
||||
// return ((Integer) get(m_simpleQueuePeriod)).intValue();
|
||||
return 900;
|
||||
public void setDigestQueueDelay(final Integer digestQueueDelay) {
|
||||
this.digestQueueDelay = digestQueueDelay;
|
||||
}
|
||||
|
||||
public Integer getDigestQueuePeriod() {
|
||||
return digestQueuePeriod;
|
||||
}
|
||||
|
||||
public void setDigestQueuePeriod(final Integer digestQueuePeriod) {
|
||||
this.digestQueuePeriod = digestQueuePeriod;
|
||||
}
|
||||
|
||||
public Integer getSimpleQueueDelay() {
|
||||
return simpleQueueDelay;
|
||||
}
|
||||
|
||||
public void setSimpleQueueDelay(final Integer simpleQueueDelay) {
|
||||
this.simpleQueueDelay = simpleQueueDelay;
|
||||
}
|
||||
|
||||
public Integer getSimpleQueuePeriod() {
|
||||
return simpleQueuePeriod;
|
||||
}
|
||||
|
||||
public void setSimpleQueuePeriod(final Integer simpleQueuePeriod) {
|
||||
this.simpleQueuePeriod = simpleQueuePeriod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 89 * hash + Objects.hashCode(requestManagerDelay);
|
||||
hash = 89 * hash + Objects.hashCode(requestManagerPeriod);
|
||||
hash = 89 * hash + Objects.hashCode(digestQueueDelay);
|
||||
hash = 89 * hash + Objects.hashCode(digestQueuePeriod);
|
||||
hash = 89 * hash + Objects.hashCode(simpleQueueDelay);
|
||||
hash = 89 * hash + Objects.hashCode(simpleQueuePeriod);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof NotificationConfig)) {
|
||||
return false;
|
||||
}
|
||||
final NotificationConfig other = (NotificationConfig) obj;
|
||||
if (!Objects.equals(requestManagerDelay, other.getRequestManagerDelay())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(requestManagerPeriod,
|
||||
other.getRequestManagerPeriod())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(digestQueueDelay, other.getDigestQueueDelay())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(digestQueuePeriod, other.getDigestQueuePeriod())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(simpleQueueDelay, other.getSimpleQueueDelay())) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(simpleQueuePeriod, other.getSimpleQueuePeriod());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s{ "
|
||||
+ "requestManagerDelay = %d, "
|
||||
+ "requestManagerPeriod = %d, "
|
||||
+ "digestQueueDelay = %d, "
|
||||
+ "digestQueuePeriod = %d, "
|
||||
+ "simpleQueueDelay = %d, "
|
||||
+ "simpleQueuePeriod = %d"
|
||||
+ " }",
|
||||
super.toString(),
|
||||
requestManagerDelay,
|
||||
requestManagerPeriod,
|
||||
digestQueueDelay,
|
||||
digestQueuePeriod,
|
||||
simpleQueueDelay,
|
||||
simpleQueuePeriod);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
package com.arsdigita.templating;
|
||||
|
||||
import com.arsdigita.bebop.Bebop;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.ExceptionUnwrapper;
|
||||
import com.arsdigita.util.Exceptions;
|
||||
|
|
@ -193,7 +193,7 @@ public class Templating {
|
|||
template = new XSLTemplate(source);
|
||||
}
|
||||
|
||||
} else if (LegacyKernelConfig.getConfig().isDebugEnabled()
|
||||
} else if (KernelConfig.getConfig().isDebugEnabled()
|
||||
&& template.isModified()) {
|
||||
// XXX referencing Kernel above is a broken dependency.
|
||||
// Debug mode should be captured at a lower level,
|
||||
|
|
|
|||
|
|
@ -42,17 +42,17 @@ public abstract class UI {
|
|||
private static final UIConfig s_config = UIConfig.getConfig();
|
||||
|
||||
/** URL for systems public top level page (entry or start page). */
|
||||
private static final String s_rootPageURL = s_config.getRootPage();
|
||||
private static final String s_rootPageURL = s_config.getRootPageUrl();
|
||||
/** URL to page a user should be redirected to after login. */
|
||||
private static final String s_userRedirectURL = s_config.getUserRedirect();
|
||||
private static final String s_userRedirectURL = s_config.getUserRedirectUrl();
|
||||
/** (Absolute) URL for workspace page. */
|
||||
private static final String s_workspaceURL = s_config.getWorkspace();
|
||||
private static final String s_workspaceURL = s_config.getWorkspaceUrl();
|
||||
|
||||
|
||||
/**
|
||||
* Provides a handle to the UI config record.
|
||||
*
|
||||
* @return Instance of UIConfig
|
||||
* @return Instance of LegacyUIConfig
|
||||
*/
|
||||
public static UIConfig getConfig() {
|
||||
return s_config;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
|
||||
* Copyright (C) 2016 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
@ -13,264 +13,141 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package com.arsdigita.ui;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.StringArrayParameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.configuration.Configuration;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.configuration.Setting;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* A configuration record for configuration of the core UI package
|
||||
* (layout of main UI components).
|
||||
*
|
||||
* Accessors of this class may return null. Developers should take care
|
||||
* to trap null return values in their code.
|
||||
*
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
* @version $Id: $
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class UIConfig extends AbstractConfig {
|
||||
@Configuration(descBundle = "com.arsdigita.ui.UIConfigDescription",
|
||||
descKey = "ui.config.description")
|
||||
public final class UIConfig {
|
||||
|
||||
/** A logger instance. */
|
||||
private static final Logger s_log = Logger.getLogger(UIConfig.class);
|
||||
@Setting(descKey = "ui.config.default_layout")
|
||||
private List<String> defaultLayout = Arrays.asList(new String[]{
|
||||
"top:com.arsdigita.ui.UserBanner",
|
||||
"bottom:com.arsdigita.ui.SiteBanner",
|
||||
"bottom:com.arsdigita.ui.DebugPanel"
|
||||
});
|
||||
|
||||
/** Singelton config object. */
|
||||
private static UIConfig s_conf;
|
||||
@Setting(descKey = "ui.config.root_page_url")
|
||||
private String rootPageUrl = "/register/";
|
||||
|
||||
/**
|
||||
* Gain a UIConfig object.
|
||||
*
|
||||
* Singelton pattern, don't instantiate a lifecacle object using the
|
||||
* constructor directly!
|
||||
* @return
|
||||
*/
|
||||
public static synchronized UIConfig getConfig() {
|
||||
if (s_conf == null) {
|
||||
s_conf = new UIConfig();
|
||||
s_conf.load();
|
||||
@Setting(descKey = "ui.config.user_redirect_url")
|
||||
private String userRedirectUrl = "/permissions/";
|
||||
|
||||
@Setting(descKey = "ui.config.workspace_url")
|
||||
private String workspaceUrl = "pvt/";
|
||||
|
||||
public static UIConfig getConfig() {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
return confManager.findConfiguration(UIConfig.class);
|
||||
}
|
||||
|
||||
return s_conf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default set of page component objects defining the default layout for the
|
||||
* <strong>SimplePage</strong> class.
|
||||
*
|
||||
* Format expected by clients:
|
||||
* list { { "margin_position", "class_name_of_bebop_component"} ,
|
||||
* { "margin_position", "class_name_of_bebop_component"} ,
|
||||
* ...
|
||||
* { "margin_position", "class_name_of_bebop_component"}
|
||||
* }
|
||||
* Elements are optional and may have 0 ...n pairs of position/classname.
|
||||
*
|
||||
* Example:
|
||||
* defaultLayout = { { "top", "com.arsdigita.ui.UserBanner" },
|
||||
* { "bottom", "com.arsdigita.ui.SiteBanner" },
|
||||
* { "bottom", "com.arsdigita.ui.DebugPanel" }
|
||||
* { "left", "com.arsdigita.x.y.z" },
|
||||
* { "right", "com.arsdigita.x.y.z" }
|
||||
* };
|
||||
*
|
||||
* Currently there is no list parameter model available. We use a
|
||||
* StringArrayParameter instead, where each String element contains a
|
||||
* colon separated position:class entry. It is converted to a list by
|
||||
* the getter method.
|
||||
*/
|
||||
// Quick 'md Dirty, we reeally need a StringListParameter class
|
||||
private final Parameter m_defaultLayout =
|
||||
new StringArrayParameter(
|
||||
"core.ui.default_layout",
|
||||
Parameter.REQUIRED,
|
||||
new String[]
|
||||
{ "top:com.arsdigita.ui.UserBanner"
|
||||
,"bottom:com.arsdigita.ui.SiteBanner"
|
||||
,"bottom:com.arsdigita.ui.DebugPanel"
|
||||
//,"left:com.arsdigita.x.y.zl",
|
||||
//,"right:com.arsdigita.x.y.zr",
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* The customized layout for applications using the SimplePage class
|
||||
* Format: list presumably same format as m_defaultLayout. details unknown
|
||||
*
|
||||
* According to a comment in old enterprise.init file:
|
||||
* // Application specific page components
|
||||
* // applicationLayouts = {
|
||||
* // { "forums",
|
||||
* // {
|
||||
* // { "top", "com.arsdigita.x.y.z" },
|
||||
* // { "left", "com.arsdigita.x.y.z" },
|
||||
* // { "bottom", "com.arsdigita.x.y.z" },
|
||||
* // { "right", "com.arsdigita.x.y.z" }
|
||||
* // }
|
||||
* // },
|
||||
* // { "search",
|
||||
* // {
|
||||
* // { "top", "com.arsdigita.x.y.z" },
|
||||
* // { "left", "com.arsdigita.x.y.z" },
|
||||
* // { "bottom", "com.arsdigita.x.y.z" },
|
||||
* // { "right", "com.arsdigita.x.y.z" }
|
||||
* // }
|
||||
* // }
|
||||
* // };
|
||||
*
|
||||
*/
|
||||
private final Parameter m_applicationLayouts =
|
||||
new StringArrayParameter(
|
||||
"core.ui.application_layouts",
|
||||
Parameter.OPTIONAL,
|
||||
null
|
||||
);
|
||||
|
||||
/** String containing the relative URL for the top level page
|
||||
* (or entry page / home page) of the site, Without leading slash but
|
||||
* with trailing slash in case of a directory.
|
||||
* By default it is the login page, but usually the root page of the
|
||||
* main presentation application, e.g. portal, navigation, forum, etc. */
|
||||
private final Parameter m_rootPageURL =
|
||||
new StringParameter("core.ui.pagemap.root_page_url",
|
||||
Parameter.REQUIRED, "/register/");
|
||||
|
||||
/** String containing the URL of a page, a servlet or a jsp, to which a
|
||||
* user after login will be redirected to.
|
||||
* In case of a jsp or servlet it may contain user specific logic to
|
||||
* redirect to a page specific for the user or a group of users.
|
||||
* By default it is the /permissions/ page, but usually it is an
|
||||
* application like personal-portal or content-center. */
|
||||
private final Parameter m_userRedirectURL =
|
||||
new StringParameter("core.ui.pagemap.user_redirect_url",
|
||||
Parameter.REQUIRED, "/permissions/");
|
||||
|
||||
/** String containing the URL for the workspace of the site. */
|
||||
// Old initializer: waf.pagemap.workspace
|
||||
// XXX url pvt seems not to exist anymore! (pboy 2011-02-03)
|
||||
private final Parameter m_workspaceURL = new StringParameter
|
||||
("core.ui.pagemap.workspace_url", Parameter.REQUIRED, "pvt/");
|
||||
|
||||
/**
|
||||
* Constructs an empty RuntimeConfig object.
|
||||
*
|
||||
*/
|
||||
public UIConfig() {
|
||||
// pboy: According to the comment for the getConfig() method a singleton
|
||||
// pattern is to be used. Therefore the constructor must be changed to
|
||||
// private!
|
||||
// private UIConfig() {
|
||||
register(m_defaultLayout);
|
||||
register(m_applicationLayouts);
|
||||
|
||||
register(m_rootPageURL);
|
||||
register(m_userRedirectURL);
|
||||
register(m_workspaceURL);
|
||||
|
||||
loadInfo();
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the set of default page component objects defining
|
||||
* the default layout for SimplePage class.
|
||||
*/
|
||||
public List getDefaultLayout() {
|
||||
|
||||
/** List contain the default layout used to create a SimplePage. */
|
||||
ArrayList defaultLayout = new ArrayList();
|
||||
/** Value of the defaultLayout parameter, a string array of
|
||||
pair of position:class strings */
|
||||
String[] layoutParameter = (String[]) get(m_defaultLayout) ;
|
||||
|
||||
for (int i = 0; i < layoutParameter.length ; ++i) {
|
||||
String[] layoutSection = StringUtils.split(layoutParameter[i],':');
|
||||
defaultLayout.add(Arrays.asList(layoutSection));
|
||||
}
|
||||
return defaultLayout;
|
||||
public List<String> getDefaultLayout() {
|
||||
return new ArrayList<>(defaultLayout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the set of customized layout for applications using the
|
||||
* SimplePage class.
|
||||
* Parameter is optional, method may return null!
|
||||
*/
|
||||
public List getApplicationLayouts() {
|
||||
|
||||
/** Value of the customLayout parameter, a string array of
|
||||
pair of position:class strings */
|
||||
String[] customParameter = (String[]) get(m_applicationLayouts) ;
|
||||
|
||||
if (customParameter != null) {
|
||||
// This part of method could NOT be tested yet!
|
||||
/** List contain the application layout used to create a SimplePage. */
|
||||
ArrayList customLayout = new ArrayList();
|
||||
for (int i = 0; i < customParameter.length ; ++i) {
|
||||
String[] layoutSection = StringUtils.split(customParameter[i],':');
|
||||
customLayout.add(Arrays.asList(layoutSection));
|
||||
}
|
||||
return customLayout;
|
||||
} else {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
public void setDefaultLayout(final List<String> defaultLayout) {
|
||||
this.defaultLayout = defaultLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the site's root page url - i.e. the front page, the
|
||||
* (usually public) top level entry page for the site.
|
||||
* By default it is the login page, but usually the root page of the main
|
||||
* presentation application, e.g. portal, navigation, forum, etc.
|
||||
*
|
||||
* @return root page url
|
||||
*/
|
||||
public String getRootPage() {
|
||||
String rootPageURL = (String)get(m_rootPageURL) ;
|
||||
// Previous configurations required NO leading slash. Just in case an
|
||||
// old configuration is in place we have to translate.
|
||||
return ( rootPageURL.startsWith("/") ?
|
||||
rootPageURL : "/"+rootPageURL );
|
||||
public String getRootPageUrl() {
|
||||
return rootPageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve systems user login redirect page url, that is the page, a
|
||||
* servlet oder a JSP ti which a user is redirected to after login.
|
||||
* By default it is the /permissions/ page, but usually it is an application
|
||||
* like personal-portal or content-center.
|
||||
*
|
||||
* @return user login redirect page url
|
||||
*/
|
||||
public String getUserRedirect() {
|
||||
String userRedirectURL = (String)get(m_userRedirectURL);
|
||||
// Previous configurations required NO leading slash. Just in case an
|
||||
// old configuration is in place we have to translate.
|
||||
return ( userRedirectURL.startsWith("/") ?
|
||||
userRedirectURL : "/"+userRedirectURL );
|
||||
public void setRootPageUrl(final String rootPageUrl) {
|
||||
this.rootPageUrl = rootPageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve systems workspace url.
|
||||
*
|
||||
* @return workspace page url
|
||||
*/
|
||||
public String getWorkspace() {
|
||||
String workspaceURL = (String)get(m_workspaceURL);
|
||||
// Previous configurations required NO leading slash. Just in case an
|
||||
// old configuration is in place we have to translate.
|
||||
return ( workspaceURL.startsWith("/") ?
|
||||
workspaceURL : "/"+workspaceURL );
|
||||
public String getUserRedirectUrl() {
|
||||
return userRedirectUrl;
|
||||
}
|
||||
|
||||
public void setUserRedirectUrl(final String userRedirectUrl) {
|
||||
this.userRedirectUrl = userRedirectUrl;
|
||||
}
|
||||
|
||||
public String getWorkspaceUrl() {
|
||||
return workspaceUrl;
|
||||
}
|
||||
|
||||
public void setWorkspaceUrl(final String workspaceUrl) {
|
||||
this.workspaceUrl = workspaceUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 31 * hash + Objects.hashCode(defaultLayout);
|
||||
hash = 31 * hash + Objects.hashCode(rootPageUrl);
|
||||
hash = 31 * hash + Objects.hashCode(userRedirectUrl);
|
||||
hash = 31 * hash + Objects.hashCode(workspaceUrl);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof UIConfig)) {
|
||||
return false;
|
||||
}
|
||||
final UIConfig other = (UIConfig) obj;
|
||||
if (!Objects.equals(rootPageUrl, other.getRootPageUrl())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(userRedirectUrl, other.getUserRedirectUrl())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(workspaceUrl, other.getWorkspaceUrl())) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(defaultLayout, other.getDefaultLayout());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringJoiner joiner = new StringJoiner(", ");
|
||||
if (defaultLayout != null) {
|
||||
defaultLayout.forEach(s -> joiner.add(s));
|
||||
}
|
||||
|
||||
return String.format("%s{ "
|
||||
+ "defaultLayout = \"%s\", "
|
||||
+ "rootPageUrl = \"%s\", "
|
||||
+ "userRedirectUrl = \"%s\", "
|
||||
+ "workspaceUrl = \"%s\""
|
||||
+ " }",
|
||||
super.toString(),
|
||||
defaultLayout,
|
||||
rootPageUrl,
|
||||
userRedirectUrl,
|
||||
workspaceUrl);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
|||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
|
||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
|
@ -158,7 +158,7 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
// Screen name
|
||||
m_screenName = new TextField(new StringParameter(
|
||||
USER_FORM_INPUT_SCREEN_NAME));
|
||||
if (LegacyKernelConfig.getConfig().screenNameIsPrimaryIdentifier()) {
|
||||
if (KernelConfig.getConfig().screenNameIsPrimaryIdentifier()) {
|
||||
m_screenName.addValidationListener(new NotEmptyValidationListener());
|
||||
}
|
||||
add(USER_FORM_LABEL_SCREEN_NAME);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import com.arsdigita.bebop.form.Password;
|
|||
import com.arsdigita.bebop.form.Submit;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
|
|
@ -126,7 +126,7 @@ public class ChangePasswordForm extends Form
|
|||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
|
||||
final LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final User user = shiro.getUser();
|
||||
|
||||
final Label greeting = new Label(LoginHelper.getMessage(
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
|||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
|
@ -285,7 +285,7 @@ public abstract class UserForm extends Form
|
|||
|
||||
final String oldEmail = user.getPrimaryEmailAddress().getAddress();
|
||||
final String email = (String) m_email.getValue(state);
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()
|
||||
&& email != null && !email.equals(oldEmail)) {
|
||||
final User result = userRepository.findByEmailAddress(email);
|
||||
if (result != null) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
|||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
|
||||
|
|
@ -61,6 +61,7 @@ import org.apache.shiro.authc.UsernamePasswordToken;
|
|||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
|
||||
/**
|
||||
* A Bebop form that accepts login and password from the user and attempts to
|
||||
|
|
@ -133,6 +134,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
addValidationListener(this);
|
||||
addProcessListener(this);
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
m_autoRegistrationOn = autoRegistrationOn;
|
||||
|
||||
m_timestamp = new Hidden(new StringParameter(FORM_TIMESTAMP));
|
||||
|
|
@ -158,7 +161,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
"login.userRegistrationForm.cookieOption"));
|
||||
Option opt = new Option(FORM_PERSISTENT_LOGIN_P_DEFAULT, optLabel);
|
||||
m_isPersistent.addOption(opt);
|
||||
if (LegacyKernelConfig.getConfig().isLoginRemembered()) {
|
||||
if (kernelConfig.isRememberLoginEnabled()) {
|
||||
m_isPersistent.setOptionSelected(FORM_PERSISTENT_LOGIN_P_DEFAULT);
|
||||
}
|
||||
cookiePanel.add(m_isPersistent);
|
||||
|
|
@ -192,7 +195,9 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
"subsite:loginPromptMsg",
|
||||
LoginServlet.SUBSITE_NS_URI);
|
||||
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
if (kernelConfig.emailIsPrimaryIdentifier()) {
|
||||
loginMessage.setClassAttr("email");
|
||||
} else {
|
||||
loginMessage.setClassAttr("screenName");
|
||||
|
|
@ -200,7 +205,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
|
||||
add(loginMessage);
|
||||
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (kernelConfig.emailIsPrimaryIdentifier()) {
|
||||
add(new Label(LoginHelper.getMessage(
|
||||
"login.userRegistrationForm.email")));
|
||||
m_loginName = new TextField(new EmailParameter(FORM_LOGIN));
|
||||
|
|
@ -228,7 +233,10 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
s_log.info("In init");
|
||||
if (LegacyKernelConfig.getConfig().isSSOenabled()) {
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
if (kernelConfig.isSsoEnabled()) {
|
||||
// try SSO login
|
||||
s_log.info("trying SSO");
|
||||
// try {
|
||||
|
|
@ -345,32 +353,6 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
} catch (AuthenticationException ex) {
|
||||
onLoginFail(event, ex);
|
||||
}
|
||||
|
||||
// try {
|
||||
// final CcmSessionContext ctx = Web.getUserContext();
|
||||
// final String username;
|
||||
// if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
// username = ((InternetAddress) m_loginName.getValue(state)).
|
||||
// getAddress();
|
||||
// } else {
|
||||
// username = (String) m_loginName.getValue(state);
|
||||
// }
|
||||
//
|
||||
// final String password = ((String)m_password.getValue(state)).trim();
|
||||
// boolean forever = getPersistentLoginValue(event.getPageState(),
|
||||
// false);
|
||||
// // attempt to log in user
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final LoginManager loginManager;
|
||||
|
||||
// loginManager = cdiUtil.findBean(LoginManager.class);
|
||||
// loginManager.login(username, password);
|
||||
// onLoginSuccess(event);
|
||||
// } catch (FailedLoginException e) {
|
||||
// onLoginFail(event, e);
|
||||
// } catch (LoginException e) {
|
||||
// onLoginException(event, e);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import com.arsdigita.bebop.form.Hidden;
|
|||
import com.arsdigita.bebop.parameters.ArrayParameter;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
|
|
@ -121,7 +121,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
m_confirm.setValue(state, "");
|
||||
String loginName = (String) m_loginName.getValue(state);
|
||||
if (loginName != null) {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
m_email.setValue(state, loginName);
|
||||
} else {
|
||||
m_screenName.setValue(state, loginName);
|
||||
|
|
@ -143,7 +143,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
final String firstName = (String) m_firstName.getValue(state);
|
||||
final String lastName = (String) m_lastName.getValue(state);
|
||||
final String screenName;
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
screenName = null;
|
||||
} else {
|
||||
screenName = (String) m_screenName.getValue(state);
|
||||
|
|
@ -175,7 +175,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
|
||||
try {
|
||||
final String loginName;
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
loginName = email;
|
||||
} else {
|
||||
loginName = screenName;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.web;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -48,7 +48,7 @@ public abstract class Debugger {
|
|||
|
||||
public static class DebugParameterListener implements ParameterListener {
|
||||
public void run(HttpServletRequest sreq, ParameterMap map) {
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
final String value = sreq.getParameter(DEBUG_PARAMETER);
|
||||
|
||||
if (value != null) {
|
||||
|
|
@ -86,7 +86,7 @@ public abstract class Debugger {
|
|||
private static class DebuggerListLocal extends InternalRequestLocal {
|
||||
@Override
|
||||
protected Object initialValue() {
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
return new ArrayList();
|
||||
} else {
|
||||
return null;
|
||||
|
|
@ -95,7 +95,7 @@ public abstract class Debugger {
|
|||
|
||||
@Override
|
||||
protected void clearValue() {
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
ArrayList list = (ArrayList) get();
|
||||
list.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import java.util.Optional;
|
|||
|
||||
import org.apache.logging.log4j.message.FormattedMessage;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
|
|
@ -497,11 +498,13 @@ public class ConfigurationManager {
|
|||
} else if (Double.class.getName().equals(valueTypeName)) {
|
||||
return (AbstractSetting<T>) new DoubleSetting();
|
||||
} else if (List.class.getName().equals(valueTypeName)) {
|
||||
return (AbstractSetting<T>) new EnumSetting();
|
||||
return (AbstractSetting<T>) new StringListSetting();
|
||||
} else if (LocalizedString.class.getName().equals(valueTypeName)) {
|
||||
return (AbstractSetting<T>) new LocalizedStringSetting();
|
||||
} else if (Long.class.getName().equals(valueTypeName)) {
|
||||
return (AbstractSetting<T>) new LongSetting();
|
||||
} else if (Set.class.getName().equals(valueTypeName)) {
|
||||
return (AbstractSetting<T>) new EnumSetting();
|
||||
} else if (String.class.getName().equals(valueTypeName)) {
|
||||
return (AbstractSetting<T>) new StringSetting();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@ package org.libreccm.configuration;
|
|||
import static org.libreccm.core.CoreConstants.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -110,14 +111,15 @@ public class EnumSetting
|
|||
final StringBuffer enumValues = new StringBuffer();
|
||||
enumValues.append("{ ");
|
||||
if (value != null) {
|
||||
value.forEach((String v) -> {
|
||||
final List<String> values = new ArrayList<>(value);
|
||||
values.forEach((String v) -> {
|
||||
enumValues.append('\"').append(v).append('\"');
|
||||
if (enumValues.indexOf(v) != enumValues.length() - 1) {
|
||||
if (values.indexOf(v) != values.size()- 1) {
|
||||
enumValues.append(", ");
|
||||
}
|
||||
});
|
||||
enumValues.append(" }");
|
||||
}
|
||||
enumValues.append(" }");
|
||||
|
||||
return super.toString(String.format(", value = %s%s",
|
||||
enumValues.toString(),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright (C) 2016 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.configuration;
|
||||
|
||||
import static org.libreccm.core.CoreConstants.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "SETTINGS_STRING_LIST", schema = DB_SCHEMA)
|
||||
public class StringListSetting extends AbstractSetting<List<String>> {
|
||||
|
||||
private static final long serialVersionUID = 7093818804712916413L;
|
||||
|
||||
@ElementCollection
|
||||
@JoinTable(name = "SETTINGS_STRING_LIST",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {@JoinColumn(name = "LIST_ID")})
|
||||
private List<String> value;
|
||||
|
||||
@Override
|
||||
public List<String> getValue() {
|
||||
if (value == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new ArrayList<>(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final List<String> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void addListValue(final String value) {
|
||||
this.value.add(value);
|
||||
}
|
||||
|
||||
public void removeListValue(final String value) {
|
||||
this.value.remove(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 41 * hash + Objects.hashCode(value);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof StringListSetting)) {
|
||||
return false;
|
||||
}
|
||||
final StringListSetting other = (StringListSetting) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Objects.equals(value, other.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof StringListSetting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
final StringBuilder listValues = new StringBuilder();
|
||||
listValues.append("{ ");
|
||||
if (value != null) {
|
||||
value.forEach((String v) -> {
|
||||
listValues.append('\"').append(v).append('\"');
|
||||
if (value.indexOf(v) != value.size() - 1) {
|
||||
listValues.append(", ");
|
||||
}
|
||||
});
|
||||
}
|
||||
listValues.append(" }");
|
||||
|
||||
return super.toString(String.format(", value = %s%s",
|
||||
listValues.toString(),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
|
|
@ -202,7 +202,7 @@ public class CcmShiroRealm extends AuthorizingRealm {
|
|||
|
||||
// Depending of the configuration of CCM use the appropriate method
|
||||
// for finding the user in the database.
|
||||
final LegacyKernelConfig config = LegacyKernelConfig.getConfig();
|
||||
final KernelConfig config = KernelConfig.getConfig();
|
||||
final User user;
|
||||
if ("email".equals(config.getPrimaryUserIdentifier())) {
|
||||
user = userRepository.findByEmailAddress(userIdentifier);
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.inject.Produces;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
|
@ -97,7 +99,7 @@ public class Shiro {
|
|||
}
|
||||
|
||||
public Subject getPublicUser() {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
return buildInternalSubject("public-user@localhost");
|
||||
} else {
|
||||
return buildInternalSubject("public-user");
|
||||
|
|
@ -109,7 +111,7 @@ public class Shiro {
|
|||
}
|
||||
|
||||
public User getUser() {
|
||||
final LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
if (kernelConfig.emailIsPrimaryIdentifier()) {
|
||||
return userRepository.findByEmailAddress((String) getSubject().
|
||||
getPrincipal());
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<registry>
|
||||
<config class="com.arsdigita.kernel.KernelConfig"
|
||||
storage="ccm-core/kernel.properties"/>
|
||||
</registry>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# Copyright (C) 2016 LibreCCM Foundation.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA
|
||||
|
||||
notification.config.description=Configuration for the notification system
|
||||
|
||||
notification.config.request_manager_delay=Start of request manager's delay in seconds.
|
||||
notification.config.request_manager_period=Request manager's activities period in seconds
|
||||
|
||||
notification.config.digest_queue_delay=Start of Digest Queue's delay in seconds.
|
||||
notification.config.digest_queue_period=Digest Queue's activities period in seconds
|
||||
|
||||
notification.config.simple_queue_delay=Start of Simple Queue's delay in seconds.
|
||||
notification.config.simple_queue_period=Simple Queue's activities period in seconds
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
ui.config.description=Configuration for the UI system
|
||||
|
||||
ui.config.default_layout=Default layout components for SimplePage class
|
||||
ui.config.root_page_url=Enter the relative URL for top-level page (to document root and without constant prefix if configured)
|
||||
ui.config.user_redirect_url=Enter the relative URL to a page which redirects the request according to the logged in user (if exists)
|
||||
ui.config.workspace_url=Enter the relative URL for the Workspace Page (to document root and without constant prefix if configured)
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -518,6 +517,13 @@
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SETTINGS_STRING_LIST (
|
||||
OBJECT_ID bigint not null,
|
||||
LIST_ID bigint not null,
|
||||
value varchar(255),
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||
TASK_ASSIGNMENT_ID bigint not null,
|
||||
ROLE_ID bigint,
|
||||
|
|
@ -1048,6 +1054,16 @@
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_34s3comqq4mhy9kcr04iavfef
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS_STRING_LIST;
|
||||
|
||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||
foreign key (ROLE_ID)
|
||||
|
|
|
|||
|
|
@ -518,6 +518,13 @@
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SETTINGS_STRING_LIST (
|
||||
OBJECT_ID int8 not null,
|
||||
LIST_ID int8 not null,
|
||||
value varchar(255),
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||
TASK_ASSIGNMENT_ID int8 not null,
|
||||
ROLE_ID int8,
|
||||
|
|
@ -1048,6 +1055,16 @@
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_34s3comqq4mhy9kcr04iavfef
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS_STRING_LIST;
|
||||
|
||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||
foreign key (ROLE_ID)
|
||||
|
|
|
|||
|
|
@ -1,181 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.kernel;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.JavaPropertyReader;
|
||||
import com.arsdigita.util.parameter.AbstractParameter;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
import com.arsdigita.xml.formatters.DateFormatter;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
|
||||
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.libreccm.categorization.Categorization;
|
||||
import org.libreccm.core.CcmObject;
|
||||
import org.libreccm.jpa.EntityManagerProducer;
|
||||
import org.libreccm.jpa.utils.UriConverter;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
import org.libreccm.security.Permission;
|
||||
import org.libreccm.tests.categories.IntegrationTest;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
@Category(IntegrationTest.class)
|
||||
public class LegacyKernelConfigTest {
|
||||
|
||||
public LegacyKernelConfigTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() {
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
@Deployment
|
||||
public static WebArchive createDeployment() {
|
||||
final PomEquippedResolveStage pom = Maven
|
||||
.resolver()
|
||||
.loadPomFromFile("pom.xml");
|
||||
final PomEquippedResolveStage dependencies = pom
|
||||
.importCompileAndRuntimeDependencies();
|
||||
final File[] libs = dependencies.resolve().withTransitivity().asFile();
|
||||
|
||||
for (File lib : libs) {
|
||||
System.err.printf("Adding file '%s' to test archive...%n",
|
||||
lib.getName());
|
||||
}
|
||||
|
||||
return ShrinkWrap
|
||||
.create(WebArchive.class,
|
||||
"LibreCCM-com.arsdigita.kernel.KernelConfigTest.war")
|
||||
.addPackage(CcmObject.class.getPackage())
|
||||
.addPackage(Categorization.class.getPackage())
|
||||
.addPackage(Permission.class.getPackage())
|
||||
.addPackage(LocalizedString.class.getPackage())
|
||||
.addPackage(Workflow.class.getPackage())
|
||||
.addPackage(UriConverter.class.getPackage())
|
||||
.addPackage(ApplicationRepository.class.getPackage())
|
||||
.addPackage(EntityManagerProducer.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameter.class.getPackage())
|
||||
.addPackage(JavaPropertyReader.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateFormatter.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addAsLibraries(libs)
|
||||
.addAsResource(
|
||||
"configs/com/arsdigita/kernel/KernelConfigTest/ccm-core.config",
|
||||
"ccm-core.config")
|
||||
.addAsWebInfResource(
|
||||
"configs/com/arsdigita/kernel/KernelConfigTest/registry.properties",
|
||||
"conf/registry/registry.properties")
|
||||
.addAsWebInfResource(
|
||||
"configs/com/arsdigita/kernel/KernelConfigTest/kernel.properties",
|
||||
"conf/registry/ccm-core/kernel.properties")
|
||||
.addAsResource(
|
||||
"com/arsdigita/kernel/KernelConfig_parameter.properties",
|
||||
"com/arsdigita/kernel/KernelConfig_parameter.properties")
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
.addAsWebInfResource("test-web.xml", "WEB-INF/web.xml")
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyKernelConfig() {
|
||||
final LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
|
||||
assertThat(kernelConfig.isDebugEnabled(),
|
||||
is(true));
|
||||
assertThat(kernelConfig.isWebdevSupportActive(),
|
||||
is(false));
|
||||
assertThat(kernelConfig.isDataPermissionCheckEnabled(),
|
||||
is(false));
|
||||
assertThat(kernelConfig.getPrimaryUserIdentifier(),
|
||||
is(equalTo("email")));
|
||||
assertThat(kernelConfig.screenNameIsPrimaryIdentifier(),
|
||||
is(false));
|
||||
assertThat(kernelConfig.emailIsPrimaryIdentifier(),
|
||||
is(true));
|
||||
assertThat(kernelConfig.isSSOenabled(),
|
||||
is(false));
|
||||
assertThat(kernelConfig.isLoginRemembered(),
|
||||
is(true));
|
||||
assertThat(kernelConfig.isSecureLoginRequired(),
|
||||
is(false));
|
||||
assertThat(kernelConfig.getSupportedLanguages(),
|
||||
is(equalTo("de,en")));
|
||||
assertThat(kernelConfig.languageIndependentItems(),
|
||||
is(true));
|
||||
assertThat(kernelConfig.getLanguagesIndependentCode(),
|
||||
is(equalTo("--")));
|
||||
assertThat(kernelConfig.hasLanguage("de"),
|
||||
is(true));
|
||||
assertThat(kernelConfig.hasLanguage("en"),
|
||||
is(true));
|
||||
assertThat(kernelConfig.hasLanguage("es"),
|
||||
is(false));
|
||||
assertThat(kernelConfig.getDefaultLanguage(),
|
||||
is(equalTo("de")));
|
||||
final StringTokenizer tokenizer = kernelConfig
|
||||
.getSupportedLanguagesTokenizer();
|
||||
assertThat(tokenizer.countTokens(), is(2));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.kernel.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.JavaPropertyReader;
|
||||
import com.arsdigita.util.parameter.AbstractParameter;
|
||||
|
|
@ -111,7 +110,6 @@ public class SecurityConfigTest {
|
|||
.addPackage(UriConverter.class.getPackage())
|
||||
.addPackage(ApplicationRepository.class.getPackage())
|
||||
.addPackage(EntityManagerProducer.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -136,7 +135,6 @@ public class AuthorizationInterceptorTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
|
|
@ -132,9 +130,7 @@ public class GroupManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -146,7 +145,6 @@ public class PermissionCheckerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -137,7 +136,6 @@ public class PermissionManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -132,7 +131,6 @@ public class RoleManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -163,7 +162,6 @@ public class SecuredCollectionTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -163,7 +162,6 @@ public class SecuredIteratorTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -132,7 +131,6 @@ public class ShiroTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -133,7 +132,6 @@ public class UserManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
|||
|
||||
CREATE SCHEMA ccm_core;
|
||||
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -524,6 +523,13 @@ CREATE SCHEMA ccm_core;
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SETTINGS_STRING_LIST (
|
||||
OBJECT_ID bigint not null,
|
||||
LIST_ID bigint not null,
|
||||
value varchar(255),
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||
TASK_ASSIGNMENT_ID bigint not null,
|
||||
ROLE_ID bigint,
|
||||
|
|
@ -1054,6 +1060,16 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_34s3comqq4mhy9kcr04iavfef
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS_STRING_LIST;
|
||||
|
||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||
foreign key (ROLE_ID)
|
||||
|
|
|
|||
|
|
@ -524,6 +524,13 @@ CREATE SCHEMA ccm_core;
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SETTINGS_STRING_LIST (
|
||||
OBJECT_ID int8 not null,
|
||||
LIST_ID int8 not null,
|
||||
value varchar(255),
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||
TASK_ASSIGNMENT_ID int8 not null,
|
||||
ROLE_ID int8,
|
||||
|
|
@ -1054,6 +1061,16 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_34s3comqq4mhy9kcr04iavfef
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS_STRING_LIST;
|
||||
|
||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||
foreign key (ROLE_ID)
|
||||
|
|
|
|||
Loading…
Reference in New Issue