-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: implement DeploymentReceiverAdapter for bpmn and dmn
- Loading branch information
Showing
6 changed files
with
12 additions
and
135 deletions.
There are no files selected for viewing
23 changes: 12 additions & 11 deletions
23
...in/java/io/miranum/platform/example/adapter/out/deployment/DeploymentReceiverAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
package io.miranum.platform.example.adapter.out.deployment; | ||
|
||
import io.miranum.platform.deploymentreceiver.application.DeploymentFailedException; | ||
import io.miranum.platform.deploymentreceiver.application.ports.out.MiranumDeploymentReceiver; | ||
import io.miranum.platform.deploymentreceiver.domain.Deployment; | ||
import io.miranum.platform.example.adapter.out.deployment.handler.DeploymentHandler; | ||
import io.miranum.platform.engine.application.port.in.deployment.ArtifactDeploymentUseCase; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class DeploymentReceiverAdapter implements MiranumDeploymentReceiver { | ||
|
||
private final List<DeploymentHandler> deploymentHandlers; | ||
private final ArtifactDeploymentUseCase artifactDeploymentUseCase; | ||
|
||
@Override | ||
public void deploy(final Deployment deployment) { | ||
this.deploymentHandlers.stream() | ||
.filter(handler -> handler.isResponsibleFor(deployment.getType())) | ||
.findFirst() | ||
.ifPresentOrElse(handler -> handler.deployArtifact(deployment), () -> { | ||
throw new DeploymentFailedException("No handler found for deployment type " + deployment.getType()); | ||
}); | ||
if (deployment.getType().equalsIgnoreCase("bpmn")) { | ||
log.info("Deploying BPMN artifact: {}", deployment.getFilename()); | ||
this.artifactDeploymentUseCase.deployBpmn(deployment.getFile(), deployment.getFilename(), deployment.getNamespace(), deployment.getTags()); | ||
} | ||
if (deployment.getType().equalsIgnoreCase("dmn")) { | ||
log.info("Deploying DMN artifact: {}", deployment.getFilename()); | ||
this.artifactDeploymentUseCase.deployDmn(deployment.getFile(), deployment.getFilename(), deployment.getNamespace(), deployment.getTags()); | ||
} | ||
|
||
// TODO implement forms and config deployments | ||
} | ||
|
||
} |
25 changes: 0 additions & 25 deletions
25
...ava/io/miranum/platform/example/adapter/out/deployment/handler/BpmnDeploymentHandler.java
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
...ranum/platform/example/adapter/out/deployment/handler/ConfigurationDeploymentHandler.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...in/java/io/miranum/platform/example/adapter/out/deployment/handler/DeploymentHandler.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
...java/io/miranum/platform/example/adapter/out/deployment/handler/DmnDeploymentHandler.java
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
...ava/io/miranum/platform/example/adapter/out/deployment/handler/FormDeploymentHandler.java
This file was deleted.
Oops, something went wrong.