package be.cytomine.client.abst;
import be.cytomine.client.*;
import java.util.*;
import org.json.simple.*;
import java.util.Date;
import be.cytomine.client.ImageInstance;
import be.cytomine.client.ProjectSharingSameImage;
import be.cytomine.client.Server;
import org.json.simple.JSONObject;
/**
* A link between 'abstract image' and 'project'. An 'abstract image' may be in multiple projects.
*
* @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 AbstractImageInstance
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 image linked to the project
*
*/
protected Long baseImage;
/**
* The project that keeps the image
*
*/
protected Long project;
/**
* The user that add the image to the project
*
*/
protected Long user;
/**
* Abstract image filename (see Abstract Image)
*
*/
protected String filename;
/**
* Undefined
*
*/
protected Object extension;
/**
* Abstract image original filename (see Abstract Image)
*
*/
protected String originalFilename;
/**
* Abstract image sample (see Abstract Image)
*
*/
protected Long sample;
/**
* Abstract image path (see Abstract Image)
*
*/
protected String path;
/**
* Abstract image mime (see Abstract Image)
*
*/
protected String mime;
/**
* Abstract image width (see Abstract Image)
*
*/
protected Integer width;
/**
* Abstract image height (see Abstract Image)
*
*/
protected Integer height;
/**
* Abstract image resolution (see Abstract Image)
*
*/
protected Double resolution;
/**
* Abstract image magnification (see Abstract Image)
*
*/
protected Integer magnification;
/**
* ?
*
*/
protected Long depth;
/**
* Abstract image preview (see Abstract Image)
*
*/
protected String preview;
/**
* Abstract image thumb (see Abstract Image)
*
*/
protected String thumb;
/**
* Undefined
*
*/
protected Object macro;
/**
* The number of user annotation in the image
*
*/
protected Long numberOfAnnotations;
/**
* The number of job annotation in the image
*
*/
protected Long numberOfJobAnnotations;
/**
* The number of reviewed annotation in the image
*
*/
protected Long numberOfReviewedAnnotations;
/**
* The start review date
*
*/
protected Date reviewStart;
/**
* The stop review date
*
*/
protected Date reviewStop;
/**
* The user who reviewed (or still reviewing) this image
*
*/
protected Long reviewUser;
/**
* Image has been reviewed
*
*/
protected Boolean reviewed;
/**
* Image currently reviewed
*
*/
protected Boolean inReview;
/**
*
* @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 image linked to the project
*/
public Long getBaseImage()
throws Exception
{
return baseImage;
}
/**
*
* @param baseImage
* The image linked to the project
*/
public void setBaseImage(Long baseImage)
throws Exception
{
this.baseImage = baseImage;
}
/**
*
* @return
* The project that keeps the image
*/
public Long getProject()
throws Exception
{
return project;
}
/**
*
* @param project
* The project that keeps the image
*/
public void setProject(Long project)
throws Exception
{
this.project = project;
}
/**
*
* @return
* The user that add the image to the project
*/
public Long getUser()
throws Exception
{
return user;
}
/**
*
* @param user
* The user that add the image to the project
*/
public void setUser(Long user)
throws Exception
{
this.user = user;
}
/**
*
* @return
* Abstract image filename (see Abstract Image)
*/
public String getFilename()
throws Exception
{
return filename;
}
/**
*
* @return
* Undefined
*/
public Object getExtension()
throws Exception
{
return extension;
}
/**
*
* @param extension
* Undefined
*/
public void setExtension(Object extension)
throws Exception
{
this.extension = extension;
}
/**
*
* @return
* Abstract image original filename (see Abstract Image)
*/
public String getOriginalFilename()
throws Exception
{
return originalFilename;
}
/**
*
* @return
* Abstract image sample (see Abstract Image)
*/
public Long getSample()
throws Exception
{
return sample;
}
/**
*
* @return
* Abstract image path (see Abstract Image)
*/
public String getPath()
throws Exception
{
return path;
}
/**
*
* @return
* Abstract image mime (see Abstract Image)
*/
public String getMime()
throws Exception
{
return mime;
}
/**
*
* @return
* Abstract image width (see Abstract Image)
*/
public Integer getWidth()
throws Exception
{
return width;
}
/**
*
* @return
* Abstract image height (see Abstract Image)
*/
public Integer getHeight()
throws Exception
{
return height;
}
/**
*
* @return
* Abstract image resolution (see Abstract Image)
*/
public Double getResolution()
throws Exception
{
return resolution;
}
/**
*
* @return
* Abstract image magnification (see Abstract Image)
*/
public Integer getMagnification()
throws Exception
{
return magnification;
}
/**
*
* @return
* ?
*/
public Long getDepth()
throws Exception
{
return depth;
}
/**
*
* @return
* Abstract image preview (see Abstract Image)
*/
public String getPreview()
throws Exception
{
return preview;
}
/**
*
* @return
* Abstract image thumb (see Abstract Image)
*/
public String getThumb()
throws Exception
{
return thumb;
}
/**
*
* @return
* Undefined
*/
public Object getMacro()
throws Exception
{
return macro;
}
/**
*
* @param macro
* Undefined
*/
public void setMacro(Object macro)
throws Exception
{
this.macro = macro;
}
/**
*
* @return
* The number of user annotation in the image
*/
public Long getNumberOfAnnotations()
throws Exception
{
return numberOfAnnotations;
}
/**
*
* @return
* The number of job annotation in the image
*/
public Long getNumberOfJobAnnotations()
throws Exception
{
return numberOfJobAnnotations;
}
/**
*
* @return
* The number of reviewed annotation in the image
*/
public Long getNumberOfReviewedAnnotations()
throws Exception
{
return numberOfReviewedAnnotations;
}
/**
*
* @return
* The start review date
*/
public Date getReviewStart()
throws Exception
{
return reviewStart;
}
/**
*
* @return
* The stop review date
*/
public Date getReviewStop()
throws Exception
{
return reviewStop;
}
/**
*
* @return
* The user who reviewed (or still reviewing) this image
*/
public Long getReviewUser()
throws Exception
{
return reviewUser;
}
/**
*
* @return
* Image has been reviewed
*/
public Boolean getReviewed()
throws Exception
{
return reviewed;
}
/**
*
* @return
* Image currently reviewed
*/
public Boolean getInReview()
throws Exception
{
return inReview;
}
public void build(Long baseImage, Long project, Long user)
throws Exception
{
this.baseImage=baseImage;
this.project=project;
this.user=user;
}
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.baseImage =JSONUtils.extractJSONLong(json.get("baseImage"));
this.project =JSONUtils.extractJSONLong(json.get("project"));
this.user =JSONUtils.extractJSONLong(json.get("user"));
this.filename =JSONUtils.extractJSONString(json.get("filename"));
this.extension =JSONUtils.extractJSONObject(json.get("extension"));
this.originalFilename =JSONUtils.extractJSONString(json.get("originalFilename"));
this.sample =JSONUtils.extractJSONLong(json.get("sample"));
this.path =JSONUtils.extractJSONString(json.get("path"));
this.mime =JSONUtils.extractJSONString(json.get("mime"));
this.width =JSONUtils.extractJSONInteger(json.get("width"));
this.height =JSONUtils.extractJSONInteger(json.get("height"));
this.resolution =JSONUtils.extractJSONDouble(json.get("resolution"));
this.magnification =JSONUtils.extractJSONInteger(json.get("magnification"));
this.depth =JSONUtils.extractJSONLong(json.get("depth"));
this.preview =JSONUtils.extractJSONString(json.get("preview"));
this.thumb =JSONUtils.extractJSONString(json.get("thumb"));
this.macro =JSONUtils.extractJSONObject(json.get("macro"));
this.numberOfAnnotations =JSONUtils.extractJSONLong(json.get("numberOfAnnotations"));
this.numberOfJobAnnotations =JSONUtils.extractJSONLong(json.get("numberOfJobAnnotations"));
this.numberOfReviewedAnnotations =JSONUtils.extractJSONLong(json.get("numberOfReviewedAnnotations"));
this.reviewStart =JSONUtils.extractJSONDate(json.get("reviewStart"));
this.reviewStop =JSONUtils.extractJSONDate(json.get("reviewStop"));
this.reviewUser =JSONUtils.extractJSONLong(json.get("reviewUser"));
this.reviewed =JSONUtils.extractJSONBoolean(json.get("reviewed"));
this.inReview =JSONUtils.extractJSONBoolean(json.get("inReview"));
}
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("baseImage",JSONUtils.formatJSON(this.baseImage));
json.put("project",JSONUtils.formatJSON(this.project));
json.put("user",JSONUtils.formatJSON(this.user));
json.put("filename",JSONUtils.formatJSON(this.filename));
json.put("extension",JSONUtils.formatJSON(this.extension));
json.put("originalFilename",JSONUtils.formatJSON(this.originalFilename));
json.put("sample",JSONUtils.formatJSON(this.sample));
json.put("path",JSONUtils.formatJSON(this.path));
json.put("mime",JSONUtils.formatJSON(this.mime));
json.put("width",JSONUtils.formatJSON(this.width));
json.put("height",JSONUtils.formatJSON(this.height));
json.put("resolution",JSONUtils.formatJSON(this.resolution));
json.put("magnification",JSONUtils.formatJSON(this.magnification));
json.put("depth",JSONUtils.formatJSON(this.depth));
json.put("preview",JSONUtils.formatJSON(this.preview));
json.put("thumb",JSONUtils.formatJSON(this.thumb));
json.put("macro",JSONUtils.formatJSON(this.macro));
json.put("numberOfAnnotations",JSONUtils.formatJSON(this.numberOfAnnotations));
json.put("numberOfJobAnnotations",JSONUtils.formatJSON(this.numberOfJobAnnotations));
json.put("numberOfReviewedAnnotations",JSONUtils.formatJSON(this.numberOfReviewedAnnotations));
json.put("reviewStart",JSONUtils.formatJSON(this.reviewStart));
json.put("reviewStop",JSONUtils.formatJSON(this.reviewStop));
json.put("reviewUser",JSONUtils.formatJSON(this.reviewUser));
json.put("reviewed",JSONUtils.formatJSON(this.reviewed));
json.put("inReview",JSONUtils.formatJSON(this.inReview));
return json;
}
public static ImageInstance get(Server server, Long id)
throws Exception
{
String path = "/api/imageinstance/{id}.json?";
path = path.replace("{id}",id+"");
JSONObject json = server.doGET(path);
ImageInstance domain = new ImageInstance();
domain.build(json);
return domain;
}
public static ImageInstance listByUser(Server server, Integer max, Integer offset)
throws Exception
{
throw new Exception("Not yet implemented");
}
public static ProjectSharingSameImage retrieveSameImageOtherProject(Server server, Long id, Long project, Integer max, Integer offset)
throws Exception
{
throw new Exception("Not yet implemented");
}
public static Object copyAnnotationFromSameAbstractImage(Server server, Long id, Long task, Boolean giveMe, Object layers, Integer max, Integer offset)
throws Exception
{
throw new Exception("Not yet implemented");
}
public static ImageInstance listLastOpenImage(Server server, Integer max, Integer offset)
throws Exception
{
throw new Exception("Not yet implemented");
}
public static Object copyMetadata(Server server, Long id, Long based)
throws Exception
{
throw new Exception("Not yet implemented");
}
public static ImageInstance listByProject(Server server, Long id, Boolean tree, String sortColumn, String sortDirection, String search, Integer max, Integer offset)
throws Exception
{
throw new Exception("Not yet implemented");
}
public void add(Server server)
throws Exception
{
String path = "/api/imageinstance.json?";
JSONObject json = server.doPOST(path,this.toJSON());
this.build((JSONObject)json.get("imageinstance"));
}
public static ImageInstance next(Server server, Long id, Integer max, Integer offset)
throws Exception
{
throw new Exception("Not yet implemented");
}
public void delete(Server server)
throws Exception
{
String path = "/api/imageinstance/{id}.json?";
path = path.replace("{id}",getId()+"");
server.doDELETE(path);
build(new JSONObject());
}
public static ImageInstance previous(Server server, Long id, Integer max, Integer offset)
throws Exception
{
throw new Exception("Not yet implemented");
}
public void edit(Server server)
throws Exception
{
String path = "/api/imageinstance/{id}.json?";
path = path.replace("{id}",getId()+"");
JSONObject json = server.doPUT(path,this.toJSON());
this.build((JSONObject)json.get("imageinstance"));
}
}