Hi,

I had been trying to implement the functionality, but I am not completelly sure that everything is correct:
 I had created a new velocity template for the SessionObject, I had used the ValueObject template, but just with the attributes, getters and setters. (it is on the attachment...)

I had also modified the StrutsController template to define the getSessionState method :
## Methods for the SessionObject
#foreach ( $associationEnd in $class.associationEnds )
#set ($target = $associationEnd.otherEnd)
#if ($target.hasStereotype("SessionObject"))
#set ($targetType = $target.type)
#set ($targetTypeFQName = $targetType.fullyQualifiedName)
    /**
     * Returns the session state object that is stored in the HTTP servlet session.
     *
     * @param request the last request
     * @return the session state object
     */
    private static $targetTypeFQName getSessionState(HttpServletRequest request);
#end ## if SessionObject
#end ##foreach
======================================
and also the StrutsController.vsl to implement this method:
## Methods for the SessionObjects
#foreach ( $associationEnd in $class.associationEnds )
#set ($target = $associationEnd.otherEnd)
#if ($target.hasStereotype("SessionObject"))
#set ($targetType = $target.type)
#set ($targetTypeFQName = $targetType.fullyQualifiedName)
    /**
     * Returns the session state object that is stored in the HTTP servlet session.
     *
     * @param request the last request
     * @return the session state object
     */
    private static $targetTypeFQName getSessionState(HttpServletRequest request){
        final String SESSION_STATE_$str.toUpperCase(${target.name})="${target.name}";
        HttpSession session = request.getSession();
        $targetTypeFQName state=($targetTypeFQName) session.getAttribute(SESSION_STATE_${target.name});
        if (state==null){
                state = new $targetTypeFQName();
                session.setAttribute(SESSION_STATE_$str.toUpperCase(${target.name}), state);
        }
        return state;
    }
#end ## if SessionObject
#end ##foreach
==============
I had also modified the andromda-cartridge.xml to process this template:
    <template
        path="templates/SessionObject.vsl"
        outputPattern="$generatedFile"
        outlet="server"
        overwrite="true"
        required="false">
        <modelElements variable="class">
            <modelElement stereotype="SessionObject"/> 
        </modelElements>      
    </template>
I had maven clean jar:install the BPM4Struts, but I can not get it working.

On the other hand, I think that maybe the SessonStateObject should be painted in the model, just associating it to the StrutsController, on this way the template could be more clear, but still I am not sure of this.

any ideas??


Thank you
Carlos

PD. I attach the files:


Wouter Zoons wrote:

Yes, this might prove very useful indeed

 

Feel free to send the patched code when you’re finished

I’ll make sure it gets committed into the CVS

 

Thanks

-- Wouter

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Carlos Cuenca
Sent: Saturday, July 31, 2004 11:52 AM
To: Chad Brandon
Cc: andromda-user
Subject: Re: [Andromda-user] BMP4Struts session question

 

and another question? do you think it could be interesting to include this on the distribution as a feature??
I can give you the code when I finish it..

Carlos

Chad Brandon wrote:

--- Carlos Cuenca <[EMAIL PROTECTED]> wrote:
 
  
Hi all!,
 
I am trying to create a example like Animal-Quiz,
which stores data on 
the HTTP servlet session. As I have some complex
types to be stored 
within this session, I had created a plain
serializable object with 
getters and setters, and I store the values there.
(This is all like in 
Animal-Quiz - the GuessSessionState.java).
 
My question is: is it posible to create this within
the UML model, with 
a "SessionState" stereotype, or something like this?
 
    
 
Why not?  You can generate anyhing you want :)
 
  
Thank you!
 
Carlos
 
 
 
 
    
-------------------------------------------------------
  
This SF.Net email is sponsored by OSTG. Have you
noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the
past few weeks? Now,
one more big change to announce. We are now OSTG-
Open Source Technology
Group. Come see the changes on the new OSTG site.
www.ostg.com
_______________________________________________
Andromda-user mailing list
[EMAIL PROTECTED]
 
    
https://lists.sourceforge.net/lists/listinfo/andromda-user
  
 
 
 
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Andromda-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user
 
 
  


Reply via email to