Skip to content

Commit

Permalink
Merge pull request #2 from ncats/arch-starter
Browse files Browse the repository at this point in the history
fixed export
  • Loading branch information
tylerperyea authored Nov 5, 2022
2 parents 38461dc + ba27deb commit a273c60
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ protected Stream<AdverseEventCvm> filterStream(Stream<AdverseEventCvm> stream, b
return stream;
}

/*
@PreAuthorize("isAuthenticated()")
@GetGsrsRestApiMapping("/export/{etagId}/{format}")
public ResponseEntity<Object> createExport(@PathVariable("etagId") String etagId,
Expand All @@ -114,35 +115,6 @@ public ResponseEntity<Object> createExport(@PathVariable("etagId") String etagId
HttpServletRequest request
) throws Exception {
/*
Optional<ETag> etagObj = this.eTagRepository.findByEtag(etagId);
boolean publicOnly = publicOnlyObj == null ? true : publicOnlyObj;
if (!etagObj.isPresent()) {
return new ResponseEntity("could not find etag with Id " + etagId, this.gsrsControllerConfiguration.getHttpStatusFor(HttpStatus.BAD_REQUEST, parameters));
} else {
ExportMetaData emd = new ExportMetaData(etagId, ((ETag) etagObj.get()).uri, "admin", publicOnly, format);
Stream<AdverseEventCvm> mstream = new EtagExportGenerator<AdverseEventCvm>(entityManager, transactionManager, HttpRequestHolder.fromRequest(request)).generateExportFrom(getEntityService().getContext(), etagObj.get()).get();
Stream<AdverseEventCvm> effectivelyFinalStream = this.filterStream(mstream, publicOnly, parameters);
if (fileName != null) {
emd.setDisplayFilename(fileName);
System.out.println("FILE NAME: " + fileName);
}
ExportProcess<AdverseEventCvm> p = this.exportService.createExport(emd, () -> {
return effectivelyFinalStream;
});
p.run(this.taskExecutor, (out) -> {
return (Exporter) Unchecked.uncheck(() -> {
return this.getExporterFor(format, out, publicOnly, parameters);
});
});
return new ResponseEntity(p.getMetaData(), HttpStatus.OK);
}
}
*/
Optional<ETag> etagObj = eTagRepository.findByEtag(etagId);
Expand Down Expand Up @@ -185,6 +157,7 @@ private Exporter<AdverseEventCvm> getExporterFor(String extension, OutputStream
return factory.createNewExporter(pos, params);
}
}
*/

public Optional<AdverseEventCvm> injectSubstanceDetails(Optional<AdverseEventCvm> application) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ protected Stream<AdverseEventDme> filterStream(Stream<AdverseEventDme> stream, b
return stream;
}

/*
@PreAuthorize("isAuthenticated()")
@GetGsrsRestApiMapping("/export/{etagId}/{format}")
public ResponseEntity<Object> createExport(@PathVariable("etagId") String etagId,
Expand All @@ -115,34 +116,6 @@ public ResponseEntity<Object> createExport(@PathVariable("etagId") String etagId
HttpServletRequest request
) throws Exception {
/*
Optional<ETag> etagObj = this.eTagRepository.findByEtag(etagId);
boolean publicOnly = publicOnlyObj == null ? true : publicOnlyObj;
if (!etagObj.isPresent()) {
return new ResponseEntity("could not find etag with Id " + etagId, this.gsrsControllerConfiguration.getHttpStatusFor(HttpStatus.BAD_REQUEST, parameters));
} else {
ExportMetaData emd = new ExportMetaData(etagId, ((ETag) etagObj.get()).uri, "admin", publicOnly, format);
Stream<AdverseEventDme> mstream = new EtagExportGenerator<AdverseEventDme>(entityManager, transactionManager, HttpRequestHolder.fromRequest(request)).generateExportFrom(getEntityService().getContext(), etagObj.get()).get();
Stream<AdverseEventDme> effectivelyFinalStream = this.filterStream(mstream, publicOnly, parameters);
if (fileName != null) {
emd.setDisplayFilename(fileName);
}
ExportProcess<AdverseEventDme> p = this.exportService.createExport(emd, () -> {
return effectivelyFinalStream;
});
p.run(this.taskExecutor, (out) -> {
return (Exporter) Unchecked.uncheck(() -> {
return this.getExporterFor(format, out, publicOnly, parameters);
});
});
return new ResponseEntity(p.getMetaData(), HttpStatus.OK);
}
}
*/
Optional<ETag> etagObj = eTagRepository.findByEtag(etagId);
Expand Down Expand Up @@ -185,6 +158,7 @@ private Exporter<AdverseEventDme> getExporterFor(String extension, OutputStream
return factory.createNewExporter(pos, params);
}
}
*/

public Optional<AdverseEventDme> injectSubstanceDetails(Optional<AdverseEventDme> application) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ protected Stream<AdverseEventPt> filterStream(Stream<AdverseEventPt> stream, boo
return stream;
}

/*
@PreAuthorize("isAuthenticated()")
@GetGsrsRestApiMapping("/export/{etagId}/{format}")
public ResponseEntity<Object> createExport(@PathVariable("etagId") String etagId,
Expand All @@ -114,34 +115,7 @@ public ResponseEntity<Object> createExport(@PathVariable("etagId") String etagId
HttpServletRequest request
) throws Exception {
/*
Optional<ETag> etagObj = this.eTagRepository.findByEtag(etagId);
boolean publicOnly = publicOnlyObj == null ? true : publicOnlyObj;
if (!etagObj.isPresent()) {
return new ResponseEntity("could not find etag with Id " + etagId, this.gsrsControllerConfiguration.getHttpStatusFor(HttpStatus.BAD_REQUEST, parameters));
} else {
ExportMetaData emd = new ExportMetaData(etagId, ((ETag) etagObj.get()).uri, "admin", publicOnly, format);
Stream<AdverseEventPt> mstream = new EtagExportGenerator<AdverseEventPt>(entityManager, transactionManager, HttpRequestHolder.fromRequest(request)).generateExportFrom(getEntityService().getContext(), etagObj.get()).get();
Stream<AdverseEventPt> effectivelyFinalStream = this.filterStream(mstream, publicOnly, parameters);
if (fileName != null) {
emd.setDisplayFilename(fileName);
}
ExportProcess<AdverseEventPt> p = this.exportService.createExport(emd, () -> {
return effectivelyFinalStream;
});
p.run(this.taskExecutor, (out) -> {
return (Exporter) Unchecked.uncheck(() -> {
return this.getExporterFor(format, out, publicOnly, parameters);
});
});
return new ResponseEntity(p.getMetaData(), HttpStatus.OK);
}
*/
Optional<ETag> etagObj = eTagRepository.findByEtag(etagId);
boolean publicOnly = publicOnlyObj==null? true: publicOnlyObj;
Expand Down Expand Up @@ -183,6 +157,7 @@ private Exporter<AdverseEventPt> getExporterFor(String extension, OutputStream p
return factory.createNewExporter(pos, params);
}
}
*/

@GetGsrsRestApiMapping("/faersdashboard/{name}")
public ResponseEntity<String> findFaersDashboardRecordByName(@PathVariable("name") String name) throws Exception {
Expand Down

0 comments on commit a273c60

Please sign in to comment.