Package org.apache.tapestry.vlib

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine


    {
        if (isInError())
            return;

        Visit visit = (Visit) getVisit();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();

        UserListEditMap map = getListEditMap();

        List updatedUsers = map.getValues();

        Person[] updates = (Person[]) updatedUsers.toArray(new Person[updatedUsers.size()]);

        Integer[] resetPasswordUserIds = toArray(map.getResetPasswordKeys());
        Integer[] deletedUserIds = toArray(map.getDeletedKeys());

        String password = getPassword();
        setPassword(null);

        if (Tapestry.isBlank(password) && Tapestry.size(resetPasswordUserIds) != 0)
        {
            setErrorField("inputPassword", getMessage("need-password"));
            return;
        }

        Integer adminId = visit.getUserId();

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

                operations.updatePersons(
                    updates,
                    resetPasswordUserIds,
                    password,
                    deletedUserIds,
                    adminId);
                break;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure(getMessage("update-failure"), ex, i++);
            }
            catch (RemoveException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
View Full Code Here


    private void runQuery()
    {
        Visit visit = (Visit) getVisit();
        Integer userPK = visit.getUserId();

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        SortOrdering ordering = new SortOrdering(getSortColumn(), isDescending());

        int i = 0;
        while (true)
        {
            try
            {
                IBookQuery query = getBorrowedQuery();

                if (query == null)
                {
                    query = vengine.createNewQuery();
                    setBorrowedQuery(query);
                }

                int count = query.borrowerQuery(userPK, ordering);

                if (count != _browser.getResultCount())
                    _browser.initializeForResultCount(count);

                break;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception finding borrowed books.", ex, i++);

                setBorrowedQuery(null);
            }
        }
    }
View Full Code Here

    public void returnBook(IRequestCycle cycle)
    {
        Object[] parameters = cycle.getServiceParameters();
        Integer bookPK = (Integer) parameters[0];

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        IOperations operations = vengine.getOperations();

        try
        {
            Book book = operations.returnBook(bookPK);
View Full Code Here

        cycle.activate(loginPage);
    }

    public void logout(IRequestCycle cycle)
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getPage().getEngine();

        vengine.logout();

        IMessageProperty home = (IMessageProperty) cycle.getPage("Home");

        home.setMessage(getMessage("goodbye"));
View Full Code Here

        if (isInError())
            return;

        Visit visit = (Visit) getVisit();
        Integer userId = visit.getUserId();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();

        attributes.put("ownerId", userId);
        attributes.put("holderId", userId);

        int i = 0;
        while (true)
        {
            try
            {

                IOperations operations = vengine.getOperations();

                if (publisherId != null)
                    operations.addBook(attributes);
                else
                {
                    operations.addBook(attributes, publisherName);

                    // Clear the app's cache of info; in this case, known publishers.

                    vengine.clearCache();
                }

                break;
            }
            catch (CreateException ex)
            {
                setError("Error adding book: " + ex.getMessage());
                return;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception adding new book.", ex, i++);
            }
        }

        // Success.  First, update the message property of the return page.
View Full Code Here

        }

        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");
View Full Code Here

        cycle.activate(selectPage);
    }

    private IPropertySelectionModel buildUserBookModel(Person user)
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Book[] books = null;

        int i = 0;
        while (true)
        {
            books = null;

            try
            {
                IBookQuery query = vengine.createNewQuery();

                int count = query.ownerQuery(user.getId(), null);

                if (count > 0)
                    books = query.get(0, count);

                break;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure(
                    "Unable to retrieve books owned by " + user.getNaturalName() + ".",
                    ex,
                    i++);
            }
        }
View Full Code Here

        return model;
    }

    private Person readPerson(Integer personId)
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        return vengine.readPerson(personId);
    }
View Full Code Here

        {
            setErrorField("inputPassword1", getMessage("password-must-match"));
            return;
        }

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Login login = (Login) cycle.getPage("Login");

        int i = 0;
        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.

                login.loginUser(user, cycle);

                break;
            }
            catch (RegistrationException ex)
            {
                setError(ex.getMessage());
                return;
            }
            catch (CreateException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception registering new user.", ex, i++);
            }
        }
    }
View Full Code Here

     *
     **/

    private void readPublishers()
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Publisher[] publishers = null;

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

                publishers = operations.getPublishers();

                break;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure(getMessage("read-failure"), ex, i++);
            }
        }

        ListEditMap map = new ListEditMap();

View Full Code Here

TOP

Related Classes of org.apache.tapestry.vlib.VirtualLibraryEngine

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.