Examples of IPersonHome


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

    public Book borrowBook(Integer bookId, Integer borrowerId)
        throws FinderException, RemoteException, BorrowException
    {
        IBookHome bookHome = getBookHome();
        IPersonHome personHome = getPersonHome();

        IBook book = bookHome.findByPrimaryKey(bookId);

        if (!book.getLendable())
            throw new BorrowException("Book may not be borrowed.");

        // Verify that the borrower exists.

        personHome.findByPrimaryKey(borrowerId);

        // TBD: Check that borrower has authenticated

        // findByPrimaryKey() throws an exception if the EJB doesn't exist,
        // so we're safe.

        personHome.findByPrimaryKey(book.getOwnerId());

        // Here's the real work; just setting the holder of the book
        // to be the borrower.

        book.setHolderId(borrowerId);
View Full Code Here

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

    }

    public void updatePerson(Integer personId, Map attributes)
        throws FinderException, RemoteException
    {
        IPersonHome home = getPersonHome();

        IPerson person = home.findByPrimaryKey(personId);

        person.updateEntityAttributes(attributes);
    }
View Full Code Here

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

        return result;
    }

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

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

        return result;
    }

    public Map getPersonAttributes(Integer personId) throws FinderException, RemoteException
    {
        IPersonHome home = getPersonHome();

        IPerson person = home.findByPrimaryKey(personId);

        return person.getEntityAttributes();
    }
View Full Code Here

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

     **/

    public Person registerNewUser(String firstName, String lastName, String email, String password)
        throws RegistrationException, CreateException, RemoteException
    {
        IPersonHome home;

        if (password == null || password.trim().length() == 0)
            throw new RegistrationException("Must specify a password.");

        validateUniquePerson(firstName, lastName, email);

        home = getPersonHome();

        Map attributes = new HashMap();

        attributes.put("lastName", lastName.trim());
        attributes.put("firstName", firstName.trim());
        attributes.put("email", email.trim());
        attributes.put("password", password.trim());
        attributes.put("lastAccess", new Timestamp(System.currentTimeMillis()));

        IPerson person = home.create(attributes);

        Integer personId = (Integer) person.getPrimaryKey();

        try
        {
View Full Code Here

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

        if (newOwnerId == null)
            throw new RemoteException("Must provide an owner for the books.");

        // Verify that the new owner exists.

        IPersonHome personHome = getPersonHome();
        personHome.findByPrimaryKey(newOwnerId);

        // Direct SQL would be more efficient, but this'll probably do.

        IBookHome home = getBookHome();
View Full Code Here

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

        String newPassword,
        Integer[] deleted,
        Integer adminId)
        throws FinderException, RemoveException, RemoteException
    {
        IPersonHome home = getPersonHome();

        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++)
        {
            IPerson person = home.findByPrimaryKey(resetPassword[i]);

            person.setPassword(newPassword);
        }

        count = Tapestry.size(deleted);

        if (count > 0)
        {
            returnBooksFromDeletedPersons(deleted);
            moveBooksFromDeletedPersons(deleted, adminId);
        }

        for (int i = 0; i < count; i++)
            home.remove(deleted[i]);
    }
View Full Code Here

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

    public Book borrowBook(Integer bookId, Integer borrowerId)
        throws FinderException, RemoteException, BorrowException
    {
        IBookHome bookHome = getBookHome();
        IPersonHome personHome = getPersonHome();

        IBook book = bookHome.findByPrimaryKey(bookId);

        if (!book.getLendable())
            throw new BorrowException("Book may not be borrowed.");

        // Verify that the borrower exists.

        personHome.findByPrimaryKey(borrowerId);

        // TBD: Check that borrower has authenticated

        // findByPrimaryKey() throws an exception if the EJB doesn't exist,
        // so we're safe.

        personHome.findByPrimaryKey(book.getOwnerId());

        // Here's the real work; just setting the holder of the book
        // to be the borrower.

        book.setHolderId(borrowerId);
View Full Code Here

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

    }

    public void updatePerson(Integer personId, Map attributes)
        throws FinderException, RemoteException
    {
        IPersonHome home = getPersonHome();

        IPerson person = home.findByPrimaryKey(personId);

        person.updateEntityAttributes(attributes);
    }
View Full Code Here

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

        return result;
    }

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