Re: Modeler and CAY-322

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jun 14 2005 - 19:50:27 EDT

  • Next message: Mike Kienenberger: "Re: Modeler and CAY-322"

    > Is this going to cause a problem? Does the modeler use the DataMap
    > namespace? Should model.getMap() be cloned in the call? And if
    > so, how?

    Namespace is set in the Modeler whenever a DataMap is loaded within
    domain (or added to a domain via "New DataMap" action), Domain's
    EntityResolver automatically sets itself as DataMap's parent
    namespace (see EntityResolver.addDataMap(..)). So yes, if you reset
    it during class generation to something else this will cause problems.

    So I would suggest to move namespace "injection" functionality to the
    Ant API. E.g. pass an instance of EntityResolver to
    CayenneGenerator.loadDataMap and loadAdditionalDataMaps(). Is this
    not desirable for some reason?

    As for generating classes from the Modeler, I think it should work
    fine without any extra namespace tricks, as all DataMaps are already
    in the DataDomain namespace... But now I vaguely recall someone
    complaining that it doesn't. May need to test that...

    Andrus

    On Jun 14, 2005, at 4:42 PM, Mike Kienenberger wrote:

    > in (CAY-322) cgen task cannot generate classes for cross-DataMap
    > relationships, I wrote:
    >
    >> Since both fixes modify the namespace variable of the DataMaps
    >> passed in,
    >>
    > this could cause problems in the modeler after class generation
    > completes.
    >
    > In
    > org.objectstyle.cayenne.modeler.dialog.classgen.ClassGeneratorControll
    > er.generateClasses(),
    > it appears that the DataMap is passed in "as-is". This means that
    > DefaultClassGenerator will be modifying a "live" DataMap's namespace
    > variable.
    >
    > Is this going to cause a problem? Does the modeler use the DataMap
    > namespace? Should model.getMap() be cloned in the call? And if
    > so, how?
    >
    > DefaultClassGenerator generator = new
    > DefaultClassGenerator(model.getMap(), selected);
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Jun 14 2005 - 19:50:29 EDT