jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart" <christophe.lomb...@gmail.com>
Subject Re: Jackrabbit:OCM : Recursive Same Type Objects
Date Mon, 22 Sep 2008 09:35:48 GMT
On Mon, Sep 22, 2008 at 11:19, Boni Gopalan (BioImagene) <
Boni.G@bioimagene.com> wrote:

> Hi Christopher:
>
> The recursive beans get persisted without any problems.  So it was a non
> issue.  I need a quick help on persisting an Enum.  Is there a converter
> available?,  Should I have to implement a custom converter?  If so would
> it be an Atomic Converter or a Bean Converter?


Yes I think so.
I think both can be used depending on your enum.
If you have a single atomic value inside the Enum, it should be nice to have
a Atomic converter.
If you have multiple fields inside the Enum, a specific BeanConverter
becomes interesting. eg. :

public enum Planet {
    MERCURY (3.303e+23, 2.4397e6),
    VENUS   (4.869e+24, 6.0518e6),
    EARTH   (5.976e+24, 6.37814e6),
    MARS    (6.421e+23, 3.3972e6),
    JUPITER (1.9e+27,   7.1492e7),
    SATURN  (5.688e+26, 6.0268e7),
    URANUS  (8.686e+25, 2.5559e7),
    NEPTUNE (1.024e+26, 2.4746e7),
    PLUTO   (1.27e+22,  1.137e6);

    private final double mass;   // in kilograms
    private final double radius; // in meters
    Planet(double mass, double radius) {
        this.mass = mass;
        this.radius = radius;
    }
    public double mass()   { return mass; }
    public double radius() { return radius; }

    // universal gravitational constant  (m3 kg-1 s-2)
    public static final double G = 6.67300E-11;

    public double surfaceGravity() {
        return G * mass / (radius * radius);
    }
    public double surfaceWeight(double otherMass) {
        return otherMass * surfaceGravity();

    }




>
>
> On another note : I had a need to update multiple objects based on a
> Query.  Since there were no suitable methods available I extended your
> ObjectContentManagerImpl and implemented an updated method that accepts
> a node iterator and Object as parameters.  Did I reinvent any wheels?
>

Can you give more details ? What kind of update is it ?




>
> Thanks
> Boni
>
> -----Original Message-----
> From: Christophe Lombart [mailto:christophe.lombart@gmail.com]
> Sent: 19 September 2008 14:47
> To: users@jackrabbit.apache.org
> Subject: Re: Jackrabbit:OCM : Recursive Same Type Objects
>
> for a bean, no problem but we have to check this specific case within
> Collection.
> We have to add a unit test and a bug fix if needed.
>
> It is not working, please create a jira issue. I can work on it.
>
> Christophe
>
>
> On Fri, Sep 19, 2008 at 10:19, Boni Gopalan (BioImagene) <
> Boni.G@bioimagene.com> wrote:
>
> > Hi , I have a need to persist objects of the following structure.
> >
> > Class Foo{
> >        String id;
> >        List<Foo> children;
> > }
> >
> > Is it possible to achieve a proper mapping with XML mappings?  Is
> there
> > any recursion stopper that will stop me at runtime??, I see an ominous
> > test config file named : jcrmapping-avoidrecursiveloop in the trunk!!
> >
> > Sorry, I should have rather tried it first before asking: Very tight
> > deadline !!
> >
> > Thanks
> > Boni
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message