Skip to content

Commit

Permalink
add log in receive process, to log received bundle entities
Browse files Browse the repository at this point in the history
  • Loading branch information
mafasva committed Oct 7, 2024
1 parent ee36db8 commit 1440efc
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import static de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.ConstantsDataTransfer.BPMN_EXECUTION_VARIABLE_CONTINUE_STATUS;
import static de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.ConstantsDataTransfer.CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_INSERT_INTO_CRR_FHIR_REPOSITORY_FAILED;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.camunda.bpm.engine.delegate.BpmnError;
Expand Down Expand Up @@ -57,6 +59,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw
dataLogger.logData("Received bundle", bundle);

dataClientFactory.getDataStoreClient().getFhirClient().storeBundle(bundle);
logger.info("stored bundle with entries: {}", entryIdsToList(bundle));

execution.setVariable(BPMN_EXECUTION_VARIABLE_CONTINUE_STATUS, ContinueStatus.SUCCESS);
}
Expand All @@ -74,4 +77,20 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw
"Unable to insert data into CRR");
}
}

private List<String> entryIdsToList(Bundle bundle)
{
List<String> entryIds = new ArrayList<>();

for (Bundle.BundleEntryComponent entry : bundle.getEntry())
{
String fullUrl = entry.getFullUrl();
if (fullUrl != null && !fullUrl.isEmpty())
{
entryIds.add(fullUrl);
}
}

return entryIds;
}
}

0 comments on commit 1440efc

Please sign in to comment.