diff --git a/src/main/java/org/mifos/processor/bulk/api/definition/BulkTransfer.java b/src/main/java/org/mifos/processor/bulk/api/definition/BulkTransfer.java deleted file mode 100644 index d081c28d..00000000 --- a/src/main/java/org/mifos/processor/bulk/api/definition/BulkTransfer.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.mifos.processor.bulk.api.definition; - -import static org.mifos.processor.bulk.zeebe.ZeebeVariables.FILE_NAME; -import static org.mifos.processor.bulk.zeebe.ZeebeVariables.PURPOSE; - -import java.io.IOException; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.multipart.MultipartFile; - -public interface BulkTransfer { - - @Deprecated - - @PostMapping(value = "/bulk/transfer/{requestId}/{fileName}", produces = "application/json") - String bulkTransfer(@RequestHeader(value = "X-CorrelationID", required = false) String requestId, - @RequestParam("data") MultipartFile file, @RequestHeader(value = FILE_NAME, required = false) String fileName, - @RequestHeader(value = PURPOSE, required = false) String purpose, @RequestHeader(value = "Type", required = false) String type, - @RequestHeader(value = "Platform-TenantId") String tenant) throws IOException; -} diff --git a/src/main/java/org/mifos/processor/bulk/api/implementation/BulkTransferController.java b/src/main/java/org/mifos/processor/bulk/api/implementation/BulkTransferController.java deleted file mode 100644 index f0ef69fe..00000000 --- a/src/main/java/org/mifos/processor/bulk/api/implementation/BulkTransferController.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.mifos.processor.bulk.api.implementation; - -import static org.mifos.processor.bulk.camel.config.CamelProperties.HEADER_PLATFORM_TENANT_ID; -import static org.mifos.processor.bulk.zeebe.ZeebeVariables.FILE_NAME; -import static org.mifos.processor.bulk.zeebe.ZeebeVariables.HEADER_CLIENT_CORRELATION_ID; -import static org.mifos.processor.bulk.zeebe.ZeebeVariables.HEADER_TYPE; -import static org.mifos.processor.bulk.zeebe.ZeebeVariables.PURPOSE; - -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import org.apache.camel.Exchange; -import org.apache.camel.ProducerTemplate; -import org.mifos.processor.bulk.api.definition.BulkTransfer; -import org.mifos.processor.bulk.file.FileStorageService; -import org.mifos.processor.bulk.utility.Headers; -import org.mifos.processor.bulk.utility.SpringWrapperUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; - -@RestController -public class BulkTransferController implements BulkTransfer { - - @Autowired - private ProducerTemplate producerTemplate; - - @Autowired - ObjectMapper objectMapper; - - @Autowired - FileStorageService fileStorageService; - - @Override - public String bulkTransfer(String requestId, MultipartFile file, String fileName, String purpose, String type, String tenant) - throws IOException { - Headers headers = new Headers.HeaderBuilder().addHeader(HEADER_CLIENT_CORRELATION_ID, requestId).addHeader(PURPOSE, purpose) - .addHeader(FILE_NAME, fileName).addHeader(HEADER_TYPE, type).addHeader(HEADER_PLATFORM_TENANT_ID, tenant).build(); - Exchange exchange = SpringWrapperUtil.getDefaultWrappedExchange(producerTemplate.getCamelContext(), headers); - fileStorageService.save(file); - producerTemplate.send("direct:post-bulk-transfer", exchange); - return exchange.getIn().getBody(String.class); - } -} diff --git a/src/main/java/org/mifos/processor/bulk/camel/routes/ProcessorStartRoute.java b/src/main/java/org/mifos/processor/bulk/camel/routes/ProcessorStartRoute.java index 8b7e4554..e94d92d2 100644 --- a/src/main/java/org/mifos/processor/bulk/camel/routes/ProcessorStartRoute.java +++ b/src/main/java/org/mifos/processor/bulk/camel/routes/ProcessorStartRoute.java @@ -149,19 +149,6 @@ private void setup() { }).to("direct:validateFileSyncResponse").choice().when(header("CamelHttpResponseCode").isNotEqualTo("200")) .log(LoggingLevel.ERROR, "File upload failed").otherwise().to("direct:executeBatch").endChoice().endChoice(); - from("direct:post-bulk-transfer").unmarshal().mimeMultipart("multipart/*").to("direct:validate-tenant").process(exchange -> { - String fileName = System.currentTimeMillis() + "_" + exchange.getIn().getHeader("fileName", String.class); - String requestId = exchange.getIn().getHeader("requestId", String.class); - String purpose = exchange.getIn().getHeader("purpose", String.class); - String batchId = UUID.randomUUID().toString(); - String callbackUrl = exchange.getIn().getHeader("X-CallbackURL", String.class); - exchange.setProperty(CALLBACK, callbackUrl); - exchange.setProperty(BATCH_ID, batchId); - exchange.setProperty(FILE_NAME, fileName); - exchange.setProperty(REQUEST_ID, requestId); - exchange.setProperty(PURPOSE, purpose); - }).wireTap("direct:start-batch-process-csv"); - from("direct:validate-tenant").id("direct:validate-tenant").log("Validating tenant").process(exchange -> { String tenantName = exchange.getIn().getHeader(HEADER_PLATFORM_TENANT_ID, String.class); // validation is disabled for now