Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Lets Let's say we want to change workflow variables directly inside a system tool activity without creating having to create a complex beanshell script. This The Process Tool Plugin assigns a simple expression into to a workflow variable. The expression is evaluated using a beanshell interpreter, and the resulting value is converted into a string. The workflow variable is then assigned to this that string value.

All workflow variables are directly accessible inside the expression, but note that all joget workflow Joget Workflow variables are of String the string type.

Usage

...

Scenario:

  1. set Set a workflow variable to a constant value: use  .  Use AssignVariablePlugin as a tool, .  Use the parameters are : workflow variable name : A, expression  expression : 0.
  2. to To increment a workflow variable value : , use AssignVariablePlugin as a tool, .  Use the parameters are : workflow variable name : A, expression : Integer.parseInt(A) + 1.to
  3. To decrement a workflow variable value : use AssignVariablePlugin as a tool, . Use the parameters are : workflow variable name : A, expression : Integer.parseInt(A) - 1.

Steps

...

in Creating a Plugin: 

Create an empty project folder. Inside this folder, create subdirectory src\main\java\myplugin.

...

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<project  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0  http://maven.apache.org/xsd/maven-4.0.0.xsd"  xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>myplugin</groupId>
  <artifactId>AssignVariablePlugin</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>bundle</packaging>
  <name>AssignVariablePlugin</name>
  <url>http://inventorsparadox.blogspot.com</url>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.3</version>
        <executions>
          <execution>
            <id>integration-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skipTests>false</skipTests>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Export-Package>myplugin</Export-Package>
            <Private-Package>myplugin.*</Private-Package>
            <Bundle-Activator>myplugin.AssignVariablePlugin</Bundle-Activator>
              <Import-Package>!*,org.joget.report.dao,org.joget.report.model,org.joget.report.service,org.joget.commons.util,org.joget.plugin.base,org.joget.plugin.property.model,org.joget.plugin.property.service,org.joget.directory.model,org.joget.directory.model.service,org.joget.directory.dao,org.joget.workflow.model,org.joget.workflow.model.dao,org.joget.workflow.model.service,org.joget.workflow.util,org.joget.apps.app.dao,org.joget.apps.app.lib,org.joget.apps.app.model,org.joget.apps.app.service,org.joget.apps.datalist.lib,org.joget.apps.datalist.model,org.joget.apps.datalist.service,org.joget.apps.form.lib,org.joget.apps.form.dao,org.joget.apps.form.model,org.joget.apps.form.service,org.joget.apps.list.service,org.joget.apps.userview.lib,org.joget.apps.userview.model,org.joget.apps.userview.service,org.joget.apps.workflow.lib,javax.servlet,javax.servlet.http,org.osgi.framework;version="1.3.0"</Import-Package>
<Embed-Dependency>scope=compile|runtime;inline=false;artifactId=!commons-logging</Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>
                        <Embed-Directory>dependency</Embed-Directory>
                        <Embed-StripGroup>true</Embed-StripGroup>
                        <DynamicImport-Package>*</DynamicImport-Package>          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <distributionManagement>
    <repository>
      <id>internal</id>
      <url>http://dev.joget.org/archiva/repository/internal</url>
    </repository>
    <snapshotRepository>
      <id>snapshots</id>
      <url>http://dev.joget.org/archiva/repository/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.4</version>
      <scope>test</scope>
    </dependency>
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>     <dependency>
            <groupId>org.beanshell</groupId>
            <artifactId>bsh</artifactId>
            <version>2.0b4</version>
        </dependency>
  <dependency>
            <groupId>org.joget</groupId>
            <artifactId>wflow-core</artifactId>
            <version>3.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>  
  </dependencies>
</project>

Build

...

Step:

Code Block
mvn install

Installation :

Login to joget workflow Joget Workflow as admin, choose System Settings, Manage Plugins, Upload Settings>Manage Plugins>Upload Plugin, then browse to the target directory of the project folder. Upload the project snapshot jar that is being was generated by the previous maven execution.