package be.cytomine.client.abst; import be.cytomine.client.*; import java.util.*; import org.json.simple.*; import java.util.Date; import be.cytomine.client.ImageSequence; import be.cytomine.client.SequencePossibilties; import be.cytomine.client.Server; import org.json.simple.JSONObject; /** * A position of an image in the image group * * @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 AbstractImageSequence 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 * */ protected Long image; /** * The image zStack * */ protected Integer zStack; /** * The image slice * */ protected Integer slice; /** * The image time * */ protected Integer time; /** * The image channel * */ protected Integer channel; /** * The image group * */ protected Long imageGroup; /** * The image instance full data (see image instance for more details) * */ protected Object model; /** * * @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 */ public Long getImage() throws Exception { return image; } /** * * @param image * The image */ public void setImage(Long image) throws Exception { this.image = image; } /** * * @return * The image zStack */ public Integer getZStack() throws Exception { return zStack; } /** * * @param zStack * The image zStack */ public void setZStack(Integer zStack) throws Exception { this.zStack = zStack; } /** * * @return * The image slice */ public Integer getSlice() throws Exception { return slice; } /** * * @param slice * The image slice */ public void setSlice(Integer slice) throws Exception { this.slice = slice; } /** * * @return * The image time */ public Integer getTime() throws Exception { return time; } /** * * @param time * The image time */ public void setTime(Integer time) throws Exception { this.time = time; } /** * * @return * The image channel */ public Integer getChannel() throws Exception { return channel; } /** * * @param channel * The image channel */ public void setChannel(Integer channel) throws Exception { this.channel = channel; } /** * * @return * The image group */ public Long getImageGroup() throws Exception { return imageGroup; } /** * * @param imageGroup * The image group */ public void setImageGroup(Long imageGroup) throws Exception { this.imageGroup = imageGroup; } /** * * @return * The image instance full data (see image instance for more details) */ public Object getModel() throws Exception { return model; } public void build(Long image, Long imageGroup) throws Exception { this.image=image; this.imageGroup=imageGroup; } 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.image =JSONUtils.extractJSONLong(json.get("image")); this.zStack =JSONUtils.extractJSONInteger(json.get("zStack")); this.slice =JSONUtils.extractJSONInteger(json.get("slice")); this.time =JSONUtils.extractJSONInteger(json.get("time")); this.channel =JSONUtils.extractJSONInteger(json.get("channel")); this.imageGroup =JSONUtils.extractJSONLong(json.get("imageGroup")); this.model =JSONUtils.extractJSONObject(json.get("model")); } 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("image",JSONUtils.formatJSON(this.image)); json.put("zStack",JSONUtils.formatJSON(this.zStack)); json.put("slice",JSONUtils.formatJSON(this.slice)); json.put("time",JSONUtils.formatJSON(this.time)); json.put("channel",JSONUtils.formatJSON(this.channel)); json.put("imageGroup",JSONUtils.formatJSON(this.imageGroup)); json.put("model",JSONUtils.formatJSON(this.model)); return json; } public static ImageSequence get(Server server, Long id) throws Exception { String path = "/api/imagesequence/{id}.json?"; path = path.replace("{id}",id+""); JSONObject json = server.doGET(path); ImageSequence domain = new ImageSequence(); domain.build(json); return domain; } public static ImageSequence listByImageGroup(Server server, Long id, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public static ImageSequence getByImageInstance(Server server, Long id, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public static SequencePossibilties getSequenceInfo(Server server, Long id) throws Exception { throw new Exception("Not yet implemented"); } public static ImageSequence getByImageGroupAndIndex(Server server, Long id, Long zstack, Long time, Long channel, Long slice, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public void add(Server server) throws Exception { String path = "/api/imagesequence.json?"; JSONObject json = server.doPOST(path,this.toJSON()); this.build((JSONObject)json.get("imagesequence")); } public void delete(Server server) throws Exception { String path = "/api/imagesequence/{id}.json?"; path = path.replace("{id}",getId()+""); server.doDELETE(path); build(new JSONObject()); } public void edit(Server server) throws Exception { String path = "/api/imagesequence/{id}.json?"; JSONObject json = server.doPUT(path,this.toJSON()); this.build((JSONObject)json.get("imagesequence")); } }