From c3cb701438c65d04abcae646af0d73743838e3e7 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Wed, 5 Dec 2018 10:09:18 +0000 Subject: [PATCH] added lombok added ActionType git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/dataminer-invocation-model@174569 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 7 +- .../analysis/dminvocation/ActionType.java | 39 ++++++++ .../model/DataMinerInputParams.java | 66 +++---------- .../model/DataMinerInvocation.java | 99 +++---------------- .../model/DataMinerOutputParams.java | 65 +++--------- .../dminvocation/model/DataMinerParam.java | 98 +++--------------- .../model/DataMinerParameters.java | 91 +++-------------- src/test/java/DataMinerInvocationTest.java | 6 +- 8 files changed, 108 insertions(+), 363 deletions(-) create mode 100644 src/main/java/org/gcube/data/analysis/dminvocation/ActionType.java diff --git a/pom.xml b/pom.xml index 5827a79..86ad561 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,6 @@ - com.sun.xml.bind jaxb-core @@ -78,6 +77,12 @@ 2.5.2 + + org.projectlombok + lombok + 1.14.8 + + log4j diff --git a/src/main/java/org/gcube/data/analysis/dminvocation/ActionType.java b/src/main/java/org/gcube/data/analysis/dminvocation/ActionType.java new file mode 100644 index 0000000..02ca855 --- /dev/null +++ b/src/main/java/org/gcube/data/analysis/dminvocation/ActionType.java @@ -0,0 +1,39 @@ +/** + * + */ +package org.gcube.data.analysis.dminvocation; + + +/** + * The Enum ActionType. + * + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) + * Dec 5, 2018 + */ +public enum ActionType { + + EDIT("edit"), + RUN("run"); + + private String action; + + /** + * Instantiates a new action type. + * + * @param action the action + */ + ActionType(String action){ + this.action = action; + } + + + /** + * Gets the action. + * + * @return the action + */ + public String getAction() { + + return action; + } +} diff --git a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInputParams.java b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInputParams.java index ab0194c..73e5f76 100644 --- a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInputParams.java +++ b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInputParams.java @@ -11,6 +11,12 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + /** * The Class DataMinerInputParams. @@ -20,6 +26,11 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "dataminer-inputparams") @XmlAccessorType (XmlAccessType.FIELD) +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@ToString public class DataMinerInputParams implements Serializable{ /** @@ -31,61 +42,6 @@ public class DataMinerInputParams implements Serializable{ private List listParam; - /** - * Instantiates a new data miner input params. - */ - public DataMinerInputParams() { - } - - /** - * Instantiates a new data miner input params. - * - * @param listParam the list param - */ - public DataMinerInputParams(List listParam) { - - super(); - this.listParam = listParam; - } - - - /** - * Gets the list param. - * - * @return the listParam - */ - public List getListParam() { - - return listParam; - } - - - - /** - * Sets the list param. - * - * @param listParam the listParam to set - */ - public void setListParam(List listParam) { - - this.listParam = listParam; - } - - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("DataMinerInputParams [listParam="); - builder.append(listParam); - builder.append("]"); - return builder.toString(); - } - } diff --git a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInvocation.java b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInvocation.java index 855eb87..1a71a2a 100644 --- a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInvocation.java +++ b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerInvocation.java @@ -10,6 +10,14 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import org.gcube.data.analysis.dminvocation.ActionType; + /** * The Class DataMinerInvocation. * @@ -18,97 +26,22 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "dataminer-invocation") @XmlAccessorType (XmlAccessType.FIELD) +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@ToString public class DataMinerInvocation implements Serializable{ - /** - * - */ private static final long serialVersionUID = -3642902539322040226L; @XmlElement(name = "operator-id") private String operatorId; + @XmlElement(name = "action") + private ActionType actionType = ActionType.RUN; + @XmlElement(name = "parameters") private DataMinerParameters parameters; - /** - * Instantiates a new data miner invocation. - */ - public DataMinerInvocation() { - } - - /** - * Instantiates a new data miner invocation. - * - * @param operatorId the operator id - * @param parameters the parameters - */ - public DataMinerInvocation( - String operatorId, DataMinerParameters parameters) { - - super(); - this.operatorId = operatorId; - this.parameters = parameters; - } - - - /** - * Gets the operator id. - * - * @return the operatorId - */ - public String getOperatorId() { - - return operatorId; - } - - - /** - * Gets the parameters. - * - * @return the parameters - */ - public DataMinerParameters getParameters() { - - return parameters; - } - - - /** - * Sets the operator id. - * - * @param operatorId the operatorId to set - */ - public void setOperatorId(String operatorId) { - - this.operatorId = operatorId; - } - - - /** - * Sets the parameters. - * - * @param parameters the parameters to set - */ - public void setParameters(DataMinerParameters parameters) { - - this.parameters = parameters; - } - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("DataMinerInvocation [operatorId="); - builder.append(operatorId); - builder.append(", parameters="); - builder.append(parameters); - builder.append("]"); - return builder.toString(); - } - } diff --git a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerOutputParams.java b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerOutputParams.java index c11fa93..0b42890 100644 --- a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerOutputParams.java +++ b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerOutputParams.java @@ -11,6 +11,12 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + /** * The Class DataMinerOutputParams. @@ -20,6 +26,11 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "dataminer-outputparams") @XmlAccessorType (XmlAccessType.FIELD) +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@ToString public class DataMinerOutputParams implements Serializable{ /** @@ -30,58 +41,4 @@ public class DataMinerOutputParams implements Serializable{ @XmlElement(name = "param") private List params; - /** - * Instantiates a new data miner output params. - */ - public DataMinerOutputParams() { - } - - - /** - * Instantiates a new data miner output params. - * - * @param params the params - */ - public DataMinerOutputParams(List params) { - - super(); - this.params = params; - } - - - /** - * Gets the params. - * - * @return the params - */ - public List getParams() { - - return params; - } - - - /** - * Sets the params. - * - * @param params the params to set - */ - public void setParams(List params) { - - this.params = params; - } - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("DataMinerOutputParams [params="); - builder.append(params); - builder.append("]"); - return builder.toString(); - } - } diff --git a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParam.java b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParam.java index 8c12f71..b5ee233 100644 --- a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParam.java +++ b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParam.java @@ -7,6 +7,12 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + /** * The Class DataMinerParam. @@ -16,96 +22,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "param") @XmlAccessorType (XmlAccessType.FIELD) +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@ToString public class DataMinerParam { private String key; private String value; - - /** - * Instantiates a new data miner param. - */ - public DataMinerParam() { - - // TODO Auto-generated constructor stub - } - - - /** - * Instantiates a new data miner param. - * - * @param key the key - * @param value the value - */ - public DataMinerParam(String key, String value) { - - super(); - this.key = key; - this.value = value; - } - - - - /** - * Gets the key. - * - * @return the key - */ - public String getKey() { - - return key; - } - - - - /** - * Gets the value. - * - * @return the value - */ - public String getValue() { - - return value; - } - - - - /** - * Sets the key. - * - * @param key the key to set - */ - public void setKey(String key) { - - this.key = key; - } - - - - /** - * Sets the value. - * - * @param value the value to set - */ - public void setValue(String value) { - - this.value = value; - } - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("DataMinerParam [key="); - builder.append(key); - builder.append(", value="); - builder.append(value); - builder.append("]"); - return builder.toString(); - } - } diff --git a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParameters.java b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParameters.java index d5cb958..88cc499 100644 --- a/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParameters.java +++ b/src/main/java/org/gcube/data/analysis/dminvocation/model/DataMinerParameters.java @@ -10,6 +10,12 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + /** @@ -20,6 +26,11 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "dataminer-parameters") @XmlAccessorType (XmlAccessType.FIELD) +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@ToString public class DataMinerParameters implements Serializable{ /** @@ -31,84 +42,4 @@ public class DataMinerParameters implements Serializable{ @XmlElement(name = "output") private DataMinerOutputParams output; - /** - * Instantiates a new data miner params model. - */ - public DataMinerParameters() { - - } - - /** - * Instantiates a new data miner params model. - * - * @param input the input - * @param output the output - */ - public DataMinerParameters( - DataMinerInputParams input, DataMinerOutputParams output) { - - super(); - this.input = input; - this.output = output; - } - - - /** - * Gets the input. - * - * @return the input - */ - public DataMinerInputParams getInput() { - - return input; - } - - - /** - * Gets the output. - * - * @return the output - */ - public DataMinerOutputParams getOutput() { - - return output; - } - - - /** - * Sets the input. - * - * @param input the input to set - */ - public void setInput(DataMinerInputParams input) { - - this.input = input; - } - - - /** - * Sets the output. - * - * @param output the output to set - */ - public void setOutput(DataMinerOutputParams output) { - - this.output = output; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("DataMinerParameters [input="); - builder.append(input); - builder.append(", output="); - builder.append(output); - builder.append("]"); - return builder.toString(); - } - } diff --git a/src/test/java/DataMinerInvocationTest.java b/src/test/java/DataMinerInvocationTest.java index afb05bb..4c1e2e7 100644 --- a/src/test/java/DataMinerInvocationTest.java +++ b/src/test/java/DataMinerInvocationTest.java @@ -32,15 +32,15 @@ import org.junit.Test; */ public class DataMinerInvocationTest { - static String operatorID = "THE_OPERATOR_ID"; + static String operatorID = "[THE_OPERATOR_ID]"; static Map parameters = new HashMap(); @Before public void init(){ - parameters.put("key1", "value1"); - parameters.put("key2", "value2"); + parameters.put("[key1]", "[value1]"); + parameters.put("[key2]", "[value2]"); }