22.2. Revising Registration

Registration is currently accomplished with the following classes:

  • RegisterUserEvent

  • RegisterUserDelegate

  • RegisterUserCommand

The RegisterUserEvent will become a type of the new UserEvent class.

The register function of the RegisterUserDelegate will move to the UserDelegate class.

The execute function of the RegisterUserCommand will be updated to use the new UserEvent and UserDelegate classes.

Start by creating the user event class. In the com.FlexBlog.events package create a new event class named UserEvent. Edit the class to match the following:

package com.FlexBlog.events
{
    import com.FlexBlog.valueobjects.UserVO;
    import com.adobe.cairngorm.control.CairngormEvent;
    public class UserEvent extends CairngormEvent
    {
        public static const REGISTER:String = 'registerUserEvent';
        public var user:UserVO;
        public function UserEvent(type:String, user:UserVO = null,
        bubbles:Boolean=false, cancelable:Boolean=false)
        {
            super(type, bubbles, cancelable);
            this.user = user;
        }
    }
}

Now create the new user delegate class. In the com.FlexBlog.delegates package create a new delegate class named UserDelegate. Edit the class to match the following:

package com.FlexBlog.delegates { import com.FlexBlog.valueobjects.UserVO; import flash.errors.SQLError; import mx.rpc.IResponder; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import sql.FlexBlogDatabaseManager; public class UserDelegate { private var responder:IResponder; public function UserDelegate(responder:IResponder) ...

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.