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 be.cytomine.client.AbstractImage; import be.cytomine.client.Server; import org.json.simple.JSONObject; /** * A real image store on disk, see 'image instance' for an image link in a project * * @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 AbstractAbstractImage 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 exact image full filename * */ protected String filename; /** * The image short filename (will be show in GUI) * */ protected String originalFilename; /** * The instrument that digitalize the image * */ protected Long scanner; /** * The source of the image (human, annimal,...) * */ protected Long sample; /** * The full image path directory * */ protected String path; /** * The image type. For creation, use the ext (not the mime id!) * */ protected Long mime; /** * The image width lenght * */ protected Integer width; /** * The image height lenght * */ protected Integer height; /** * Undefined * */ protected Object depth; /** * The image resolution (microm per pixel) * */ protected Double resolution; /** * The image max zoom * */ protected Integer magnification; /** * URL to get abstract image short view (htumb) * */ protected String thumb; /** * Undefined * */ protected Object fullPath; /** * Undefined * */ protected Object macroURL; /** * URL to get image file metadata * */ protected String metadataUrl; /** * The image owner * */ protected Long user; /** * * @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 exact image full filename */ public String getFilename() throws Exception { return filename; } /** * * @param filename * The exact image full filename */ public void setFilename(String filename) throws Exception { this.filename = filename; } /** * * @return * The image short filename (will be show in GUI) */ public String getOriginalFilename() throws Exception { return originalFilename; } /** * * @return * The instrument that digitalize the image */ public Long getScanner() throws Exception { return scanner; } /** * * @param scanner * The instrument that digitalize the image */ public void setScanner(Long scanner) throws Exception { this.scanner = scanner; } /** * * @return * The source of the image (human, annimal,...) */ public Long getSample() throws Exception { return sample; } /** * * @param sample * The source of the image (human, annimal,...) */ public void setSample(Long sample) throws Exception { this.sample = sample; } /** * * @return * The full image path directory */ public String getPath() throws Exception { return path; } /** * * @param path * The full image path directory */ public void setPath(String path) throws Exception { this.path = path; } /** * * @return * The image type. For creation, use the ext (not the mime id!) */ public Long getMime() throws Exception { return mime; } /** * * @param mime * The image type. For creation, use the ext (not the mime id!) */ public void setMime(Long mime) throws Exception { this.mime = mime; } /** * * @return * The image width lenght */ public Integer getWidth() throws Exception { return width; } /** * * @param width * The image width lenght */ public void setWidth(Integer width) throws Exception { this.width = width; } /** * * @return * The image height lenght */ public Integer getHeight() throws Exception { return height; } /** * * @param height * The image height lenght */ public void setHeight(Integer height) throws Exception { this.height = height; } /** * * @return * Undefined */ public Object getDepth() throws Exception { return depth; } /** * * @param depth * Undefined */ public void setDepth(Object depth) throws Exception { this.depth = depth; } /** * * @return * The image resolution (microm per pixel) */ public Double getResolution() throws Exception { return resolution; } /** * * @param resolution * The image resolution (microm per pixel) */ public void setResolution(Double resolution) throws Exception { this.resolution = resolution; } /** * * @return * The image max zoom */ public Integer getMagnification() throws Exception { return magnification; } /** * * @param magnification * The image max zoom */ public void setMagnification(Integer magnification) throws Exception { this.magnification = magnification; } /** * * @return * URL to get abstract image short view (htumb) */ public String getThumb() throws Exception { return thumb; } /** * * @return * Undefined */ public Object getFullPath() throws Exception { return fullPath; } /** * * @param fullPath * Undefined */ public void setFullPath(Object fullPath) throws Exception { this.fullPath = fullPath; } /** * * @return * Undefined */ public Object getMacroURL() throws Exception { return macroURL; } /** * * @param macroURL * Undefined */ public void setMacroURL(Object macroURL) throws Exception { this.macroURL = macroURL; } /** * * @return * URL to get image file metadata */ public String getMetadataUrl() throws Exception { return metadataUrl; } /** * * @param user * The image owner */ public void setUser(Long user) throws Exception { this.user = user; } public void build(String filename, String path, Long mime, Double resolution, Integer magnification) throws Exception { this.filename=filename; this.path=path; this.mime=mime; this.resolution=resolution; this.magnification=magnification; } 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.filename =JSONUtils.extractJSONString(json.get("filename")); this.originalFilename =JSONUtils.extractJSONString(json.get("originalFilename")); this.scanner =JSONUtils.extractJSONLong(json.get("scanner")); this.sample =JSONUtils.extractJSONLong(json.get("sample")); this.path =JSONUtils.extractJSONString(json.get("path")); this.mime =JSONUtils.extractJSONLong(json.get("mime")); this.width =JSONUtils.extractJSONInteger(json.get("width")); this.height =JSONUtils.extractJSONInteger(json.get("height")); this.depth =JSONUtils.extractJSONObject(json.get("depth")); this.resolution =JSONUtils.extractJSONDouble(json.get("resolution")); this.magnification =JSONUtils.extractJSONInteger(json.get("magnification")); this.thumb =JSONUtils.extractJSONString(json.get("thumb")); this.fullPath =JSONUtils.extractJSONObject(json.get("fullPath")); this.macroURL =JSONUtils.extractJSONObject(json.get("macroURL")); this.metadataUrl =JSONUtils.extractJSONString(json.get("metadataUrl")); this.user =JSONUtils.extractJSONLong(json.get("user")); } 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("filename",JSONUtils.formatJSON(this.filename)); json.put("originalFilename",JSONUtils.formatJSON(this.originalFilename)); json.put("scanner",JSONUtils.formatJSON(this.scanner)); 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("depth",JSONUtils.formatJSON(this.depth)); json.put("resolution",JSONUtils.formatJSON(this.resolution)); json.put("magnification",JSONUtils.formatJSON(this.magnification)); json.put("thumb",JSONUtils.formatJSON(this.thumb)); json.put("fullPath",JSONUtils.formatJSON(this.fullPath)); json.put("macroURL",JSONUtils.formatJSON(this.macroURL)); json.put("metadataUrl",JSONUtils.formatJSON(this.metadataUrl)); return json; } public static AbstractImage get(Server server, Long id) throws Exception { String path = "/api/abstractimage/{id}.json?"; path = path.replace("{id}",id+""); JSONObject json = server.doGET(path); AbstractImage domain = new AbstractImage(); domain.build(json); return domain; } public static Object metadata(Server server, Long id, Boolean extract) throws Exception { throw new Exception("Not yet implemented"); } public static Object label(Server server, Long id, String label) throws Exception { throw new Exception("Not yet implemented"); } public static Object preview(Server server, Long id) throws Exception { throw new Exception("Not yet implemented"); } public static Object thumb(Server server, Long id) throws Exception { throw new Exception("Not yet implemented"); } public static Object imageServers(Server server, Long id, Boolean merge, List channels, List colors) throws Exception { throw new Exception("Not yet implemented"); } public static Object associated(Server server, Long id, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public static Object imageProperties(Server server, Long id, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public static Object imageProperty(Server server, Long id, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public static AbstractImage listByProject(Server server, Long id, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public void add(Server server) throws Exception { String path = "/api/abstractimage.json?"; JSONObject json = server.doPOST(path,this.toJSON()); this.build((JSONObject)json.get("abstractimage")); } public static AbstractImage list(Server server, Long project, String sortColumn, String sortDirection, String search, Integer max, Integer offset) throws Exception { throw new Exception("Not yet implemented"); } public void delete(Server server) throws Exception { String path = "/api/abstractimage/{id}.json?"; path = path.replace("{id}",getId()+""); server.doDELETE(path); build(new JSONObject()); } public void edit(Server server) throws Exception { String path = "/api/abstractimage/{id}.json?"; path = path.replace("{id}",getId()+""); JSONObject json = server.doPUT(path,this.toJSON()); this.build((JSONObject)json.get("abstractimage")); } }