Definede entity class for activity specification extend.
Issue-ID: SDC-1129
Change-Id: I37d7c77f99002e8e4e1bd754a72d9c2f7b51aae6
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.externalservice.sdc.entity;\r
+\r
+import com.google.gson.annotations.SerializedName;\r
+\r
+/**\r
+ *\r
+ */\r
+public class ActivityContent {\r
+ @SerializedName("class")\r
+ private String clazz;\r
+ \r
+ private String scriptFormat;\r
+ \r
+ private String script;\r
+\r
+ /**\r
+ * @return the clazz\r
+ */\r
+ public String getClazz() {\r
+ return clazz;\r
+ }\r
+\r
+ /**\r
+ * @param clazz the clazz to set\r
+ */\r
+ public void setClazz(String clazz) {\r
+ this.clazz = clazz;\r
+ }\r
+\r
+ /**\r
+ * @return the scriptFormat\r
+ */\r
+ public String getScriptFormat() {\r
+ return scriptFormat;\r
+ }\r
+\r
+ /**\r
+ * @param scriptFormat the scriptFormat to set\r
+ */\r
+ public void setScriptFormat(String scriptFormat) {\r
+ this.scriptFormat = scriptFormat;\r
+ }\r
+\r
+ /**\r
+ * @return the script\r
+ */\r
+ public String getScript() {\r
+ return script;\r
+ }\r
+\r
+ /**\r
+ * @param script the script to set\r
+ */\r
+ public void setScript(String script) {\r
+ this.script = script;\r
+ }\r
+ \r
+ \r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.externalservice.sdc.entity;\r
+\r
+/**\r
+ *\r
+ */\r
+public class ActivitySpec {\r
+ private String id;\r
+ \r
+ private String versionId;\r
+ \r
+ private String name;\r
+ \r
+ private String description;\r
+ \r
+ private String type;\r
+ \r
+ private ActivityContent content;\r
+ \r
+ private String[] categoryList;\r
+\r
+ private Parameter[] inputs;\r
+ \r
+ private Parameter[] outputs;\r
+\r
+ private String status;\r
+\r
+ /**\r
+ * @return the id\r
+ */\r
+ public String getId() {\r
+ return id;\r
+ }\r
+\r
+ /**\r
+ * @param id the id to set\r
+ */\r
+ public void setId(String id) {\r
+ this.id = id;\r
+ }\r
+\r
+ /**\r
+ * @return the versionId\r
+ */\r
+ public String getVersionId() {\r
+ return versionId;\r
+ }\r
+\r
+ /**\r
+ * @param versionId the versionId to set\r
+ */\r
+ public void setVersionId(String versionId) {\r
+ this.versionId = versionId;\r
+ }\r
+\r
+ /**\r
+ * @return the name\r
+ */\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ /**\r
+ * @param name the name to set\r
+ */\r
+ public void setName(String name) {\r
+ this.name = name;\r
+ }\r
+\r
+ /**\r
+ * @return the description\r
+ */\r
+ public String getDescription() {\r
+ return description;\r
+ }\r
+\r
+ /**\r
+ * @param description the description to set\r
+ */\r
+ public void setDescription(String description) {\r
+ this.description = description;\r
+ }\r
+\r
+ /**\r
+ * @return the type\r
+ */\r
+ public String getType() {\r
+ return type;\r
+ }\r
+\r
+ /**\r
+ * @param type the type to set\r
+ */\r
+ public void setType(String type) {\r
+ this.type = type;\r
+ }\r
+\r
+ /**\r
+ * @return the content\r
+ */\r
+ public ActivityContent getContent() {\r
+ return content;\r
+ }\r
+\r
+ /**\r
+ * @param content the content to set\r
+ */\r
+ public void setContent(ActivityContent content) {\r
+ this.content = content;\r
+ }\r
+\r
+ /**\r
+ * @return the categoryList\r
+ */\r
+ public String[] getCategoryList() {\r
+ return categoryList;\r
+ }\r
+\r
+ /**\r
+ * @param categoryList the categoryList to set\r
+ */\r
+ public void setCategoryList(String[] categoryList) {\r
+ this.categoryList = categoryList;\r
+ }\r
+\r
+ /**\r
+ * @return the inputs\r
+ */\r
+ public Parameter[] getInputs() {\r
+ return inputs;\r
+ }\r
+\r
+ /**\r
+ * @param inputs the inputs to set\r
+ */\r
+ public void setInputs(Parameter[] inputs) {\r
+ this.inputs = inputs;\r
+ }\r
+\r
+ /**\r
+ * @return the outputs\r
+ */\r
+ public Parameter[] getOutputs() {\r
+ return outputs;\r
+ }\r
+\r
+ /**\r
+ * @param outputs the outputs to set\r
+ */\r
+ public void setOutputs(Parameter[] outputs) {\r
+ this.outputs = outputs;\r
+ }\r
+\r
+ /**\r
+ * @return the status\r
+ */\r
+ public String getStatus() {\r
+ return status;\r
+ }\r
+\r
+ /**\r
+ * @param status the status to set\r
+ */\r
+ public void setStatus(String status) {\r
+ this.status = status;\r
+ }\r
+ \r
+ \r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.externalservice.sdc.entity;\r
+\r
+import com.google.gson.annotations.SerializedName;\r
+\r
+/**\r
+ *\r
+ */\r
+public class Parameter {\r
+ private String name;\r
+ \r
+ private String type;\r
+ \r
+ @SerializedName("default")\r
+ private String defaultValue;\r
+ \r
+ private String value;\r
+\r
+ /**\r
+ * @return the name\r
+ */\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ /**\r
+ * @param name the name to set\r
+ */\r
+ public void setName(String name) {\r
+ this.name = name;\r
+ }\r
+\r
+ /**\r
+ * @return the type\r
+ */\r
+ public String getType() {\r
+ return type;\r
+ }\r
+\r
+ /**\r
+ * @param type the type to set\r
+ */\r
+ public void setType(String type) {\r
+ this.type = type;\r
+ }\r
+\r
+ /**\r
+ * @return the defaultValue\r
+ */\r
+ public String getDefaultValue() {\r
+ return defaultValue;\r
+ }\r
+\r
+ /**\r
+ * @param defaultValue the defaultValue to set\r
+ */\r
+ public void setDefaultValue(String defaultValue) {\r
+ this.defaultValue = defaultValue;\r
+ }\r
+\r
+ /**\r
+ * @return the value\r
+ */\r
+ public String getValue() {\r
+ return value;\r
+ }\r
+\r
+ /**\r
+ * @param value the value to set\r
+ */\r
+ public void setValue(String value) {\r
+ this.value = value;\r
+ }\r
+ \r
+ \r
+\r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.resources.entity;\r
+\r
+import java.util.Map;\r
+\r
+import com.google.gson.annotations.SerializedName;\r
+\r
+/**\r
+ *\r
+ */\r
+public class Content {\r
+ @SerializedName("class")\r
+ private String clazz;\r
+ \r
+ private String script;\r
+ \r
+ private String scriptFormat;\r
+ \r
+ private Map<String, InputOutput> inputs;\r
+ \r
+ private Map<String, InputOutput> outputs;\r
+\r
+ /**\r
+ * @return the clazz\r
+ */\r
+ public String getClazz() {\r
+ return clazz;\r
+ }\r
+\r
+ /**\r
+ * @param clazz the clazz to set\r
+ */\r
+ public void setClazz(String clazz) {\r
+ this.clazz = clazz;\r
+ }\r
+\r
+ /**\r
+ * @return the script\r
+ */\r
+ public String getScript() {\r
+ return script;\r
+ }\r
+\r
+ /**\r
+ * @param script the script to set\r
+ */\r
+ public void setScript(String script) {\r
+ this.script = script;\r
+ }\r
+\r
+ /**\r
+ * @return the scriptFormat\r
+ */\r
+ public String getScriptFormat() {\r
+ return scriptFormat;\r
+ }\r
+\r
+ /**\r
+ * @param scriptFormat the scriptFormat to set\r
+ */\r
+ public void setScriptFormat(String scriptFormat) {\r
+ this.scriptFormat = scriptFormat;\r
+ }\r
+\r
+ /**\r
+ * @return the inputs\r
+ */\r
+ public Map<String, InputOutput> getInputs() {\r
+ return inputs;\r
+ }\r
+\r
+ /**\r
+ * @param inputs the inputs to set\r
+ */\r
+ public void setInputs(Map<String, InputOutput> inputs) {\r
+ this.inputs = inputs;\r
+ }\r
+\r
+ /**\r
+ * @return the outputs\r
+ */\r
+ public Map<String, InputOutput> getOutputs() {\r
+ return outputs;\r
+ }\r
+\r
+ /**\r
+ * @param outputs the outputs to set\r
+ */\r
+ public void setOutputs(Map<String, InputOutput> outputs) {\r
+ this.outputs = outputs;\r
+ }\r
+\r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.resources.entity;\r
+\r
+/**\r
+ *\r
+ */\r
+public class ExtendActivity {\r
+ private String id;\r
+ \r
+ private I18nString displayName;\r
+ \r
+ private I18nString description;\r
+ \r
+ private String type;\r
+ \r
+ private Content content;\r
+\r
+ /**\r
+ * @return the id\r
+ */\r
+ public String getId() {\r
+ return id;\r
+ }\r
+\r
+ /**\r
+ * @param id the id to set\r
+ */\r
+ public void setId(String id) {\r
+ this.id = id;\r
+ }\r
+\r
+ /**\r
+ * @return the type\r
+ */\r
+ public String getType() {\r
+ return type;\r
+ }\r
+\r
+ /**\r
+ * @param type the type to set\r
+ */\r
+ public void setType(String type) {\r
+ this.type = type;\r
+ }\r
+\r
+ /**\r
+ * @return the content\r
+ */\r
+ public Content getContent() {\r
+ return content;\r
+ }\r
+\r
+ /**\r
+ * @param content the content to set\r
+ */\r
+ public void setContent(Content content) {\r
+ this.content = content;\r
+ }\r
+\r
+ /**\r
+ * @return the displayName\r
+ */\r
+ public I18nString getDisplayName() {\r
+ return displayName;\r
+ }\r
+\r
+ /**\r
+ * @param displayName the displayName to set\r
+ */\r
+ public void setDisplayName(I18nString displayName) {\r
+ this.displayName = displayName;\r
+ }\r
+\r
+ /**\r
+ * @return the description\r
+ */\r
+ public I18nString getDescription() {\r
+ return description;\r
+ }\r
+\r
+ /**\r
+ * @param description the description to set\r
+ */\r
+ public void setDescription(I18nString description) {\r
+ this.description = description;\r
+ }\r
+ \r
+ \r
+\r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.resources.entity;\r
+\r
+/**\r
+ *\r
+ */\r
+public class I18nString {\r
+ private String en_US;\r
+ \r
+ private String zh_CN;\r
+\r
+ /**\r
+ * @return the en_US\r
+ */\r
+ public String getEn_US() {\r
+ return en_US;\r
+ }\r
+\r
+ /**\r
+ * @param en_US the en_US to set\r
+ */\r
+ public void setEn_US(String en_US) {\r
+ this.en_US = en_US;\r
+ }\r
+\r
+ /**\r
+ * @return the zh_CN\r
+ */\r
+ public String getZh_CN() {\r
+ return zh_CN;\r
+ }\r
+\r
+ /**\r
+ * @param zh_CN the zh_CN to set\r
+ */\r
+ public void setZh_CN(String zh_CN) {\r
+ this.zh_CN = zh_CN;\r
+ }\r
+ \r
+ \r
+\r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.resources.entity;\r
+\r
+import com.google.gson.annotations.SerializedName;\r
+\r
+/**\r
+ *\r
+ */\r
+public class InputOutput {\r
+ private String type;\r
+ \r
+ @SerializedName("default")\r
+ private String defaultValue;\r
+ \r
+ private boolean required;\r
+ \r
+ private I18nString displayName;\r
+ \r
+ private boolean show = true;\r
+ \r
+ private boolean editable = true;\r
+ \r
+ private String value;\r
+ \r
+\r
+ /**\r
+ * @return the type\r
+ */\r
+ public String getType() {\r
+ return type;\r
+ }\r
+\r
+ /**\r
+ * @param type the type to set\r
+ */\r
+ public void setType(String type) {\r
+ this.type = type;\r
+ }\r
+\r
+ /**\r
+ * @return the defaultValue\r
+ */\r
+ public String getDefaultValue() {\r
+ return defaultValue;\r
+ }\r
+\r
+ /**\r
+ * @param defaultValue the defaultValue to set\r
+ */\r
+ public void setDefaultValue(String defaultValue) {\r
+ this.defaultValue = defaultValue;\r
+ }\r
+\r
+ /**\r
+ * @return the required\r
+ */\r
+ public boolean isRequired() {\r
+ return required;\r
+ }\r
+\r
+ /**\r
+ * @param required the required to set\r
+ */\r
+ public void setRequired(boolean required) {\r
+ this.required = required;\r
+ }\r
+\r
+ /**\r
+ * @return the displayName\r
+ */\r
+ public I18nString getDisplayName() {\r
+ return displayName;\r
+ }\r
+\r
+ /**\r
+ * @param displayName the displayName to set\r
+ */\r
+ public void setDisplayName(I18nString displayName) {\r
+ this.displayName = displayName;\r
+ }\r
+\r
+ /**\r
+ * @return the show\r
+ */\r
+ public boolean isShow() {\r
+ return show;\r
+ }\r
+\r
+ /**\r
+ * @param show the show to set\r
+ */\r
+ public void setShow(boolean show) {\r
+ this.show = show;\r
+ }\r
+\r
+ /**\r
+ * @return the editable\r
+ */\r
+ public boolean isEditable() {\r
+ return editable;\r
+ }\r
+\r
+ /**\r
+ * @param editable the editable to set\r
+ */\r
+ public void setEditable(boolean editable) {\r
+ this.editable = editable;\r
+ }\r
+\r
+ /**\r
+ * @return the value\r
+ */\r
+ public String getValue() {\r
+ return value;\r
+ }\r
+\r
+ /**\r
+ * @param value the value to set\r
+ */\r
+ public void setValue(String value) {\r
+ this.value = value;\r
+ }\r
+\r
+\r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.resources;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import javax.ws.rs.core.Response;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.onap.sdc.workflowdesigner.resources.entity.ExtendActivity;\r
+import org.onap.sdc.workflowdesigner.utils.FileCommonUtils;\r
+\r
+import com.google.gson.Gson;\r
+\r
+/**\r
+ *\r
+ */\r
+public class ExtendActivityResourceTest {\r
+\r
+ /**\r
+ * @throws java.lang.Exception\r
+ */\r
+ @Before\r
+ public void setUp() throws Exception {}\r
+\r
+ /**\r
+ * @throws java.lang.Exception\r
+ */\r
+ @After\r
+ public void tearDown() throws Exception {}\r
+\r
+ /**\r
+ * Test method for {@link org.onap.sdc.workflowdesigner.resources.ExtendActivityResource#getExtActivities(java.lang.String)}.\r
+ */\r
+ @Test\r
+ public void testGetExtActivities() {\r
+ ExtendActivityResource resource = new ExtendActivityResource();\r
+ try {\r
+ Response response = resource.getExtActivities("test");\r
+ ExtendActivity[] extActivities = (ExtendActivity[]) response.getEntity();\r
+ Gson gson = new Gson();\r
+ FileCommonUtils.write("test.json", gson.toJson(extActivities));\r
+ assertEquals(extActivities.length == 0, false);\r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * Test method for {@link org.onap.sdc.workflowdesigner.resources.ExtendActivityResource#getDisplayInfo(java.lang.String)}.\r
+ */\r
+ @Test\r
+ public void testGetDisplayInfo() {\r
+\r
+ }\r
+\r
+}\r