Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
1 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
/**
*
*/
package gov.va.med.ars.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import gov.va.med.ars.exceptions.GenericException;
import gov.va.med.ars.model.request.JsonArrayModel;
import gov.va.med.ars.service.IArchiveService;
import net.minidev.json.JSONObject;
/**
* @author
DNS
*
*/
@RestController
@RequestMapping("/api/v1/archive")
public class ArchiveRestController {
@Autowired
IArchiveService archiveService;
@PostMapping
public ResponseEntity<?> getAttachmentsArchived(@RequestBody JsonArrayModel archiveAttachments) throws GenericException {
JSONObject response = null;
boolean archived = archiveService.archiveAttachments(archiveAttachments);
if (archived) {
response = new JSONObject();
response.put("response", archived);
return new ResponseEntity<>(response, HttpStatus.OK);
} else {
response = new JSONObject();
response.put("errorCode", "Invalid Request");
response.put("message", "Please archive valid Attachment Id's.");
return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST);
}
}
@InitBinder()
public void customizeBinding (WebDataBinder binder) {
binder.setDisallowedFields(new String[]{});
}
}