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

Commit

Permalink
fix: update reflection, update deployment process
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Oct 26, 2023
1 parent 9afbe5b commit 58f83c9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.camunda.zeebe.protocol.record.value.*;
import io.camunda.zeebe.protocol.record.value.deployment.DeploymentResource;
import io.camunda.zeebe.protocol.record.value.deployment.ProcessMetadataValue;
import io.camunda.zeebe.protocol.record.value.deployment.Process;
import org.lorislab.zeebe.dev.monitor.models.*;
import org.lorislab.zeebe.dev.monitor.models.Error;
import org.lorislab.zeebe.dev.monitor.ws.NotificationService;
Expand All @@ -18,9 +19,7 @@
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import java.util.TimeZone;
import java.util.UUID;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -147,6 +146,33 @@ private void importWorkflowProcess(final ProcessMetadataValue value, LocalDateTi
dr.persistAndFlush();
}

public void importProcess(final Record<Process> record) {
if (record.getPartitionId() != Protocol.DEPLOYMENT_PARTITION) {
return;
}
Process value = record.getValue();

Definition def = Definition.findById(value.getProcessDefinitionKey());
if (def != null) {
//TODO: check version and duplicates
return;
}
Definition entity = new Definition();
entity.key = value.getProcessDefinitionKey();
entity.bpmnProcessId = value.getBpmnProcessId();
entity.version = value.getVersion();
entity.timestamp = localDateTime(record.getTimestamp());
entity.persistAndFlush();

BpmnXmlResource dr = new BpmnXmlResource();
dr.name = value.getResourceName();
dr.key = entity.key;
dr.resource = value.getResource();
dr.persistAndFlush();

instanceNotificationService.sendEvent(new NotificationService.ProcessEvent(NotificationService.ProcessEventType.DEPLOYED));
}

public void importTimer(final Record<TimerRecordValue> record) {
Timer timer = Timer.findById(record.getKey());
if (timer == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public Response records(byte[] body) {
if (record.getRecordType() == RecordType.EVENT) {
switch (record.getValueType()) {
case PROCESS_INSTANCE -> importDataService.importProcessInstance(value(record));
case DEPLOYMENT -> importDataService.importWorkflowProcess(value(record));
case PROCESS -> importDataService.importProcess(value(record));
// case DEPLOYMENT -> importDataService.importWorkflowProcess(value(record));
case TIMER -> importDataService.importTimer(value(record));
case PROCESS_MESSAGE_SUBSCRIPTION -> importDataService.importMessageSubscription(value(record));
case MESSAGE_START_EVENT_SUBSCRIPTION -> importDataService.importMessageStartEventSubscription(value(record));
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/reflection-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
{"name" : "io.camunda.zeebe.protocol.record.value.deployment.ImmutableDeploymentResource$Builder", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.deployment.ImmutableProcess$Builder", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.deployment.ImmutableProcessMetadataValue$Builder", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.deployment.ImmutableForm$Builder,", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.deployment.ImmutableFormMetadataValue$Builder,", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.deployment.ImmutableForm$Builder", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.deployment.ImmutableFormMetadataValue$Builder", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.ImmutableProcessInstanceCreationStartInstructionValue$Builder", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
{"name" : "io.camunda.zeebe.protocol.record.value.ImmutableProcessInstanceModificationActivateInstructionValue$Builder", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true},
Expand Down

0 comments on commit 58f83c9

Please sign in to comment.