Package org.simplecart.administration

Examples of org.simplecart.administration.Administrator


            throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest) request;
        HttpServletResponse res = (HttpServletResponse) response;

        HttpSession session = req.getSession(); // get the session or create it
        Administrator admin = (Administrator) session.getAttribute(Constants.LOGGED_IN_ADMIN_KEY);
        if (admin == null) {
            // redirect to the login page
            res.sendRedirect(req.getContextPath() + "/AdministratorLogin.do");
        } else {
            chain.doFilter(request, response);
View Full Code Here


        orderAddress.setStreetLine2("apt. c");
        orderAddress.setCity("SLC");
        orderAddress.setState("UT");
        orderAddress.setPostalCode("84104");

        Administrator newAdmin = new Administrator();
        newAdmin.setNameFirst("Test");
        newAdmin.setNameLast("User");
        newAdmin.setUsername("test");
        newAdmin.setPassword("testpass");
        newAdmin.setEmailAddress("test@simplecart.org");
       
        // associate objects
        newAdmin.setAddress(generalAddress);

        dao.makePersistent(newAdmin);
       
        // create a sample customer
        Customer customer = new Customer();
View Full Code Here

        HttpSession session = request.getSession();
        String username = (String) PropertyUtils.getSimpleProperty(form,"username");
        String password = (String) PropertyUtils.getSimpleProperty(form,"password");
        ActionMessages errors = new ActionMessages();
        SecurityService securityService = new AdministrationSecurityService ();
        Administrator administrator = null;

        // perform authentication
        try {
            administrator = (Administrator) securityService.authenticate(username, password);
        } catch (AuthenticationException e) {
View Full Code Here

        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();
        PropertyUtils.copyProperties(newAdministrator, administratorForm);
       
        // attache the address to this new administrator
        newAdministrator.setAddress(newAddress);
       
        // get a DAO for the new Stake
        dao = new AdministratorDAO();
       
        // store the new Stake
View Full Code Here

        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

       
        // 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);
       
        // get a DAO for the new Stake
        dao = new AdministratorDAO();
       
View Full Code Here

                (HttpServletRequest) pageContext.getRequest();
        StringBuffer url = new StringBuffer(request.getContextPath());
        url.append(config.getPrefix());
        url.append(page);
        url.append(".do");
        Administrator administrator = null;
        try {
            administrator = (Administrator) pageContext.findAttribute(name);
        } catch (ClassCastException e) {
            administrator = null;
        }
        if (administrator == null && !this.activity.equals("enter"))
            throw new JspException
                    (messages.getMessage("error.generalMessage", name));
        if (page.indexOf("?") < 0)
            url.append("?");
        else
            url.append("&");
        url.append("activity=");
        url.append(this.activity);
        if (!this.activity.equals("enter")) {
            url.append("&administratorId=");
            url.append(TagUtils.getInstance().filter(administrator.getId().toString()));
        }
       
        // Generate the hyperlink start element
        HttpServletResponse response =
                (HttpServletResponse) pageContext.getResponse();
View Full Code Here

       
        // extract id from the request
        Long id = Long.decode(request.getParameter("administratorId"));
       
        // get Administrator object
        Administrator administrator = loadAdministrator(id);
       
        // create a administratorForm from a PartyForm
        administratorForm = (PartyForm) form;
       
        // copy properties to form-bean
        PropertyUtils.copyProperties(administratorForm, administrator);
        PropertyUtils.copyProperties(administratorForm, administrator.getAddress());
        administratorForm.setActivity(Constants.EDIT_PAGE_KEY);
        administratorForm.setId(administrator.getId());
       
        // go to display page
        return mapping.findForward(Constants.EDIT_PAGE_KEY);
       
    }
View Full Code Here

       
        // extract id from the request
        Long id = Long.decode(request.getParameter("administratorId"));
       
        // get Administrator object
        Administrator administrator = loadAdministrator(id);
       
        // create a administratorForm from a PartyForm
        administratorForm = (PartyForm) form;
       
        // copy properties to form-bean
        PropertyUtils.copyProperties(administratorForm, administrator);
        PropertyUtils.copyProperties(administratorForm, administrator.getAddress());
        administratorForm.setActivity(Constants.DELETE_PAGE_KEY);
        administratorForm.setId(administrator.getId());
       
        // go to display page
        return mapping.findForward(Constants.DELETE_PAGE_KEY);
       
    }
View Full Code Here

        if (dao == null){
            throw new AuthenticationException ("Error initializing dao");
        }

        // create example object for query
        Administrator loginAdministrator = new Administrator();
        loginAdministrator.setUsername(username);
       
        // find member object by example
        Collection matchingAdministrators = dao.findByExample(loginAdministrator);
        Iterator memberIter = matchingAdministrators.iterator();
        if (memberIter.hasNext()) {
            loginAdministrator = (Administrator) memberIter.next();
        } else loginAdministrator = null;

        if ((loginAdministrator == null) || !password.equals(loginAdministrator.getPassword())) {
            throw new AuthenticationException ("Error validating user");
        }

        // commit this transaction
        HibernateUtility.commitTransaction();
View Full Code Here

TOP

Related Classes of org.simplecart.administration.Administrator

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.