Package domain

Examples of domain.UserRequest


    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String requestedStr = request.getParameter("clientrequested");
        if (requestedStr == null || requestedStr.isEmpty()) {
            return new ModelAndView("redirect:/operator/request/index.htm");
        }
        UserRequest requested = null;
        try {
            requested = CH.get(getDao(), UserRequest.class, requestedStr);
        } catch (Exception ex) {
        }
        if (requested == null) {
            return new ModelAndView("redirect:/operator/request/index.htm");
        }

        Client client = new Client();
        client.setSurname(getDirectoryItem(Surname.class, requested.getSurname()));
        client.setName(getDirectoryItem(Name.class, requested.getName()));
        client.setPatronymic(getDirectoryItem(Patronymic.class, requested.getPatronymic()));
        client.setBorn(requested.getBornDate());
        client.setSex(requested.getSex());
        client.setTelephones(requested.getPhoneNumber());
        client.setAddressID(requested.getAddress().getId());
        client.setAddressCashe(requested.getAddress().getAsStringCashe());
        client.setDistrict(requested.getDistrict());
        getDao().save((EntityWithId)client);

        UserClient userClient = new UserClient();
        userClient.setUserClientPK(new UserClientPK(getUserInfo().getLogin(), client.getId()));
        userClient.setClient(client);
        userClient.setUserLogin(requested.getRequesterLogin());
        getDao().save(userClient);

        getDao().delete(requested);

        return new ModelAndView("redirect:/operator/client.htm?client=" + client.getId());
View Full Code Here


    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String requestedStr = request.getParameter("clientrequested");
        if (requestedStr != null && !requestedStr.isEmpty()) {
            try {
                UserRequest requested = CH.get(getDao(), UserRequest.class, requestedStr);
                getDao().delete(requested);
            } catch (Exception ex) {
            }
        }
View Full Code Here

        String requestedStr = request.getParameter("clientrequested");
        if (requestedStr == null || requestedStr.isEmpty()) {
            return new ModelAndView("redirect:/operator/request/index.htm");
        }
        UserRequest requested = null;
        try {
            requested = CH.get(getDao(), UserRequest.class, requestedStr);
        } catch (Exception ex) {
        }
        if (requested == null) {
            return new ModelAndView("redirect:/operator/request/index.htm");
        }

        UserClient userClient = new UserClient();
        userClient.setUserClientPK(new UserClientPK(getUserInfo().getLogin(), client.getId()));
        userClient.setClient(client);
        userClient.setUserLogin(requested.getRequesterLogin());
        getDao().save(userClient);

        return new ModelAndView("redirect:/operator/request/index.htm");
    }
View Full Code Here

    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String requestStr = request.getParameter("clientrequested");
        if (requestStr == null || requestStr.isEmpty()) {
            return new ModelAndView("redirect:/operator/request/index.htm");
        }
        UserRequest userRequest = null;
        try {
            userRequest = CH.get(getDao(), UserRequest.class, requestStr);
        } catch (Exception ex) {
        }
        if (userRequest == null) {
            return new ModelAndView("redirect:/operator/request/index.htm");
        }

        ClientData data = new ClientData();
        data.surname = userRequest.getSurname() != null ? userRequest.getSurname().trim() : "";
        data.name = userRequest.getName() != null ? userRequest.getName().trim() : "";
        data.patron = userRequest.getPatronymic() != null ? userRequest.getPatronymic().trim() : "";
        List<Client> clientList = getDao().findOutClientsByData(data);

        List<ClientData> clients = new LinkedList<ClientData>();
        for (Client client : clientList) {
            ClientData clientData = new ClientData();
            clientData.client = client;

            Address address = null;
            if (client.getAddressID() != null) {
                address = getDao().getById(Address.class, client.getAddressID());
            }
            clientData.address = address != null ? address.getAsStringShort() : "";

            clientData.born = Converter.dateToString(client.getBorn());

            clients.add(clientData);
        }

        HashMap model = new HashMap();

        ClientRequestedData requestedData = new ClientRequestedData();
        requestedData.requested = userRequest;


        Address address = userRequest.getAddress();
        if (address != null && address.getAddressObject() != null) {
            requestedData.address = address.getAsStringShort();
        }

        model.put("userrequest", requestedData);
View Full Code Here

            return showForm(request, errors, getFormView());
        }

        //end check DTO

        UserRequest ur = new UserRequest();
        ur.setBornDate(getBornDate(urdto));

        try {
            Integer address = createAddress(urdto);
            ur.setAddress(getDao().getById(Address.class, address));
        } catch (Exception ex) {
            errors.rejectValue("area", "register.wrongaddress");
            return showForm(request, errors, getFormView());
        }
        District defaultDistrict = AddressManager.getDefaultDistrict(getDao(), urdto.getStreet(), urdto.getBuilding());
        ur.setDistrict(defaultDistrict);
        ur.setSurname(urdto.getSurname());
        ur.setName(urdto.getName());
        ur.setPatronymic(urdto.getPatronymic());
        ur.setOms(urdto.getOms());
        ur.setPhoneNumber(urdto.getPhoneNumber());
        ur.setRequesterLogin(getUserInfo().getLogin());
        ur.setSex(urdto.getSex());
        getDao().save(ur);
        return new ModelAndView("redirect:/users/list.htm");
    }
View Full Code Here

        String requestStr = hsr.getParameter("request");
        if (requestStr == null || requestStr.isEmpty()) {
            return new ModelAndView("redirect:/users/list.htm");
        }
       
        UserRequest request = null;
        try {
            request = CH.get(getDao(), UserRequest.class, hsr.getParameter("request"));
        } catch (Exception ex) {
        }
        if (request != null) {
View Full Code Here

TOP

Related Classes of domain.UserRequest

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.