gateway.deleteObject(link,  (new PojoOptions()).map());
gateway.deleteObject(link);
    public void cutAndPaste(Map toPaste, Map toCut)            throws DSOutOfServiceException, DSAccessException    {        /*        try {        if ((toPaste == null || toCut == null) ||             (toPaste.size() == 0 || toCut.size() == 0)) {            throw new IllegalArgumentException("No data to cut and Paste.");        }                Iterator i = toPaste.keySet().iterator();        DataObject parent;        while (i.hasNext()) {            parent = (DataObject) i.next();            paste(parent, (Set) toPaste.get(parent));        }                i = toCut.keySet().iterator();        while (i.hasNext()) {            parent = (DataObject) i.next();            //removeDataObjects((Set) toCut.get(parent), parent);            cut(parent, (Set) toCut.get(parent));        }                        } catch (Exception e) {            e.printStackTrace();        }        */                        Iterator i = toPaste.keySet().iterator();        DataObject parent = null;        IObject[] children;        ImageData img = null;        while (i.hasNext()) {            System.out.println("to paste 0");            parent = (DataObject) i.next();            Set imgs = (Set) toPaste.get(parent);            Iterator j = imgs.iterator();            while (j.hasNext()) {                img = (ImageData) j.next();             }        }        Image ioObject = null;        Dataset mParent = parent.asDataset();        DatasetImageLink l = new DatasetImageLink();        ioObject = (Image) gateway.updateObject(img.asIObject(),                 (new PojoOptions()).map());        l.link(mParent, ioObject);        gateway.createObject(l, (new PojoOptions()).map());        i = toCut.keySet().iterator();        while (i.hasNext()) {            System.out.println("to remove 0");            parent = (DataObject) i.next();            Set imgs = (Set) toCut.get(parent);            Iterator k = imgs.iterator();            while (k.hasNext()) {                img = (ImageData) k.next();                            }            ioObject = (Image) gateway.updateObject(img.asIObject(),                     (new PojoOptions()).map());        }        mParent = parent.asDataset();        List links = ioObject.collectDatasetLinks(null);        i = links.iterator();        DatasetImageLink link = null;        while (i.hasNext()) {            System.out.println("to remove");            link = (DatasetImageLink) i.next();            if (link.getParent().getId() == mParent.getId()) break;          }        gateway.deleteObject(link,  (new PojoOptions()).map());           }