Hi Patrick,
Thanks for the quick reply. That's too bad that we cannot use AOP on the
ext files that the Generator uses. :( My customizations would be much
cleaner if was possible. Maybe you can ask the oAW developers if it can be
added? I would ask them, but I can barely get around the oAW world as it
is. I would just confuse them. ;)
I ended up copying the definition for domainObjectBase into my xpt advice
file and adding in a call to my helper method to create the implements
string. This is really unclean because there is so much duplicate code now.
But it looks like that's what I have to go with.
Thanks for the help with the code snippets. That got me closer to my
solution.
After I got my generator code to be executed, I found that Jalopy was
blowing up over the new generated code. It was like what Ryan discovered
earlier and mentioned on the forums. I debugged into the problem and found
that my Entity is Auditable, so my code generated an extra "implements"
keyword in the class declaration. That was what Jalopy choked on. I ended
up putting in code to test for Auditable and generate the "implements"
keyword correctly:
String getExtraImplements(DomainObject domainObject) :
if (domainObject.useMyInterface && domainObject.metaType == Entity) then
(((Entity)domainObject).auditable ?
", com.foo.MyInterface" :
"implements com.foo.MyInterface")
else if(domainObject.noun) then
"implements com.foo.MyInterface"
else
"";
Thanks for your help!
--Polly
Patrik Nordwall wrote:
>
>
> amphoras wrote:
>>
>> Hi,
>>
>> I am trying to using AOP to add to the Sculptor helper.ext method
>> "getExtendsAndImplementsLitteral". I saw in the oAW forums and the oAW
>> video that it is supposed to be possible:
>>
>> http://www.openarchitectureware.org/forum/viewtopic.php?showtopic=5923
>>
>
> In that post the solution is to use
> <extensionAdvices value="extensions::advices::myadvice"/>
> in the Generator component.
> That is maybe not an option for you. It would be better to use XtendAdvice
> with Generator (Xpand) target. I don't know how to do that. Maybe it is
> not currently supported by oAW.
>
> I found a few problems in your code. Note that DslEntity etc is not used
> here. I would write it something like this...
>
> around extensions::helper::getExtendsAndImplementsLitteral(DomainObject
> domainObject):
> ((String) ctx.proceed()) + getExtraImplements(domainObject);
>
> String getExtraImplements(DomainObject domainObject) :
> (domainObject.metaType == Entity || domainObject.metaType ==
> ValueObject)
> ?
> " implements com.foo.MyInterface" :
> "";
>
>
>
> String getExtraImplements(DomainObject domainObject) :
> if (domainObject.metaType == Entity) then
> (((Entity) domainObject).useInterface ? " implements
> com.foo.MyInterface" : "")
> else if (domainObject.metaType == ValueObject) then
> (((ValueObject) domainObject).useInterface ? " implements
> com.foo.MyInterface" : "");
>
> /Patrik
>
--
View this message in context:
http://www.nabble.com/Using-AOP-to-extend-ext-file-tp18930627s17564p18934275.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer