📄 realmregister.java
字号:
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file. */package org.butor.realm.service;import java.util.Properties;import org.butor.bls.IOutputResponse;import org.butor.bls.IRequest;import org.butor.bls.Service;import org.butor.bls.ServiceException;import org.butor.dataStruct.Message;import org.butor.log.Log;import org.butor.realm.RealmService;import org.butor.realm.service.bean.RealmRegisterParam;/** * TODO * * @author sawanai * Jul 5, 2004 */public class RealmRegister extends Service { /** * */ public RealmRegister() { super(RealmRegisterParam.SERVICE_NAME); } public String getDescription() { return "Register new user."; } /** * ParamBean class * @see org.butor.bls.IService#getParamBeanClass() */ public Class getServiceParamBeanClass() { return RealmRegisterParam.class; } public IOutputResponse execute(IRequest request) throws ServiceException { IOutputResponse response = request.createResponse(); RealmRegisterParam params = (RealmRegisterParam) getServiceParamBean(request); String userid = (params.getUserid() == null ? null : params.getUserid().trim()); if (userid == null || userid.length() == 0) { response.addMessage(new Message(1000, Message.ERROR, "Missing param userid!")); response.endResponse(1000); return response; } String password = (params.getPassword() == null ? null : params.getPassword().trim()); if (password == null || password.length() == 0) { response.addMessage(new Message(1000, Message.ERROR, "Missing param password!")); response.endResponse(1000); return response; } String firstName = (params.getFirstName() == null ? null : params.getFirstName().trim()); if (firstName == null || firstName.length() == 0) { response.addMessage(new Message(1000, Message.ERROR, "Missing param firstName!")); response.endResponse(1000); return response; } String lastName = (params.getLastName() == null ? null : params.getLastName().trim()); if (lastName == null || lastName.length() == 0) { response.addMessage(new Message(1000, Message.ERROR, "Missing param lastName!")); response.endResponse(1000); return response; } String email = (params.getEmail() == null ? null : params.getEmail().trim()); if (email == null) { response.addMessage(new Message(1000, Message.ERROR, "Missing param email!")); response.endResponse(1000); return response; } Properties props = RealmService.register(firstName, lastName, userid, password, email); int stat = 0; String message = ""; if (props != null) { stat = 0; message = "Register OK"; } else { stat = -1; //TODO retstat FAILED message = "Register failed"; } response.addMessage(new Message(stat, Message.INFO, message)); response.endResponse(stat); Log.logStr(this, Log.LOG_TYPE_INFO, "execute()", message +" for userid=[" +userid +"]"); return response; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -