Examples of CustomerUserTO


Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

    public void load() {
        if (getContext().getRequest().getParameter("id") == null) {
            return;
        }
        Long id = Long.parseLong(getContext().getRequest().getParameter("id"));
        CustomerUserTO cuto = cuFacade.getByCustomerId(id);
        cto = cuto.getCustomer();
        uto = cuto.getUser();

        this.setCto(cto);
        this.setUto(uto);
        logger.debug("load() \ncuto={} \ncto={} \nuto={}", cuto, cto, uto);
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

    public Resolution save() {
        logger.debug("save() cto={} \nuto={}", this.getCto(), this.getUto());
        logger.debug("save() cto={} \nuto={}", cto, uto);
        if (uto.getPassword().equals(password2)) {
            logger.debug("save() cto={} \nid={}", cto, cto.getUser());
            cuFacade.update(new CustomerUserTO(cto, uto));           
            return new RedirectResolution("/tyre/list");
        }
        passwordError = "true";
        return new RedirectResolution("/registration/edit.jsp").addParameter("passwordError", passwordError).flash(this);
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

            d.setUsername(restUsername);
            d.setPassword(restPassword);
           
            return d;
        }
        CustomerUserTO cUser = cuFacade.getByUsername(string);
        if (cUser == null) {
            throw new UsernameNotFoundException(string + " not found");
        }
        d.setIsAdmin(cUser.getUser().getRoleAdmin());
        if (d.getIsAdmin()) {
            d.setAuthorities(Arrays.asList(createRole("ROLE_ADMIN")));
        } else {
            d.setAuthorities(Arrays.asList(createRole("ROLE_USER")));
        }
        d.setUsername(cUser.getUser().getUsername());
        d.setPassword(cUser.getUser().getPassword());
        d.setCustomer(cUser.getCustomer());

        return d;
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

        log.debug("load() \ncto={} \nuto={}", cto, uto);
        if (getContext().getRequest().getParameter("cto.id") == null) {
            return;
        }
        Long id = Long.parseLong(getContext().getRequest().getParameter("cto.id"));
        CustomerUserTO cuto = cuFacade.getByCustomerId(id);
        cto = cuto.getCustomer();
        uto = cuto.getUser();

        log.debug("load() \ncuto={} \ncto={} \nuto={}", cuto, cto, uto);       
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

    public Resolution save() {
        log.debug("save() cto={} \nuto={}", this.getCto(), this.getUto());       
        if (uto.getPassword().equals(password2)) {
            log.debug("save() cto={} \nid={}", cto, cto.getUser());
            cuFacade.update(new CustomerUserTO(cto, uto));           
            return new RedirectResolution("/customer/list.jsp");
        }
       
        return new RedirectResolution(this.getClass(), "all");
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

            throw new IllegalArgumentException("id is null");
        }
       
        CustomerTO cto = cservice.get(id);
        UserTO uto = cto.getUser();       
        return new CustomerUserTO(cto, uto);
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

    @Override
    public List<CustomerUserTO> findAll() {
        List<CustomerTO> customerTOList = cservice.findAll();
        List<CustomerUserTO> cuTOList = new ArrayList<>();
        for (CustomerTO c : customerTOList) {
            cuTOList.add(new CustomerUserTO(c, c.getUser()));
        }
        return cuTOList;
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

    @Override
    public CustomerUserTO getByUsername(String username) {
        UserTO userTO = uservice.getByUsername(username);       
        CustomerTO customerTO = cservice.getByUsername(username);
       
        return new CustomerUserTO(customerTO, userTO);
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

        user = createUser("mrkvicka", "345sac", false);
        user.setId(5L);
        userTO = mapper.map(user, UserTO.class);       
        customer = createCustomer(4L, "Adam", "Petrik", "Burzoazna 12", "112567");
        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO)
       
        when(ctoMock.getUser()).thenReturn(userTO);       
        when(cservice.get(4L)).thenReturn(customerTO);                     

        CustomerUserTO cuto = facade.getByCustomerId(4L);
        assertEquals(customerUserTO, cuto);
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.dto.CustomerUserTO

        user = createUser("mrkvicka", "345sac", false);
        user.setId(5L);
        userTO = mapper.map(user, UserTO.class);       
        customer = createCustomer(4L, "Adam", "Petrik", "Burzoazna 12", "112567");
        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO)
       
        facade.remove(customerUserTO);
        verify(cservice).remove(customerTO);
        verify(uservice).remove(userTO);
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.