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
This commit is contained in:
Francesco Mangiacrapa 2018-12-05 10:09:18 +00:00
parent 87ada9ed39
commit c3cb701438
8 changed files with 108 additions and 363 deletions

View File

@ -57,7 +57,6 @@
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
@ -78,6 +77,12 @@
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.8</version>
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>log4j</groupId>

View File

@ -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;
}
}

View File

@ -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<DataMinerParam> 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<DataMinerParam> listParam) {
super();
this.listParam = listParam;
}
/**
* Gets the list param.
*
* @return the listParam
*/
public List<DataMinerParam> getListParam() {
return listParam;
}
/**
* Sets the list param.
*
* @param listParam the listParam to set
*/
public void setListParam(List<DataMinerParam> 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();
}
}

View File

@ -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();
}
}

View File

@ -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<DataMinerParam> params;
/**
* Instantiates a new data miner output params.
*/
public DataMinerOutputParams() {
}
/**
* Instantiates a new data miner output params.
*
* @param params the params
*/
public DataMinerOutputParams(List<DataMinerParam> params) {
super();
this.params = params;
}
/**
* Gets the params.
*
* @return the params
*/
public List<DataMinerParam> getParams() {
return params;
}
/**
* Sets the params.
*
* @param params the params to set
*/
public void setParams(List<DataMinerParam> 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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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<String,String> parameters = new HashMap<String,String>();
@Before
public void init(){
parameters.put("key1", "value1");
parameters.put("key2", "value2");
parameters.put("[key1]", "[value1]");
parameters.put("[key2]", "[value2]");
}