Skip to content

Commit e8a6dcb

Browse files
committed
Update where we save models and controllers
1 parent 545c712 commit e8a6dcb

File tree

5 files changed

+50
-11
lines changed

5 files changed

+50
-11
lines changed

Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
FROM guligo/jdk-maven-ant
2-
32
MAINTAINER ProcessMaker Inc.
43

5-
COPY /src /opt/executor
6-
7-
WORKDIR /opt/executor
8-
94
# https://superuser.com/questions/1423486
105
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
116
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA8E81B4331F7F50
127
RUN apt-get update && apt-get install -y git-core
13-
RUN if [ ! -d "sdk-java" ]; then git clone --depth 1 https://github.com/ProcessMaker/sdk-java.git; fi
148

9+
COPY /src /opt/executor
10+
WORKDIR /opt/executor
11+
RUN if [ ! -d "sdk-java" ]; then git clone --depth 1 https://github.com/ProcessMaker/sdk-java.git; fi
1512
WORKDIR /opt/executor/sdk-java
16-
1713
RUN mvn clean install
18-
1914
WORKDIR /opt/executor

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,48 @@ public class Script implements BaseScript {
5151
{"z":300.0}
5252
```
5353

54+
### Example using the ProcessMaker 4 SDK
55+
Get all users' email addresses
56+
```java
57+
import ProcessMaker_Client.ApiClient;
58+
import java.io.*;
59+
import java.util.*;
60+
61+
import ProcessMaker_Client.ApiClient;
62+
import ProcessMaker_Client.ApiException;
63+
import ProcessMaker_Client.Configuration;
64+
import ProcessMaker_Client.auth.*;
65+
import ProcessMaker_Model.*;
66+
import ProcessMaker_Api.UsersApi;
67+
68+
public class Script implements BaseScript {
69+
public void execute(Map<String, Object> data, Map<String, Object> config, Map<String, Object> output, ApiClient api) {
70+
UsersApi apiInstance = new UsersApi(api);
71+
String filter = "";
72+
String orderBy = "id";
73+
String orderDirection = "asc";
74+
Integer perPage = 100;
75+
String include = "";
76+
77+
try {
78+
InlineResponse20019 result = apiInstance.getUsers(filter, orderBy, orderDirection, perPage, include);
79+
80+
List<String> emails = new ArrayList<>();
81+
for (Users u : result.getData()) {
82+
emails.add(u.getEmail());
83+
}
84+
output.put("emails", emails);
85+
86+
} catch (ApiException e) {
87+
System.err.println("Exception when calling UsersApi");
88+
System.err.println("Status code: " + e.getCode());
89+
System.err.println("Reason: " + e.getResponseBody());
90+
e.printStackTrace();
91+
}
92+
}
93+
}
94+
```
95+
5496
## Command Line Usage
5597
```bash
5698
$ docker run -v <path to local data.json>:/opt/executor/data.json \

src/BaseScript.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import org.openapitools.client.api.UsersApi;
21
import ProcessMaker_Client.ApiClient;
32
import com.google.gson.Gson;
43
import java.io.*;

src/DockerExecutorJavaServiceProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public function boot()
3636
'runner' => 'JavaRunner',
3737
'mime_type' => 'application/java',
3838
'image' => env('SCRIPTS_JAVA_IMAGE', 'processmaker4/executor-java'),
39-
'options' => ['invokerPackage' => "ProcessMaker_Client"]
39+
'options' => [
40+
'invokerPackage' => "ProcessMaker_Client",
41+
'modelPackage' => "ProcessMaker_Model",
42+
'apiPackage' => "ProcessMaker_Api",
43+
]
4044
];
4145
config(['script-runners.java' => $config]);
4246

src/Main.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import org.openapitools.client.api.UsersApi;
21
import ProcessMaker_Client.ApiClient;
32
import com.google.gson.Gson;
43
import java.io.*;

0 commit comments

Comments
 (0)