[ http://jira.andromda.org/browse/EJB-106?page=comments#action_15360 ] 

Olivier THIERRY commented on EJB-106:
-------------------------------------

I made changes to the cartridge to implement this. It's hard to make a patch 
since these changes concern some templates that are already concerned by the 
patch to separate daos and transformers, so such a patch would work only if you 
have applied patch  for dao / transformers before. 

Anyway, you don't need a lot of changes to make it work.

In EJB3EntityFacadeLogicImpl class, you have to change implementation for 
handleIsDaoImplementationRequired method :

/**
 * @see 
org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleIsDaoImplementationRequired()
 */
protected boolean handleIsDaoImplementationRequired()
{
    return !this.getDaoBusinessOperations().isEmpty();
}

In cartridge.xml.vsl template you have to remove these lines :

<template
    path="templates/ejb3/DaoImpl.vsl"
    outputPattern="$generatedFile"
    outlet="daos"
    overwrite="true">
    <modelElements variable="entity">
        <modelElement>
            <type 
name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade">
                <property name="daoImplementationRequired">false</property>
                <property name="embeddableSuperclass">false</property>
            </type>
        </modelElement>
    </modelElements>
</template>

In ejb-jar.xml.vsl template, you have to change the way dao session beans are 
defined :

<session>
    <description>
        <![CDATA[
        $entity.getDocumentation("", 64, false)
        ]]>
    </description>
    <ejb-name>${entity.daoName}</ejb-name>
    <local>${entity.fullyQualifiedDaoName}</local>
    <ejb-class>#if 
($entity.daoImplementationRequired)${entity.fullyQualifiedDaoImplementationName}#else${entity.fullyQualifiedDaoBaseName}#end</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
</session>

And finally in DaoBase.vsl template you have to change the class definition 
line so that the class is abstract only if there is a Dao implementation :

public#if ($entity.daoImplementationRequired) abstract#end class 
$entity.daoBaseName

> Improve the daoImplementationRequired implementation in EJB3Entity metafacade
> -----------------------------------------------------------------------------
>
>          Key: EJB-106
>          URL: http://jira.andromda.org/browse/EJB-106
>      Project: EJB Cartridge
>         Type: Improvement

>  Environment: AndroMDA 3.3-SNAPSHOT + EJB3 cartridge
>     Reporter: Olivier THIERRY
>     Assignee: Vance Karimi
>     Priority: Minor

>
> Working on the patch to separate DAO and Transformer 
> (http://galaxy.andromda.org/jira/browse/EJB-105), I asked myself a question 
> about the way we decide if DAO implementation class has to be generated in 
> core/src/main/java or core/target/src. I have many DAO implementation classes 
> generated in core/src/main/java, but with no method to complete !
> This choice is based upon daoImplementationRequired property of entity. In 
> the metafacade class, I saw this property is true in one of the the three 
> following cases :
> 1 - Entity has value objects references
> 2 - Entity has business operations, i.e. static methods
> 3 - Entity has query operations (methods checked as a query or having 
> <<FinderMethod>> stereotype).
> I agree with the first two cases, but I don't understand the third one. For 
> what I understood, if a method is checked as a query or has the 
> <<FinderMethod>> stereotype, the query itself will be totally generated in 
> DAOBase class, so no need for the developer to implement it in a DAOImpl 
> class. So the first two methods should be enough to decide whether the 
> developer will have to write the DAO implementation.
> After applying the patch about Transformer / DAO separations, it means 
> there's only one case when you need to generate DAO implementation class : 
> when the entity has business operations.
> See also this topic : http://galaxy.andromda.org/forum/viewtopic.php?t=5664

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Reply via email to