Subversion Repositories SmartDukaan

Rev

Rev 167 | Rev 493 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.hotspot.dashbaord.server.handler;

import in.shop2020.hotspot.dashbaord.shared.actions.AuthRequest;
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse;
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse.NEXT;
import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;

public class AuthHandler implements ActionHandler<AuthRequest, AuthResponse>{

        @Override
        public AuthResponse execute(AuthRequest request, ExecutionContext response)
                        throws ActionException {
                String userName = request.getUsername();
                                
                if (userName.trim().toUpperCase().equals("SHOP2020")){
                        return new AuthResponse(userName, true, " You are charming, loving and affectionate", NEXT.INBOX);
                }
                
                if (userName.trim().toUpperCase().equals("ADMIN")){
                        return new AuthResponse(userName, true, " You are charming, loving and affectionate", NEXT.ADMIN);
                }
                else
                        return new AuthResponse(userName, false, "None", NEXT.INBOX);
        }

        @Override
        public Class<AuthRequest> getActionType() {
                
                return AuthRequest.class;
        }

        @Override
        public void rollback(AuthRequest arg0, AuthResponse arg1,
                        ExecutionContext arg2) throws ActionException {
                                
        }

}