aboutsummaryrefslogtreecommitdiffstats
path: root/workflow-designer-be/src/main/java
diff options
context:
space:
mode:
authorayalaben <ayala.benzvi@amdocs.com>2018-07-25 16:09:11 +0300
committerayalaben <ayala.benzvi@amdocs.com>2018-07-26 10:29:03 +0300
commit39c25972746a9f4034b34dfd3294ef8de93cf986 (patch)
tree8ddde85944f8ee7b89ff63c83ca25921c745ba23 /workflow-designer-be/src/main/java
parenta52d50e788792a63e97a9176ab319d53db7a2853 (diff)
Expand workflow versions
Change-Id: I76dd9821bd338188d407aaa3c8344ba90c29ab0f Issue-ID: SDC-1518 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'workflow-designer-be/src/main/java')
-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)