Package org.apache.tapestry.vlib.ejb

Examples of org.apache.tapestry.vlib.ejb.Person


    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        Integer targetUserId = getTargetUserId();

        Person target = vengine.readPerson(targetUserId);

        List selectedBooks = getSelectedBooks();

        int count = Tapestry.size(selectedBooks);

        if (count == 0)
        {
            setError(format("select-at-least-one-book", target.getNaturalName()));
            return;
        }

        Integer[] bookIds = (Integer[]) selectedBooks.toArray(new Integer[count]);

        int i = 0;
        while (true)
        {
            IOperations operations = vengine.getOperations();

            try
            {
                operations.transferBooks(targetUserId, bookIds);

                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure(getMessage("update-failure"), ex, i++);
            }
        }

        MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");

        myLibrary.setMessage(
            format("transfered-books", Integer.toString(count), target.getNaturalName()));

        myLibrary.activate(cycle);
    }
View Full Code Here


        EntitySelectionModel result = new EntitySelectionModel();

        for (i = 0; i < persons.length; i++)
        {

            Person p = persons[i];
            Integer pk = p.getId();

            if (pk.equals(userPK))
                continue;

            result.add(pk, p.getNaturalName());
        }

        return result;
    }
View Full Code Here

    }

    public void pageBeginRender(PageEvent event)
    {
        Person person = getPerson();

        if (person == null)
        {
            VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
View Full Code Here

        while (true)
        {
            try
            {
                IOperations bean = vengine.getOperations();
                Person user =
                    bean.registerNewUser(getFirstName(), getLastName(), getEmail(), password1);

                // Ask the login page to return us to the proper place, as well
                // as set a cookie identifying the user for next time.
View Full Code Here

        {
            try
            {
                IOperations operations = vengine.getOperations();

                Person person = operations.login(getEmail(), password);

                loginUser(person, cycle);

                break;
View Full Code Here

    public void synchronizeUser(IRequestCycle cycle)
    {
        UserListEditMap map = getListEditMap();

        Person user = (Person) map.getValue();

        if (user == null)
        {
            setError(getMessage("out-of-date"));
            throw new PageRedirectException(this);
View Full Code Here

    {
        Connection connection = null;
        IStatement statement = null;
        ResultSet set = null;

        Person result = null;

        try
        {
            connection = getConnection();
View Full Code Here

    public Person login(String email, String password) throws RemoteException, LoginException
    {
        IPersonHome home = getPersonHome();
        IPerson person = null;
        Person result = null;

        try
        {
            person = home.findByEmail(email);
        }
        catch (FinderException ex)
        {
            throw new LoginException("Unknown e-mail address.", false);
        }

        if (!person.getPassword().equals(password))
            throw new LoginException("Invalid password.", true);

        try
        {
            result = getPerson((Integer) person.getPrimaryKey());
        }
        catch (FinderException ex)
        {
            throw new LoginException("Could not read person.", false);
        }

        if (result.isLockedOut())
            throw new LoginException("You have been locked out of the Virtual Library.", false);

        // Set the last access time for any subsequent login.

        person.setLastAccess(new Timestamp(System.currentTimeMillis()));
View Full Code Here

        int count = Tapestry.size(updated);

        for (int i = 0; i < count; i++)
        {
            Person u = updated[i];
            IPerson person = home.findByPrimaryKey(u.getId());

            person.setAdmin(u.isAdmin());
            person.setLockedOut(u.isLockedOut());
        }

        count = Tapestry.size(resetPassword);

        for (int i = 0; i < count; i++)
View Full Code Here

        columns[Person.EMAIL_COLUMN] = set.getString(column++);
        columns[Person.LOCKED_OUT_COLUMN] = getBoolean(set, column++);
        columns[Person.ADMIN_COLUMN] = getBoolean(set, column++);
        columns[Person.LAST_ACCESS_COLUMN] = set.getTimestamp(column++);

        return new Person(columns);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.vlib.ejb.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.