Package domain.address

Examples of domain.address.AddressObject


                        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;
                    }
                }
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());
View Full Code Here

        List<Lpu> lpus = getDao().getList(queryCriteria, null, null);
        List<LpuRenderDTO> lines = new ArrayList<LpuRenderDTO>();
        for (Lpu lpu : lpus) {
            if (dto.getCity() != null && !dto.getCity().isEmpty()) {
                //Фильтруем по району/нас пункту
                AddressObject item = lpu.getAddress().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 (dto.getStreet() != null && !dto.getStreet().isEmpty()) {
                //Фильтруем по улице
                AddressObject item = lpu.getAddress().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;
                }
            }
View Full Code Here

        String lpuId = hsr.getParameter("lpu");
        String streetId = hsr.getParameter("street");
        String building = hsr.getParameter("building");
        String values = "";
        if (addressParentId != null){
            AddressObject ao = null;
            try{
                ao = CH.getOptional(getDao(), AddressObject.class, addressParentId);
            }catch(Exception ex){
            }
            if (ao != null) {
                List<AddressObject> childs = getDao().getChildList(ao);

                values += ao.getType().getLevel();
                for (int level = 3; level <= 5; level++) {
                    values += "=0;не выбран";
                    for (Iterator<AddressObject> it = childs.iterator(); it.hasNext();) {
                        AddressObject child = it.next();
                        if (child.getType().getLevel() == level) {
                            values += ";" + child.getId() + ";" + child.getSpecTitle();
                            it.remove();
                        }
                    }
                }

    //        values = values.length() > 0 ? values.substring(1) : "";
            }else{
                values += "=0;не выбран=0;не выбран=0;не выбран=0";
            }
        }else if (lpuId != null) {
            Lpu lpu = CH.getOptional(getDao(), Lpu.class, lpuId);
            List<District> districtList = getDao().getDistrictList(lpu);
            values +="0;не указан";
            for (District district : districtList) {
                values += ";" + district.getId() + ";" + district;
            }
        }else if (streetId != null && building != null && !building.isEmpty()) {
            AddressObject ao = CH.getOptional(getDao(), AddressObject.class, streetId);
            if (ao != null){
                District defaultDistrict = AddressManager.getDefaultDistrict(getDao(), ao.getId(), building);
//            values += defaultDistrict.getId() + ";" + defaultDistrict + "=";
//            values += defaultDistrict.getLpu().getId() + ";" + defaultDistrict.getLpu() + "=";
//            List<District> districts = getDao().getDistrictList(defaultDistrict.getLpu());
//            for (District district : districts) {
                if (defaultDistrict != null){
View Full Code Here

    private DAO dao;

    public AddressContainer getAddressList(int parentId){
        if (parentId != 0){
            AddressObject parent = getDao().getById(AddressObject.class, parentId);
            List<AddressObject> childList = getDao().getChildList(parent);
            AddressContainer ac = new AddressContainer(parent.getType().getLevel(), childList);
            return ac;
        }else{
            return new AddressContainer(parentId, new ArrayList<AddressObject>());
        }
    }
View Full Code Here

*/
public class AddressManager {


    static public void correctAddress(DAO dao, Address address) {
        AddressObject street = getStreet(address);
        if (street != null) {
            List<AddressObject> items = dao.getChildList(street);
            for (int i = 0; i < items.size(); i++) {
                if (include(items.get(i), address.getBuilding())) {
                    address.setAddressObject(items.get(i));
View Full Code Here

            }
        }
    }

    static private AddressObject getStreet(Address address) {
        AddressObject ao = address.getAddressObject();
        while (ao == null) {
            if (ao.getType().getLevel() == 5) {
                return ao;
            }
            ao = ao.getParent();
        }
        return null;
    }
View Full Code Here

     * @param streetID
     * @param buildingNumberString
     * @return
     */
    static public District getDefaultDistrict(DAO dao, int streetID, String buildingNumberString) {
        AddressObject object = dao.getById(AddressObject.class, streetID);
        if (object == null || object.getType().getLevel() != 5) {
            return null;
        }
        List<AddressDistrict> adList = dao.AddressDistrictList(object);
        for (AddressDistrict ad : adList) {
            if (include(ad, buildingNumberString)) {
View Full Code Here

TOP

Related Classes of domain.address.AddressObject

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.