当前位置: 首页>>代码示例>>Java>>正文


Java UserInfo类代码示例

本文整理汇总了Java中com.openbravo.pos.ticket.UserInfo的典型用法代码示例。如果您正苦于以下问题:Java UserInfo类的具体用法?Java UserInfo怎么用?Java UserInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserInfo类属于com.openbravo.pos.ticket包,在下文中一共展示了UserInfo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.openbravo.pos.ticket.UserInfo; //导入依赖的package包/类
/**
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    DynaActionForm inputForm = (DynaActionForm) form;
    RestaurantManager manager = new RestaurantManager();
    String login = inputForm.getString("login");
    String password = inputForm.getString("password");
    UserInfo user = manager.findUser(login, password);
    if (user != null) {
        HttpSession session = request.getSession();
        session.setAttribute("user", user);
        return mapping.findForward(SUCCESS);
    }
    ActionMessages errors = new ActionErrors();
    ActionMessage msg = new ActionMessage("errors.loginfailed", "login/password");
    errors.add(ActionMessages.GLOBAL_MESSAGE, msg);
    saveErrors(request, errors);

    return mapping.findForward(FAILURE);

}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:33,代码来源:LoginAction.java

示例2: map2VO

import com.openbravo.pos.ticket.UserInfo; //导入依赖的package包/类
@Override
protected UserInfo map2VO(ResultSet rs) throws SQLException {
    UserInfo user = new UserInfo();
    rs.next();
    user.setLogin(rs.getString("name"));
    if (rs.getString("apppassword") == null) {
        user.setPassword("");
    } else {
        user.setPassword(rs.getString("apppassword"));
    }
    return user;
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:13,代码来源:LoginDAO.java

示例3: findUser

import com.openbravo.pos.ticket.UserInfo; //导入依赖的package包/类
public UserInfo findUser(String login, String password) {
    Connection con = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    UserInfo user = null;
    String sqlStr = "SELECT NAME, APPPASSWORD FROM PEOPLE WHERE NAME = ? AND APPPASSWORD ";
    String end = "";
    if (password.equals("")) {
        end = "IS NULL";
    } else {
        end = " = ?";
    }

    try {
        //get connection
        con = getConnection();
        //prepare statement
        ps = con.prepareStatement(sqlStr + end);
        ps.setString(1, login);
        if (!password.equals("")) {
            ps.setString(2, StringUtils.hashString(password));
        }

        //execute
        rs = ps.executeQuery();
        //transform to VO
        user = map2VO(rs);

    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        try {
            // close the resources 
            if (ps != null) {
                ps.close();
            }
            if (con != null) {
                con.close();
            }
        } catch (SQLException sqlee) {
            sqlee.printStackTrace();
        }
    }

    return user;
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:47,代码来源:LoginDAO.java

示例4: findUser

import com.openbravo.pos.ticket.UserInfo; //导入依赖的package包/类
public UserInfo findUser(String aLogin, String password) {
    login = new LoginDAO();

    return login.findUser(aLogin, password);
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:6,代码来源:RestaurantManager.java

示例5: doFilter

import com.openbravo.pos.ticket.UserInfo; //导入依赖的package包/类
/**
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are creating
 * @param chain The filter chain we are processing
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain)
        throws IOException, ServletException {

    if (debug) {
        log("PdaFilter:doFilter()");
    }

    doBeforeProcessing(request, response);

    Throwable problem = null;
    try {
        HttpServletRequest httpRequest = (HttpServletRequest) request;
        HttpServletResponse httpResponse = (HttpServletResponse) response;
        HttpSession session = httpRequest.getSession(false);

        if (session != null) {
            UserInfo currentUser = (UserInfo) session.getAttribute("user");
            if (currentUser == null) {
                filterConfig.getServletContext().getRequestDispatcher(loginForm).forward(httpRequest, httpResponse);
            }
        } else {
            filterConfig.getServletContext().getRequestDispatcher(loginForm).forward(httpRequest, httpResponse);
        }
        chain.doFilter(request, response);
    } catch (Throwable t) {
        // If an exception is thrown somewhere down the filter chain,
        // we still want to execute our after processing, and then
        // rethrow the problem after that.
        problem = t;
        t.printStackTrace();
    }

    doAfterProcessing(request, response);

    // If there was a problem, we want to rethrow it if it is
    // a known type, otherwise log it.
    if (problem != null) {
        if (problem instanceof ServletException) {
            throw (ServletException) problem;
        }
        if (problem instanceof IOException) {
            throw (IOException) problem;
        }
        sendProcessingError(problem, response);
    }
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:57,代码来源:PdaFilter.java

示例6: getUserInfo

import com.openbravo.pos.ticket.UserInfo; //导入依赖的package包/类
public UserInfo getUserInfo() {
    return new UserInfo(m_sId, m_sName);
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:4,代码来源:AppUser.java

示例7: getUserInfo

import com.openbravo.pos.ticket.UserInfo; //导入依赖的package包/类
/**
 *
 * @return
 */
public UserInfo getUserInfo() {
    return new UserInfo(m_sId, m_sName);
}
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:8,代码来源:AppUser.java


注:本文中的com.openbravo.pos.ticket.UserInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。