Posted By

maxkar on 01/04/09


Tagged

Flex as3 cairngorm flamingo granite


Versions (?)

Cairngorm Flamingo Granite Delegate example


 / Published in: ActionScript 3
 

  1. /*
  2.   This guy calls the Backend. It handles all the
  3.   weird things involved with "talking to a server".
  4.  
  5.   Delegate: Created by a Command, they instantiate remote procedure calls
  6.   (HTTP, Web Services, etc) and hand the results back to that Command.
  7.  
  8. */
  9. package com.xx.business
  10. {
  11. import mx.rpc.IResponder;
  12.  
  13. import com.adobe.cairngorm.business.ServiceLocator;
  14. /*import com.exadel.flamingo.flex.components.flamingo.SeamRemoteObject;
  15. import com.exadel.flamingo.flex.components.flamingo.BindingService;
  16. */
  17. import org.granite.tide.seam.Context;
  18. import org.granite.tide.seam.Seam;
  19.  
  20. public class UserDelegate
  21. {
  22. private var responder : IResponder;
  23. /* private var loginService : SeamRemoteObject;
  24. private var service : SeamRemoteObject;
  25. */
  26.  
  27. public function UserDelegate(responder : IResponder)
  28. {
  29. /* this.loginService = SeamRemoteObject(ServiceLocator.getInstance().getRemoteObject( "loginService" ));
  30. this.service = SeamRemoteObject(ServiceLocator.getInstance().getRemoteObject( "userService" ));*/
  31. this.responder = responder;
  32.  
  33. }
  34.  
  35. public function loginPrincipal(user : Object) : void
  36. {
  37. var tideContext:Context = Seam.getInstance().getSeamContext();
  38.  
  39. if (user.isLoggedIn)
  40. {
  41. // loginService.logout();
  42. tideContext.identity.logout();
  43. }
  44. else {
  45. // loginService.logout();
  46. // loginService.setCredentials( user.userName, user.password );
  47. tideContext.identity.username = user.userName;
  48. tideContext.identity.password = user.password;
  49. }
  50.  
  51. tideContext.identity.login(responder.result, responder.fault);
  52. }
  53.  
  54.  
  55.  
  56. public function findAllUsers() : void
  57. {
  58. /* var call : Object = service.getAllPrincipals();
  59. call.resultHandler = responder.result;
  60. call.faultHandler = responder.fault;
  61. */
  62. }
  63.  
  64. public function findUsers( searchValues : Object ) : void
  65. {
  66. /* var call : Object = service.find( searchValues );
  67. call.resultHandler = responder.result;
  68. call.faultHandler = responder.fault;
  69. */
  70. }
  71.  
  72. public function createPrincipal(user : Object) : void
  73. {
  74. /* var call : Object = service.save( user );
  75. call.resultHandler = responder.result;
  76. call.faultHandler = responder.fault;
  77. */
  78. }
  79.  
  80. public function updatePrincipal(user : Object) : void
  81. {
  82. /* var call : Object = service.savePrincipal( user );
  83. call.resultHandler = responder.result;
  84. call.faultHandler = responder.fault;
  85. */
  86. }
  87.  
  88. public function deletePrincipal(user : Object) : void
  89. {
  90. /* var call : Object = service.deletePrincipal( user );
  91. call.resultHandler = responder.result;
  92. call.faultHandler = responder.fault;
  93. */
  94. }
  95. }
  96. }

Report this snippet  

You need to login to post a comment.