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

add log in receive process, to log received bundle entities #139

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
Loading