Examples of VirtualLibraryEngine


Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

                if (i++ == 0)
                    getListener().actionTriggered(this, page.getRequestCycle());
                else
                {
                    VirtualLibraryEngine vengine = (VirtualLibraryEngine) page.getEngine();
                    vengine.rmiFailure("Unable to retrieve query results.", ex, i);
                }

            }
        }
View Full Code Here

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

            return;

        Visit visit = getVisitState();

        Integer userId = visit.getUserId();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) 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

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

        {
            delegate.record(getPassword1Field(), passwordMustMatch());
            return;
        }

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Login login = getLogin();

        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);

                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

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

     * id to Publisher. Also, sets the deletedPublisherIds property to an empty set.
     */

    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(updateFailure(), ex, i++);
            }
        }

        DefaultPrimaryKeyConverter converter = getConverter();

View Full Code Here

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

        Publisher[] updated = extractUpdatedPublishers();
        Integer[] deletedKeys = extractDeletedKeys();

        // Now, push the updates through to the database

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

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

                operations.updatePublishers(updated, deletedKeys);

                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoveException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure(updateFailure(), ex, i++);
            }
        }

        // Clear any cached info about publishers.

        vengine.clearCache();

        MyLibrary page = getMyLibrary();

        page.setMessage(publishersUpdated());
View Full Code Here

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

        // An error, from a validation field, may already have occured.

        if (delegate.getHasErrors())
            return;

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

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

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

                loginUser(person);

                break;

            }
            catch (LoginException ex)
            {
                IFormComponent field = ex.isPasswordError() ? getPasswordField() : getEmailField();

                getValidationDelegate().record(field, ex.getMessage());
                return;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception validating user.", ex, i++);
            }
        }
    }
View Full Code Here

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

     */

    public void activate()
    {
        Visit visit = getVisitState();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getRequestCycle().getEngine();

        Integer userId = visit.getUserId();
        Map attributes = null;

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

                attributes = operations.getPersonAttributes(userId);

                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception reading user.", ex, i++);
            }
        }

        attributes.remove("password");
        setAttributes(attributes);
View Full Code Here

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

            attributes.put("password", password1);
        }

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

        int i = 0;
        while (true)
        {
            try
            {
                /**
                 * Note: this allows the user to change thier e-mail such that it conflicts with
                 * another user! Need yet-another IOperations method to perform the update!
                 */

                IOperations operations = vengine.getOperations();

                operations.updatePerson(userId, attributes);
                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception updating user attributes.", ex, i++);
            }
        }

        vengine.clearCache();

        getMyLibrary().activate();
    }
View Full Code Here

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

    @InjectPage("MyLibrary")
    public abstract MyLibrary getMyLibrary();

    public void formSubmit()
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        Integer targetUserId = getTargetUserId();

        Person target = vengine.readPerson(targetUserId);

        List selectedBooks = getSelectedBooks();

        int count = Tapestry.size(selectedBooks);

        if (count == 0)
        {
            setError(selectAtLeastOneBook(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(updateFailure(), ex, i++);
            }
        }

        MyLibrary myLibrary = getMyLibrary();
View Full Code Here

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine

        myLibrary.activate();
    }

    private IPropertySelectionModel buildPersonModel()
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Visit visit = (Visit) vengine.getVisit();
        Integer userPK = visit.getUserId();

        Person[] persons = null;

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

            try
            {
                persons = operations.getPersons();

                break;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure(readUsersFailure(), ex, i++);
            }
        }

        EntitySelectionModel result = new EntitySelectionModel();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.