Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…list into skayliu-master
  • Loading branch information
saig0 committed Aug 22, 2022
2 parents a3f3f92 + b681b6e commit 23b01d2
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 74 deletions.
42 changes: 21 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@

<groupId>io.zeebe</groupId>
<artifactId>zeebe-simple-tasklist</artifactId>
<version>0.6.0-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>org.camunda</groupId>
<artifactId>camunda-release-parent</artifactId>
<version>3.7</version>
<version>3.9.1</version>
<!-- do not remove empty tag - http://jira.codehaus.org/browse/MNG-4687 -->
<relativePath />
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<zeebe.version>0.26.1</zeebe.version>
<version.zeebe.spring>0.26.2</version.zeebe.spring>
<zeebe.version>8.0.4</zeebe.version>
<version.zeebe.spring>8.0.6</version.zeebe.spring>

<spring.boot.version>2.4.3</spring.boot.version>
<zeebe-hazelcast.version>0.10.0</zeebe-hazelcast.version>
<spring.boot.version>2.7.1</spring.boot.version>
<zeebe-hazelcast.version>1.2.1</zeebe-hazelcast.version>
<!-- pin Hazelcast version because of spring-boot-dependencies -->
<version.hazelcast>4.1.2</version.hazelcast>
<version.hazelcast>5.1.2</version.hazelcast>

<!-- release parent settings -->
<version.java>11</version.java>
<version.java>17</version.java>
<java.version>${version.java}</java.version>

<maven.compiler.source>${java.version}</maven.compiler.source>
Expand All @@ -50,7 +50,7 @@
<dependencies>

<dependency>
<groupId>io.zeebe</groupId>
<groupId>io.camunda</groupId>
<artifactId>zeebe-bom</artifactId>
<version>${zeebe.version}</version>
<scope>import</scope>
Expand Down Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<version>2.1.214</version>
</dependency>

</dependencies>
Expand All @@ -91,7 +91,7 @@

<!-- spring deps-->
<dependency>
<groupId>io.zeebe.spring</groupId>
<groupId>io.camunda</groupId>
<artifactId>spring-zeebe-starter</artifactId>
<version>${version.zeebe.spring}</version>
</dependency>
Expand Down Expand Up @@ -140,17 +140,17 @@
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
<version>0.46</version>
<version>0.48</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>sockjs-client</artifactId>
<version>1.1.2</version>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>stomp-websocket</artifactId>
<version>2.3.3-1</version>
<version>2.3.4</version>
</dependency>

<!-- hot swapping, live reload -->
Expand All @@ -163,7 +163,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>

Expand All @@ -185,7 +185,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<!--<version>${spring.boot.version}</version>-->
<executions>
<execution>
<goals>
Expand All @@ -198,7 +198,7 @@
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>2.8.0</version>
<version>3.2.0</version>
<configuration>
<to>
<image>docker.io/camunda/zeebe-simple-tasklist</image>
Expand All @@ -214,7 +214,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
<executions>
<execution>
<id>copy</id>
Expand Down Expand Up @@ -305,9 +305,9 @@
</profiles>

<scm>
<url>https://github.com/zeebe-io/zeebe-simple-tasklist</url>
<connection>scm:git:[email protected]:zeebe-io/zeebe-simple-tasklist.git</connection>
<developerConnection>scm:git:[email protected]:zeebe-io/zeebe-simple-tasklist.git
<url>https://github.com/camunda-community-hub/zeebe-simple-tasklist</url>
<connection>scm:git:[email protected]:camunda-community-hub/zeebe-simple-tasklist.git</connection>
<developerConnection>scm:git:[email protected]:camunda-community-hub/zeebe-simple-tasklist.git
</developerConnection>
<tag>HEAD</tag>
</scm>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/zeebe/tasklist/HazelcastService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.core.HazelcastInstance;
import io.camunda.zeebe.protocol.record.intent.JobIntent;
import io.zeebe.exporter.proto.Schema;
import io.zeebe.hazelcast.connect.java.ZeebeHazelcast;
import io.zeebe.protocol.record.intent.JobIntent;
import io.zeebe.tasklist.entity.HazelcastConfig;
import io.zeebe.tasklist.repository.HazelcastConfigRepository;
import io.zeebe.tasklist.repository.TaskRepository;
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/io/zeebe/tasklist/UserTaskJobHandler.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package io.zeebe.tasklist;

import io.zeebe.client.api.response.ActivatedJob;
import io.zeebe.client.api.worker.JobClient;
import io.zeebe.client.api.worker.JobHandler;
import io.zeebe.spring.client.annotation.ZeebeWorker;

import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.worker.JobClient;
import io.camunda.zeebe.client.api.worker.JobHandler;
import io.camunda.zeebe.spring.client.annotation.ZeebeWorker;
import io.zeebe.tasklist.entity.TaskEntity;
import io.zeebe.tasklist.repository.TaskRepository;
import io.zeebe.tasklist.view.FormField;
import io.zeebe.tasklist.view.NotificationService;
import java.time.Duration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.Instant;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserTaskJobHandler implements JobHandler {
Expand Down Expand Up @@ -59,11 +60,11 @@ public void handle(JobClient client, ActivatedJob job) {
entity.setTaskForm(taskForm);

final String assignee =
customHeaders.getOrDefault("assignee", (String) variables.get("assignee"));
customHeaders.getOrDefault("io.camunda.zeebe:assignee", (String) variables.get("assignee"));
entity.setAssignee(assignee);

final String candidateGroup =
customHeaders.getOrDefault("candidateGroup", (String) variables.get("candidateGroup"));
customHeaders.getOrDefault("io.camunda.zeebe:candidateGroup", (String) variables.get("candidateGroup"));
entity.setCandidateGroup(candidateGroup);

repository.save(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package io.zeebe.tasklist;

import io.zeebe.spring.client.EnableZeebeClient;
import io.camunda.zeebe.spring.client.EnableZeebeClient;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/io/zeebe/tasklist/rest/TaskResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@
*/
package io.zeebe.tasklist.rest;

import io.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.ZeebeClient;
import io.zeebe.tasklist.entity.TaskEntity;
import io.zeebe.tasklist.repository.TaskRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/tasks")
Expand Down
9 changes: 6 additions & 3 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ zeebe:
client:
worker:
defaultName: zeebe-simple-tasklist
defaultType: user
defaultType: io.camunda.zeebe:userTask
threads: 2

hazelcast:
Expand All @@ -15,7 +15,7 @@ zeebe:
adminPassword: demo

job.timeout: 2592000000 # 30 days
broker.contactPoint: 127.0.0.1:26500
broker.gateway-address: 127.0.0.1:26500
security.plaintext: true

spring:
Expand All @@ -41,11 +41,14 @@ spring:
pageable:
default-page-size: 10

main:
allow-circular-references: true

server:
port: 8081

logging:
level:
root: ERROR
io.zeebe: INFO
io.camunda: INFO
io.zeebe.tasklist: DEBUG
53 changes: 26 additions & 27 deletions src/main/resources/public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,32 @@ function withSecurityToken(url) {
// --------------------------------------------------------------------

var stompClient = null;

            function connect() {
                var socket = new SockJS('/notifications');
                stompClient = Stomp.over(socket); 
                stompClient.connect({}, function(frame) {
                    stompClient.subscribe('/notifications/tasks', function(message) {
                      handleMessage(JSON.parse(message.body));
                    });
                });
            }

            function disconnect() {
                if(stompClient != null) {
                    stompClient.disconnect();
                }
            }

            function sendMessage(msg) {
                stompClient.send("/notifications", {},
                  JSON.stringify(msg));
            }

            function handleMessage(msg) {
var message = msg.message;

showInfo(message);
}

function connect() {
var socket = new SockJS('/notifications');
stompClient = Stomp.over(socket);
stompClient.connect({}, function(frame) {
stompClient.subscribe('/notifications/tasks', function(message) {
handleMessage(JSON.parse(message.body));
});
});
}

function disconnect() {
if(stompClient != null) {
stompClient.disconnect();
}
}

function sendMessage(msg) {
stompClient.send("/notifications", {},
JSON.stringify(msg));
}

function handleMessage(msg) {
var message = msg.message;
showInfo(message);
}

// --------------------------------------------------------------------

Expand Down
10 changes: 6 additions & 4 deletions src/test/java/io/zeebe/tasklist/Demo.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package io.zeebe.tasklist;

import io.zeebe.client.ZeebeClient;
import io.zeebe.model.bpmn.Bpmn;
import io.zeebe.model.bpmn.BpmnModelInstance;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.model.bpmn.Bpmn;
import io.camunda.zeebe.model.bpmn.BpmnModelInstance;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
Expand Down Expand Up @@ -39,7 +41,7 @@ public static void main(String[] args) {
.zeebeTaskHeader("taskForm", getCustomTaskForm()))
.done();

client.newDeployCommand().addWorkflowModel(workflow, "demoProcess.bpmn").send().join();
client.newDeployCommand().addProcessModel(workflow, "demoProcess.bpmn").send().join();

IntStream.range(0, 3)
.forEach(
Expand Down
Loading

0 comments on commit 23b01d2

Please sign in to comment.