246 lines
5.0 KiB
Java
246 lines
5.0 KiB
Java
/**
|
|
*
|
|
*/
|
|
|
|
package org.gcube.common.workspacetaskexecutor.shared.dataminer;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
|
|
import org.gcube.common.workspacetaskexecutor.shared.BaseTaskConfiguration;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
|
/**
|
|
* The Class TaskConfiguration.
|
|
*
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it May 2, 2018
|
|
*/
|
|
public class TaskConfiguration implements BaseTaskConfiguration, Serializable {
|
|
|
|
/**
|
|
*
|
|
*/
|
|
@JsonIgnoreProperties
|
|
public static final String FIELD_CONFIGURATION_KEY = "configurationKey";
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = -3380573762288127547L;
|
|
private String taskId;
|
|
@JsonIgnoreProperties
|
|
private String taskDescription; // optional
|
|
/*
|
|
* The encrypted VRE Token of the user in the VRE where submit the
|
|
* computation
|
|
*/
|
|
private String maskedToken;
|
|
private String workspaceItemId;
|
|
@JsonIgnoreProperties
|
|
private Map<String, String> mapParameters; // optional
|
|
private String configurationKey;
|
|
|
|
/**
|
|
* Instantiates a new task configuration.
|
|
*/
|
|
public TaskConfiguration() {
|
|
|
|
}
|
|
|
|
/**
|
|
* Instantiates a new task configuration.
|
|
*
|
|
* @param configurationKey
|
|
* the configuration key
|
|
* @param taskId
|
|
* the task id
|
|
* @param taskDescription
|
|
* the task description
|
|
* @param maskedToken
|
|
* the token
|
|
* @param workspaceItemId
|
|
* the workspace item id
|
|
* @param mapParameters
|
|
* the map parameters
|
|
*/
|
|
public TaskConfiguration(
|
|
String configurationKey, String taskId, String taskDescription,
|
|
String maskedToken, String workspaceItemId,
|
|
Map<String, String> mapParameters) {
|
|
|
|
setConfigurationKey(configurationKey);
|
|
this.taskId = taskId;
|
|
this.taskDescription = taskDescription;
|
|
this.maskedToken = maskedToken;
|
|
this.workspaceItemId = workspaceItemId;
|
|
this.mapParameters = mapParameters;
|
|
}
|
|
|
|
/*
|
|
* (non-Javadoc)
|
|
* @see org.gcube.common.workspacetaskexecutor.shared.BaseTaskConfiguration#
|
|
* getAccessKey()
|
|
*/
|
|
@Override
|
|
public String getConfigurationKey() {
|
|
|
|
if (configurationKey == null)
|
|
configurationKey = hashCode() + "";
|
|
return configurationKey;
|
|
}
|
|
|
|
/*
|
|
* (non-Javadoc)
|
|
* @see org.gcube.common.workspacetaskexecutor.shared.BaseTaskConfiguration#
|
|
* setAccessKey(java.lang.String)
|
|
*/
|
|
@Override
|
|
public void setConfigurationKey(String configurationKey) {
|
|
|
|
this.configurationKey = configurationKey;
|
|
}
|
|
|
|
/*
|
|
* (non-Javadoc)
|
|
* @see org.gcube.common.workspacetaskexecutor.TaskConfiguration#getTaskId()
|
|
*/
|
|
@Override
|
|
public String getTaskId() {
|
|
|
|
return taskId;
|
|
}
|
|
|
|
/**
|
|
* Gets the task description.
|
|
*
|
|
* @return the taskDescription
|
|
*/
|
|
public String getTaskDescription() {
|
|
|
|
return taskDescription;
|
|
}
|
|
|
|
/**
|
|
* Gets the workspace item id.
|
|
*
|
|
* @return the workspaceItemId
|
|
*/
|
|
public String getWorkspaceItemId() {
|
|
|
|
return workspaceItemId;
|
|
}
|
|
|
|
/**
|
|
* Gets the map parameters.
|
|
*
|
|
* @return the mapParameters
|
|
*/
|
|
public Map<String, String> getMapParameters() {
|
|
|
|
return mapParameters;
|
|
}
|
|
|
|
/**
|
|
* Sets the task description.
|
|
*
|
|
* @param taskDescription
|
|
* the taskDescription to set
|
|
*/
|
|
public void setTaskDescription(String taskDescription) {
|
|
|
|
this.taskDescription = taskDescription;
|
|
}
|
|
|
|
/**
|
|
* Sets the task id.
|
|
*
|
|
* @param taskId
|
|
* the taskId to set
|
|
*/
|
|
public void setTaskId(String taskId) {
|
|
|
|
this.taskId = taskId;
|
|
}
|
|
|
|
/**
|
|
* Sets the workspace item id.
|
|
*
|
|
* @param workspaceItemId
|
|
* the workspaceItemId to set
|
|
*/
|
|
public void setWorkspaceItemId(String workspaceItemId) {
|
|
|
|
this.workspaceItemId = workspaceItemId;
|
|
}
|
|
|
|
/**
|
|
* Sets the map parameters.
|
|
*
|
|
* @param mapParameters
|
|
* the mapParameters to set
|
|
*/
|
|
public void setMapParameters(Map<String, String> mapParameters) {
|
|
|
|
this.mapParameters = mapParameters;
|
|
}
|
|
|
|
/*
|
|
* (non-Javadoc)
|
|
* @see java.lang.Object#hashCode()
|
|
*/
|
|
@Override
|
|
public int hashCode() {
|
|
|
|
int hash = 1;
|
|
hash = hash * 13 + (taskId == null ? 0 : taskId.hashCode());
|
|
hash =
|
|
hash * 17 +
|
|
(workspaceItemId == null ? 0 : workspaceItemId.hashCode());
|
|
hash = hash * new Random().nextInt();
|
|
return hash;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return the maskedToken
|
|
*/
|
|
public String getMaskedToken() {
|
|
|
|
return maskedToken;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param maskedToken the maskedToken to set
|
|
*/
|
|
public void setMaskedToken(String maskedToken) {
|
|
|
|
this.maskedToken = maskedToken;
|
|
}
|
|
|
|
/*
|
|
* (non-Javadoc)
|
|
* @see java.lang.Object#toString()
|
|
*/
|
|
@Override
|
|
public String toString() {
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
builder.append("TaskConfiguration [taskId=");
|
|
builder.append(taskId);
|
|
builder.append(", taskDescription=");
|
|
builder.append(taskDescription);
|
|
builder.append(", token=");
|
|
builder.append(maskedToken);
|
|
builder.append(", workspaceItemId=");
|
|
builder.append(workspaceItemId);
|
|
builder.append(", mapParameters=");
|
|
builder.append(mapParameters);
|
|
builder.append(", configurationKey=");
|
|
builder.append(configurationKey);
|
|
builder.append("]");
|
|
return builder.toString();
|
|
}
|
|
}
|