Package domain.address

Examples of domain.address.Address


        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);

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


        List<SheduleReception> receptions = getDao().getList(queryCriteria, null, null);

        HashMap<Integer, ReceptionGroup> map = new HashMap<Integer, ReceptionGroup>();
        for (SheduleReception reception : receptions) {
            Client client = reception.getClient();
            Address address = null;
            if (client.getAddressID() != null) {
                address = getDao().getById(Address.class, client.getAddressID());
            }
            ReceptionGroup group = map.get(client.getId());
            if (group == null) {
                group = new ReceptionGroup();
                lines.add(group);
                map.put(client.getId(), group);
                group.client = client;
                group.addressClient = address != null ? address.getAsStringShort() : "";
                group.receptionLines = new ArrayList<ReceptionLine>();
            }

            ReceptionLine receptLine = new ReceptionLine(reception);
            group.receptionLines.add(receptLine);
View Full Code Here

        Date current = GregorianCalendar.getInstance().getTime();
        if (canWork) {
            List<Client> clients = getDao().getList(queryCriteria, 0, 51);
            List<ClientLine> lines = new ArrayList<ClientLine>();
            for (Client client : clients) {
                Address address = null;
                if (client.getAddressID() != null) {
                    address = getDao().getById(Address.class, client.getAddressID());
                }
                if (address != null && dto.getHouse() != null && !dto.getHouse().isEmpty()) {
                    if (address.getBuilding() == null || !address.getBuilding().equals(dto.getHouse())) {
                        continue;
                    }
                }
                if (address != null && dto.getFlat() != null && !dto.getFlat().isEmpty()) {
                    if (address.getFlat() == null || !address.getFlat().equals(dto.getFlat())) {
                        continue;
                    }
                }
                if (address != null && dto.getCity() != null && !dto.getCity().isEmpty()) {
                    //Фильтруем по району/нас пункту
                    AddressObject item = address.getAddressObject();
                    boolean founded = false;
                    while (item != null) {
                        if ((item.getType().getLevel() == 3 || item.getType().getLevel() == 4)
                                && item.getTitle().toUpperCase().startsWith(dto.getCity().toUpperCase())) {
                            founded = true;
                        }
                        item = item.getParent();
                    }
                    if (!founded) {
                        continue;
                    }
                }
                if (address != null && dto.getStreet() != null && !dto.getStreet().isEmpty()) {
                    //Фильтруем по улице
                    AddressObject item = address.getAddressObject();
                    boolean founded = false;
                    while (item != null) {
                        if (item.getType().getLevel() == 5
                                && item.getTitle().toUpperCase().startsWith(dto.getStreet().toUpperCase())) {
                            founded = true;
                        }
                        item = item.getParent();
                    }
                    if (!founded) {
                        continue;
                    }
                }

                ClientLine cl = new ClientLine();
                cl.client = client;
                cl.date = Converter.dateToString(client.getBorn());
                if (client.getBorn() != null) {
                    cl.age = Integer.toString(DateTimeUtils.calcAge(client.getBorn(), current));
                } else {
                    cl.age = "";
                }
                cl.addressStr = address == null ? "" : address.getAsStringShort();
                cl.lpu = client.getDistrict() == null ? "" : client.getDistrict().getLpu().getTitleShort();
                lines.add(cl);
            }
            model.put("lines", lines);
            model.put("linescount", lines.size());
View Full Code Here

        model.put("count", receptions.size() > 50);

        HashMap<Integer, ReceptionGroup> map = new HashMap<Integer, ReceptionGroup>();
        for (SheduleReception reception : receptions) {
            Client client = reception.getClient();
            Address address = null;
            if (client.getAddressID() != null) {
                address = getDao().getById(Address.class, client.getAddressID());
            }
            ReceptionGroup group = map.get(client.getId());
            if (group == null) {
                group = new ReceptionGroup();
                lines.add(group);
                map.put(client.getId(), group);
                group.client = client;
                group.addressClient = address != null ? address.getAsStringShort() : "";
                group.receptionLines = new ArrayList<ReceptionLine>();
            }

            ReceptionLine receptLine = new ReceptionLine(reception);
            group.receptionLines.add(receptLine);
View Full Code Here

       
        boolean editbypacient = Boolean.parseBoolean(request.getParameter("editbypacient"));
        clientDTO.setClient(client);
        clientDTO.setEditbypacient(editbypacient);
        if (client != null) {
            Address address = getDao().getById(Address.class, client.getAddressID());
            AddressObject ao = address.getAddressObject();
            if (ao.getType().getLevel() == 6){
                ao = ao.getParent();
            }

            Date born = client.getBorn();
            GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();
            cal.setTime(born);
            clientDTO.setBornDay(cal.get(Calendar.DAY_OF_MONTH));
            clientDTO.setBornMonth(cal.get(Calendar.MONTH));
            clientDTO.setBornYear(Integer.toString(cal.get(Calendar.YEAR)));
            clientDTO.setSurname(client.getSurname() == null ? "" : client.getSurname().getTitle());
            clientDTO.setName(client.getName() == null ? "" : client.getName().getTitle());
            clientDTO.setPatronymic(client.getPatronymic() == null ? "" : client.getPatronymic().getTitle());
            clientDTO.setPhoneNumber(client.getTelephones());
            clientDTO.setSex(client.getSex());

            clientDTO.setStreet(ao);
            ao = ao.getParent();
            if (ao.getType().getLevel() == 4){
                clientDTO.setVillage(ao);
                ao = ao.getParent();
            }
            clientDTO.setCity(ao);
            ao = ao.getParent();
            clientDTO.setArea(ao);
            ao = ao.getParent();

            if (client.getDistrict() != null) {
                clientDTO.setDistrict(client.getDistrict());
            }
            clientDTO.setBuilding(address.getBuilding());
            clientDTO.setFlat(address.getFlat());
        }
        return clientDTO;
    }
View Full Code Here

        Client client = clientDTO.getClient();
        if (client == null) {
            client = new Client();
            try {
                Address address = createAddress(clientDTO);
                client.setAddressID(address.getId());
                client.setAddressCashe(address.getAsStringCashe());
            } catch (Exception ex) {
                errors.rejectValue("area", "register.wrongaddress");
                return showForm(request, errors, getFormView());
            }
        }else{
            Address address = getDao().getById(Address.class, client.getAddressID());
            address.setAddressObject(clientDTO.getStreet());
            address.setBuilding(clientDTO.getBuilding());
            address.setFlat(clientDTO.getFlat());
            try {
                AddressManager.correctAddress(getDao(), address);
            } catch (Exception ex) {
                errors.rejectValue("area", "register.wrongaddress");
                return showForm(request, errors, getFormView());
            }
            getDao().save(address);
            client.setAddressCashe(address.getAsStringCashe());
        }
        client.setBorn(getBornDate(clientDTO));
        //STUB
        //client.setAddress(null);
        //client.setDistrict(null);
View Full Code Here

        getDao().save(client);
        return new ModelAndView("redirect:selectclient.htm");
    }

    private Address createAddress(ClientDTO clientDTO){
        Address address = new Address();
              if (clientDTO.getStreet() != null){
            address.setAddressObject(clientDTO.getStreet());
        }else if (clientDTO.getVillage() != null){
            address.setAddressObject(clientDTO.getVillage());
        }else if (clientDTO.getCity() != null){
            address.setAddressObject(clientDTO.getCity());
        }else if (clientDTO.getArea() != null){
            address.setAddressObject(clientDTO.getArea());
        }else{
            log.debug("Адрес клиента не указан");
        }
        address.setBuilding(clientDTO.getBuilding());
        address.setFlat(clientDTO.getFlat());
        AddressManager.correctAddress(getDao(), address);
        getDao().saveAndRefresh(address);
        return address;
    }
View Full Code Here

        GregorianCalendar gc = new GregorianCalendar(year, urdto.getBornMonth(), urdto.getBornDay());
        return gc.getTime();
    }

    private Integer createAddress(UserRequestDTO clientDTO){
        Address address = new Address();
        if (clientDTO.getStreet() != 0){
            address.setAddressObject( getAddressObject(clientDTO.getStreet()));
        }else if (clientDTO.getVillage() != 0){
            address.setAddressObject( getAddressObject(clientDTO.getVillage()));
        }else if (clientDTO.getCity() != 0){
            address.setAddressObject( getAddressObject(clientDTO.getCity()));
        }else if (clientDTO.getArea() != 0){
            address.setAddressObject( getAddressObject(clientDTO.getArea()));
        }else{
//            log.debug("Адрес клиента не указан");
        }
        address.setBuilding(clientDTO.getBuilding());
        address.setFlat(clientDTO.getFlat());
        AddressManager.correctAddress(getDao(), address);
        getDao().saveAndRefresh(address);
        return address.getId();
    }
View Full Code Here

TOP

Related Classes of domain.address.Address

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.