Image m = new Image(new Long(annotatedObject.getId()), false);
Image m = new Image(annotatedObject.getId(), false);
    public static IObject createAnnotation(IObject annotatedObject,                                    AnnotationData data)    {        if (annotatedObject instanceof Dataset) {            Dataset m = (Dataset) annotatedObject;             DatasetAnnotation annotation = new DatasetAnnotation();            annotation.setContent(data.getText());            annotation.setDataset(m);            return annotation;        } else if (annotatedObject instanceof ImageData) {            Image m = new Image(new Long(annotatedObject.getId()), false);            ImageAnnotation annotation = new ImageAnnotation();            annotation.setContent(data.getText());            annotation.setImage(m);            return annotation;        }        throw new IllegalArgumentException("DataObject cannot be annotated.");    }