/ Published in: ActionScript 3
Expand |
Embed | Plain Text
/* This guy calls the Backend. It handles all the weird things involved with "talking to a server". Delegate: Created by a Command, they instantiate remote procedure calls (HTTP, Web Services, etc) and hand the results back to that Command. */ package com.xx.business { import mx.rpc.IResponder; import com.adobe.cairngorm.business.ServiceLocator; /*import com.exadel.flamingo.flex.components.flamingo.SeamRemoteObject; import com.exadel.flamingo.flex.components.flamingo.BindingService; */ import org.granite.tide.seam.Context; import org.granite.tide.seam.Seam; public class UserDelegate { private var responder : IResponder; /* private var loginService : SeamRemoteObject; private var service : SeamRemoteObject; */ public function UserDelegate(responder : IResponder) { /* this.loginService = SeamRemoteObject(ServiceLocator.getInstance().getRemoteObject( "loginService" )); this.service = SeamRemoteObject(ServiceLocator.getInstance().getRemoteObject( "userService" ));*/ this.responder = responder; } public function loginPrincipal(user : Object) : void { var tideContext:Context = Seam.getInstance().getSeamContext(); if (user.isLoggedIn) { // loginService.logout(); tideContext.identity.logout(); } else { // loginService.logout(); // loginService.setCredentials( user.userName, user.password ); tideContext.identity.username = user.userName; tideContext.identity.password = user.password; } tideContext.identity.login(responder.result, responder.fault); } public function findAllUsers() : void { /* var call : Object = service.getAllPrincipals(); call.resultHandler = responder.result; call.faultHandler = responder.fault; */ } public function findUsers( searchValues : Object ) : void { /* var call : Object = service.find( searchValues ); call.resultHandler = responder.result; call.faultHandler = responder.fault; */ } public function createPrincipal(user : Object) : void { /* var call : Object = service.save( user ); call.resultHandler = responder.result; call.faultHandler = responder.fault; */ } public function updatePrincipal(user : Object) : void { /* var call : Object = service.savePrincipal( user ); call.resultHandler = responder.result; call.faultHandler = responder.fault; */ } public function deletePrincipal(user : Object) : void { /* var call : Object = service.deletePrincipal( user ); call.resultHandler = responder.result; call.faultHandler = responder.fault; */ } } }
You need to login to post a comment.
