First phase of client configuration re-org

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2289 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-02-02 22:29:15 +00:00
parent 4c49f3ce7c
commit da914e0549
40 changed files with 231 additions and 2559 deletions

View File

@@ -1,47 +0,0 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.bean;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.alfresco.config.xml.XMLConfigService;
import org.alfresco.web.app.Application;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Bean used for administration purposes
*
* @author gavinc
*/
public class AdminBean
{
/**
* Resets the config service
*
* @param event Event that caused the request for the reset
*/
public void resetConfigService(ActionEvent event)
{
// get the config service
XMLConfigService configSvc = (XMLConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
// reset it
configSvc.reset();
}
}

View File

@@ -35,7 +35,6 @@ import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.AssociationRef;
@@ -53,7 +52,6 @@ import org.alfresco.web.config.PropertySheetConfigElement;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Backing bean for the edit document properties dialog
@@ -180,8 +178,6 @@ public class DocumentPropertiesBean
// make sure the property is represented correctly
Serializable propValue = (Serializable)props.get(propName);
PropertyDefinition propDef = this.dictionaryService.getProperty(qname);
properties.put(qname, propValue);
}
@@ -315,8 +311,7 @@ public class DocumentPropertiesBean
{
// we need to use the config service to see whether there are any
// editable properties configured for this document.
ConfigService configSvc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
Config configProps = configSvc.getConfig(this.editableNode, new ConfigLookupContext("edit-properties"));
PropertySheetConfigElement propsToDisplay = (PropertySheetConfigElement)configProps.
getConfigElement("property-sheet");

View File

@@ -30,7 +30,6 @@ import javax.faces.validator.ValidatorException;
import javax.portlet.PortletRequest;
import javax.servlet.http.HttpServletRequest;
import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
@@ -99,14 +98,6 @@ public class LoginBean
this.navigator = navigator;
}
/**
* @param configService The ConfigService to set.
*/
public void setConfigService(ConfigService configService)
{
this.configService = configService;
}
/**
* @param val Username from login dialog
*/
@@ -161,8 +152,8 @@ public class LoginBean
*/
public SelectItem[] getLanguages()
{
ClientConfigElement config = (ClientConfigElement) this.configService.getGlobalConfig()
.getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
ClientConfigElement config = Application.getClientConfig(
FacesContext.getCurrentInstance());
List<String> languages = config.getLanguages();
SelectItem[] items = new SelectItem[languages.size()];
@@ -420,7 +411,4 @@ public class LoginBean
/** The NavigationBean bean reference */
private NavigationBean navigator;
/** ConfigService bean reference */
private ConfigService configService;
}

View File

@@ -23,7 +23,6 @@ import java.util.List;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.alfresco.config.ConfigService;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.Application;
@@ -54,9 +53,6 @@ public class RecentSpacesBean implements IContextListener
/** The BrowseBean reference */
private BrowseBean browseBean;
/** ConfigService bean reference */
private ConfigService configService;
/** Maximum number of recent spaces to show */
private Integer maxRecentSpaces = null;
@@ -95,14 +91,6 @@ public class RecentSpacesBean implements IContextListener
this.browseBean = browseBean;
}
/**
* @param configService The ConfigService to set.
*/
public void setConfigService(ConfigService configService)
{
this.configService = configService;
}
/**
* @return the List of recent spaces
*/
@@ -194,8 +182,7 @@ public class RecentSpacesBean implements IContextListener
{
if (maxRecentSpaces == null)
{
ClientConfigElement config = (ClientConfigElement)this.configService.getGlobalConfig().getConfigElement(
ClientConfigElement.CONFIG_ELEMENT_ID);
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
maxRecentSpaces = Integer.valueOf(config.getRecentSpacesItems());
}

View File

@@ -33,8 +33,6 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.repository.Repository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Handler class used by the Add Content Wizard
@@ -43,8 +41,6 @@ import org.apache.commons.logging.LogFactory;
*/
public class AddContentWizard extends BaseContentWizard
{
private static Log logger = LogFactory.getLog(AddContentWizard.class);
// TODO: retrieve these from the config service
private static final String WIZARD_TITLE_ID = "add_content_title";
private static final String WIZARD_DESC_ID = "add_content_desc";

View File

@@ -41,7 +41,6 @@ import org.alfresco.repo.action.executer.MoveActionExecuter;
import org.alfresco.repo.action.executer.SimpleWorkflowActionExecuter;
import org.alfresco.repo.action.executer.SpecialiseTypeActionExecuter;
import org.alfresco.repo.action.executer.TransformActionExecuter;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.action.ActionDefinition;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
@@ -58,7 +57,6 @@ import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Base handler class containing common code used by the New Space Wizard and New Action Wizard
@@ -559,8 +557,7 @@ public abstract class BaseActionWizard extends AbstractWizardBean
{
if (this.encodings == null)
{
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
@@ -617,8 +614,7 @@ public abstract class BaseActionWizard extends AbstractWizardBean
{
if (this.transformers == null)
{
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
@@ -682,8 +678,7 @@ public abstract class BaseActionWizard extends AbstractWizardBean
{
if (this.imageTransformers == null)
{
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
@@ -747,8 +742,7 @@ public abstract class BaseActionWizard extends AbstractWizardBean
{
if (this.aspects == null)
{
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
@@ -825,8 +819,7 @@ public abstract class BaseActionWizard extends AbstractWizardBean
Application.getMessage(context, "content")));
// add any configured content sub-types to the list
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Custom Content Types");
if (wizardCfg != null)
{

View File

@@ -51,7 +51,6 @@ import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Base Handler class used by the Content Wizards
@@ -499,8 +498,7 @@ public abstract class BaseContentWizard extends AbstractWizardBean
Application.getMessage(context, "content")));
// add any configured content sub-types to the list
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Custom Content Types");
if (wizardCfg != null)
{

View File

@@ -23,8 +23,6 @@ import javax.faces.event.ValueChangeEvent;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Handler class used by the Create In-line Content Wizard
@@ -36,8 +34,6 @@ public class CreateContentWizard extends BaseContentWizard
protected static final String CONTENT_TEXT = "txt";
protected static final String CONTENT_HTML = "html";
private static Log logger = LogFactory.getLog(CreateContentWizard.class);
// TODO: retrieve these from the config service
private static final String WIZARD_TITLE_ID = "create_content_title";
private static final String WIZARD_DESC_ID = "create_content_desc";

View File

@@ -63,7 +63,6 @@ import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Handler class used by the New Space Wizard
@@ -948,8 +947,7 @@ public class NewRuleWizard extends BaseActionWizard
{
if (this.modelTypes == null)
{
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{

View File

@@ -31,7 +31,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
@@ -52,7 +51,6 @@ import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.ui.common.component.description.UIDescription;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Handler class used by the New Space Wizard
@@ -78,12 +76,12 @@ public class NewSpaceWizard extends AbstractWizardBean
private static final String ERROR = "error_space";
private static final String DEFAULT_SPACE_TYPE_ICON = "/images/icons/space.gif";
private static final String ICONS_LOOKUP_KEY = " icons";
// new space wizard specific properties
protected SearchService searchService;
protected NamespaceService namespaceService;
protected DictionaryService dictionaryService;
protected ConfigService configService;
protected String spaceType;
protected String icon;
@@ -559,9 +557,8 @@ public class NewSpaceWizard extends AbstractWizardBean
this.folderTypeDescriptions.add(defaultDesc);
// add any configured content sub-types to the list
ConfigService svc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(Application.BEAN_CONFIG_SERVICE);
Config wizardCfg = svc.getConfig("Custom Folder Types");
Config wizardCfg = Application.getConfigService(FacesContext.getCurrentInstance()).
getConfig("Custom Folder Types");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("folder-types");
@@ -689,7 +686,8 @@ public class NewSpaceWizard extends AbstractWizardBean
QName type = QName.createQName(this.spaceType);
String typePrefixForm = type.toPrefixString(this.namespaceService);
Config config = this.configService.getConfig(typePrefixForm);
Config config = Application.getConfigService(FacesContext.getCurrentInstance()).
getConfig(typePrefixForm + ICONS_LOOKUP_KEY);
if (config != null)
{
ConfigElement iconsCfg = config.getConfigElement("icons");
@@ -774,16 +772,6 @@ public class NewSpaceWizard extends AbstractWizardBean
{
this.dictionaryService = dictionaryService;
}
/**
* Sets the config service
*
* @param configService The ConfigService
*/
public void setConfigService(ConfigService configService)
{
this.configService = configService;
}
/**
* @return Returns the copyPolicy.

View File

@@ -30,13 +30,11 @@ import javax.faces.event.ActionEvent;
import javax.faces.validator.ValidatorException;
import javax.transaction.UserTransaction;
import org.alfresco.config.ConfigService;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.OwnableService;
import org.alfresco.service.cmr.security.PermissionService;
@@ -44,7 +42,6 @@ import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.ContextListener;
import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
@@ -97,9 +94,6 @@ public class NewUserWizard extends AbstractWizardBean
/** OwnableService bean reference */
private OwnableService ownableService;
/** ConfigService bean reference */
private ConfigService configService;
/** action context */
private Node person = null;
@@ -150,14 +144,6 @@ public class NewUserWizard extends AbstractWizardBean
{
this.ownableService = ownableService;
}
/**
* @param configService The ConfigService to set.
*/
public void setConfigService(ConfigService configService)
{
this.configService = configService;
}
/**
* Initialises the wizard
@@ -968,9 +954,7 @@ public class NewUserWizard extends AbstractWizardBean
*/
private String getDefaultPermission()
{
ClientConfigElement config = (ClientConfigElement)this.configService.getGlobalConfig().getConfigElement(
ClientConfigElement.CONFIG_ELEMENT_ID);
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
return config.getHomeSpacePermission();
}