Skip to content

Commit

Permalink
[26255] update generated bluemedication client, download extended pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
huthomas committed Apr 2, 2024
1 parent 105ad93 commit b553951
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bundles/at.medevit.elexis.bluemedication.core/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<classpathentry exported="true" kind="lib" path="lib/gson-fire-1.8.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/okhttp-4.10.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/openapi-java-client-1.7.0.jar" sourcepath="lib/openapi-java-client-1.7.0-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ public default Result<UploadResult> uploadDocument(IPatient patient, File docume
*/
public Result<String> downloadPdf(UploadResult uploadResult);

/**
* Download the results of upload and user interaction on the browser. The
* result is the original pdf extended with the extracted emediplan.
*
* @param uploadResult
* @return
*/
public Result<String> downloadExtendedPdf(UploadResult uploadResult);

/**
* Add a pending {@link UploadResult} to the map of pending results. One object
* can only have one {@link UploadResult}.
Expand Down Expand Up @@ -104,4 +113,5 @@ public default Result<UploadResult> uploadDocument(IPatient patient, File docume
* @param onSuccess
*/
public void startPollForResult(Object object, UploadResult uploadResult, Consumer<Object> onSuccess);

}
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,28 @@ public Result<String> downloadPdf(UploadResult uploadResult) {
}
}

@Override
public Result<String> downloadExtendedPdf(UploadResult uploadResult) {
initProxyOrOauth();
try {
ExtractionAndConsolidationApi apiInstance = new ExtractionAndConsolidationApi();
configureApiClient(apiInstance.getApiClient());
ApiResponse<File> response = apiInstance
.downloadIdExtractionExtendedpdfGetWithHttpInfo(uploadResult.getId(), true);
if (response.getStatusCode() >= 300) {
return Result.ERROR("Response status code was [" + response.getStatusCode() + "]");
}
if (response.getData() == null) {
return Result.ERROR("Response has no data");
}
return Result.OK(response.getData().getAbsolutePath());
} catch (ApiException e) {
hinAuthHandleException(e);
logger.error("Error downloading Document Pdf", e);
return Result.ERROR(e.getMessage());
}
}

@Override
public void addPendingUploadResult(Object object, UploadResult uploadResult) {
pendingUploadResults.put(object, uploadResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
}

private void downloadAndImportPdf(IDocumentHandle docHandle, UploadResult uploadResult) {
Result<String> pdf = BlueMedicationServiceHolder.getService().downloadPdf(uploadResult);
Result<String> pdf = BlueMedicationServiceHolder.getService().downloadExtendedPdf(uploadResult);
if (pdf.isOK()) {
DocumentStore documentsService = DocumentStoreServiceHolder.getService();
// debug code, save to new document
Expand Down

0 comments on commit b553951

Please sign in to comment.