Skip to content

Commit

Permalink
2.4 Add towTruckToolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-yves-monnet committed Apr 29, 2020
1 parent 791ca32 commit c9e4cd5
Show file tree
Hide file tree
Showing 11 changed files with 456 additions and 218 deletions.
32 changes: 31 additions & 1 deletion GroovyMaintenance/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,37 @@ How to create a Groovy maintenance file

Write your groovy file, with a name "TimerFailedReArm.groovy". Give the code "TimerFailedReArm" to the user to load it.

Place holder
## Available object

Different object are available in the groovy

### restAPIContext
The RestAPIConext contains these methods:

public APIClient getApiClient()
public APISession getApiSession()
public Locale getLocale()
public ResourceProvider getResourceProvider()

### apiAccessor

The Bonita ApiAccessor


## apiClient
The Bonita ApiClient

### bonitaToolboxAPI
this object contains theses methods
public List<Map<String,Object>> executeSqlRequest(String sqlRequest ) {
public List<Map<String,Object>> executeSqlRequest(String sqlRequest, List<Object> parameter ) {

public String decoratorHtml(List<Map<String,Object>> listValues)
public String decoratorCsv(List<Map<String,Object>> listValues)



## Place holder
In the file, you can set some Place Holder. Syntax is {{<key>[;tips:<type>]}}
For example, you can set

Expand Down
34 changes: 34 additions & 0 deletions GroovyMaintenance/SqlRequest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.util.logging.Level
import java.util.logging.Logger



/* ******************************************************************* */
/* */
/* Name: Executing a SQL Request */
/* */
/* Description: The SQL Request is executed on the Engine Database */
/* */
/* ******************************************************************* */

Logger logger = Logger.getLogger("org.bonitasoft.groovymaintenance.executeflownode");

StringBuilder analysis = new StringBuilder();

// flow nodes
// Attention, at this moment, the list may be a list of whatever - soon more control
String sqlRequest= {{sqlRequestBonita;type:TEXT;default:select ID, STARTDATE ,NAME from process_instance}};
int maxRecords = {{MawRecord;type:INTEGER;default:1000}};



analysis.append("SqlRequest ["+sqlRequest+"]...<br>");
List<Map<String,Object>> listResult = towTruckToolbox.executeSqlRequest( sqlRequest, maxRecords );

analysis.append("<br>");
analysis.append( towTruckToolbox.decoratorHtmlFormated(listResult));


return analysis.toString();


20 changes: 14 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bonitasoft.custompage</groupId>
<artifactId>CustomPageTowTruck</artifactId>
<version>1.0.1</version>
<version>2.3</version>
<name>CustomPageTowTruck</name>
<properties>
<bonita.version>7.8.4</bonita.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<sonar.sources>pom.xml,src</sonar.sources>
<sonar.java.binaries>target/classes</sonar.java.binaries>

</properties>
<dependencies>
<dependency>
<groupId>org.bonitasoft.engine</groupId>
Expand All @@ -20,20 +28,20 @@
<dependency>
<groupId>org.bonitasoft.log.event</groupId>
<artifactId>bonita-event</artifactId>
<version>1.5.0</version>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<!-- to execute the Deploy Plugin -->
<dependency>
<groupId>org.bonitasoft.store</groupId>
<artifactId>bonita-store</artifactId>
<version>1.1.0</version>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.bonitasoft.engine</groupId>
Expand Down Expand Up @@ -165,7 +173,7 @@
<!-- use UPDATE or DELETEANDADD -->
<argument>strategy:UPDATE</argument>
<argument>profile:BOTools</argument>

</arguments>
</configuration>
</execution>
Expand All @@ -174,5 +182,5 @@

</plugins>
</build>

</project>
Loading

0 comments on commit c9e4cd5

Please sign in to comment.