package be.cytomine.client.abst;
import be.cytomine.client.*;
import java.util.*;
import org.json.simple.*;
import java.util.Date;
import java.util.List;
import org.json.simple.JSONObject;
/**
* A job is a software instance. This is the execution of software with some parameters
*
* @author ClientBuilder (Loïc Rollus)
* @version 0.1
*
* DO NOT EDIT THIS FILE. THIS IS CODE IS BUILD AUTOMATICALY. ALL CHANGE WILL BE LOST AFTER NEXT GENERATION.
*
* IF YOU WANT TO EDIT A DOMAIN FILE (change method, add property,...), JUST EDIT THE CHILD FILE “YourDomain.java” instead of this file “AbstractYourDomain.java”. I WON'T BE CLEAR IF IT ALREADY EXIST.
*
*/
public abstract class AbstractJob
extends AbstractDomain
{
/**
* The full class name of the domain
*
*/
protected String clazz;
/**
* The domain id
*
*/
protected Long id;
/**
* The date of the domain creation
*
*/
protected Date created;
/**
* The date of the domain modification
*
*/
protected Date updated;
/**
* When domain was removed from Cytomine
*
*/
protected Date deleted;
/**
* The algo type based on the class name
*
*/
protected String algoType;
/**
* The algo progression (from 0 to 100)
*
*/
protected Integer progress;
/**
* The algo status (NOTLAUNCH = 0, INQUEUE = 1, RUNNING = 2,SUCCESS = 3,FAILED = 4,INDETERMINATE = 5,WAIT = 6,PREVIEWED = 7)
*
*/
protected Integer status;
/**
* Job Indice for this software in this project
*
*/
protected Integer number;
/**
* Text comment for the job status
*
*/
protected String statusComment;
/**
* The project of the job
*
*/
protected Long project;
/**
* The software of the job
*
*/
protected Long software;
/**
* The software name of the job
*
*/
protected String softwareName;
/**
* Generic field for job rate info. The rate is a quality value about the job works
*
*/
protected Double rate;
/**
* Flag to see if data generate by this job are deleted
*
*/
protected Boolean dataDeleted;
/**
* The username of the job
*
*/
protected String username;
/**
* The user of the job
*
*/
protected Long userJob;
/**
* List of job parameters for this job
*
*/
protected List jobParameters;
/**
*
* @return
* The full class name of the domain
*/
public String getClazz()
throws Exception
{
return clazz;
}
/**
*
* @return
* The domain id
*/
public Long getId()
throws Exception
{
return id;
}
/**
*
* @return
* The date of the domain creation
*/
public Date getCreated()
throws Exception
{
return created;
}
/**
*
* @return
* The date of the domain modification
*/
public Date getUpdated()
throws Exception
{
return updated;
}
/**
*
* @return
* When domain was removed from Cytomine
*/
public Date getDeleted()
throws Exception
{
return deleted;
}
/**
*
* @return
* The algo type based on the class name
*/
public String getAlgoType()
throws Exception
{
return algoType;
}
/**
*
* @return
* The algo progression (from 0 to 100)
*/
public Integer getProgress()
throws Exception
{
return progress;
}
/**
*
* @param progress
* The algo progression (from 0 to 100)
*/
public void setProgress(Integer progress)
throws Exception
{
this.progress = progress;
}
/**
*
* @return
* The algo status (NOTLAUNCH = 0, INQUEUE = 1, RUNNING = 2,SUCCESS = 3,FAILED = 4,INDETERMINATE = 5,WAIT = 6,PREVIEWED = 7)
*/
public Integer getStatus()
throws Exception
{
return status;
}
/**
*
* @param status
* The algo status (NOTLAUNCH = 0, INQUEUE = 1, RUNNING = 2,SUCCESS = 3,FAILED = 4,INDETERMINATE = 5,WAIT = 6,PREVIEWED = 7)
*/
public void setStatus(Integer status)
throws Exception
{
this.status = status;
}
/**
*
* @return
* Job Indice for this software in this project
*/
public Integer getNumber()
throws Exception
{
return number;
}
/**
*
* @return
* Text comment for the job status
*/
public String getStatusComment()
throws Exception
{
return statusComment;
}
/**
*
* @param statusComment
* Text comment for the job status
*/
public void setStatusComment(String statusComment)
throws Exception
{
this.statusComment = statusComment;
}
/**
*
* @return
* The project of the job
*/
public Long getProject()
throws Exception
{
return project;
}
/**
*
* @param project
* The project of the job
*/
public void setProject(Long project)
throws Exception
{
this.project = project;
}
/**
*
* @return
* The software of the job
*/
public Long getSoftware()
throws Exception
{
return software;
}
/**
*
* @param software
* The software of the job
*/
public void setSoftware(Long software)
throws Exception
{
this.software = software;
}
/**
*
* @return
* The software name of the job
*/
public String getSoftwareName()
throws Exception
{
return softwareName;
}
/**
*
* @return
* Generic field for job rate info. The rate is a quality value about the job works
*/
public Double getRate()
throws Exception
{
return rate;
}
/**
*
* @param rate
* Generic field for job rate info. The rate is a quality value about the job works
*/
public void setRate(Double rate)
throws Exception
{
this.rate = rate;
}
/**
*
* @return
* Flag to see if data generate by this job are deleted
*/
public Boolean getDataDeleted()
throws Exception
{
return dataDeleted;
}
/**
*
* @param dataDeleted
* Flag to see if data generate by this job are deleted
*/
public void setDataDeleted(Boolean dataDeleted)
throws Exception
{
this.dataDeleted = dataDeleted;
}
/**
*
* @return
* The username of the job
*/
public String getUsername()
throws Exception
{
return username;
}
/**
*
* @return
* The user of the job
*/
public Long getUserJob()
throws Exception
{
return userJob;
}
/**
*
* @return
* List of job parameters for this job
*/
public List getJobParameters()
throws Exception
{
return jobParameters;
}
public void build(Long project, Long software)
throws Exception
{
this.project=project;
this.software=software;
}
public void build(JSONObject json)
throws Exception
{
this.clazz =JSONUtils.extractJSONString(json.get("class"));
this.id =JSONUtils.extractJSONLong(json.get("id"));
this.created =JSONUtils.extractJSONDate(json.get("created"));
this.updated =JSONUtils.extractJSONDate(json.get("updated"));
this.deleted =JSONUtils.extractJSONDate(json.get("deleted"));
this.algoType =JSONUtils.extractJSONString(json.get("algoType"));
this.progress =JSONUtils.extractJSONInteger(json.get("progress"));
this.status =JSONUtils.extractJSONInteger(json.get("status"));
this.number =JSONUtils.extractJSONInteger(json.get("number"));
this.statusComment =JSONUtils.extractJSONString(json.get("statusComment"));
this.project =JSONUtils.extractJSONLong(json.get("project"));
this.software =JSONUtils.extractJSONLong(json.get("software"));
this.softwareName =JSONUtils.extractJSONString(json.get("softwareName"));
this.rate =JSONUtils.extractJSONDouble(json.get("rate"));
this.dataDeleted =JSONUtils.extractJSONBoolean(json.get("dataDeleted"));
this.username =JSONUtils.extractJSONString(json.get("username"));
this.userJob =JSONUtils.extractJSONLong(json.get("userJob"));
this.jobParameters =JSONUtils.extractJSONList(json.get("jobParameters"));
}
public JSONObject toJSON()
throws Exception
{
JSONObject json=new JSONObject();
json.put("class",JSONUtils.formatJSON(this.clazz));
json.put("id",JSONUtils.formatJSON(this.id));
json.put("created",JSONUtils.formatJSON(this.created));
json.put("updated",JSONUtils.formatJSON(this.updated));
json.put("deleted",JSONUtils.formatJSON(this.deleted));
json.put("algoType",JSONUtils.formatJSON(this.algoType));
json.put("progress",JSONUtils.formatJSON(this.progress));
json.put("status",JSONUtils.formatJSON(this.status));
json.put("number",JSONUtils.formatJSON(this.number));
json.put("statusComment",JSONUtils.formatJSON(this.statusComment));
json.put("project",JSONUtils.formatJSON(this.project));
json.put("software",JSONUtils.formatJSON(this.software));
json.put("softwareName",JSONUtils.formatJSON(this.softwareName));
json.put("rate",JSONUtils.formatJSON(this.rate));
json.put("dataDeleted",JSONUtils.formatJSON(this.dataDeleted));
json.put("username",JSONUtils.formatJSON(this.username));
json.put("userJob",JSONUtils.formatJSON(this.userJob));
json.put("jobParameters",JSONUtils.formatJSON(this.jobParameters));
return json;
}
}