aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/Job.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt3
3 files changed, 16 insertions, 5 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/Job.java b/vid-app-common/src/main/java/org/onap/vid/job/Job.java
index 197e03b7b..9861d0703 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/Job.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/Job.java
@@ -21,13 +21,12 @@
package org.onap.vid.job;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.onap.vid.job.impl.JobSharedData;
-
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.onap.vid.job.impl.JobSharedData;
public interface Job {
@@ -68,6 +67,7 @@ public interface Job {
COMPLETED_WITH_NO_ACTION(true, false),
CREATING(false),
PENDING_RESOURCE(false),
+ COMPLETED_AND_PAUSED(true, false),
;
private final Boolean finalStatus;
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
index 9b4f8b985..3ecb4aed3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
@@ -230,7 +230,7 @@ abstract class ResourceCommand(
InternalState.IN_PROGRESS -> {
when {
- jobStatus != JobStatus.COMPLETED -> InternalState.IN_PROGRESS
+ jobStatus !in setOf(JobStatus.COMPLETED, JobStatus.COMPLETED_AND_PAUSED) -> InternalState.IN_PROGRESS
isDescendantHasAction(Action.Create) -> InternalState.CREATING_CHILDREN
isDescendantHasAction(Action.Upgrade) -> InternalState.CREATING_CHILDREN
else -> InternalState.TERMINAL
@@ -385,9 +385,19 @@ abstract class ResourceCommand(
protected open fun getExpiryChecker(): ExpiryChecker = ExpiryChecker {false}
protected open fun handleInProgressStatus(jobStatus: JobStatus): JobStatus {
- return if (jobStatus == JobStatus.PAUSE) JobStatus.IN_PROGRESS else jobStatus
+ if (jobStatus == JobStatus.PAUSE){
+ return JobStatus.IN_PROGRESS
+ } else if (completedAndPaused(jobStatus)){
+ return JobStatus.COMPLETED_AND_PAUSED
+ }
+ return jobStatus
}
+ private fun completedAndPaused(jobStatus: JobStatus) =
+ jobStatus == JobStatus.COMPLETED && getRequest().pauseInstantiation == afterCompletion
+ && featureManager.isActive(Features.FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION)
+
+
protected open fun watchChildren():JobStatus {
return watchChildrenJobsBL.retrieveChildrenJobsStatus(childJobs)
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt
index 194fe4ba2..502d8344d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt
@@ -21,11 +21,11 @@
package org.onap.vid.job.command
import org.apache.commons.lang3.StringUtils
+import org.onap.portalsdk.core.service.DataAccessService
import org.onap.vid.job.Job
import org.onap.vid.job.Job.JobStatus.*
import org.onap.vid.job.impl.JobDaoImpl
import org.onap.vid.utils.DaoUtils
-import org.onap.portalsdk.core.service.DataAccessService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import java.util.*
@@ -63,6 +63,7 @@ constructor(private val dataAccessService: DataAccessService) {
a == COMPLETED_WITH_ERRORS || b == COMPLETED_WITH_ERRORS-> COMPLETED_WITH_ERRORS
a == COMPLETED && b.isFailure -> COMPLETED_WITH_ERRORS
b == COMPLETED && a.isFailure -> COMPLETED_WITH_ERRORS
+ a == COMPLETED_AND_PAUSED || b == COMPLETED_AND_PAUSED -> COMPLETED_AND_PAUSED
a == COMPLETED || b == COMPLETED -> COMPLETED
a.isFailure || b.isFailure -> FAILED
else -> COMPLETED_WITH_NO_ACTION