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

issue/200 API v2 Maven Module #223

Merged
merged 11 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
###
# dsf-bpe ignores
###
dsf-bpe/dsf-bpe-server-jetty/api/v1/*.jar
dsf-bpe/dsf-bpe-server-jetty/api/v2/*.jar
dsf-bpe/dsf-bpe-server-jetty/conf/config.properties
dsf-bpe/dsf-bpe-server-jetty/docker/api/v1/*.jar
dsf-bpe/dsf-bpe-server-jetty/docker/api/v2/*.jar
dsf-bpe/dsf-bpe-server-jetty/docker/dsf_bpe.jar
dsf-bpe/dsf-bpe-server-jetty/docker/dsf_status_client.jar
dsf-bpe/dsf-bpe-server-jetty/docker/lib/*.jar
Expand Down
66 changes: 66 additions & 0 deletions dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>dsf-bpe-process-api-v1-impl</artifactId>

<parent>
<groupId>dev.dsf</groupId>
<artifactId>dsf-bpe-pom</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>dev.dsf</groupId>
<artifactId>dsf-bpe-process-api</artifactId>
</dependency>
<dependency>
<groupId>dev.dsf</groupId>
<artifactId>dsf-bpe-process-api-v1</artifactId>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-jaxb</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>${hapi.fhir.version.v1}</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import dev.dsf.bpe.v1.service.QuestionnaireResponseHelper;
import dev.dsf.bpe.v1.service.TaskHelper;
import dev.dsf.bpe.v1.variables.Variables;
import dev.dsf.bpe.variables.VariablesImpl;
import dev.dsf.bpe.v1.variables.VariablesImpl;
import dev.dsf.fhir.authorization.process.ProcessAuthorizationHelper;
import dev.dsf.fhir.authorization.read.ReadAccessHelper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

public class ProxyConfigDelegate implements ProxyConfig
{
private final dev.dsf.common.config.ProxyConfig delegate;
private final dev.dsf.bpe.api.config.ProxyConfig delegate;

public ProxyConfigDelegate(dev.dsf.common.config.ProxyConfig delegate)
public ProxyConfigDelegate(dev.dsf.bpe.api.config.ProxyConfig delegate)
{
this.delegate = delegate;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.dsf.bpe.listener;
package dev.dsf.bpe.v1.listener;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.dsf.bpe.listener;
package dev.dsf.bpe.v1.listener;

import java.util.function.Function;

Expand All @@ -8,7 +8,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import dev.dsf.bpe.subscription.TaskHandler;
import dev.dsf.bpe.api.Constants;
import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage;

public class ContinueListener extends AbstractListener implements ExecutionListener
Expand All @@ -23,8 +23,8 @@ public ContinueListener(String serverBaseUrl, Function<DelegateExecution, Listen
@Override
public void doNotify(DelegateExecution execution, ListenerVariables variables) throws Exception
{
Task task = variables.getResource(TaskHandler.TASK_VARIABLE);
execution.removeVariable(TaskHandler.TASK_VARIABLE);
Task task = variables.getResource(Constants.TASK_VARIABLE);
execution.removeVariable(Constants.TASK_VARIABLE);

if (task != null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.dsf.bpe.listener;
package dev.dsf.bpe.v1.listener;

import java.util.List;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.dsf.bpe.listener;
package dev.dsf.bpe.v1.listener;

import org.hl7.fhir.r4.model.Task;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.dsf.bpe.listener;
package dev.dsf.bpe.v1.listener;

import java.util.function.Function;

Expand All @@ -8,7 +8,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import dev.dsf.bpe.subscription.TaskHandler;
import dev.dsf.bpe.api.Constants;
import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage;

public class StartListener extends AbstractListener implements ExecutionListener
Expand All @@ -23,8 +23,8 @@ public StartListener(String serverBaseUrl, Function<DelegateExecution, ListenerV
@Override
public void doNotify(DelegateExecution execution, ListenerVariables variables) throws Exception
{
Task task = variables.getResource(TaskHandler.TASK_VARIABLE);
execution.removeVariable(TaskHandler.TASK_VARIABLE);
Task task = variables.getResource(Constants.TASK_VARIABLE);
execution.removeVariable(Constants.TASK_VARIABLE);

if (task != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import dev.dsf.fhir.authorization.read.ReadAccessHelper;

@Configuration
public class DefaultSpringConfiguration
public class ApiServicesSpringConfiguration
{
@Autowired
private ProcessPluginApi api;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.dsf.bpe.v1.plugin;

import org.springframework.context.ApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import dev.dsf.bpe.api.plugin.ProcessPluginApiBuilder;
import dev.dsf.bpe.api.plugin.ProcessPluginFactory;
import dev.dsf.bpe.v1.spring.ApiServiceConfig;

public class ProcessPluginApiBuilderImpl implements ProcessPluginApiBuilder
{
@Override
public ProcessPluginFactory build(ClassLoader apiClassLoader, ApplicationContext apiApplicationContext,
ConfigurableEnvironment environment)
{
return new ProcessPluginFactoryImpl(apiClassLoader, apiApplicationContext, environment);
}

@Override
public Class<?> getSpringServiceConfigClass()
{
return ApiServiceConfig.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package dev.dsf.bpe.v1.plugin;

import java.net.URLClassLoader;
import java.nio.file.Path;
import java.util.stream.Stream;

import org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import dev.dsf.bpe.api.listener.ListenerFactory;
import dev.dsf.bpe.api.plugin.AbstractProcessPluginFactory;
import dev.dsf.bpe.api.plugin.ProcessPlugin;
import dev.dsf.bpe.api.plugin.ProcessPluginFactory;
import dev.dsf.bpe.v1.ProcessPluginDefinition;
import dev.dsf.bpe.v1.activity.DefaultUserTaskListener;

public class ProcessPluginFactoryImpl extends AbstractProcessPluginFactory implements ProcessPluginFactory
{
public static final int API_VERSION = 1;

public ProcessPluginFactoryImpl(ClassLoader apiClassLoader, ApplicationContext apiApplicationContext,
ConfigurableEnvironment environment)
{
super(API_VERSION, apiClassLoader, apiApplicationContext, environment, ProcessPluginDefinition.class,
DefaultUserTaskListener.class);
}

@Override
protected ProcessPlugin createProcessPlugin(Object processPluginDefinition, boolean draft, Path jarFile,
URLClassLoader pluginClassLoader)
{
return new ProcessPluginImpl((ProcessPluginDefinition) processPluginDefinition, API_VERSION, draft, jarFile,
pluginClassLoader, environment, apiApplicationContext);
}

@Override
@SuppressWarnings("rawtypes")
public Stream<TypedValueSerializer> getSerializer()
{
return apiApplicationContext.getBeansOfType(TypedValueSerializer.class).values().stream();
}

@Override
public ListenerFactory getListenerFactory()
{
return apiApplicationContext.getBean(ListenerFactory.class);
}
}
Loading
Loading