Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped to use latest versions of spring and activiti dependencies #8

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven"
# See documentation for possible values
directory: "/"
# Location of package manifests
schedule:
interval: "daily"
42 changes: 42 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Java CI
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11' ]
name: Build on Java ${{ matrix.Java }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java }}
uses: actions/[email protected]
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
- name: Cache SonarCloud packages
uses: actions/[email protected]
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/[email protected]
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B clean package --file pom.xml
- name: Codecov
uses: codecov/[email protected]
20 changes: 17 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
<version>1.5.22.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<activiti.version>5.19.0.2</activiti.version>
<java.version>11</java.version>
<activiti.version>6.0.0</activiti.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -48,7 +49,6 @@


<!-- Testing -->

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand All @@ -67,6 +67,20 @@
</exclusions>
</dependency>

<!-- API, java.xml.bind module -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
</dependency>

<!-- Runtime, com.sun.xml.bind module -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>3.0.2</version>
</dependency>

</dependencies>

<build>
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/org/activiti/HireProcessRestController.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.activiti;

import org.activiti.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
Expand All @@ -12,21 +11,23 @@
@RestController
public class HireProcessRestController {

@Autowired
private RuntimeService runtimeService;
private final RuntimeService runtimeService;
private final ApplicantRepository applicantRepository;

@Autowired
private ApplicantRepository applicantRepository;
public HireProcessRestController(RuntimeService runtimeService, ApplicantRepository applicantRepository) {
this.runtimeService = runtimeService;
this.applicantRepository = applicantRepository;
}

@ResponseStatus(value = HttpStatus.OK)
@RequestMapping(value = "/start-hire-process", method = RequestMethod.POST,
@PostMapping(value = "/start-hire-process",
produces = MediaType.APPLICATION_JSON_VALUE)
public void startHireProcess(@RequestBody Map<String, String> data) {

Applicant applicant = new Applicant(data.get("name"), data.get("email"), data.get("phoneNumber"));
applicantRepository.save(applicant);

Map<String, Object> vars = Collections.<String, Object>singletonMap("applicant", applicant);
Map<String, Object> vars = Collections.singletonMap("applicant", applicant);
runtimeService.startProcessInstanceByKey("hireProcessWithJpa", vars);
}

Expand Down
52 changes: 25 additions & 27 deletions src/main/java/org/activiti/MyApp.java
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
package org.activiti;

import org.activiti.engine.IdentityService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.User;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
public class MyApp {

public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}

// @Bean
// public CommandLineRunner init(final RepositoryService repositoryService,
// final RuntimeService runtimeService,
// final TaskService taskService) {
//
// return new CommandLineRunner() {
// @Override
// public void run(String... strings) throws Exception {
// Map<String, Object> variables = new HashMap<String, Object>();
// variables.put("applicantName", "John Doe");
// variables.put("email", "[email protected]");
// variables.put("phoneNumber", "123456789");
// runtimeService.startProcessInstanceByKey("hireProcess", variables);
// }
// };
//
// }
@Bean
public CommandLineRunner init(final RuntimeService runtimeService) {

return strings -> {
Map<String, Object> variables = new HashMap<>();
variables.put("applicantName", "John Doe");
variables.put("email", "[email protected]");
variables.put("phoneNumber", "123456789");
runtimeService.startProcessInstanceByKey("hireProcess", variables);
};

}

@Bean
InitializingBean usersAndGroupsInitializer(final IdentityService identityService) {

return new InitializingBean() {
public void afterPropertiesSet() throws Exception {
return () -> {

Group group = identityService.newGroup("user");
group.setName("users");
group.setType("security-role");
identityService.saveGroup(group);
Group group = identityService.newGroup("user");
group.setName("users");
group.setType("security-role");
identityService.saveGroup(group);

User admin = identityService.newUser("admin");
admin.setPassword("admin");
identityService.saveUser(admin);
User admin = identityService.newUser("admin");
admin.setPassword("admin");
identityService.saveUser(admin);

}
};
}

Expand Down
Loading