Mobile Java Servlet for NORD POS and other Openbravo POS forks.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
res
src/com/nordpos/mobile/stripes
web
README.md

README.md

NORD POS mobile servlet

Copyright (c) 2012 Nord Trading Ltd. Apache License, Version 2.0 (ALv2)

This is servlet for create, read, update and delete database tables of Openbravo Java Client POS. Also, this servlet is compatible with many other Openbravo POS forks(NORD POS, OpenPOS, uniCenta oPOS and etc.)

NORD POS mobile - Login githalytics.com alpha

Introduction

This project is an example of the ease develop and convenience of use mini servlets to access the data of big desktop application. I am propose for you to make forks of this project, but not only for Openbravo POS developers, also for Stripes, Persist and jQuery Mobile frameworks beginers.

Java web application powered by Stripes Framework

I am choose a Stripes, because it have simple structure of web-page and visual substitution methods of Java.

NORD POS mobile - Products list NORD POS mobile - Product ticket

###Example JavaServer Pages###

                <stripes:form beanclass="com.nordpos.mobile.stripes.action.LoginActionBean">
                    <table>
                        <tr>
                            <td>Name</td>
                            <td><stripes:text name="loginName"/></td>
                        </tr>
                        <tr>
                            <td>Password</td>
                            <td><stripes:password name="loginPassword"/></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <stripes:submit name="login" value="Login" />
                            </td>
                        </tr>
                    </table>
                </stripes:form>

###Example Java Action###

public class LoginActionBean extends BaseActionBean {

    private People loginUser = new People();
    private PeoplePersist peopleDao;
    private String loginName = "";
    private String loginPassword = "";

    @DefaultHandler
    public Resolution load() {
        return new ForwardResolution("/WEB-INF/jsp/login.jsp");
    }

    public Resolution login() {
        peopleDao = new PeoplePersist(getContext().getServletContext());
        loginUser = peopleDao.findUser(loginName, loginPassword);
        if (loginUser != null) {
            return new ForwardResolution("/WEB-INF/jsp/users.jsp");
        } else {
            return new RedirectResolution("/WEB-INF/jsp/login.jsp");
        }
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public void setLoginPassword(String loginPassword) {
        this.loginPassword = loginPassword;
    }

    public List<People> getUsers() {
        peopleDao = new PeoplePersist(getContext().getServletContext());
        return peopleDao.findUsers();
    }
}

Java data access object powered by Persist ORM/DAO

I am choose Persist, because you can easy get data from model of database and need minimum settings for run SQL commands.

NORD POS mobile - Product view

###Example Java Data Access Object###

    public People findUser(String login, String password) {
        People validUser;
        if (password == null) {
            validUser = persist.read(People.class,
                    "SELECT ID, NAME, APPPASWORD FROM PEOPLE "
                    + "WHERE NAME = ? AND APPPASSWORD IS NULL",
                    login);
        } else {
            validUser = persist.read(People.class,
                    "SELECT ID, NAME, APPPASWORD FROM PEOPLE "
                    + "WHERE NAME = ? AND APPPASSWORD = ?",
                    login,
                    PasswordUtils.hashString(password));
        }

        return validUser;
    }

    public People findUser(String id) {
        return persist.read(People.class,
                "SELECT ID, NAME, APPPASWORD FROM PEOPLE WHERE ID = ?",
                id);
    }

    public List<People> findUsers() {
        return persist.readList(People.class,
                "SELECT ID, NAME, APPPASWORD FROM PEOPLE ORDER BY NAME");
    }

    public Integer countUsers() {
        return persist.read(Integer.class,
                "SELECT COUNT(ID) FROM PEOPLE");
    }

###Example Java Model###

public class People {

    private String id;
    private String name;
    private String apppasword;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAppPassword() {
        return apppasword;
    }

    public void setAppPassword(String apppasword) {
        this.apppasword = apppasword;
    }
}

Mobile user interface powered by jQuery Mobile

I am choose jQuery Mobile, because you need only one line of source code for change all elements of interface.

NORD POS mobile - Categories list