Commit 9f6b693e authored by javi's avatar javi
Browse files

new version of rest-api

parent 8f81a134
......@@ -40,13 +40,45 @@ public class DocumentController {
@RequestMapping("/documents/{id}/finding/{findingId}")
public String findFinding(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId) {
String snippet = documentService.findTextSnippetByDocumentIdAndFindingId(id, findingId);
String snippet = documentService.findFindingEvidenceByDocumentIdAndFindingId(id, findingId);
return snippet;
}
@RequestMapping("/documents/{id}/findings/{findingIds}")
public String findFindings(@PathVariable(value="id") Long id, @PathVariable(value="findingIds") List<Integer> findingIds) {
//String snippet = documentService.findFindingEvidenceByDocumentIdAndFindingId(id, findingId);
//return snippet;
return "";
}
@RequestMapping("/documents/{id}/acceptFinding/{findingId}")
public String acceptFinding(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId) {
documentService.acceptFinding(id, findingId);
return "true";
}
@RequestMapping("/documents/{id}/rejectFinding/{findingId}")
public String rejectFinding(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId) {
documentService.rejectFinding(id, findingId);
return "true";
}
@RequestMapping("/documents/{id}/exportFinding/{findingId}/{export_finding}")
public String setExportFinding(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId, @PathVariable(value="export_finding") String export_finding) {
documentService.setExportFinding(id, findingId, export_finding);
return "true";
}
@RequestMapping("/documents/{id}/sentence/{sentenceId}")
public String findSentence(@PathVariable(value="id") Long id, @PathVariable(value="sentenceId") Integer sentenceId) {
String snippet = documentService.findSentenceById(id, sentenceId);
String snippet = documentService.findSentenceEvidenceByDocumentIdAndSentenceId(id, sentenceId);
return snippet;
}
@RequestMapping("/documents/{id}/evidence/all")
public String findAllEvidence(@PathVariable(value="id") Long id) {
String snippet = documentService.findFindingsEvidenceByDocumentId(id);
return snippet;
}
......@@ -57,17 +89,16 @@ public class DocumentController {
return snippet;
}
@RequestMapping(value = "/export/{id}")
@RequestMapping(value = "/documents/export/{id}")
public ResponseEntity<byte[]> generateReport(@PathVariable("id") long documentId){
String filename = "Study_Report_" + documentId +".txt";
byte[] content = documentService.exportDocumentAnnotation(documentId);
HttpHeaders head = new HttpHeaders();
head.setContentType(MediaType.parseMediaType("text/plain"));
head.add("content-disposition", "attachment; filename=ejemple");
head.setContentDispositionFormData("ejemple", "ejemple");
head.add("content-disposition", "attachment; filename="+filename);
head.setContentDispositionFormData(filename, filename);
head.setCacheControl("must-revalidate, post-check=0, pre-check=0");
return new ResponseEntity<>(content, head,HttpStatus.OK);
return new ResponseEntity<>(content, head,HttpStatus.OK);
}
}
\ No newline at end of file
......@@ -16,6 +16,10 @@ public class Finding {
@Field("id")
private Integer findingId;
private String status="non_curated";
private String export="no";
private Annotation finding_field;
@Field("FINDING")
......@@ -69,6 +73,8 @@ public class Finding {
@Field("RELEVANT_TEXT")
private Annotation relevant_text;
private List<SRDomainFinding> srDomainFindings;
public Finding() {}
......@@ -381,5 +387,52 @@ public class Finding {
}
/**
*
* @return
*/
public List<Annotation> generateSortedAnnotationsAllBorrar() {
List<Annotation> all = new ArrayList<Annotation>();
if(this.getStudy_testcd()!=null) {
all.add(this.getStudy_testcd());
}
if(this.getManifestation_finding()!=null) {
all.add(this.getManifestation_finding());
}
return all;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getExport() {
return export;
}
public void setExport(String export) {
this.export = export;
}
public List<SRDomainFinding> getSrDomainFindings() {
return srDomainFindings;
}
public void setSrDomainFindings(List<SRDomainFinding> srDomainFindings) {
this.srDomainFindings = srDomainFindings;
}
}
package es.bsc.inb.ades.rest.api.model;
/**
* This class describes a finding in SR-Domain format.
* No textual evidence.
* @author javi
*
*/
public class SRDomainFinding implements Cloneable{
private String STUDYID="";
private String DOMAIN="";
private String SRSEQ="";
private String SRRISK="";
private String SPGRPCD="";
private String GRPLBL="";
private String SRGRPDOS="";
private String SRSEX="";
private String SRSTDY="";
private String SRSTPHSE="";
private String SROBSTDY="";
private String SRENDY="";
private String SRENPHSE="";
private String SROBENDY="";
private String SRDOMAIN="";
private String SRSPEC="";
private String SRTSTCD="";
private String SRFNDG="";
private String SRORES="";
private String SROBSV="";
private String SROBSQ="";
private String SRSEV="";
private String SRPCNT="";
private String SRSIGF="";
private String SRTRTEF="";
private String SRCOMNT="";
public String getSTUDYID() {
return STUDYID;
}
public void setSTUDYID(String sTUDYID) {
STUDYID = sTUDYID;
}
public String getDOMAIN() {
return DOMAIN;
}
public void setDOMAIN(String dOMAIN) {
DOMAIN = dOMAIN;
}
public String getSRSEQ() {
return SRSEQ;
}
public void setSRSEQ(String sRSEQ) {
SRSEQ = sRSEQ;
}
public String getSRRISK() {
return SRRISK;
}
public void setSRRISK(String sRRISK) {
SRRISK = sRRISK;
}
public String getSPGRPCD() {
return SPGRPCD;
}
public void setSPGRPCD(String sPGRPCD) {
SPGRPCD = sPGRPCD;
}
public String getGRPLBL() {
return GRPLBL;
}
public void setGRPLBL(String gRPLBL) {
GRPLBL = gRPLBL;
}
public String getSRGRPDOS() {
return SRGRPDOS;
}
public void setSRGRPDOS(String sRGRPDOS) {
SRGRPDOS = sRGRPDOS;
}
public String getSRSEX() {
return SRSEX;
}
public void setSRSEX(String sRSEX) {
SRSEX = sRSEX;
}
public String getSRSTDY() {
return SRSTDY;
}
public void setSRSTDY(String sRSTDY) {
SRSTDY = sRSTDY;
}
public String getSRSTPHSE() {
return SRSTPHSE;
}
public void setSRSTPHSE(String sRSTPHSE) {
SRSTPHSE = sRSTPHSE;
}
public String getSROBSTDY() {
return SROBSTDY;
}
public void setSROBSTDY(String sROBSTDY) {
SROBSTDY = sROBSTDY;
}
public String getSRENDY() {
return SRENDY;
}
public void setSRENDY(String sRENDY) {
SRENDY = sRENDY;
}
public String getSRENPHSE() {
return SRENPHSE;
}
public void setSRENPHSE(String sRENPHSE) {
SRENPHSE = sRENPHSE;
}
public String getSROBENDY() {
return SROBENDY;
}
public void setSROBENDY(String sROBENDY) {
SROBENDY = sROBENDY;
}
public String getSRDOMAIN() {
return SRDOMAIN;
}
public void setSRDOMAIN(String sRDOMAIN) {
SRDOMAIN = sRDOMAIN;
}
public String getSRSPEC() {
return SRSPEC;
}
public void setSRSPEC(String sRSPEC) {
SRSPEC = sRSPEC;
}
public String getSRTSTCD() {
return SRTSTCD;
}
public void setSRTSTCD(String sRTSTCD) {
SRTSTCD = sRTSTCD;
}
public String getSRFNDG() {
return SRFNDG;
}
public void setSRFNDG(String sRFNDG) {
SRFNDG = sRFNDG;
}
public String getSRORES() {
return SRORES;
}
public void setSRORES(String sRORES) {
SRORES = sRORES;
}
public String getSROBSV() {
return SROBSV;
}
public void setSROBSV(String sROBSV) {
SROBSV = sROBSV;
}
public String getSROBSQ() {
return SROBSQ;
}
public void setSROBSQ(String sROBSQ) {
SROBSQ = sROBSQ;
}
public String getSRSEV() {
return SRSEV;
}
public void setSRSEV(String sRSEV) {
SRSEV = sRSEV;
}
public String getSRPCNT() {
return SRPCNT;
}
public void setSRPCNT(String sRPCNT) {
SRPCNT = sRPCNT;
}
public String getSRSIGF() {
return SRSIGF;
}
public void setSRSIGF(String sRSIGF) {
SRSIGF = sRSIGF;
}
public String getSRTRTEF() {
return SRTRTEF;
}
public void setSRTRTEF(String sRTRTEF) {
SRTRTEF = sRTRTEF;
}
public String getSRCOMNT() {
return SRCOMNT;
}
public void setSRCOMNT(String sRCOMNT) {
SRCOMNT = sRCOMNT;
}
public SRDomainFinding clone() {
try {
return (SRDomainFinding)super.clone();
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
......@@ -14,13 +14,21 @@ public interface DocumentService {
Document findByDocumentId2(Long id);
String findTextSnippetByDocumentIdAndFindingId(Long id, Integer findingId);
String findTextSnippetByDocumentIdAndFindingId2(Long id, Integer findingId);
String findFindingEvidenceByDocumentIdAndFindingId(Long id, Integer findingId);
DocumentAnnotations findByDocumentAnnotationsByDocumentId(Long id);
String findSentenceById(Long id, Integer sentenceId);
String findSentenceEvidenceByDocumentIdAndSentenceId(Long id, Integer sentenceId);
byte[] exportDocumentAnnotation(Long documentId);
String findFindingsEvidenceByDocumentId(Long id);
Boolean acceptFinding(Long id, Integer findingId);
Boolean rejectFinding(Long id, Integer findingId);
Boolean setExportFinding(Long id, Integer findingId, String export_finding);
}
package es.bsc.inb.ades.rest.api.util;
public class Constants {
public static int SLICE_START = 1000;
public static int SLICE_END = 2000;
public static int POINTS_INT = 5;
public static String POINTS = ".....";
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment