当前位置: 首页>>代码示例>>Java>>正文


Java ConfigService.getConfig方法代码示例

本文整理汇总了Java中org.springframework.extensions.config.ConfigService.getConfig方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigService.getConfig方法的具体用法?Java ConfigService.getConfig怎么用?Java ConfigService.getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.extensions.config.ConfigService的用法示例。


在下文中一共展示了ConfigService.getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOtherPropertiesPresent

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Determines whether this document has any other properties other than the 
 * default set to display to the user.
 * 
 * @return true of there are properties to show, false otherwise
 */
public boolean getOtherPropertiesPresent()
{
   if ((this.hasOtherProperties == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
   {
      // we need to use the config service to see whether there are any
      // editable properties configured for this document.
      ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config configProps = configSvc.getConfig(this.editableNode);
      PropertySheetConfigElement propsToDisplay = (PropertySheetConfigElement)configProps.
            getConfigElement("property-sheet");
      
      if (propsToDisplay != null && propsToDisplay.getEditableItemNamesToShow().size() > 0)
      {
         this.hasOtherProperties = Boolean.TRUE;
      }
      else
      {
         this.hasOtherProperties = Boolean.FALSE;
      }
   }
   
   return this.hasOtherProperties.booleanValue();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:DocumentPropertiesDialog.java

示例2: getInlineEditableMimeTypes

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
protected List<String> getInlineEditableMimeTypes()
{
   if ((this.inlineEditableMimeTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))	  
   {
      this.inlineEditableMimeTypes = new ArrayList<String>(8);
      
      // get the create mime types list from the config
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Content Wizards");
      if (wizardCfg != null)
      {
         ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types");
         if (typesCfg != null)
         {
            for (ConfigElement child : typesCfg.getChildren())
            {
               String currentMimeType = child.getAttribute("name");
               this.inlineEditableMimeTypes.add(currentMimeType);
            }
         }
      }
   }
   
   return this.inlineEditableMimeTypes;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:26,代码来源:AddContentDialog.java

示例3: getDialogConfig

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns the dialog configuration object for the given dialog name.
 * If there is a node in the dispatch context a lookup is performed using
 * the node otherwise the global config section is used.
 * 
 * 
 * @param name The name of dialog being launched
 * @param dispatchContext The node being acted upon
 * @return The DialogConfig for the dialog or null if no config could be found
 */
protected DialogConfig getDialogConfig(FacesContext context, String name, Node dispatchContext)
{
   DialogConfig dialogConfig = null;
   ConfigService configSvc = Application.getConfigService(context);
   
   Config config = null;
   
   if (dispatchContext != null)
   {
      if (logger.isDebugEnabled())
         logger.debug("Using dispatch context for dialog lookup: " + 
               dispatchContext.getType().toString());
      
      // use the node to perform the lookup (this will include the global section)
      config = configSvc.getConfig(dispatchContext);
   }
   else
   {
      if (logger.isDebugEnabled())
         logger.debug("Looking up dialog in global config");
         
      // just use the global 
      config = configSvc.getGlobalConfig();
   }

   if (config != null)
   {
      DialogsConfigElement dialogsCfg = (DialogsConfigElement)config.getConfigElement(
            DialogsConfigElement.CONFIG_ELEMENT_ID);
      if (dialogsCfg != null)
      {
         dialogConfig = dialogsCfg.getDialog(name);
      }
   }
   
   return dialogConfig;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:48,代码来源:AlfrescoNavigationHandler.java

示例4: getWizardConfig

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns the wizard configuration object for the given wizard name.
 * If there is a node in the dispatch context a lookup is performed using
 * the node otherwise the global config section is used.
 * 
 * @param name The name of wizard being launched
 * @param dispatchContext The node being acted upon
 * @return The WizardConfig for the wizard or null if no config could be found
 */
protected WizardConfig getWizardConfig(FacesContext context, String name, Node dispatchContext)
{
   WizardConfig wizardConfig = null;
   ConfigService configSvc = Application.getConfigService(context);
   
   Config config = null;
   
   if (dispatchContext != null)
   {
      if (logger.isDebugEnabled())
         logger.debug("Using dispatch context for wizard lookup: " + 
               dispatchContext.getType().toString());
      
      // use the node to perform the lookup (this will include the global section)
      config = configSvc.getConfig(dispatchContext);
   }
   else
   {
      if (logger.isDebugEnabled())
         logger.debug("Looking up wizard in global config");
      
      // just use the global 
      config = configSvc.getGlobalConfig();
   }

   if (config != null)
   {
      WizardsConfigElement wizardsCfg = (WizardsConfigElement)config.getConfigElement(
            WizardsConfigElement.CONFIG_ELEMENT_ID);
      if (wizardsCfg != null)
      {
         wizardConfig = wizardsCfg.getWizard(name);
      }
   }
   
   return wizardConfig;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:47,代码来源:AlfrescoNavigationHandler.java

示例5: getEncoding

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * @return  Returns the encoding currently selected
 */
public String getEncoding()
{
   if (encoding == null)
   {
      ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config config = configSvc.getConfig("Import Dialog");
      if (config != null)
      {
         ConfigElement defaultEncCfg = config.getConfigElement("default-encoding");
         if (defaultEncCfg != null)
         {
            String value = defaultEncCfg.getValue();
            if (value != null)
            {
               encoding = value.trim();
            }
         }
      }
      if (encoding == null || encoding.length() == 0)
      {
         // if not configured, set to a sensible default for most character sets
         encoding = "UTF-8";
      }
   }
   return encoding;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:ImportDialog.java

示例6: getEncodings

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
public List<SelectItem> getEncodings()
{
    if ((this.encodings == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
    {
        FacesContext context = FacesContext.getCurrentInstance();
        
        this.encodings = new ArrayList<SelectItem>(3);
        
        ConfigService svc = Application.getConfigService(context);
        Config cfg = svc.getConfig("Import Dialog");
        if (cfg != null)
        {
            ConfigElement typesCfg = cfg.getConfigElement("encodings");
            if (typesCfg != null)
            {
                for (ConfigElement child : typesCfg.getChildren())
                {
                    String encoding = child.getAttribute("name");
                    if (encoding != null)
                    {
                        this.encodings.add(new SelectItem(encoding, encoding));
                    }
                }
            }
            else
            {
                logger.warn("Could not find 'encodings' configuration element");
            }
        }
        else
        {
            encodings = UICharsetSelector.getCharsetEncodingList();
        }
    }
   
    return this.encodings;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:38,代码来源:ImportDialog.java

示例7: getRemovableAspects

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns a list of aspects that can be removed
 * 
 * @return List of SelectItem objects representing the aspects that can be removed
 */
public List<SelectItem> getRemovableAspects()
{
   if ((this.removableAspects == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
   {
      // get the list of common aspects
      this.removableAspects = new ArrayList<SelectItem>();
      this.removableAspects.addAll(getCommonAspects());
      
      // get those aspects configured to appear only in the remove aspect action
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Action Wizards");
      if (wizardCfg != null)
      {
         ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects-remove");
         if (aspectsCfg != null)
         {
            List<SelectItem> aspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
            this.removableAspects.addAll(aspects);
         }
         else
         {
            logger.warn("Could not find 'aspects-remove' configuration element");
         }
      }
      else
      {
         logger.warn("Could not find 'Action Wizards' configuration section");
      }
      
      // make sure the list is sorted by the label
      QuickSort sorter = new QuickSort(this.removableAspects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
      sorter.sort();
   }
   
   return this.removableAspects;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:42,代码来源:BaseActionWizard.java

示例8: getAddableAspects

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns a list of aspects that can be added
 * 
 * @return List of SelectItem objects representing the aspects that can be added
 */
public List<SelectItem> getAddableAspects()
{
   if ((this.addableAspects == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
   {
      // get the list of common aspects
      this.addableAspects = new ArrayList<SelectItem>();
      this.addableAspects.addAll(getCommonAspects());
      
      // get those aspects configured to appear only in the remove aspect action
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Action Wizards");
      if (wizardCfg != null)
      {
         ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects-add");
         if (aspectsCfg != null)
         {
            List<SelectItem> aspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
            this.addableAspects.addAll(aspects);
         }
         else
         {
            logger.warn("Could not find 'aspects-add' configuration element");
         }
      }
      else
      {
         logger.warn("Could not find 'Action Wizards' configuration section");
      }
      
      // make sure the list is sorted by the label
      QuickSort sorter = new QuickSort(this.addableAspects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
      sorter.sort();
   }
   
   return this.addableAspects;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:42,代码来源:BaseActionWizard.java

示例9: getTestableAspects

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns a list of aspects that can be tested i.e. hasAspect
 * 
 * @return List of SelectItem objects representing the aspects that can be tested for
 */
public List<SelectItem> getTestableAspects()
{
   if ((this.testableAspects == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
   {
      // get the list of common aspects
      this.testableAspects = new ArrayList<SelectItem>();
      this.testableAspects.addAll(getCommonAspects());
      
      // get those aspects configured to appear only in the remove aspect action
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Action Wizards");
      if (wizardCfg != null)
      {
         ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects-test");
         if (aspectsCfg != null)
         {
            List<SelectItem> aspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
            this.testableAspects.addAll(aspects);
         }
         else
         {
            logger.warn("Could not find 'aspects-test' configuration element");
         }
      }
      else
      {
         logger.warn("Could not find 'Action Wizards' configuration section");
      }
      
      // make sure the list is sorted by the label
      QuickSort sorter = new QuickSort(this.testableAspects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
      sorter.sort();
   }
   
   return this.testableAspects;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:42,代码来源:BaseActionWizard.java

示例10: getCommonAspects

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns the aspects that are available in all scenarios i.e. add, remove and test
 * 
 * @return List of SelectItem objects representing the available aspects
 */
protected List<SelectItem> getCommonAspects()
{
   if ((this.commonAspects == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
   {
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Action Wizards");
      if (wizardCfg != null)
      {
         ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects");
         if (aspectsCfg != null)
         {
            this.commonAspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
         }
         else
         {
            logger.warn("Could not find 'aspects' configuration element");
         }
      }
      else
      {
         logger.warn("Could not find 'Action Wizards' configuration section");
      }
   }
   
   return this.commonAspects;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:32,代码来源:BaseActionWizard.java

示例11: getEncoding

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * @return  Returns the encoding currently selected
 */
public String getEncoding()
{
   if (encoding == null)
   {
      ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config config = configSvc.getConfig("Content Wizards");
      if (config != null)
      {
         ConfigElement defaultEncCfg = config.getConfigElement("default-encoding");
         if (defaultEncCfg != null)
         {
            String value = defaultEncCfg.getValue();
            if (value != null)
            {
               encoding = value.trim();
            }
         }
      }
      if (encoding == null || encoding.length() == 0)
      {
         // if not configured, set to a sensible default for most character sets
         encoding = "UTF-8";
      }
   }
   return encoding;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:BaseContentWizard.java

示例12: initOtherProperties

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Initialises the other properties flags from config
 */
protected void initOtherProperties()
{
   // TODO - review implications of these default values for dynamic/MT client
   ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
   
   if (configSvc != null)
   {
      Config config = configSvc.getConfig("Content Wizards");
      if (config != null)
      {
         ConfigElement otherPropsCfg = config.getConfigElement("other-properties");
         if (otherPropsCfg != null)
         {
            // get the attributes
            String userChoiceVisible = otherPropsCfg.getAttribute("user-choice-visible");
            String userChoiceDefault = otherPropsCfg.getAttribute("user-choice-default");
            
            // set the defaults
            if (userChoiceVisible != null)
            {
               this.otherPropertiesChoiceVisible = Boolean.parseBoolean(userChoiceVisible);
            }
            
            if (userChoiceDefault != null)
            {
               this.showOtherProperties = Boolean.parseBoolean(userChoiceDefault);
            }
         }
      }
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:35,代码来源:BaseContentWizard.java

示例13: getRegisteredEngines

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns a list of OpenSearchEngine objects representing the 
 * registered OpenSearch engines.
 * 
 * @param context Faces context
 * @return List of registered engines
 */
private List<OpenSearchEngine> getRegisteredEngines(FacesContext context)
{
   List<OpenSearchEngine> engines = null;
   
   // get the web api config service object from spring
   ConfigService cfgSvc = (ConfigService)FacesContextUtils.
         getRequiredWebApplicationContext(context).getBean("webscripts.config");
   SearchProxy searchProxy = (SearchProxy)FacesContextUtils.
         getRequiredWebApplicationContext(context).getBean("webscript.org.alfresco.repository.search.searchproxy.get");
   if (cfgSvc != null)
   {
      // get the OpenSearch configuration
      Config cfg = cfgSvc.getConfig("OpenSearch");
      OpenSearchConfigElement osConfig = (OpenSearchConfigElement)cfg.
            getConfigElement(OpenSearchConfigElement.CONFIG_ELEMENT_ID);
      if (osConfig != null)
      {
         // generate the the list of engines with a unique for each
         int id = 1;
         engines = new ArrayList<OpenSearchEngine>();
         
         Set<EngineConfig> enginesCfg = osConfig.getEngines();
         for (EngineConfig engineCfg : enginesCfg)
         {
            // resolve engine label
            String label = engineCfg.getLabel();
            String labelId = engineCfg.getLabelId();
            if (labelId != null && labelId.length() > 0)
            {
               label = Application.getMessage(context, labelId);
            }

            // locate search engine template url of most appropriate response type
            String url = searchProxy.createUrl(engineCfg, MimetypeMap.MIMETYPE_ATOM);
            if (url == null)
            {
               url = searchProxy.createUrl(engineCfg, MimetypeMap.MIMETYPE_RSS);
            }
             
            if (url != null)
            {
               if (url.startsWith("/"))
               {
                  url = context.getExternalContext().getRequestContextPath() + "/wcservice" + url;
               }
                       
               // add the engine
               OpenSearchEngine engine = new OpenSearchEngine(id, label, url);
               engines.add(engine);
               
               // increase the id counter
               id++;
             }
         }
      }
   }
   
   return engines;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:67,代码来源:UIOpenSearch.java

示例14: getObjectTypes

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * @return Returns a list of object types to allow the user to select from
 */
public List<SelectItem> getObjectTypes()
{
   if ((this.objectTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
   {
      FacesContext context = FacesContext.getCurrentInstance();
      
      // add the well known object type to start with
      this.objectTypes = new ArrayList<SelectItem>(5);
      
      // add any configured content or folder sub-types to the list
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Action Wizards");
      if (wizardCfg != null)
      {
         ConfigElement typesCfg = wizardCfg.getConfigElement("specialise-types");
         if (typesCfg != null)
         {               
            for (ConfigElement child : typesCfg.getChildren())
            {
               QName idQName = Repository.resolveToQName(child.getAttribute("name"));
               TypeDefinition typeDef = this.getDictionaryService().getType(idQName);
               
               // make sure the type is a subtype of content or folder but not 
               // the content or folder type itself
               if (typeDef != null &&
                   typeDef.getName().equals(ContentModel.TYPE_CONTENT) == false &&
                   typeDef.getName().equals(ContentModel.TYPE_FOLDER) == false &&
                   (this.getDictionaryService().isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT) ||
                   this.getDictionaryService().isSubClass(typeDef.getName(), ContentModel.TYPE_FOLDER)))
               {
                  // try and get the display label from config
                  String label = Utils.getDisplayLabel(context, child);

                  // if there wasn't a client based label try and get it from the dictionary
                  if (label == null)
                  {
                     label = typeDef.getTitle(this.getDictionaryService());
                  }
                  
                  // finally, just use the localname
                  if (label == null)
                  {
                     label = idQName.getLocalName();
                  }
                  
                  this.objectTypes.add(new SelectItem(idQName.toString(), label));
               }
            }
            
            // make sure the list is sorted by the label
            QuickSort sorter = new QuickSort(this.objectTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
            sorter.sort();
            
            // add the select an action item at the start of the list
            this.objectTypes.add(0, new SelectItem("null", 
                  Application.getMessage(FacesContext.getCurrentInstance(), "select_a_type")));
         }
         else
         {
            logger.warn("Could not find 'specialise-types' configuration element");
         }
      }
      else
      {
         logger.warn("Could not find 'Action Wizards' configuration section");
      }
      
   }
   
   return this.objectTypes;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:75,代码来源:BaseActionWizard.java

示例15: getTransformers

import org.springframework.extensions.config.ConfigService; //导入方法依赖的package包/类
/**
 * Returns the transformers that are available
 * 
 * @return List of SelectItem objects representing the available transformers
 */
public List<SelectItem> getTransformers()
{
   if ((this.transformers == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
   {
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Action Wizards");
      if (wizardCfg != null)
      {
         ConfigElement transformersCfg = wizardCfg.getConfigElement("transformers");
         if (transformersCfg != null)
         {
            FacesContext context = FacesContext.getCurrentInstance();
            Map<String, String> mimeTypes = this.getMimetypeService().getDisplaysByMimetype();
            this.transformers = new ArrayList<SelectItem>();
            for (ConfigElement child : transformersCfg.getChildren())
            {
               String id = child.getAttribute("name");
               
               // try and get the display label from config
               String label = Utils.getDisplayLabel(context, child);

               // if there wasn't a client based label get it from the mime type service
               if (label == null)
               {
                  label = mimeTypes.get(id);
               }
               
               // if there is still no label use the raw mimetype
               if (label == null)
               {
                   label = id;
               }
               
               this.transformers.add(new SelectItem(id, label));
            }
            
            // make sure the list is sorted by the label
            QuickSort sorter = new QuickSort(this.transformers, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
            sorter.sort();
         }
         else
         {
            logger.warn("Could not find 'transformers' configuration element");
         }
      }
      else
      {
         logger.warn("Could not find 'Action Wizards' configuration section");
      }
   }
   
   return this.transformers;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:59,代码来源:BaseActionWizard.java


注:本文中的org.springframework.extensions.config.ConfigService.getConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。