首页 \ 问答 \ 如何将Control-Parm中的工作流属性传递给Alfresco中的FTL文件?(How to Pass Workflow Propert in Control-Parm to FTL File in Alfresco?)

如何将Control-Parm中的工作流属性传递给Alfresco中的FTL文件?(How to Pass Workflow Propert in Control-Parm to FTL File in Alfresco?)

因此,对于我的项目,我们在Alfresco存储库中有一些javascript代码作为规则运行。 因此,只要新文档进入某个空间,就会动态创建一个新文件夹,并将该文档移动到新创建的空间中。 此外,无论何时创建新文件夹,都会对文档更新属性(期望caseID实际上是基于数据库中序列的动态生成的值):

//Add caseID as a property of the folder
var props = new Array(1);
props["wf:caseIDNum"] = caseID;
var newAspect = newNewSpaceName.addAspect("wf:caseID",props);

但是,现在我们希望能够在我们的工作流程中在share-workflow-form-config-.xml文件中引用新创建的方面/属性,以便它可以作为参数传递给我们的控件模板。 也就是说,目前我们有:

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
                  <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl"/>
               </field>

但我们想要的是如下所示:

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
                  <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl">
                     <control-param name="caseID">wf:caseIDNum</control-param>
                  </control>
               </field>

所以我的问题是,通过控制参数将变量/属性从工作流模型传递给FTL文件的正确语法是什么?

编辑(10/25/12) -

所以基于这里给出的帮助,我试着像这样修改我的ftl页面......

custom-activiti-transitions.ftl

<#assign caseID = "">
<#if field.control.params.caseID??>
    <#assign caseID = field.control.params.caseID>
<#else>
    <#assign caseID = null>
</#if>

<style type="text/css">

.button {
border: 1px solid #666;
background: #DCDCDC;
padding: 5px;
color: #333;
text-shadow: 1px 1px #fff;
-moz-border-radius: 5px;
-webkit-border-radius: 5px
border-radius: 5px;
cursor: pointer;
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
a.button:hover {
background: #bbb;
color: #000;
text-shadow: 1px 1px #eee;
}

a.button:active {
position: relative;
top: 1px;
left: 1px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}

</style>

<a class="button" href="#" onClick="MyWindow=window.open('http://localhost:8080/alfresco/faces/jsp/custom/CodeSelector.jsp?caseID=${caseID}','My Window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=300'); return false;" style="text-decoration:none" target="_blank"><span>Add Codes</span></a>

在我的share-workflow-form-config.xml中 ,我更改了以下任何实例:

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
 <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl">
 </control>
</field>

至...

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
 <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl">
  <control-param name="caseID">wf:caseIDNum</control-param>
 </control>
</field>

我的问题是在share-workflow-form-config.xml中我指定了control-param ,我可以让它传递一个像“30”这样的硬编码值。 但是,当我尝试获取工作流属性的值,如wf:caseIDNum ,它返回参数中的实际字符串,如:

http://localhost:8080/alfresco/faces/jsp/custom/CodeSelector.jsp?caseID=wfcaseIDNum

而不是财产的实际价值,即“30”。

关于我可能做错的任何想法?


So for my project, we have some javascript code running as a rule within the Alfresco repository. So whenever a new document comes into a certain space, a new folder is dynamically created and that document is moved into that newly created space. Additionally, whenever a new folder is created, a property is updated like so for the document (expect caseID is actually a dynamically generated value based on a sequence in our database):

//Add caseID as a property of the folder
var props = new Array(1);
props["wf:caseIDNum"] = caseID;
var newAspect = newNewSpaceName.addAspect("wf:caseID",props);

However, now we want to be able to reference that newly created aspect/property during the course of our workflow in our share-workflow-form-config-.xml file so that it can be passed as a parameter to our control template. That is, currently we have:

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
                  <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl"/>
               </field>

But what we want is something like the below:

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
                  <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl">
                     <control-param name="caseID">wf:caseIDNum</control-param>
                  </control>
               </field>

So my question is, is that the proper syntax to pass a variable/property from the workflow model to the FTL file via the control param?

Edit (10/25/12) -

So based on the help given here, I tried to modify my ftl page like so...

custom-activiti-transitions.ftl:

<#assign caseID = "">
<#if field.control.params.caseID??>
    <#assign caseID = field.control.params.caseID>
<#else>
    <#assign caseID = null>
</#if>

<style type="text/css">

.button {
border: 1px solid #666;
background: #DCDCDC;
padding: 5px;
color: #333;
text-shadow: 1px 1px #fff;
-moz-border-radius: 5px;
-webkit-border-radius: 5px
border-radius: 5px;
cursor: pointer;
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
a.button:hover {
background: #bbb;
color: #000;
text-shadow: 1px 1px #eee;
}

a.button:active {
position: relative;
top: 1px;
left: 1px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}

</style>

<a class="button" href="#" onClick="MyWindow=window.open('http://localhost:8080/alfresco/faces/jsp/custom/CodeSelector.jsp?caseID=${caseID}','My Window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=300'); return false;" style="text-decoration:none" target="_blank"><span>Add Codes</span></a>

And in my share-workflow-form-config.xml, I changed any instance of:

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
 <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl">
 </control>
</field>

to...

<field id="wf:submitCode" label-id="workflow.field.outcome" set="actions">
 <control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl">
  <control-param name="caseID">wf:caseIDNum</control-param>
 </control>
</field>

My problem is that in the share-workflow-form-config.xml where I specify the control-param, I can get it to pass in a hard coded value like "30". However, when I try to get the value of the workflow property like wf:caseIDNum, it returns the actual string in the parameter like:

http://localhost:8080/alfresco/faces/jsp/custom/CodeSelector.jsp?caseID=wfcaseIDNum

as opposed to the actual value for the property, i.e. "30".

Any ideas on what I could be doing wrong?


原文:https://stackoverflow.com/questions/12977225
更新时间:2022-04-06 14:04

最满意答案

您可能不会喜欢这个答案,但是,有一种方法:查看源代码并改进异常,然后在问题跟踪器中发布补丁。

提示:在此目录中搜索throw new MappingException ,只有三个类抛出此异常。


You probably won't like this answer, but yes, there is a way: check out the source code and improve the exceptions, then post the patch in the issue tracker.

Hint: search for throw new MappingException in this directory, there are only three classes that throw this exception.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。