Zadania automatyczneZadania automatyczne to komponenty użytkownika, będące osobnym zadaniem w ścieżce procesu. Stworzone zadania automatyczne dostępne są w edytorze procesów i mogą być łatwo wykorzystane w procesie biznesowym umożliwiając tym samym realizacje logiki biznesowej. Ich zachowanie może być dodatkowo konfigurowane za pomocą parametrów. Definiowanie zadania automatycznegoAplikacje tworzone są w oparciu o ich definicję stworzoną przez użytkownika. Definicja taka musi zawierać następujące elementy:
Aplikacja może również dostarczać skrypt, który buduje wygląd parametrów podczas jej definiowania w PWE. W tym celu należy dodać kolejną adnotację dla klasy Przykładowa definicja przedstawiona jest poniżej. Aplikacja wylicza wartość brutto na podstawie wartości netto i wartości VAT i ustawią ją do zmiennej podanej w parametrze.
Implementacja zadania automatycznegoZadanie automatyczne musi posiadać metodę o nazwie execute. Metoda może posiadać następujące typy parametrów:
|
<!-- Udostępnianie zadań autoamtycznych--> <workflow-components key="components" /> |
Aplikacje oraz settery praktycznie się od siebie nie różnią pod względem budowy komponentu, dlatego możliwe jest stworzenie pojedynczej definicji, która może pełnić w systemie zarówno rolę aplikacji lub settera. Definicja takiego komponentu musi mieć postać:
@Application @VariableSetter public class MixedComponent { @Define public void definition( CommonDefinitionBuilder builder ) { // @formatter:off builder .id( "variable-and-application-component-id" ) .name( "variable-and-application-component-name" ) .category( Categories.CUSTOM ) .parameter() .id( "variable-and-application-param-id" ) .name( "variable-and-application-param-name" ) .type( Types.VARIABLE) .create(); // @formatter:on } public void execute( @Param( "variable-and-application-param-id" ) Variable param ) { handle( param ); } public void set( @Param( "variable-and-application-param-id" ) Variable param ) { handle( param ); } public void handle( Variable param ) { param.setValue( "some value" ); } } |
Metoda execute zostanie wywołana, jeżeli będzie to aplikacja, set jeżeli będzie to setter. Jeżeli obie metody mają wykonywać dokładnie to samo, można wykorzystać powyższą koncepcję. Argumenty, które można przekazać do poszczególnych metod wywołujących są nadal zgodne z dokumentacjami aplikacji oraz settera.
Należy zwrócić więc uwagę, iż w aplikacji można pobrać a w setterze
. Różnią się one tylko tym, iż
zawiera nazwę akcji, która zaakceptowała zadanie. Obie klasy dziedziczą po
, a więc w obu metodach set oraz execute można pobrać tego typu parametr.
Automatic tasksAutomatic tasks are user components that are separate tasks in the process path. Created automatic tasks are available in the process editor and can be easily used in a business process enabling the execution of business logic. Their behavior can be additionally configured using parameters. Defining the automatic taskApplications are created based on their definition, created by the user. Such a definition must contain the following elements:
The application can also provide a script that builds the appearance of parameters when it is defined in the PWE. To do this, add another annotation for the class
An example definition is shown below. The application calculates the gross value based on the net value and VAT value and will set it to the variable specified in the parameter.
Implementation of an automatic taskThe automatic task must have a method named execute. The method can have the following types of parameters:
|
<!-- Sharing automatic tasks--> <workflow-components key="components" /> |
Applications and setters are practically no different from each other in terms of component construction, so it is possible to create a single definition that can act as both an application or a setter in the system. The definition of such a component must be of the form:
@Application @VariableSetter public class MixedComponent { @Define public void definition( CommonDefinitionBuilder builder ) { // @formatter:off builder .id( "variable-and-application-component-id" ) .name( "variable-and-application-component-name" ) .category( Categories.CUSTOM ) .parameter() .id( "variable-and-application-param-id" ) .name( "variable-and-application-param-name" ) .type( Types.VARIABLE) .create(); // @formatter:on } public void execute( @Param( "variable-and-application-param-id" ) Variable param ) { handle( param ); } public void set( @Param( "variable-and-application-param-id" ) Variable param ) { handle( param ); } public void handle( Variable param ) { param.setValue( "some value" ); } } |
The execute method will be called if it is an application; set if it is a setter. If both methods are to do exactly the same thing, you can use the above concept. The arguments that can be passed to each calling method are still in accordance with the documentation of the application and the setter.
So note that in the application you can download in a setter
. They differ only in that it
contains the name of the action that accepted the task. Both classes inherit from
, so in both set and execute methods you can retrieve this type of parameter.