summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-server/src
diff options
context:
space:
mode:
authorYuanHu <yuan.hu1@zte.com.cn>2018-03-21 09:04:54 +0800
committerYuanHu <yuan.hu1@zte.com.cn>2018-03-21 09:05:41 +0800
commit821c6300e715b354c421b3329809dfc906c67c87 (patch)
treed2891b0b18640243b21630fc444c37ee80ac2b60 /sdc-workflow-designer-server/src
parentbbc0b40602f42a6aac5e04fa6cea8507f7ae8f6e (diff)
Entity Class for Display Information.
Entity Class for Display Information. Issue-ID: SDC-1129 Change-Id: I8b9a895b068de1537c9c0320be26e4a3fe641ac0 Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server/src')
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java19
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryData.java50
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfo.java52
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategory.java34
4 files changed, 151 insertions, 4 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java
index 7ed2170c..10269a37 100644
--- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java
@@ -23,6 +23,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.jetty.http.HttpStatus;
+import org.onap.sdc.workflowdesigner.resources.entity.ExtActivityDisplayInfo;
import org.onap.sdc.workflowdesigner.resources.entity.ExtendActivity;
import org.onap.sdc.workflowdesigner.utils.FileCommonUtils;
import org.onap.sdc.workflowdesigner.utils.RestUtils;
@@ -74,7 +75,6 @@ public class ExtendActivityResource {
try {
ExtendActivity[] extActivities = retriveExtActivites(sence);
-
return Response.status(Response.Status.OK).entity(extActivities).build();
} catch (IOException e) {
LOGGER.error("Get ExtActivities failed.", e);
@@ -99,7 +99,7 @@ public class ExtendActivityResource {
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Get Extend Activities DisplayInfo", response = String.class)
+ @ApiOperation(value = "Get Extend Activities DisplayInfo", response = ExtActivityDisplayInfo.class)
@ApiResponses(value = {
@ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
response = String.class),
@@ -110,12 +110,23 @@ public class ExtendActivityResource {
@Timed
public Response getDisplayInfo(@ApiParam(value = "sence") @QueryParam("sence") String sence) {
try {
- String json = FileCommonUtils.readString(EXT_ACTIVITIES_DISPLAY_INFO_FILE_NAME);
- return Response.status(Response.Status.OK).entity(json).build();
+ ExtActivityDisplayInfo displayInfo = retriveDisplayInfo(sence);
+ return Response.status(Response.Status.OK).entity(displayInfo).build();
} catch (IOException e) {
LOGGER.error("Get Extend Activities DisplayInfo failed.", e);
throw RestUtils.newInternalServerErrorException(e);
}
}
+ /**
+ * @param sence
+ * @return
+ * @throws IOException
+ */
+ private ExtActivityDisplayInfo retriveDisplayInfo(String sence) throws IOException {
+ String json = FileCommonUtils.readString(EXT_ACTIVITIES_DISPLAY_INFO_FILE_NAME);
+ Gson gson = new Gson();
+ return gson.fromJson(json, ExtActivityDisplayInfo.class);
+ }
+
}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryData.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryData.java
new file mode 100644
index 00000000..1c92120d
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryData.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2018 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the Apache License, Version 2.0
+ * and the Eclipse Public License v1.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * ZTE - initial API and implementation and/or initial documentation
+ */
+package org.onap.sdc.workflowdesigner.resources.entity;
+
+/**
+ *
+ */
+public class CategoryData {
+ private I18nString displayName;
+
+ private boolean collapse;
+
+ /**
+ * @return the displayName
+ */
+ public I18nString getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * @param displayName the displayName to set
+ */
+ public void setDisplayName(I18nString displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * @return the collapse
+ */
+ public boolean isCollapse() {
+ return collapse;
+ }
+
+ /**
+ * @param collapse the collapse to set
+ */
+ public void setCollapse(boolean collapse) {
+ this.collapse = collapse;
+ }
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfo.java
new file mode 100644
index 00000000..960a65cd
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfo.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2018 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the Apache License, Version 2.0
+ * and the Eclipse Public License v1.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * ZTE - initial API and implementation and/or initial documentation
+ */
+package org.onap.sdc.workflowdesigner.resources.entity;
+
+import java.util.Map;
+
+/**
+ *
+ */
+public class ExtActivityDisplayInfo {
+ private Map<String, NodeCategory> nodes;
+
+ private Map<String, CategoryData> categoryData;
+
+ /**
+ * @return the nodes
+ */
+ public Map<String, NodeCategory> getNodes() {
+ return nodes;
+ }
+
+ /**
+ * @param nodes the nodes to set
+ */
+ public void setNodes(Map<String, NodeCategory> nodes) {
+ this.nodes = nodes;
+ }
+
+ /**
+ * @return the categoryData
+ */
+ public Map<String, CategoryData> getCategoryData() {
+ return categoryData;
+ }
+
+ /**
+ * @param categoryData the categoryData to set
+ */
+ public void setCategoryData(Map<String, CategoryData> categoryData) {
+ this.categoryData = categoryData;
+ }
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategory.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategory.java
new file mode 100644
index 00000000..bcafca6e
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategory.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2018 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the Apache License, Version 2.0
+ * and the Eclipse Public License v1.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * ZTE - initial API and implementation and/or initial documentation
+ */
+package org.onap.sdc.workflowdesigner.resources.entity;
+
+/**
+ *
+ */
+public class NodeCategory {
+ private String category;
+
+ /**
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * @param category the category to set
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+}