Not really necessary
 
On your delegate you can attached the userID to the call object and then access through your command.onResult param.token object
 
 public class LoginCommand implements Command, Responder
 {
  public function execute(event:CairngormEvent):void
  {
   var delegate:LoginDelegate = new LoginDelegate(this);
   var loginEvt:LoginEvent = LoginEvent( event );
   delegate.login(loginEvt.userVO);
  }
  
  public function onResult(event:*=null):void
  {
   var submitVO:UserVO = UserVO(event.token.user);
  }
 
 
 
 public class LoginDelegate
 {
  public function LoginDelegate(responder:Responder)
  {
   service = ServiceLocator.getInstance().getService('userGateway');
   this.responder = responder;
  }
  
  public function login(user:UserVO):void
  {
   var call:AsyncToken = service.validate(user);
   call.user = user;
   call.resultHandler = responder.onResult;
   call.faultHandler = responder.onFault;
  }
  
  private var service:AbstractService;
  private var responder:Responder
 }
 
 
 
Regards,
 
Bjorn Schultheiss
Senior Flash Developer
QDC Technologies
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Robin Burrer
Sent: Wednesday, 11 October 2006 11:12 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Cairngorm commands - best practise

Hi there

Let’s say I want to do a server request. I want to search my database for a particular keyword and return a record set.

The user would type in the keyword in a text area and I would then create a SearchDatabaseEvent which then would trigger a SearchDatabaseEventCommand and so on …

However I also want to send the userID when I do my server request. Should the SearchDatabaseCommand get the userID from the model or from the SearchDatabaseEvent (so I would have two properties in my event “keywords” and “userId”)? The SearchDatabaseCommand obviously knows about the model because it has to populate the model with the result record set. So I could just get the user ID from the model when the “execute method” is triggered.

This approach seems a bit wired though because it seems that couples my command to strongly to the model. On the other hand it seems strange to query the model from my view to populate the SearchDatabaseEvent with userId property as well.

Any thoughts?

Cheers

Robin

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to