Obtain relationship target objects of a DataObject

From: Andreas Hartmann (andrea..pache.org)
Date: Sun Sep 20 2009 - 17:49:46 EDT

  • Next message: Andrus Adamchik: "Re: Obtain relationship target objects of a DataObject"

    Hi everyone,

    I'd like to write some generic code to replace the set of related
    objects of a DataObject with a different set of objects. But I can't
    figure out how to get the list of the target objects.

    Here's some naiive code to illustrate what I'd like to achieve:

    final List<DataObject> oldObjects = (List<DataObject>)
    object.readProperty(name);

    for (final DataObject targetObj : oldObjects) {
         object.removeToManyTarget(name, targetObj, true);
    }

    for (final DataObject targetObj : newObjects) {
         object.addToManyTarget(name, targetObj, true);
    }

    But apparently object.readProperty(…) doesn't return a list of the
    existing target objects.

    What would be the correct way to do this?

    Thanks a lot in advance!

    -- Andreas

    -- 
    Andreas Hartmann, CTO
    BeCompany GmbH
    http://www.becompany.ch
    Tel.: +41 (0) 43 818 57 01
    



    This archive was generated by hypermail 2.0.0 : Sun Sep 20 2009 - 17:50:53 EDT