Re: EOReporter using JavaModel_Full.template hangs with inheritance
Carl Lindberg <[email protected]> Wed, 9 Apr 2003 00:49:42 -0400
| Newsgroups | gmane.comp.web.webobjects.eof |
|---|---|
| Message-ID | <[email protected]> |
> I have a model that contains inheritance via single table mapping. I
> was
> trying to generate documentation from my model using eoreporter-1.1.
>
> [...]
> Every time I tried to run this, it would hang when it got to one of the
> subclasses in my inheritance relationship. I believe the problem was
> with
> the following code from JavaModel_Full.template.
>
> {procedure PrintClassList CurrEntity}
> {CurrEntity.className}
> {if CurrEntity.className ne 'EOGenericRecord'}
> {while CurrEntity.parentEntity}
> {' : '}
> {call PrintEntity CurrEntity.parentEntity}
> {identify CurrEntity = CurrEntity.parentEntity}
> {endwhile}
> {endif}
> {endprocedure}
>
> I think this is supposed to print the class hierarchy separated by
> colens
> as in OutManCorr : ManCorr.
>
> I replaced this code with the following which seemed to work:
>
> {procedure PrintClassList CurrEntity}
> {CurrEntity.className}
> {if CurrEntity.className ne 'EOGenericRecord'}
> {if CurrEntity.parentEntity}
> {' : '}
> {call PrintClassList CurrEntity.parentEntity}
> {endif}
> {endif}
> {endprocedure}
>
> Was I wrong in my assumptions or does this look correct?
Yep, this is a bug. Due to a technicality in MiscMerge, you can't
override a local variable with "identify". The fix would be to use
another variable name, or figure out a different way using recursion.
The existing code prints out a class name, then an inheritance list of
the entity names (not the parent class names). The PrintEntity macro
will print out a hyperlinked entity name instead of just static text,
so your fix doesn't quite do the same thing.
Something like this should also work (untested):
{procedure _PrintEntityList CurrEntity}
{' : '}
{call PrintEntity CurrEntity}
{if CurrEntity.parentEntity}
{call _PrintEntityList CurrEntity.parentEntity}
{endif}
{endprocedure}
{procedure PrintClassList CurrEntity}
{CurrEntity.className}
{if CurrEntity.className ne 'EOGenericRecord'}
{if CurrEntity.parentEntity}
{call _PrintEntityList CurrEntity.parentEntity}
{endif}
{endif}
{endprocedure}