From: YuanHu Date: Wed, 21 Mar 2018 01:04:54 +0000 (+0800) Subject: Entity Class for Display Information. X-Git-Tag: v1.1.0~57 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=821c6300e715b354c421b3329809dfc906c67c87;p=sdc%2Fsdc-workflow-designer.git Entity Class for Display Information. Entity Class for Display Information. Issue-ID: SDC-1129 Change-Id: I8b9a895b068de1537c9c0320be26e4a3fe641ac0 Signed-off-by: YuanHu --- 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 nodes; + + private Map categoryData; + + /** + * @return the nodes + */ + public Map getNodes() { + return nodes; + } + + /** + * @param nodes the nodes to set + */ + public void setNodes(Map nodes) { + this.nodes = nodes; + } + + /** + * @return the categoryData + */ + public Map getCategoryData() { + return categoryData; + } + + /** + * @param categoryData the categoryData to set + */ + public void setCategoryData(Map 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; + } + +}