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