Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into FLPATH-274
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiubodiu authored Apr 12, 2023
2 parents 5835a8d + 5285a35 commit e44e72c
Show file tree
Hide file tree
Showing 136 changed files with 10,755 additions and 7,384 deletions.
2 changes: 1 addition & 1 deletion external-dependencies/download-tibco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
if [ -f "tibjms.jar" ]; then exit 0; fi
rm -rf /tmp/tibco
mkdir /tmp/tibco
curl -s -o /tmp/tibco/tibco.zip "https://edownloads.tibco.com/Installers/tap/EMS-CE/10.2.1/TIB_ems-ce_10.2.1_linux_x86_64.zip?SJCDPTPG=1681227113_1e3fe1f60cbbe9ee810af68e0b4256bb&ext=.zip"
curl -s -o /tmp/tibco/tibco.zip "https://edownloads.tibco.com/Installers/tap/EMS-CE/10.2.1/TIB_ems-ce_10.2.1_linux_x86_64.zip?SJCDPTPG=1683881528_ae3eee42628d3f74b67cb52ea15aea45&ext=.zip"
cd /tmp/tibco
unzip tibco.zip TIB_ems-ce_10.2.1/tar/TIB_ems-ce_10.2.1_linux_x86_64-java_client.tar.gz
tar -zxf TIB_ems-ce_10.2.1/tar/TIB_ems-ce_10.2.1_linux_x86_64-java_client.tar.gz opt/tibco/ems/10.2/lib/tibjms.jar
Expand Down
18 changes: 0 additions & 18 deletions notification-service-sdk/pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.parodos</groupId>
<artifactId>notification-service-sdk</artifactId>
<packaging>jar</packaging>
<name>notification-service-sdk</name>
<version>${revision}</version>
<url>https://github.com/openapitools/openapi-generator</url>
<description>OpenAPI Java</description>
<scm>
Expand Down Expand Up @@ -41,7 +39,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<fork>true</fork>
<meminitial>128m</meminitial>
Expand Down Expand Up @@ -75,7 +72,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<systemProperties>
<property>
Expand Down Expand Up @@ -151,7 +147,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -188,7 +183,6 @@
<plugin>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
<version>${spring.javaformat.version}</version>
<executions>
<execution>
<phase>process-sources</phase>
Expand Down Expand Up @@ -241,17 +235,14 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${okhttp-version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson-version}</version>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
Expand All @@ -261,12 +252,10 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3-version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -287,13 +276,6 @@
<properties>
<gson-fire-version>1.8.5</gson-fire-version>
<swagger-core-version>1.6.3</swagger-core-version>
<okhttp-version>4.9.2</okhttp-version>
<gson-version>2.8.8</gson-version>
<commons-lang3-version>3.12.0</commons-lang3-version>
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.2</junit-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spotless.version>2.17.3</spotless.version>
</properties>
</project>
21 changes: 7 additions & 14 deletions notification-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,10 @@
<java.version>11</java.version>
<spring-cloud.version>2020.0.6</spring-cloud.version>
<springdoc-openapi-ui.version>1.6.4</springdoc-openapi-ui.version>
<postgres.socket.factory.version>1.2.0</postgres.socket.factory.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<openapi.generator.version>5.4.0</openapi.generator.version>

<gson-fire-version>1.8.5</gson-fire-version>
<swagger-core-version>1.6.3</swagger-core-version>
<okhttp-version>4.9.2</okhttp-version>
<gson-version>2.8.8</gson-version>
<commons-lang3-version>3.12.0</commons-lang3-version>
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<spotless.version>2.17.3</spotless.version>
</properties>
<dependencies>
<!-- START Spring Web Dependencies -->
Expand Down Expand Up @@ -152,17 +143,14 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${okhttp-version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson-version}</version>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
Expand All @@ -172,12 +160,10 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3-version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -189,6 +175,13 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<!-- START Metrics Dependencies -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>runtime</scope>
</dependency>
<!-- END Metrics Dependencies -->
</dependencies>
<dependencyManagement>
<dependencies>
Expand Down
20 changes: 19 additions & 1 deletion notification-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,22 @@ spring:

springdoc:
writer-with-order-by-keys: true
writer-with-default-pretty-printer: true
writer-with-default-pretty-printer: true

management:
metrics:
export:
prometheus:
enabled: true
endpoint:
health:
enabled: true
prometheus:
enabled: true
metrics:
enabled: true
endpoints:
enabled-by-default: false
web:
exposure:
include: "health,prometheus"
10 changes: 0 additions & 10 deletions parodos-model-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
<url>http://github.com/parodos-dev/parodos/tree/master</url>
</scm>

<properties>
<lombok.version>1.18.26</lombok.version>
<spring.framework.version>5.3.26</spring.framework.version>
<jackson-databind.version>2.14.2</jackson-databind.version>
</properties>

<dependencies>
<!-- START Parodos Workflow Dependencies -->
<dependency>
Expand All @@ -44,23 +38,19 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<!-- END Developer Productivity Dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
*/
public enum WorkFlowStatus {

FAILED, IN_PROGRESS, COMPLETED, PENDING
FAILED, IN_PROGRESS, COMPLETED, PENDING, REJECTED;

public boolean isFailed() {
return FAILED.name().equals(name());
}

public boolean isRejected() {
return REJECTED.name().equals(name());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,15 @@
*/
package com.redhat.parodos.workflow.task;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.springframework.beans.factory.BeanNameAware;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.redhat.parodos.workflow.context.WorkContextDelegate;
import com.redhat.parodos.workflow.exception.MissingParameterException;
import com.redhat.parodos.workflow.utils.WorkContextUtils;
import com.redhat.parodos.workflows.work.WorkContext;
import com.redhat.parodos.workflows.workflow.WorkFlow;

import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.BeanNameAware;

/**
* Base Class for a WorkFlowTask.
Expand Down Expand Up @@ -65,6 +58,22 @@ public void setWorkFlowCheckers(List<WorkFlow> workFlowCheckers) {
this.workFlowCheckers = workFlowCheckers;
}

public String getProjectId(WorkContext workContext) {
return WorkContextUtils.getProjectId(workContext);
}

public String getMasterExecutionId(WorkContext workContext) {
return WorkContextUtils.getMainExecutionId(workContext);
}

public void addParameter(WorkContext workContext, String key, String value) {
WorkContextUtils.addParameter(workContext, key, value);
}

public Map<String, String> getAllParameters(WorkContext workContext) {
return WorkContextUtils.getAllParameters(workContext, name);
}

/**
* Get Parameters specific to this WorkFlowTask, this is a required parameter
* @param workContext
Expand All @@ -74,14 +83,7 @@ public void setWorkFlowCheckers(List<WorkFlow> workFlowCheckers) {
*/
public String getRequiredParameterValue(WorkContext workContext, String parameterName)
throws MissingParameterException {
Map<String, String> parameters = Optional
.ofNullable(new ObjectMapper().convertValue(
WorkContextDelegate.read(workContext, WorkContextDelegate.ProcessType.WORKFLOW_TASK_EXECUTION,
name, WorkContextDelegate.Resource.ARGUMENTS),
new TypeReference<HashMap<String, String>>() {
}))
.orElse(new HashMap<>());
parameters.putAll(getParentParameters(workContext, getName()));
Map<String, String> parameters = getAllParameters(workContext);
return parameters.entrySet().stream().filter(entry -> parameterName.equals(entry.getKey()))
.map(Map.Entry::getValue).findFirst().orElseThrow(() -> {
log.error(String.format("parameter %s is not provided for task %s!", parameterName, name));
Expand All @@ -98,40 +100,9 @@ public String getRequiredParameterValue(WorkContext workContext, String paramete
* @throws MissingParameterException
*/
public String getOptionalParameterValue(WorkContext workContext, String parameterName, String defaultValue) {
Map<String, String> parameters = Optional
.ofNullable(new ObjectMapper().convertValue(
WorkContextDelegate.read(workContext, WorkContextDelegate.ProcessType.WORKFLOW_TASK_EXECUTION,
name, WorkContextDelegate.Resource.ARGUMENTS),
new TypeReference<HashMap<String, String>>() {
}))
.orElse(new HashMap<>());
parameters.putAll(getParentParameters(workContext, getName()));
Map<String, String> parameters = getAllParameters(workContext);
return parameters.entrySet().stream().filter(entry -> parameterName.equals(entry.getKey()))
.map(Map.Entry::getValue).findFirst().orElse(defaultValue);
}

/**
* Get Parameters that are set at the WorkFlow level
* @param workContext
* @param workName
* @return
*/
private Map<String, String> getParentParameters(WorkContext workContext, String workName) {
String parentWorkflowName = (String) WorkContextDelegate.read(workContext,
WorkContextDelegate.ProcessType.WORKFLOW_EXECUTION, workName,
WorkContextDelegate.Resource.PARENT_WORKFLOW);
Map<String, String> map = new HashMap<>();
Optional.ofNullable(
new ObjectMapper().convertValue(
WorkContextDelegate.read(workContext, WorkContextDelegate.ProcessType.WORKFLOW_EXECUTION,
workName, WorkContextDelegate.Resource.ARGUMENTS),
new TypeReference<HashMap<String, String>>() {
}))
.ifPresent(map::putAll);
if (parentWorkflowName != null) {
map.putAll(getParentParameters(workContext, parentWorkflowName));
}
return map;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
*/
public enum WorkFlowTaskStatus {

FAILED, COMPLETED, IN_PROGRESS, PENDING
FAILED, COMPLETED, IN_PROGRESS, PENDING, REJECTED

}
Loading

0 comments on commit e44e72c

Please sign in to comment.