Search in sources :

Example 11 with BatchAck

use of org.jumpmind.symmetric.model.BatchAck in project symmetric-ds by JumpMind.

the class RestService method putAcknowledgeBatch.

@ApiOperation(value = "Acknowledge a set of batches for the specified engine")
@RequestMapping(value = "/engine/{engine}/acknowledgebatch", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public final BatchAckResults putAcknowledgeBatch(@PathVariable("engine") String engineName, @ApiParam(value = "This the password for the nodeId being passed in.  The password is stored in the node_security table.") @RequestParam(value = WebConstants.SECURITY_TOKEN) String securityToken, @RequestBody BatchResults batchResults) {
    BatchAckResults finalResult = new BatchAckResults();
    ISymmetricEngine engine = getSymmetricEngine(engineName);
    List<BatchAckResult> results = null;
    if (batchResults.getBatchResults().size() > 0) {
        if (securityVerified(batchResults.getNodeId(), engine, securityToken)) {
            IAcknowledgeService ackService = engine.getAcknowledgeService();
            List<BatchAck> batchAcks = convertBatchResultsToAck(batchResults);
            results = ackService.ack(batchAcks);
        } else {
            throw new NotAllowedException();
        }
    }
    finalResult.setBatchAckResults(results);
    return finalResult;
}
Also used : BatchAck(org.jumpmind.symmetric.model.BatchAck) BatchAckResults(org.jumpmind.symmetric.web.rest.model.BatchAckResults) BatchAckResult(org.jumpmind.symmetric.model.BatchAckResult) ISymmetricEngine(org.jumpmind.symmetric.ISymmetricEngine) IAcknowledgeService(org.jumpmind.symmetric.service.IAcknowledgeService) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) ApiOperation(com.wordnik.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

BatchAck (org.jumpmind.symmetric.model.BatchAck)11 OutgoingBatch (org.jumpmind.symmetric.model.OutgoingBatch)5 BufferedReader (java.io.BufferedReader)3 IOException (java.io.IOException)3 ProcessInfo (org.jumpmind.symmetric.model.ProcessInfo)3 ProcessInfoKey (org.jumpmind.symmetric.model.ProcessInfoKey)3 ArrayList (java.util.ArrayList)2 IoException (org.jumpmind.exception.IoException)2 ISymmetricEngine (org.jumpmind.symmetric.ISymmetricEngine)2 SymmetricException (org.jumpmind.symmetric.SymmetricException)2 Node (org.jumpmind.symmetric.model.Node)2 IAcknowledgeService (org.jumpmind.symmetric.service.IAcknowledgeService)2 IOutgoingWithResponseTransport (org.jumpmind.symmetric.transport.IOutgoingWithResponseTransport)2 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)1 FileNotFoundException (java.io.FileNotFoundException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 NotImplementedException (org.apache.commons.lang.NotImplementedException)1 FileConflictException (org.jumpmind.symmetric.file.FileConflictException)1 BatchAckResult (org.jumpmind.symmetric.model.BatchAckResult)1