aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2019-02-01 15:05:15 +0100
committerromaingimbert <romain.gimbert@orange.com>2019-02-01 15:05:15 +0100
commit7093b767e7d9a76c4f91ec98e95a9b1ea8a5e14d (patch)
treebf5d63b7d170504e490ca415345543d855dcbf62 /src/main/java/org
parent2afa1a1b9b020c0ada15581658268e98b7219a64 (diff)
Update to Spring Boot 2
-update pom dependencies -fix code -fix test Change-Id: I23c3c702c598ce46e5b861a2fbdfd06f2d439c51 Issue-ID: EXTAPI-192 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/nbi/ServiceRegisterRunner.java2
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/HubResource.java8
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java11
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java68
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java48
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java52
6 files changed, 102 insertions, 87 deletions
diff --git a/src/main/java/org/onap/nbi/ServiceRegisterRunner.java b/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
index 90ea9ac..05072c1 100644
--- a/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
+++ b/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
@@ -63,7 +63,7 @@ public class ServiceRegisterRunner implements CommandLineRunner {
@Value("${nbi.version}")
private String SERVICE_VERSION;
- @Value("${server.contextPath}")
+ @Value("${server.servlet.context-path}")
private String SERVICE_URL;
@Value("${msb.service.custom_path}")
diff --git a/src/main/java/org/onap/nbi/apis/hub/HubResource.java b/src/main/java/org/onap/nbi/apis/hub/HubResource.java
index 6383265..0f94802 100755
--- a/src/main/java/org/onap/nbi/apis/hub/HubResource.java
+++ b/src/main/java/org/onap/nbi/apis/hub/HubResource.java
@@ -14,6 +14,7 @@ package org.onap.nbi.apis.hub;
import java.net.URI;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
import org.onap.nbi.apis.hub.model.Subscriber;
import org.onap.nbi.apis.hub.model.Subscription;
@@ -72,11 +73,12 @@ public class HubResource extends ResourceManagement {
@GetMapping(value = "/{subscriptionId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Subscription> getSubscription(@PathVariable String subscriptionId) {
- Subscriber subscriber = subscriptionService.findSubscriptionById(subscriptionId);
- if (subscriber == null) {
+
+ Optional<Subscriber> optionalSubscriber = subscriptionService.findSubscriptionById(subscriptionId);
+ if (!optionalSubscriber.isPresent()) {
return ResponseEntity.notFound().build();
}
- return ResponseEntity.ok(Subscription.createFromSubscriber(subscriber));
+ return ResponseEntity.ok(Subscription.createFromSubscriber(optionalSubscriber.get()));
}
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java b/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java
index 550c185..3507d63 100644
--- a/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java
@@ -15,6 +15,7 @@ package org.onap.nbi.apis.hub.service;
import com.google.common.collect.Lists;
import java.text.MessageFormat;
import java.util.List;
+import java.util.Optional;
import org.onap.nbi.apis.hub.model.Subscriber;
import org.onap.nbi.apis.hub.model.Subscription;
import org.onap.nbi.apis.hub.repository.SubscriberRepository;
@@ -30,8 +31,8 @@ public class SubscriptionService {
@Autowired
SubscriberRepository subscriberRepository;
- public Subscriber findSubscriptionById(String subscriptionId) {
- return subscriberRepository.findOne(subscriptionId);
+ public Optional<Subscriber> findSubscriptionById(String subscriptionId) {
+ return subscriberRepository.findById(subscriptionId);
}
public Subscriber createSubscription(Subscription subscription) {
@@ -51,12 +52,12 @@ public class SubscriptionService {
private boolean isSubscriberAlreadyExisting(Subscriber subscriber) {
Example<Subscriber> subscriberExample = Example.of(subscriber);
- Subscriber subscriberAlreadyExisting = subscriberRepository.findOne(subscriberExample);
- return subscriberAlreadyExisting != null;
+ Optional<Subscriber> subscriberAlreadyExisting = subscriberRepository.findOne(subscriberExample);
+ return subscriberAlreadyExisting.isPresent();
}
public void deleteSubscription(String subscriptionId) {
- subscriberRepository.delete(subscriptionId);
+ subscriberRepository.deleteById(subscriptionId);
}
public void deleteAll() {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
index 2cd1c9a..e34a3e7 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
@@ -1,20 +1,20 @@
/**
- * Copyright (c) 2018 Orange
+ * Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
*/
package org.onap.nbi.apis.serviceorder;
+import java.util.List;
+import java.util.Optional;
+import javax.validation.Valid;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.StateType;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
@@ -35,10 +35,15 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.validation.Errors;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import java.util.List;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/serviceOrder")
@@ -66,19 +71,17 @@ public class ServiceOrderResource extends ResourceManagement {
MultiCriteriaRequestBuilder multiCriteriaRequestBuilder;
-
-
@GetMapping(value = "/{serviceOrderId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getServiceOrder(@PathVariable String serviceOrderId,
- @RequestParam MultiValueMap<String, String> params) {
+ @RequestParam MultiValueMap<String, String> params) {
- ServiceOrder serviceOrder = serviceOrderService.findServiceOrderById(serviceOrderId);
- if (serviceOrder == null) {
+ Optional<ServiceOrder> optionalServiceOrder = serviceOrderService.findServiceOrderById(serviceOrderId);
+ if (!optionalServiceOrder.isPresent()) {
return ResponseEntity.notFound().build();
}
JsonRepresentation filter = new JsonRepresentation(params);
- return this.getResponse(serviceOrder, filter);
+ return this.getResponse(optionalServiceOrder.get(), filter);
}
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -107,26 +110,29 @@ public class ServiceOrderResource extends ResourceManagement {
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> createServiceOrder(@Valid @RequestBody ServiceOrder serviceOrder, Errors errors,
- @RequestParam MultiValueMap<String, String> params) {
-
+ @RequestParam MultiValueMap<String, String> params) {
if (errors != null && errors.hasErrors()) {
throw new ValidationException(errors.getAllErrors());
}
- ServiceOrder serviceOrderSaved =serviceOrderService.createServiceOrder(serviceOrder);
+ ServiceOrder serviceOrderSaved = serviceOrderService.createServiceOrder(serviceOrder);
JsonRepresentation filter = new JsonRepresentation(params);
return this.createResponse(serviceOrderSaved, filter);
}
- @PutMapping(value = "/test/{serviceOrderId}",consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> checkServiceOrderRessource(@PathVariable String serviceOrderId,@RequestParam MultiValueMap<String, String> params){
- ServiceOrder serviceOrder = serviceOrderService.findServiceOrderById(serviceOrderId);
- serviceOrder = checkServiceOrder(serviceOrder);
+ @PutMapping(value = "/test/{serviceOrderId}", consumes = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> checkServiceOrderRessource(@PathVariable String serviceOrderId,
+ @RequestParam MultiValueMap<String, String> params) {
+ Optional<ServiceOrder> optionalServiceOrder = serviceOrderService.findServiceOrderById(serviceOrderId);
+ if (!optionalServiceOrder.isPresent()) {
+ return ResponseEntity.notFound().build();
+ }
+ ServiceOrder serviceOrder = checkServiceOrder(optionalServiceOrder.get());
JsonRepresentation filter = new JsonRepresentation(params);
- return this.createResponse(serviceOrder,filter);
+ return this.createResponse(serviceOrder, filter);
}
@@ -137,10 +143,10 @@ public class ServiceOrderResource extends ResourceManagement {
} else if (serviceOrderInfo.isAllItemsCompleted()) {
serviceOrderService.updateOrderState(serviceOrder, StateType.COMPLETED);
} else {
- createAAICustomer.createAAICustomer(serviceOrder,serviceOrderInfo);
- if(StateType.ACKNOWLEDGED==serviceOrder.getState()) {
+ createAAICustomer.createAAICustomer(serviceOrder, serviceOrderInfo);
+ if (StateType.ACKNOWLEDGED == serviceOrder.getState()) {
createAAIServiceType.createAAIServiceType(serviceOrder, serviceOrderInfo);
- if(StateType.ACKNOWLEDGED==serviceOrder.getState()) {
+ if (StateType.ACKNOWLEDGED == serviceOrder.getState()) {
serviceOrchestratorManager.registerServiceOrder(serviceOrder, serviceOrderInfo);
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java b/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
index b851be8..2b0f22c 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
@@ -1,20 +1,20 @@
/**
- * Copyright (c) 2018 Orange
+ * Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
*/
package org.onap.nbi.apis.serviceorder.service;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
import org.onap.nbi.apis.serviceorder.model.OrderMessage;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
@@ -24,9 +24,6 @@ import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Date;
-import java.util.List;
-
@Service
public class ServiceOrderService {
@@ -35,28 +32,28 @@ public class ServiceOrderService {
private static final String SERVICE_ID = "service.id";
- public ServiceOrder findServiceOrderById(String serviceOrderId){
- return serviceOrderRepository.findOne(serviceOrderId);
+ public Optional<ServiceOrder> findServiceOrderById(String serviceOrderId) {
+ return serviceOrderRepository.findById(serviceOrderId);
}
- public List<ServiceOrder> findServiceOrdersByState(StateType state){
+ public List<ServiceOrder> findServiceOrdersByState(StateType state) {
return serviceOrderRepository.findByState(state);
}
- public ServiceOrder updateOrderState(ServiceOrder serviceOrder,StateType state){
- if(StateType.COMPLETED.equals(state) || StateType.REJECTED.equals(state)) {
+ public ServiceOrder updateOrderState(ServiceOrder serviceOrder, StateType state) {
+ if (StateType.COMPLETED.equals(state) || StateType.REJECTED.equals(state)) {
serviceOrder.setCompletionDateTime(new Date());
}
serviceOrder.setState(state);
return serviceOrderRepository.save(serviceOrder);
}
- public void updateOrderItemState(ServiceOrder serviceOrder,ServiceOrderItem serviceOrderItem, StateType state){
+ public void updateOrderItemState(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem, StateType state) {
serviceOrderItem.setState(state);
serviceOrderRepository.save(serviceOrder);
}
- public ServiceOrder createServiceOrder(ServiceOrder serviceOrder){
+ public ServiceOrder createServiceOrder(ServiceOrder serviceOrder) {
serviceOrder.setState(StateType.ACKNOWLEDGED);
serviceOrder.setOrderDate(new Date());
serviceOrder.setId(null);
@@ -68,11 +65,11 @@ public class ServiceOrderService {
return serviceOrderRepository.save(serviceOrder);
}
- public void deleteServiceOrder(String serviceOrderId){
- serviceOrderRepository.delete(serviceOrderId);
+ public void deleteServiceOrder(String serviceOrderId) {
+ serviceOrderRepository.deleteById(serviceOrderId);
}
- public long countServiceOrder(){
+ public long countServiceOrder() {
return serviceOrderRepository.count();
}
@@ -107,7 +104,7 @@ public class ServiceOrderService {
serviceOrderRepository.save(serviceOrder);
}
- public void addOrderItemMessage(ServiceOrder serviceOrder,ServiceOrderItem serviceOrderItem, String code) {
+ public void addOrderItemMessage(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem, String code) {
OrderMessage orderMessage = new OrderMessage();
orderMessage.setCode(code);
orderMessage.setSeverity(SeverityMessage.ERROR);
@@ -148,7 +145,8 @@ public class ServiceOrderService {
}
- public void addOrderItemMessageRequestSo(ServiceOrder serviceOrder,ServiceOrderItem serviceOrderItem, String message) {
+ public void addOrderItemMessageRequestSo(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem,
+ String message) {
OrderMessage orderMessage = new OrderMessage();
orderMessage.setCode("105");
orderMessage.setSeverity(SeverityMessage.ERROR);
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
index b153ff1..67f3a86 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
+import java.util.Optional;
import org.onap.nbi.apis.serviceorder.model.ActionType;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
@@ -70,7 +71,13 @@ public class SOTaskProcessor {
ServiceOrderInfo serviceOrderInfo = getServiceOrderInfo(executionTask);
- ServiceOrder serviceOrder = serviceOrderService.findServiceOrderById(serviceOrderInfo.getServiceOrderId());
+ Optional<ServiceOrder> optionalServiceOrder = serviceOrderService
+ .findServiceOrderById(serviceOrderInfo.getServiceOrderId());
+ if (!optionalServiceOrder.isPresent()) {
+ throw new TechnicalException(
+ "Unable to retrieve service order for id " + serviceOrderInfo.getServiceOrderId());
+ }
+ ServiceOrder serviceOrder = optionalServiceOrder.get();
ServiceOrderItem serviceOrderItem = getServiceOrderItem(executionTask, serviceOrder);
boolean e2eService = E2EServiceUtils
.isE2EService(serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()));
@@ -84,14 +91,14 @@ public class SOTaskProcessor {
} else {
ResponseEntity<CreateServiceInstanceResponse> response = postSoProcessor
- .postServiceOrderItem(serviceOrderInfo,serviceOrderItem);
+ .postServiceOrderItem(serviceOrderInfo, serviceOrderItem);
updateServiceOrderItem(response, serviceOrderItem, serviceOrder);
}
}
boolean shouldStopPolling = shouldStopPolling(executionTask);
if (!shouldStopPolling && StateType.FAILED != serviceOrderItem.getState()
- ) {
+ ) {
// TODO lancer en asynchrone
sOGetStatusManager.pollRequestStatus(serviceOrder, serviceOrderItem, e2eService);
@@ -109,7 +116,8 @@ public class SOTaskProcessor {
}
private boolean shouldPostSo(ServiceOrderItem serviceOrderItem) {
- return StateType.ACKNOWLEDGED == serviceOrderItem.getState() || StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState();
+ return StateType.ACKNOWLEDGED == serviceOrderItem.getState()
+ || StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState();
}
private ServiceOrderItem getServiceOrderItem(ExecutionTask executionTask, ServiceOrder serviceOrder) {
@@ -178,7 +186,6 @@ public class SOTaskProcessor {
}
-
/**
* Update ServiceOrderItem with SO response by using serviceOrderRepository with the serviceOrderId
*/
@@ -188,7 +195,7 @@ public class SOTaskProcessor {
if (response == null || !response.getStatusCode().is2xxSuccessful()) {
LOGGER.warn("response ko for serviceOrderItem.id=" + orderItem.getId());
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.FAILED);
- buildOrderMessageIfNeeded(orderItem,serviceOrder,response);
+ buildOrderMessageIfNeeded(orderItem, serviceOrder, response);
} else {
CreateServiceInstanceResponse createServiceInstanceResponse = response.getBody();
if (createServiceInstanceResponse != null && !orderItem.getState().equals(StateType.FAILED)) {
@@ -209,14 +216,16 @@ public class SOTaskProcessor {
}
- private void updateOrderItemToInProgress(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem){
- if(serviceOrderItem.getAction()!= ActionType.MODIFY){
+ private void updateOrderItemToInProgress(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem) {
+ if (serviceOrderItem.getAction() != ActionType.MODIFY) {
serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem, StateType.INPROGRESS);
} else {
- if(StateType.ACKNOWLEDGED==serviceOrderItem.getState()){
- serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem, StateType.INPROGRESS_MODIFY_REQUEST_DELETE_SEND);
+ if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
+ serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem,
+ StateType.INPROGRESS_MODIFY_REQUEST_DELETE_SEND);
} else {
- serviceOrderService.updateOrderItemState(serviceOrder,serviceOrderItem,StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND);
+ serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem,
+ StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND);
}
}
}
@@ -224,17 +233,16 @@ public class SOTaskProcessor {
private void buildOrderMessageIfNeeded(ServiceOrderItem serviceOrderItem, ServiceOrder serviceOrder,
ResponseEntity<?> response) {
- if(response!=null)
- {
- if(response.getStatusCode()== HttpStatus.INTERNAL_SERVER_ERROR) {
+ if (response != null) {
+ if (response.getStatusCode() == HttpStatus.INTERNAL_SERVER_ERROR) {
serviceOrderService.addOrderMessage(serviceOrder, "502");
- }
- else if(response.getStatusCode()== HttpStatus.BAD_REQUEST) {
- ResponseEntity<?> messageError=response;
- if(messageError.getBody().toString().toLowerCase().contains("serviceinstance already exists")){
+ } else if (response.getStatusCode() == HttpStatus.BAD_REQUEST) {
+ ResponseEntity<?> messageError = response;
+ if (messageError.getBody().toString().toLowerCase().contains("serviceinstance already exists")) {
serviceOrderService.addOrderItemMessage(serviceOrder, serviceOrderItem, "105");
} else {
- serviceOrderService.addOrderItemMessageRequestSo(serviceOrder, serviceOrderItem, messageError.getBody().toString());
+ serviceOrderService.addOrderItemMessageRequestSo(serviceOrder, serviceOrderItem,
+ messageError.getBody().toString());
}
}
}
@@ -273,7 +281,7 @@ public class SOTaskProcessor {
* Update an executionTask in database when it's process with a success
*/
private void updateSuccessTask(ExecutionTask executionTask) {
- executionTaskRepository.delete(executionTask.getInternalId());
+ executionTaskRepository.deleteById(executionTask.getInternalId());
executionTaskRepository.updateReliedTaskAfterDelete(executionTask.getInternalId());
}
@@ -326,8 +334,8 @@ public class SOTaskProcessor {
private boolean shouldStopPolling(ExecutionTask executionTask) {
long createTimeinMillis = executionTask.getCreateDate().getTime();
long lastAttemptTimeInMillis = executionTask.getLastAttemptDate().getTime();
- long differenceInMillis = lastAttemptTimeInMillis-createTimeinMillis;
- float pollingDurationInMillis = pollingDurationInMins*60000;
+ long differenceInMillis = lastAttemptTimeInMillis - createTimeinMillis;
+ float pollingDurationInMillis = pollingDurationInMins * 60000;
LOGGER.debug("Task {} with orderitem id {}: Task create date: {} Task last attempt date: {}",
executionTask.getInternalId(), executionTask.getOrderItemId(), createTimeinMillis,
lastAttemptTimeInMillis);