I've got a few thoughts on how to get the flex pieces to generate from  
the sculptor. I'm still focusing on the java / server side of things  
for now - the flex pieces will come later.

The most challenging thing that I'm facing is that to properly use  
lazy loading across the channel to the flex side, I need to have the  
objects that I'm working with all implement a certain interface - one  
provided by another project called dpHibernate.

The interface is simple:

public interface IHibernateProxy
{
        Object getProxyKey();
        void setProxyKey(Object obj);
        
        Boolean getProxyInitialized();
        void setProxyInitialized(Boolean b);    
}


and the implementation is actually the same for all of the objects...  
They provide an abstract class that you can have everything inherit  
from - but since we're generating the code anyway there is no reason  
to not just make them implement the interface and avoid the issue of  
inheritance.

In my initial stages, I've been working with SpecialCases.xpt to make  
the server side code modified to the point where it will do what I  
want before I start to think about how to get it to generate it in the  
templates... etc. - but I can't seem to get the domain object to take  
on any interfaces because I don't see how to advice the  
getExtendsAndImplementsLitteral() method that's in the helper.ext -


«AROUND *::domainObjectBase FOR DomainObject»
        «LET attributes.exists(a | a.name == "uuid")  AS hasUuidAttribute -»
     «FILE javaFileName(getDomainPackage() + "." + name + "Base")»
package «getDomainPackage()»;


/**
  * Generated base class, which implements properties and
  * associations for the domain object.
  */
public abstract class «name»Base «getExtendsAndImplementsLitteral()»  {

     «EXPAND DomainObject::attribute FOREACH attributes»

     «EXPAND DomainObject::oneReferenceAttribute FOREACH  
references.select(r | !r.many)»
     «EXPAND DomainObject::manyReferenceAttribute FOREACH  
references.select(r | r.many)»

     «IF  
getConstructorParameters().isEmpty»public«ELSE»protected«ENDIF»  
«name»Base() {
     }

     «EXPAND DomainObject::propertyConstructorBase-»

     «EXPAND DomainObject::propertyAccessors FOREACH  
attributes.select(a | a.name != "uuid") »
     «IF hasUuidAttribute -»
            «EXPAND DomainObject::uuidAccessor»
     «ENDIF-»


     «EXPAND DomainObject::oneReferenceAccessors FOREACH  
references.select(r | !r.many)»
     «EXPAND DomainObject::manyReferenceAccessors FOREACH  
references.select(r | r.many)»

     «EXPAND DomainObject::acceptToString»
     «IF !abstract -»
         «EXPAND DomainObject::keyGetter»
     «ENDIF-»
        /* code goes here */
}
     «ENDFILE»
     «ENDLET»
«ENDAROUND»

If I hard code in anything after the  
«getExtendsAndImplementsLitteral()» such as "implements  
net.digitalprimates.persistence.hibernate.proxy.IHibernateProxy" the  
java beautifier throws exceptions when I try to run the generation.

Any thoughts on how to get the DomainBase objects to all implement a  
specific interface? The implementation of the interface will always  
look like this:
        ----
        public Object proxyKey;
        public Boolean proxyInitialized = true;

        
        public Object getProxyKey()
        {
                return proxyKey;
        }

        
        public void setProxyKey(Object proxyKey)
        {
                this.proxyKey = proxyKey;
        }

        
        public Boolean getProxyInitialized()
        {
                return proxyInitialized;
        }

        
        public void setProxyInitialized(Boolean proxyInitialized)
        {
                this.proxyInitialized = proxyInitialized;
        }
        ----
I suppose I could do some after-the-fact rigging using AOP and create  
an introduction that would cause all of the domain objects to  
implement this interface without changing their base code, but I think  
it would be a lot cleaner if I could just figure out how to get oAW  
and Sculptor to do it for me.

Any thoughts?

Ryan


-------------------------------------------------------------------------
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

Reply via email to