Package com.stormpath.tooter.model

Examples of com.stormpath.tooter.model.Toot


    @Override
    public void validate(Object o, Errors errors) {

        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "tootMessage", "tooter.required", "Field toot is required");

        Toot toot = (Toot) o;

        if (toot.getTootMessage() != null && toot.getTootMessage().length() > 160) {
            errors.rejectValue("tootMessage", "tooter.too.many.chars");
        }
    }
View Full Code Here


        if (!result.hasErrors()) {

            User persistCustomer = new User(sessionUser);

            List<Toot> tootList;
            Toot persistToot = new Toot();
            persistToot.setTootMessage(toot.getTootMessage());
            persistToot.setCustomer(persistCustomer);

            try {

                tootDao.saveToot(persistToot);
                toot.setTootId(persistToot.getTootId());
                tootList = tootDao.getTootsByUserId(persistCustomer.getId());

                for (Toot itemToot : tootList) {
                    itemToot.setCustomer(sessionUser);
                }
View Full Code Here

                           BindingResult result,
                           HttpSession session) {

        List<Toot> tootList;

        Toot newToot = new Toot();

        try {

            User user = (User) session.getAttribute("sessionUser");

            if (user == null || user.getId() == null) {
                // if they're not in the session, they're probably not logged in
                return "redirect:/login";
            }

            tootList = tootDao.getTootsByUserId(user.getId());

            for (Toot itemToot : tootList) {
                itemToot.setCustomer(user);
            }

            Collections.sort(tootList);
            user.setTootList(tootList);
            newToot.setCustomer(user);
        } catch (Exception e) {
            e.printStackTrace();
        }

        model.addAttribute("toot", newToot);
View Full Code Here

TOP

Related Classes of com.stormpath.tooter.model.Toot

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.