aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuanHu <yuan.hu1@zte.com.cn>2018-03-19 19:06:16 +0800
committerYuanHu <yuan.hu1@zte.com.cn>2018-03-19 19:06:16 +0800
commit8ffa3474ef62373b4ac2657bf2be9b5a31629009 (patch)
tree94c82c6e5690cbdb1890bc4c847296e29fd4b364
parent43bed0e28512332aecc3b70f9e24840682c59e92 (diff)
Entity Class for Activity Spec.
Definede entity class for activity specification extend. Issue-ID: SDC-1129 Change-Id: I37d7c77f99002e8e4e1bd754a72d9c2f7b51aae6 Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContent.java70
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpec.java179
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java87
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/Content.java103
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivity.java100
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/I18nString.java52
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java135
-rw-r--r--sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResourceTest.java69
8 files changed, 795 insertions, 0 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContent.java
new file mode 100644
index 00000000..e97fd8e2
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContent.java
@@ -0,0 +1,70 @@
+/**
+ * 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.externalservice.sdc.entity;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ *
+ */
+public class ActivityContent {
+ @SerializedName("class")
+ private String clazz;
+
+ private String scriptFormat;
+
+ private String script;
+
+ /**
+ * @return the clazz
+ */
+ public String getClazz() {
+ return clazz;
+ }
+
+ /**
+ * @param clazz the clazz to set
+ */
+ public void setClazz(String clazz) {
+ this.clazz = clazz;
+ }
+
+ /**
+ * @return the scriptFormat
+ */
+ public String getScriptFormat() {
+ return scriptFormat;
+ }
+
+ /**
+ * @param scriptFormat the scriptFormat to set
+ */
+ public void setScriptFormat(String scriptFormat) {
+ this.scriptFormat = scriptFormat;
+ }
+
+ /**
+ * @return the script
+ */
+ public String getScript() {
+ return script;
+ }
+
+ /**
+ * @param script the script to set
+ */
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpec.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpec.java
new file mode 100644
index 00000000..2ce45fa0
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpec.java
@@ -0,0 +1,179 @@
+/**
+ * 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.externalservice.sdc.entity;
+
+/**
+ *
+ */
+public class ActivitySpec {
+ private String id;
+
+ private String versionId;
+
+ private String name;
+
+ private String description;
+
+ private String type;
+
+ private ActivityContent content;
+
+ private String[] categoryList;
+
+ private Parameter[] inputs;
+
+ private Parameter[] outputs;
+
+ private String status;
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the versionId
+ */
+ public String getVersionId() {
+ return versionId;
+ }
+
+ /**
+ * @param versionId the versionId to set
+ */
+ public void setVersionId(String versionId) {
+ this.versionId = versionId;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the content
+ */
+ public ActivityContent getContent() {
+ return content;
+ }
+
+ /**
+ * @param content the content to set
+ */
+ public void setContent(ActivityContent content) {
+ this.content = content;
+ }
+
+ /**
+ * @return the categoryList
+ */
+ public String[] getCategoryList() {
+ return categoryList;
+ }
+
+ /**
+ * @param categoryList the categoryList to set
+ */
+ public void setCategoryList(String[] categoryList) {
+ this.categoryList = categoryList;
+ }
+
+ /**
+ * @return the inputs
+ */
+ public Parameter[] getInputs() {
+ return inputs;
+ }
+
+ /**
+ * @param inputs the inputs to set
+ */
+ public void setInputs(Parameter[] inputs) {
+ this.inputs = inputs;
+ }
+
+ /**
+ * @return the outputs
+ */
+ public Parameter[] getOutputs() {
+ return outputs;
+ }
+
+ /**
+ * @param outputs the outputs to set
+ */
+ public void setOutputs(Parameter[] outputs) {
+ this.outputs = outputs;
+ }
+
+ /**
+ * @return the status
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @param status the status to set
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java
new file mode 100644
index 00000000..cce803b8
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java
@@ -0,0 +1,87 @@
+/**
+ * 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.externalservice.sdc.entity;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ *
+ */
+public class Parameter {
+ private String name;
+
+ private String type;
+
+ @SerializedName("default")
+ private String defaultValue;
+
+ private String value;
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the defaultValue
+ */
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/Content.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/Content.java
new file mode 100644
index 00000000..d5e45774
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/Content.java
@@ -0,0 +1,103 @@
+/**
+ * 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;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ *
+ */
+public class Content {
+ @SerializedName("class")
+ private String clazz;
+
+ private String script;
+
+ private String scriptFormat;
+
+ private Map<String, InputOutput> inputs;
+
+ private Map<String, InputOutput> outputs;
+
+ /**
+ * @return the clazz
+ */
+ public String getClazz() {
+ return clazz;
+ }
+
+ /**
+ * @param clazz the clazz to set
+ */
+ public void setClazz(String clazz) {
+ this.clazz = clazz;
+ }
+
+ /**
+ * @return the script
+ */
+ public String getScript() {
+ return script;
+ }
+
+ /**
+ * @param script the script to set
+ */
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+ /**
+ * @return the scriptFormat
+ */
+ public String getScriptFormat() {
+ return scriptFormat;
+ }
+
+ /**
+ * @param scriptFormat the scriptFormat to set
+ */
+ public void setScriptFormat(String scriptFormat) {
+ this.scriptFormat = scriptFormat;
+ }
+
+ /**
+ * @return the inputs
+ */
+ public Map<String, InputOutput> getInputs() {
+ return inputs;
+ }
+
+ /**
+ * @param inputs the inputs to set
+ */
+ public void setInputs(Map<String, InputOutput> inputs) {
+ this.inputs = inputs;
+ }
+
+ /**
+ * @return the outputs
+ */
+ public Map<String, InputOutput> getOutputs() {
+ return outputs;
+ }
+
+ /**
+ * @param outputs the outputs to set
+ */
+ public void setOutputs(Map<String, InputOutput> outputs) {
+ this.outputs = outputs;
+ }
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivity.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivity.java
new file mode 100644
index 00000000..529f43e9
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivity.java
@@ -0,0 +1,100 @@
+/**
+ * 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 ExtendActivity {
+ private String id;
+
+ private I18nString displayName;
+
+ private I18nString description;
+
+ private String type;
+
+ private Content content;
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the content
+ */
+ public Content getContent() {
+ return content;
+ }
+
+ /**
+ * @param content the content to set
+ */
+ public void setContent(Content content) {
+ this.content = content;
+ }
+
+ /**
+ * @return the displayName
+ */
+ public I18nString getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * @param displayName the displayName to set
+ */
+ public void setDisplayName(I18nString displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * @return the description
+ */
+ public I18nString getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(I18nString description) {
+ this.description = description;
+ }
+
+
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/I18nString.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/I18nString.java
new file mode 100644
index 00000000..1dc880d8
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/I18nString.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;
+
+/**
+ *
+ */
+public class I18nString {
+ private String en_US;
+
+ private String zh_CN;
+
+ /**
+ * @return the en_US
+ */
+ public String getEn_US() {
+ return en_US;
+ }
+
+ /**
+ * @param en_US the en_US to set
+ */
+ public void setEn_US(String en_US) {
+ this.en_US = en_US;
+ }
+
+ /**
+ * @return the zh_CN
+ */
+ public String getZh_CN() {
+ return zh_CN;
+ }
+
+ /**
+ * @param zh_CN the zh_CN to set
+ */
+ public void setZh_CN(String zh_CN) {
+ this.zh_CN = zh_CN;
+ }
+
+
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java
new file mode 100644
index 00000000..04736225
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java
@@ -0,0 +1,135 @@
+/**
+ * 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 com.google.gson.annotations.SerializedName;
+
+/**
+ *
+ */
+public class InputOutput {
+ private String type;
+
+ @SerializedName("default")
+ private String defaultValue;
+
+ private boolean required;
+
+ private I18nString displayName;
+
+ private boolean show = true;
+
+ private boolean editable = true;
+
+ private String value;
+
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the defaultValue
+ */
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @return the required
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * @param required the required to set
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ /**
+ * @return the displayName
+ */
+ public I18nString getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * @param displayName the displayName to set
+ */
+ public void setDisplayName(I18nString displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * @return the show
+ */
+ public boolean isShow() {
+ return show;
+ }
+
+ /**
+ * @param show the show to set
+ */
+ public void setShow(boolean show) {
+ this.show = show;
+ }
+
+ /**
+ * @return the editable
+ */
+ public boolean isEditable() {
+ return editable;
+ }
+
+ /**
+ * @param editable the editable to set
+ */
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+}
diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResourceTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResourceTest.java
new file mode 100644
index 00000000..8d3fd5d3
--- /dev/null
+++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResourceTest.java
@@ -0,0 +1,69 @@
+/**
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.sdc.workflowdesigner.resources.entity.ExtendActivity;
+import org.onap.sdc.workflowdesigner.utils.FileCommonUtils;
+
+import com.google.gson.Gson;
+
+/**
+ *
+ */
+public class ExtendActivityResourceTest {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {}
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {}
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.resources.ExtendActivityResource#getExtActivities(java.lang.String)}.
+ */
+ @Test
+ public void testGetExtActivities() {
+ ExtendActivityResource resource = new ExtendActivityResource();
+ try {
+ Response response = resource.getExtActivities("test");
+ ExtendActivity[] extActivities = (ExtendActivity[]) response.getEntity();
+ Gson gson = new Gson();
+ FileCommonUtils.write("test.json", gson.toJson(extActivities));
+ assertEquals(extActivities.length == 0, false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.resources.ExtendActivityResource#getDisplayInfo(java.lang.String)}.
+ */
+ @Test
+ public void testGetDisplayInfo() {
+
+ }
+
+}