Package org.simplecart.webapp.forms

Examples of org.simplecart.webapp.forms.PartyForm


        // get the session to store the new user object
        HttpSession session = request.getSession();
       
        // cast my form to a useful Type
        PartyForm customerForm = (PartyForm) form;
       
        // copy form-bean values to new Stake and Address objects
        Address newAddress = new Address();
        PropertyUtils.copyProperties(newAddress, customerForm);
        Customer newCustomer = new Customer();
        PropertyUtils.copyProperties(newCustomer, customerForm);
       
        // attache the address to this new customer
        newCustomer.setAddress(newAddress);
       
        // store customer object in the session
        session.setAttribute(Constants.LOGGED_IN_USER_KEY,newCustomer);
       
        // get a DAO for the new Stake
        dao = new CustomerDAO();
       
        // store the new Stake
        dao.makePersistent(newCustomer);
       
        // commit this transaction
        HibernateUtility.commitTransaction();
        HibernateUtility.closeSession();
       
        //********** NOW LOG the CUSTOMER IN **********
       
        SecurityService securityService = new CustomerSecurityService();
        Customer customer = null;

        // perform authentication
        try {
            customer = (Customer) securityService.authenticate(customerForm.getUsername(), customerForm.getPassword());
        } catch (AuthenticationException e) {
            if (e.getMessage().equals("Error initializing dao"))
                errors.add(
                        ActionMessages.GLOBAL_MESSAGE,
                        new ActionMessage("error.database"));
View Full Code Here


            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
       
        // cast my form to a useful Type
        PartyForm customerForm = (PartyForm) form;
       
        // get a DAO for the new Stake
        dao = new CustomerDAO();
       
        Customer customer = null;
       
        try {
            // find customer objects and attach to request
            customer = dao.findById(customerForm.getId(), false);
           
            // copy form-bean values to new Stake and Address objects
            // NOTE: PropertyUtils will not work in this situation since there
            //       is an ID field which is different for Stake and Address
            customer.setNameFirst(customerForm.getNameFirst());
            customer.setNameLast(customerForm.getNameLast());
            customer.setUsername(customerForm.getUsername());
            customer.setPassword(customerForm.getPassword());
            customer.setEmailAddress(customerForm.getEmailAddress());
            customer.setCompanyName(customerForm.getCompanyName());
            customer.setPhone(customerForm.getPhone());
            customer.getAddress().setStreetLine1(customerForm.getStreetLine1());
            customer.getAddress().setStreetLine2(customerForm.getStreetLine2());
            customer.getAddress().setCity(customerForm.getCity());
            customer.getAddress().setState(customerForm.getState());
            customer.getAddress().setPostalCode(customerForm.getPostalCode());
           
            // update the Stake
            dao.makePersistent(customer);
           
            // close transaction and session
View Full Code Here

            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
       
        // cast my form to a useful Type
        PartyForm administratorForm = (PartyForm) form;
       
        // copy form-bean values to new Stake and Address objects
        Address newAddress = new Address();
        PropertyUtils.copyProperties(newAddress, administratorForm);
        Administrator newAdministrator = new Administrator();
View Full Code Here

            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
       
        // cast my form to a useful Type
        PartyForm administratorForm = (PartyForm) form;
       
        // get a DAO for the new Stake
        dao = new AdministratorDAO();
       
        Administrator administrator = null;
       
        try {
            // find administrator objects and attach to request
            administrator = dao.findById(administratorForm.getId(), false);
           
            // copy form-bean values to new Stake and Address objects
            // NOTE: PropertyUtils will not work in this situation since there
            //       is an ID field which is different for Stake and Address
            administrator.setNameFirst(administratorForm.getNameFirst());
            administrator.setNameLast(administratorForm.getNameLast());
            administrator.setUsername(administratorForm.getUsername());
            administrator.setPassword(administratorForm.getPassword());
            administrator.setEmailAddress(administratorForm.getEmailAddress());
            administrator.getAddress().setStreetLine1(administratorForm.getStreetLine1());
            administrator.getAddress().setStreetLine2(administratorForm.getStreetLine2());
            administrator.getAddress().setCity(administratorForm.getCity());
            administrator.getAddress().setState(administratorForm.getState());
            administrator.getAddress().setPostalCode(administratorForm.getPostalCode());
           
            // update the Stake
            dao.makePersistent(administrator);
           
            // close transaction and session
View Full Code Here

            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
       
        // cast my form to a useful Type
        PartyForm administratorForm = (PartyForm) form;
       
        // copy form-bean values to new Stake objects
        Administrator administrator = new Administrator();
        PropertyUtils.copyProperties(administrator, administratorForm);
       
View Full Code Here

TOP

Related Classes of org.simplecart.webapp.forms.PartyForm

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.