Project p = ((Project) parent); Dataset d = ((Dataset) child); Set links = d.findProjectDatasetLink(p); if (links != null) { Iterator i = links.iterator(); int j = 0;  while (i.hasNext()) { System.out.println("creation: "+j); p.addProjectDatasetLink((ProjectDatasetLink)  i.next(), false); }
Project p = (Project) parent; Dataset d = (Dataset) child; ProjectDatasetLink link; Iterator it = d.iterateProjectLinks(); while (it.hasNext()) { link = (ProjectDatasetLink) it.next(); if (p.getId().equals(link.parent().getId())) p.addProjectDatasetLink(link, false);
    public static void linkParentToChild(IObject child, IObject parent)    {        if (parent == null) return;        if (child == null) throw new IllegalArgumentException("Child cannot" +                                "be null.");        if (parent instanceof Project) {            if (!(child instanceof Dataset))                throw new IllegalArgumentException("Child not valid.");            Project p = ((Project) parent);            Dataset d = ((Dataset) child);            Set links = d.findProjectDatasetLink(p);            if (links != null) {                Iterator i = links.iterator();                int j = 0;                                while (i.hasNext()) {                    System.out.println("creation: "+j);                    p.addProjectDatasetLink((ProjectDatasetLink)  i.next(), false);                }            }            //((ProjectData) parent).getDatasets().add(child);           // (parent.asProject()).linkDataset(child.asDataset());        }     }