解释 alfresco 配置 evaluator="xx" condition="yy"

explain alfresco config evaluator="xx" condition="yy"

我正在尝试 alfresco 4.2c

我正在努力学习户外定制。 谁能解释这个 xml 标签的作用:

<config evaluator="string-compare" condition="yy">
 ...
 ...
</config>

条件部分是否正在检查具有设置 yy 的配置文件? 那是哪个配置文件,在哪里可以找到?

还有其他 我也需要了解这一点。抱歉,如果这太基础了,但我不能在不先了解这一点的情况下继续阅读和理解其他 alfresco 文档。

我很可能错过了解释这些的文档,请更有知识的人指导我一些解释这些的相关文档。 (我一直在从一个文档跳到另一个文档而没有真正理解这些。)

配置评估器在 Alfresco 中用于覆盖和自定义用户界面,只需修改 xml 个文件。

据报道here

In this file, an evaluator element is used to target the elements for customization. These evaluators are managed by the SpringSurfXmlConfigService. This service is extended by the Alfresco web client framework to include the following default evaluators:

几乎所有以“-config.xml”后缀结尾的配置文件都包含类似于您提到的配置部分。

The configuration service uses an amalgamation approach. An object is given as the context and a lookup is performed to retrieve all the configuration that matches that object.

There are several built-in evaluators that can be used i.e. 'string-compare' and 'object-type'. Other custom evaluators can be plugged in by specifying them at the top of the config file (see example below). All configured evaluators are called and passed the context object. If the evaluator matches that section of config is added to the result.

All sections that match are merged into one result, this allows a fine grained configuration approach, and also allows overriding of configuration data. However, this does mean that configuration is sensitive to the order things are defined in the file, basically, the last item wins.

This 'lookup' algorithm, however, can also be customized and plugged in when a config lookup is performed.

这意味着只要加载了应用程序上下文,就会注册许多对象,您将能够 add/modify 配置这些对象,在 condition 属性中设置您想要的对象修改。

例如,如果您查看 web-client-config-custom.xml 文件,您会看到有一个语言部分包含要在登录页面上显示的语言。 如果您想向列表中添加更多语言,您所要做的就是向该列表中添加一个条目:

<config evaluator="string-compare" condition="Languages">
    <languages>
        <language locale="ca_ES">Catalan</language>
        <language locale="hr_HR">Croatian</language>
        <language locale="cs_CZ">Czech</language>
    </languages>
</config>

application-context.xml 文件开始,您会发现它包含更具体的 *-context.xml 文件,导致 the web-client-config.xml 文件包含 <element-reader element-name="languages" class="org.alfresco.web.config.LanguagesElementReader" /> 以阅读语言部分.

可以在 Web Client Customisation Guide

中找到更多示例

一般来说,您应该查看官方的 Alfresco 文档,即使这个 Config Service wiki post 有点过时,它也可以帮助您理解即使在较新版本中也没有太大变化的机制。