aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOren Kleks <orenkle@amdocs.com>2018-07-26 07:58:02 +0000
committerGerrit Code Review <gerrit@onap.org>2018-07-26 07:58:02 +0000
commitba978ad1cbaedef616e5883717da7494b634a2ff (patch)
treeee5e590f7435df8fc7059343a180b0c488de922a
parente0f514ce91f507e4c4e8d620bf54f11e0ea8a1a8 (diff)
parent39c25972746a9f4034b34dfd3294ef8de93cf986 (diff)
Merge "Expand workflow versions"
-rw-r--r--workflow-designer-be/src/main/java/org/onap/sdc/workflow/RestUtils.java15
-rw-r--r--workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowController.java16
2 files changed, 28 insertions, 3 deletions
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/RestUtils.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/RestUtils.java
index b6259ccc..8ba75429 100644
--- a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/RestUtils.java
+++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/RestUtils.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * 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
+ *
+ * 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.sdc.workflow;
import java.util.Arrays;
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowController.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowController.java
index 7027985f..f8eb4bb9 100644
--- a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowController.java
+++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowController.java
@@ -16,7 +16,7 @@
package org.onap.sdc.workflow.api;
-import static org.onap.sdc.workflow.RestUtils.mapVersionStateFilter;
+import static org.onap.sdc.workflow.RestUtils.*;
import static org.onap.sdc.workflow.api.RestConstants.SIZE_DEFAULT;
import static org.onap.sdc.workflow.api.RestConstants.SORT_FIELD_NAME;
import static org.onap.sdc.workflow.api.RestConstants.SORT_PARAM;
@@ -31,6 +31,7 @@ import java.util.Set;
import org.onap.sdc.workflow.api.types.CollectionWrapper;
import org.onap.sdc.workflow.persistence.types.Workflow;
import org.onap.sdc.workflow.services.WorkflowManager;
+import org.onap.sdc.workflow.services.WorkflowVersionManager;
import org.onap.sdc.workflow.services.exceptions.InvalidPaginationParameterException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -59,10 +60,13 @@ import org.springframework.web.bind.annotation.RestController;
public class WorkflowController {
private final WorkflowManager workflowManager;
+ private final WorkflowVersionManager workflowVersionManager;
@Autowired
- public WorkflowController(@Qualifier("workflowManager") WorkflowManager workflowManager) {
+ public WorkflowController(@Qualifier("workflowManager") WorkflowManager workflowManager,
+ @Qualifier("workflowVersionManager") WorkflowVersionManager workflowVersionManager) {
this.workflowManager = workflowManager;
+ this.workflowVersionManager = workflowVersionManager;
}
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@@ -88,10 +92,16 @@ public class WorkflowController {
@GetMapping(path = "/{workflowId}")
@ApiOperation("Get workflow")
public Workflow get(@PathVariable("workflowId") String workflowId,
+ @ApiParam(value = "Expand workflow data", allowableValues = "versions")
+ @RequestParam(value = "expand", required = false) String expand,
@RequestHeader(USER_ID_HEADER_PARAM) String user) {
Workflow workflow = new Workflow();
workflow.setId(workflowId);
- return workflowManager.get(workflow);
+ Workflow retrievedWorkflow = workflowManager.get(workflow);
+ if("versions".equals(expand)){
+ retrievedWorkflow.setVersions(workflowVersionManager.list(workflowId,null));
+ }
+ return retrievedWorkflow;
}
@PutMapping(path = "/{workflowId}", consumes = MediaType.APPLICATION_JSON_VALUE)