Java 如何从属性文件中设置spring surf form Alfresco与dinamic变量共享

Java 如何从属性文件中设置spring surf form Alfresco与dinamic变量共享,java,share,alfresco,alfresco-share,spring-surf,Java,Share,Alfresco,Alfresco Share,Spring Surf,您好,我已经为该软件编写了一个spring surf表单扩展,在特定的下拉列表中,我希望以动态方式从alfresco读取值,或者在myaction share amp actions扩展模块的属性文件中读取值: <extension> ................................................................. <config evaluator="string-compare" condition="signed">

您好,我已经为该软件编写了一个spring surf表单扩展,在特定的下拉列表中,我希望以动态方式从
alfresco
读取值,或者在
myaction share amp actions扩展模块的属性文件中读取值:

<extension>
.................................................................
<config evaluator="string-compare" condition="signed">
       <forms>
            <form>
              <field-visibility>
                        ............................................
                        <show id="my_form_sign_firma.tipo"/>
                        ...................................     
              </field-visibility>
              <appearance>
.....................



<field id="my_form_sign_firma.tipo" label-id="property.form.sign.my_form_sign_firma.tipo">  
 <control template="/org/alfresco/components/form/controls/selectone.ftl">  
<control-param name="options">${value1},${value2},${value3}</control-param>
 </control>
</field>     
....................
属性文件设置在
share config.xml
文件中:

<bean id="configurazioniBeanCompletoLocale" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:it/test/properties/myalfresco.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="propertiesPersister">
 <bean class="org.alfresco.config.AlfrescoPropertiesPersister" />
</property>
</bean>
classpath*:it/test/properties/myalfresco.properties
文件
myalfresco.properties
包含:

value1=hello
value2=hi
value3=goodbye
valueX=hello,hi,goodbye
另外,如果有人知道如何操作,我可以接受在alfresco上使用特定文件的属性,例如:

Repository/Data Dictionary/configuration.txt
具有方面“Configurator”的属性,具有以下属性:

value1=hello
value2=hi
value3=goodbye
valueX=hello,hi,goodbye
有没有办法做到这一点

更新:

现在,我将尝试在纸上写下关于此链接的完整解决方案:


在这里,您可以找到另一个与本例类似的示例:

您可以使用自定义ftl文件作为表单控件

以共享形式提供自定义ftl文件的模板路径

 <form>
         <appearance>
            <field id="cm:name">
               <control template="/my-textfield.ftl" />
            </field>
         </appearance>
      </form>


正如Vikash所说,我建议您创建自定义表单控件(将其放在
src/main/amp/config/alfresco/web extension/site webscripts/org/alfresco/components/form/controls/mycontrol.ftl
文件夹中)

在内部,您将调用您创建的自定义webscript(它将获取文件的值)。这是琐碎的部分,我觉得没有必要给你举个例子

您可以查看ftl部件的(简化)示例:

...
<select id="${fieldHtmlId}" name="${field.name}" tabindex="0"
     <#if field.description??>title="${field.description}"</#if>
</select>
...
<script type="text/javascript">//<![CDATA[
YAHOO.util.Event.onContentReady("${fieldHtmlId}", function ()
{
    Alfresco.util.Ajax.jsonGet({
        url: encodeURI(Alfresco.constants.PROXY_URI + '/myserviceuri'),
        successCallback:
        {
            fn: function loadWebscript_successCallback(response, config)
            {
                var obj = eval('(' + response.serverResponse.responseText + ')');
                if (obj)
                {
                    for (i = 0; i < obj.length; i++) {
                            var newOption = document.createElement('option');
                            newOption.value = obj[i].id;
                            newOption.text = obj[i].name;
                            YAHOO.util.Dom.get("${fieldHtmlId}").options.add(newOption);
                    }
                }
            }
        }
    });

}, this);
//]]></script>
。。。
然后,您可以这样使用它:

<field id="my_form_sign_firma.tipo" label-id="property.form.sign.my_form_sign_firma.tipo">  
 <control template="/org/alfresco/components/form/controls/mycontrol.ftl">
 </control>
</field>  

是的,我已经试过了,但是我可以从.ftl文件中检索属性文件吗?我的意思是,如果你能给我一个完美解决方案的例子,我还没有找到一个可以从我的template.ftl中检索文件属性的javascript代码。
<field id="my_form_sign_firma.tipo" label-id="property.form.sign.my_form_sign_firma.tipo">  
 <control template="/org/alfresco/components/form/controls/mycontrol.ftl">
 </control>
</field>