Package org.apache.beehive.samples.petstore.model

Examples of org.apache.beehive.samples.petstore.model.Account


    // todo: format validation for e-mail, zip, credit card, date
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        Order order = getOrder();
        ActionErrors errors = new ActionErrors();
        Account account = order.getAccount();

        addErrorIfStringEmpty(errors, "creditCart", "order.error.creditCard.required", order.getCreditCard());
        addErrorIfStringEmpty(errors, "expirationDate", "order.error.expirationDate.required", order.getExprDate());
        addErrorIfStringEmpty(errors, "cardType", "order.error.cardType.required", order.getCardType());
View Full Code Here


                                  required = true)
                })
        }
    )
    protected Forward viewCreateAccount() {
        Account account = new Account();
        _createForm = new CreateAccountForm(account);

        Forward forward = new Forward("success", _createForm);
        forward.addActionOutput("categoryNames", _sharedFlow.getCategoryNames());
        forward.addActionOutput("languages", LANGUAGES);
View Full Code Here

        if(_accountControl.checkAccountExists(form.getUserId())) {
            _isUsernameTaken = true;
            return new Forward("failure");
        }

        Account userAccount = AccountForm.getAccount(form);

        _accountControl.insertAccount(userAccount);
        _sharedFlow.updateAccount(userAccount);

        return new Forward("shop");
View Full Code Here

    }

    public void handleLogin(String username)
        throws NoSuchAccountException, InvalidIdentifierException {

        Account account = _accountControl.getAccount(username);

        // Throw an exception if the user is not found
        if(account == null)
      throw new NoSuchAccountException("Unknown user: " + username);
       
        // and set the account (this toggles the user's logged in status)
        setAccount(account);

        // set the user's favorites list if they are logged in
        if (account.isMyListOpt())
        {
            Product[] favProducts = _catalogControl.getProductListByCategory(account.getFavCategory());
            setMyList(favProducts);
        }
    }
View Full Code Here

            _repeatedPassword = repeatedPassword;
        }

        public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
            ActionErrors errors = new ActionErrors();
            Account account = getAccount();
            account.setStatus("OK");

            addErrorIfStringEmpty(errors, "userId", "account.error.userid.required", account.getUserId());

            if(account.getPassword() == null ||
                account.getPassword().length() < 1 ||
                !account.getPassword().equals(getRepeatedPassword())) {
                errors.add("repeatedPassword", new ActionError("account.error.password.missing"));
            }

            baseValidate(errors, mapping, request);
View Full Code Here

    // todo: format validation for e-mail, zip, credit card, date
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
    {
        Order order = getOrder();
        ActionErrors errors = new ActionErrors();
        Account account = order.getAccount();

        addErrorIfStringEmpty(errors, "creditCart", "order.error.creditCard.required", order.getCreditCard());
      addErrorIfStringEmpty(errors, "expirationDate", "order.error.expirationDate.required", order.getExprDate());
        addErrorIfStringEmpty(errors, "cardType", "order.error.cardType.required", order.getCardType());
       
View Full Code Here

        _repeatedPassword = repeatedPassword;
    }

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        Account account = getAccount();
        account.setStatus("OK");

        addErrorIfStringEmpty(errors, "userId", "account.error.userid.required", account.getUserId());

        if(account.getPassword() == null ||
            account.getPassword().length() < 1 ||
            !account.getPassword().equals(getRepeatedPassword())) {
            errors.add("repeatedPassword", new ActionError("account.error.password.missing"));
        }

        baseValidate(errors, mapping, request);
View Full Code Here

    public Account getAccount(String key) throws NoSuchAccountException
    {
        if (!checkAccountExists(key))
            throw new NoSuchAccountException("no Account found for userId: " + key);

    Account acct = new Account();
    acct = _accountDao.getAccountById(key);
    if (acct.getUserId() == null)
      throw new NoSuchAccountException("no Account found for userId: " + key);
    return acct;
    }
View Full Code Here

                                  required = true)
                })
        }
    )
    public Forward viewCreateAccount() {
        Account account = new Account();
        _createForm = new CreateAccountForm(account);

        Forward forward = new Forward("success", _createForm);
        forward.addActionOutput("categoryNames", _sharedFlow.getCategoryNames());
        forward.addActionOutput("languages", getLanguages());
View Full Code Here

        if(_accountControl.checkAccountExists(form.getUserId())) {
            _isUsernameTaken = true;
            return new Forward("failure");
        }

        Account userAccount = AccountForm.getAccount(form);

        _accountControl.insertAccount(userAccount);
        _sharedFlow.updateAccount(userAccount);

        return new Forward("shop");
View Full Code Here

TOP

Related Classes of org.apache.beehive.samples.petstore.model.Account

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.