Commit 106b7e59 authored by Javi Corvi's avatar Javi Corvi
Browse files

rest api development

parent 4fdaa188
package es.bsc.inb.ades.rest.api.controllers;
import java.security.Principal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -8,28 +7,23 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.services.DocumentService;
@RestController
@CrossOrigin
@CrossOrigin()
public class DocumentController {
@Autowired
public DocumentService documentService;
@RequestMapping("/api/v1/basicauth")
public String validateLogin(Model model, Principal principal) {
return "login correct";
}
@RequestMapping("/documents/")
public List<Document> findAll() {
return documentService.findAll();
......
......@@ -200,6 +200,7 @@ public class SRDomainFinding implements Cloneable{
public Boolean getExport() {
if(export==null)return true;
return export;
}
public void setExport(Boolean export) {
......
......@@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
//Controller
@CrossOrigin(origins={ "http://localhost:3000", "http://localhost:4200", "http://localhost:8081" })
@CrossOrigin()
@RestController
public class BasicAuthenticationController {
......
......@@ -11,7 +11,8 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().
http.cors().and().csrf().disable().
//http.csrf().disable().
authorizeRequests().antMatchers(HttpMethod.OPTIONS, "/**").permitAll().anyRequest().authenticated()
.and().httpBasic();
......
......@@ -256,77 +256,80 @@ public class DocumentServiceImpl implements DocumentService {
for (Finding finding : relevantSentences.getFindings()) {
if(finding.getSrDomainFindings()!=null) {
for (SRDomainFinding srDomainFinding : finding.getSrDomainFindings()) {
//STUDYID -- > Study Identifier
retStr.append(id);
retStr.append("|");
//DOMAIN -- > Domain Abbreviation, always SR
retStr.append("SR");
retStr.append("|");
//SRSEQ -- > Sequence number
retStr.append("");
retStr.append("|");
//SRRISK --> Effect Level Associated with a Group/Sex, NOEL, LOEL, NOAEL, LOAEL, HNSTD, STD, MTD
retStr.append(srDomainFinding.getSRRISK()==null?"":srDomainFinding.getSRRISK());
retStr.append("|");
//SPGRPCD --> Sponsor-defined Group Code, group 1 , A
retStr.append(srDomainFinding.getSPGRPCD()==null?"":srDomainFinding.getSPGRPCD());
retStr.append("|");
//GRPLBL --> Sponsor-defined Group Name, "low dose", "mid dose"
retStr.append(srDomainFinding.getGRPLBL()==null?"":srDomainFinding.getGRPLBL());
retStr.append("|");
//SRGRPDOS --> Group Dose Level, "20 mg/kg"
retStr.append(srDomainFinding.getSRGRPDOS()==null?"":srDomainFinding.getSRGRPDOS());
retStr.append("|");
//SRSEX -- > Sex
retStr.append(srDomainFinding.getSRSEX()==null?"":srDomainFinding.getSRSEX());
retStr.append("|");
//SRSTDY --> Study Day of Start of Finding
retStr.append("");
retStr.append("|");
//SRSTPHSE --> Study Phase of first Observation, “PRE-DOSING”, “DOSING”, “RECOVERY”
retStr.append("");
retStr.append("|");
//SROBSTDY --> Start Phase Day of Observation
retStr.append("");
retStr.append("|");
//SRENPHSE -->Study Phase of last Observation
retStr.append("");
retStr.append("|");
//SRDOMAIN --> Domain of Finding
retStr.append(srDomainFinding.getSRDOMAIN()==null?"":srDomainFinding.getSRDOMAIN());
retStr.append("|");
//SRSPEC --> Specimen of Finding
retStr.append(srDomainFinding.getSRSPEC()==null?"":srDomainFinding.getSRSPEC());
retStr.append("|");
//SRTSTCD --> Test Short Name
retStr.append(srDomainFinding.getSRTSTCD()==null?"":srDomainFinding.getSRTSTCD());
retStr.append("|");
//SRFNDG --> Finding
retStr.append(srDomainFinding.getSRFNDG()==null?"":srDomainFinding.getSRFNDG());
retStr.append("|");
//SRORES --> Observation (original result)
retStr.append(srDomainFinding.getSRORES()==null?"":srDomainFinding.getSRORES());
retStr.append("|");
//SROBSV --> Manifestation of Finding, “I” (Increase), “D” (Decrease), “P” (Present) or “A” (Absent)
retStr.append(srDomainFinding.getSROBSV()==null?"":srDomainFinding.getSROBSV());
retStr.append("|");
//SROBSQ --> Observation Qualifier, “R” (Reversible), “T” (Transient) or ‘none’
retStr.append(srDomainFinding.getSROBSQ()==null?"":srDomainFinding.getSROBSQ());
retStr.append("|");
//SRSEV --> Severity of Finding
retStr.append("");
retStr.append("|");
//SRPCNT --> Scale of this Finding
retStr.append("");
retStr.append("|");
//SRSIGF --> Statistical Significance
retStr.append(srDomainFinding.getSRSIGF()==null?"":srDomainFinding.getSRSIGF());
retStr.append("|");
//SRTRTEF --> Treatment-Related
retStr.append(srDomainFinding.getSRTRTEF()==null?"":srDomainFinding.getSRTRTEF());
retStr.append("|");
//SRCOMNT --> Comment
retStr.append("\n");
if(srDomainFinding.getExport()) {
//STUDYID -- > Study Identifier
retStr.append(id);
retStr.append("|");
//DOMAIN -- > Domain Abbreviation, always SR
retStr.append("SR");
retStr.append("|");
//SRSEQ -- > Sequence number
retStr.append(srDomainFinding.getSRSEQ());
retStr.append("|");
//SRRISK --> Effect Level Associated with a Group/Sex, NOEL, LOEL, NOAEL, LOAEL, HNSTD, STD, MTD
retStr.append(srDomainFinding.getSRRISK()==null?"":srDomainFinding.getSRRISK());
retStr.append("|");
//SPGRPCD --> Sponsor-defined Group Code, group 1 , A
retStr.append(srDomainFinding.getSPGRPCD()==null?"":srDomainFinding.getSPGRPCD());
retStr.append("|");
//GRPLBL --> Sponsor-defined Group Name, "low dose", "mid dose"
retStr.append(srDomainFinding.getGRPLBL()==null?"":srDomainFinding.getGRPLBL());
retStr.append("|");
//SRGRPDOS --> Group Dose Level, "20 mg/kg"
retStr.append(srDomainFinding.getSRGRPDOS()==null?"":srDomainFinding.getSRGRPDOS());
retStr.append("|");
//SRSEX -- > Sex
retStr.append(srDomainFinding.getSRSEX()==null?"":srDomainFinding.getSRSEX());
retStr.append("|");
//SRSTDY --> Study Day of Start of Finding
retStr.append("");
retStr.append("|");
//SRSTPHSE --> Study Phase of first Observation, “PRE-DOSING”, “DOSING”, “RECOVERY”
retStr.append("");
retStr.append("|");
//SROBSTDY --> Start Phase Day of Observation
retStr.append("");
retStr.append("|");
//SRENPHSE -->Study Phase of last Observation
retStr.append("");
retStr.append("|");
//SRDOMAIN --> Domain of Finding
retStr.append(srDomainFinding.getSRDOMAIN()==null?"":srDomainFinding.getSRDOMAIN());
retStr.append("|");
//SRSPEC --> Specimen of Finding
retStr.append(srDomainFinding.getSRSPEC()==null?"":srDomainFinding.getSRSPEC());
retStr.append("|");
//SRTSTCD --> Test Short Name
retStr.append(srDomainFinding.getSRTSTCD()==null?"":srDomainFinding.getSRTSTCD());
retStr.append("|");
//SRFNDG --> Finding
retStr.append(srDomainFinding.getSRFNDG()==null?"":srDomainFinding.getSRFNDG());
retStr.append("|");
//SRORES --> Observation (original result)
retStr.append(srDomainFinding.getSRORES()==null?"":srDomainFinding.getSRORES());
retStr.append("|");
//SROBSV --> Manifestation of Finding, “I” (Increase), “D” (Decrease), “P” (Present) or “A” (Absent)
retStr.append(srDomainFinding.getSROBSV()==null?"":srDomainFinding.getSROBSV());
retStr.append("|");
//SROBSQ --> Observation Qualifier, “R” (Reversible), “T” (Transient) or ‘none’
retStr.append(srDomainFinding.getSROBSQ()==null?"":srDomainFinding.getSROBSQ());
retStr.append("|");
//SRSEV --> Severity of Finding
retStr.append("");
retStr.append("|");
//SRPCNT --> Scale of this Finding
retStr.append("");
retStr.append("|");
//SRSIGF --> Statistical Significance
retStr.append(srDomainFinding.getSRSIGF()==null?"":srDomainFinding.getSRSIGF());
retStr.append("|");
//SRTRTEF --> Treatment-Related
retStr.append(srDomainFinding.getSRTRTEF()==null?"":srDomainFinding.getSRTRTEF());
retStr.append("|");
//SRCOMNT --> Comment
retStr.append("\n");
}
}
}
}
......
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