Flowable 6.6.0 Eclipse设计器 - 5.扩展Flowable设计器 - 5.1定制调色板(4)

Flowable 6.6.0 用户指南相关文档下载

有关Flowable文档的其他资料,参见:

《Flowable文档大全》


《Flowable 6.6.0 Eclipse设计器》

1 安装(Installation
2 Flowable 设计器编辑器特性(Flowable Designer editor features)
3 Flowable设计器BPMN 特性(Flowable Designer BPMN features)
4 Flowable设计器部署特性(Flowable Designer deployment features)
5 扩展Flowable设计器(Extending Flowable Designer)

5 扩展Flowable设计器(Extending Flowable Designer)

5.1 定制调色板(Customizing the palette)

5.1.4 配置自定义服务任务的运行时执行(Configuring runtime execution of Custom Service Tasks)

With your fields set up and your extension applied to Designer, users can configure the properties of the service task when modelling a process. In most cases, you will want to use these user-configured properties when the process is executed by Flowable. To do this, you must tell Flowable which class to instantiate when the process reaches your CustomServiceTask.

设置字段并将扩展应用于设计器后,用户可以在建模流程时配置服务任务的属性。在大多数情况下,当流程由Flowable执行时,您将希望使用这些用户配置的属性。要做到这一点,您必须告诉Flowable在流程到达CustomServiceTask时实例化哪个类。

There is a special annotation for specifying the runtime characteristics of your CustomServiceTask, the @Runtime annotation. Here’s an example of how to use it:
@Runtime(javaDelegateClass = “org.acme.runtime.AcmeMoneyJavaDelegation”)
Your CustomServiceTask will result in a normal ServiceTask in the BPMN output of processes modeled with it. Flowable enables several ways to define the runtime characteristics of ServiceTasks. Therefore, the @Runtime annotation can take one of three attributes, which match directly to the options Flowable provides, like this:

有一个特殊的注解用于指定CustomServiceTask的运行时特性,即@ Runtime注解。下面是一个如何使用它的示例:

@Runtime(javaDelegateClass = "org.acme.runtime.AcmeMoneyJavaDelegation")

您的CustomServiceTask将在用它建模的流程的BPMN输出中生成一个普通的ServiceTask。Flowable支持多种方法( several ways)来定义ServiceTasks的运行时特征。因此,@Runtime注解可以采用三个属性中的一个,这些属性与Flowable提供的选项直接匹配,如下所示:

  • javaDelegateClass maps to flowable:class in the BPMN output. Specify the fully qualified classname of a class that implements JavaDelegate.
  • expression maps to flowable:expression in the BPMN output. Specify an expression to a method to be executed, such as a method in a Spring Bean. You should not specify any @Property annotations on fields when using this option. For more information, see below.
  • javaDelegateExpression maps to flowable:delegateExpression in the BPMN output. Specify an expression to a class that implements JavaDelegate.
  • javaDelegateClass映射到flowable: BPMN输出的类。指定实现JavaDelegate的类的完全限定类名。
  • 表达式映射到flowable: BPMN输出的表达式。指定要执行方法的表达式,例如Spring Bean中的方法。使用此选项时,不应在字段上指定任何@ Property注解。有关更多信息,请参见下文。
  • javaDelegateExpression映射到flowable:BPMN输出中的delegateExpression。为实现JavaDelegate的类指定一个表达式。

The user’s property values will be injected into the runtime class if you provide members in the class for Flowable to inject into. The names should match the names of the members in your CustomServiceTask. For more information, consult this part of the user guide. Note that from version 5.11.0 of the Designer, you can use the Expression interface for dynamic field values. This means that the value of the property in the Flowable Designer must contain an expression, and this expression will then be injected into an Expression property in the JavaDelegate implementation class.

如果您为Flowable提供类中成员以供注入,则用户的属性值将被注入到运行时类中。名称应与CustomServiceTask中成员的名称匹配。有关详细信息,请参阅用户指南的这一部分( this part)。注意,从5.11.0版本开始的设计器中,可以使用表达式接口来获取动态字段值。这意味着Flowable设计器中属性的值必须包含一个表达式,然后该表达式将被注入到JavaDelegate实现类中的Expression属性中。

Note
You can use @Property annotations on members of your CustomServiceTask, but this will not work if you use @Runtime’s expression attribute. The reason for this is that the expression you specify will be attempted to be resolved to a method by Flowable, not to a class. Therefore, no injection into a class will be performed. Any members marked with @Property will be ignored by Designer if you use expression in your @Runtime annotation. Designer will not render them as editable fields in the node’s property pane and will produce no output for the properties in the process’ BPMN.

注意
可以对CustomServiceTask的成员使用@Property注解,但如果使用@Runtime的expression属性,则这将不起作用。这样做的原因是,您指定的表达式将尝试通过Flowable解析为方法,而不是类。因此,不会对类执行注入。如果在@Runtime注解中使用表达式,设计器将忽略任何标记为@Property的成员。设计器不会将它们呈现为节点的属性窗格中的可编辑字段,并且不会为流程的BPMN中的属性生成任何输出。

Note
Note that the runtime class shouldn’t be in your extension JAR, as it’s dependent on the Flowable libraries. Flowable needs to be able to find it at runtime, so it needs to be on the Flowable engine’s classpath.

注意
注意,运行时类不应该在扩展(extension)JAR中,因为它依赖于Flowable库。Flowable要求能在运行时找到它,所以它需要在Flowable引擎的classpath上。
The examples project in Designer’s source tree contains examples of the different options for configuring @Runtime. Take a look in the money-tasks project for some starting points. The examples refer to delegate class examples that are in the money-delegates project.
设计器源代码树中的examples项目包含配置@Runtime的不同选项的示例。看看money-tasks项目作为入门。这些示例引用了money-delegates项目中的delegate类示例。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月满闲庭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值