Commit 310ae6db authored by javi's avatar javi
Browse files

export srdomain finding

parent 24574a92
Pipeline #22664 passed with stage
in 8 minutes and 4 seconds
......@@ -56,15 +56,15 @@ public class DocumentController {
return "";
}
@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);
@RequestMapping("/documents/{id}/setExportSRDomain/{srDomainId}/{export_srDomain}")
public String setExportFinding(@PathVariable(value="id") Long id, @PathVariable(value="srDomainId") Integer srDomainId, @PathVariable(value="export_srDomain") Boolean export_srDomain) {
documentService.setExportSRDomainFinding(id, srDomainId, export_srDomain);
return "true";
}
@RequestMapping("/documents/{id}/findingValidation/{findingId}/{status}")
public String setFindingValidation(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId, @PathVariable(value="export_finding") String export_finding) {
documentService.setExportFinding(id, findingId, export_finding);
documentService.setFindingValidation(id, findingId, export_finding);
return "true";
}
......
......@@ -28,7 +28,7 @@ public interface DocumentService {
String findFindingsEvidenceByDocumentId(Long id);
Boolean setExportFinding(Long id, Integer findingId, String export_finding);
Boolean setExportSRDomainFinding(Long id, Integer findingId, Boolean export_srdomain);
Boolean setFindingValidation(Long id, Integer findingId,String status);
}
......@@ -145,20 +145,23 @@ public class DocumentServiceImpl implements DocumentService {
}
@Override
public Boolean setExportFinding(Long id, Integer findingId,String export_finding) {
public Boolean setExportSRDomainFinding(Long id, Integer srDomainId,Boolean export_srdomainfinding) {
DocumentAnnotations documentAnnotations = this.findDocumentAnnotationsByDocumentId(id);
Finding findingSelected = null;
SRDomainFinding sRDomainFindingSelected = null;
for (Annotation annotation : documentAnnotations.getRelevantSentences()) {
for (Finding finding : annotation.getFindings()) {
if(finding.getFindingId().equals(findingId)) {
findingSelected = finding;
break;
for (SRDomainFinding srDomainFinding : finding.getSrDomainFindings()) {
if(srDomainFinding.getSrDomainId().equals(srDomainId)) {
sRDomainFindingSelected = srDomainFinding;
break;
}
}
}
}
if(findingSelected!=null) {
if(sRDomainFindingSelected!=null) {
//https://stackoverflow.com/questions/47699646/updating-replacing-a-deeply-nested-object-in-mongodb-with-spring-data-mongodb
findingSelected.setExport(export_finding);
sRDomainFindingSelected.setExport(export_srdomainfinding);
documentAnnotationsRepository.save(documentAnnotations);
return true;
}
......
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