Commit b829daf6 authored by Javi Corvi's avatar Javi Corvi
Browse files

new draft version of api with modifications

parent a0180df0
Pipeline #25731 passed with stage
in 4 minutes and 20 seconds
......@@ -8,7 +8,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -17,8 +16,6 @@ import es.bsc.inb.ades.rest.api.model.Document;
import es.bsc.inb.ades.rest.api.model.DocumentAnnotations;
import es.bsc.inb.ades.rest.api.model.DocumentTracking;
import es.bsc.inb.ades.rest.api.model.Status;
import es.bsc.inb.ades.rest.api.model.Tracking;
import es.bsc.inb.ades.rest.api.security.basic.inmemory.AuthenticationBean;
import es.bsc.inb.ades.rest.api.services.DocumentService;
......@@ -97,13 +94,24 @@ public class DocumentController {
return snippet;
}
@RequestMapping("/documents/{id}/evidence/sentences")
public String findSentencesEvidence(@PathVariable(value="id") Long id) {
String snippet = documentService.findSentencesEvidenceByDocumentId(id);
return snippet;
}
@RequestMapping("/documents/{id}/finding2/{findingId}")
public String findFinding2(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId) {
String snippet = documentService.findTextSnippetByDocumentIdAndFindingId2(id, findingId);
@RequestMapping("/documents/{id}/text")
public String findDocumentText(@PathVariable(value="id") Long id) {
String snippet = documentService.findTextByDocumentId(id);
return snippet;
}
// @RequestMapping("/documents/{id}/finding2/{findingId}")
// public String findFinding2(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId) {
// String snippet = documentService.findTextSnippetByDocumentIdAndFindingId2(id, findingId);
// return snippet;
// }
@RequestMapping(value = "/documents/export/{id}")
public ResponseEntity<byte[]> generateReport(@PathVariable("id") long documentId){
String filename = "Study_Report_" + documentId +".txt";
......
......@@ -23,17 +23,54 @@ public class SRDomainFinding implements Cloneable{
private String SRENPHSE="";
private String SROBENDY="";
private String SRDOMAIN="";
private String SRDOMAIN_DESC="";
private String SRSPEC="";
private String SRSPEC_DESC="";
private String SRTSTCD="";
private String SRTSTCD_DESC="";
private String SRFNDG="";
private String SRFNDG_DESC="";
private String SRORES="";
private String SROBSV="";
private String SROBSV_DESC="";
private String SROBSQ="";
private String SRSEV="";
private String SRPCNT="";
private String SRSIGF="";
private String SRTRTEF="";
private String SRCOMNT="";
public String getSrdomain_value() {
return SRDOMAIN_DESC + "(" + SRDOMAIN + ")";
}
public String getSrfndg_value() {
if(SRFNDG ==null || SRFNDG.equals("")) {
return SRORES;
}
return SRFNDG_DESC + "(" + SRFNDG + ")";
}
public String getSrtstcd_value() {
if(SRTSTCD ==null || SRTSTCD.equals("")) {
return SRTSTCD_DESC;
}
return SRTSTCD_DESC + "(" + SRTSTCD + ")";
}
public String getSrobsv_value() {
if(SROBSV ==null || SROBSV.equals("")) {
return SROBSV_DESC;
}
return SROBSV_DESC + "(" + SROBSV + ")";
}
public String getSrspec_value() {
if(SRSPEC ==null || SRSPEC.equals("")) {
return SRSPEC_DESC;
}
return SRSPEC_DESC + "(" + SRSPEC + ")";
}
private Boolean export;
private Integer findingId;
......@@ -156,9 +193,9 @@ public class SRDomainFinding implements Cloneable{
public String getSROBSV() {
return SROBSV;
}
public void setSROBSV(String sROBSV) {
SROBSV = sROBSV;
}
public String getSROBSQ() {
return SROBSQ;
}
......@@ -195,10 +232,41 @@ public class SRDomainFinding implements Cloneable{
public void setSRCOMNT(String sRCOMNT) {
SRCOMNT = sRCOMNT;
}
public void setSRDOMAIN_DESC(String sRDOMAIN_DESC) {
SRDOMAIN_DESC = sRDOMAIN_DESC;
}
public void setSROBSV(String sROBSV) {
SROBSV = sROBSV;
}
public String getSRDOMAIN_DESC() {
return SRDOMAIN_DESC;
}
public String getSRSPEC_DESC() {
return SRSPEC_DESC;
}
public void setSRSPEC_DESC(String sRSPEC_DESC) {
SRSPEC_DESC = sRSPEC_DESC;
}
public String getSRTSTCD_DESC() {
return SRTSTCD_DESC;
}
public void setSRTSTCD_DESC(String sRTSTCD_DESC) {
SRTSTCD_DESC = sRTSTCD_DESC;
}
public String getSRFNDG_DESC() {
return SRFNDG_DESC;
}
public void setSRFNDG_DESC(String sRFNDG_DESC) {
SRFNDG_DESC = sRFNDG_DESC;
}
public String getSROBSV_DESC() {
return SROBSV_DESC;
}
public void setSROBSV_DESC(String sROBSV_DESC) {
SROBSV_DESC = sROBSV_DESC;
}
public Boolean getExport() {
if(export==null)return true;
return export;
......
......@@ -6,7 +6,6 @@ import es.bsc.inb.ades.rest.api.model.Document;
import es.bsc.inb.ades.rest.api.model.DocumentAnnotations;
import es.bsc.inb.ades.rest.api.model.DocumentTracking;
import es.bsc.inb.ades.rest.api.model.Status;
import es.bsc.inb.ades.rest.api.model.Tracking;
public interface DocumentService {
......@@ -17,7 +16,7 @@ public interface DocumentService {
Document findByDocumentId2(Long id);
String findTextSnippetByDocumentIdAndFindingId2(Long id, Integer findingId);
//String findTextSnippetByDocumentIdAndFindingId2(Long id, Integer findingId);
String findFindingEvidenceByDocumentIdAndFindingId(Long id, Integer findingId);
......@@ -30,7 +29,11 @@ public interface DocumentService {
byte[] exportDocumentAnnotation(Long documentId);
String findFindingsEvidenceByDocumentId(Long id);
String findSentencesEvidenceByDocumentId(Long id);
String findTextByDocumentId(Long id);
Boolean setExportSRDomainFinding(Long id, Integer findingId, Boolean export_srdomain);
Boolean setFindingValidation(Long id, Integer findingId,String status);
......
Supports Markdown
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