Package org.apache.tapestry.vlib.ejb

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


    public abstract void setUserBookModel(IPropertySelectionModel userBookModel);

    public void activate(IRequestCycle cycle, Integer fromUserId, Integer toUserId)
    {
        Person fromUser = readPerson(fromUserId);

        IPropertySelectionModel model = buildUserBookModel(fromUser);

        if (model.getOptionCount() == 0)
        {
            IErrorProperty page = (IErrorProperty) cycle.getPage();
            page.setError(format("user-has-no-books", fromUser.getNaturalName()));
            return;
        }

        setFromUserId(fromUserId);
        setFromUser(fromUser);
View Full Code Here


     * toUser and userBookModel properties at the start of each request cycle.
     */

    public void pageBeginRender(PageEvent event)
    {
        Person fromUser = getFromUser();

        if (fromUser == null)
        {
            fromUser = readPerson(getFromUserId());
            setFromUser(fromUser);
        }

        if (getUserBookModel() == null)
            setUserBookModel(buildUserBookModel(fromUser));

        Person toUser = getToUser();
        if (toUser == null)
        {
            toUser = readPerson(getToUserId());
            setToUser(toUser);
        }
View Full Code Here

            setError(getMessage("no-books-selected"));
            return;
        }

        Integer[] keys = (Integer[]) selectedBooks.toArray(new Integer[count]);
        Person toUser = getToUser();

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

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

                operations.transferBooks(toUser.getId(), keys);

                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Unable to transfer ownership of books.", ex, i++);
            }
        }

        Person fromUser = getFromUser();
        IMessageProperty selectPage = (TransferBooksSelect) cycle.getPage("TransferBooksSelect");
        selectPage.setMessage(format("transfered-books", Integer.toString(count), fromUser
                .getNaturalName(), toUser.getNaturalName()));
        cycle.activate(selectPage);
    }
View Full Code Here

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

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

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

                loginUser(person, cycle);

                break;
View Full Code Here

    {
        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

    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

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

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

                loginUser(person, cycle);

                break;
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.