Exemple #1
0
 public static void setProvince(AreaInfo areaInfo, List<Area> allAreas) {
   if (areaInfo.getAreaLevel() >= areaInfo.LEVEL_ONE) {
     Area parentArea = getAreaByAreaCode(areaInfo.getAreaCode().substring(0, 2), allAreas);
     if (parentArea != null) {
       areaInfo.setProvince(parentArea.getName());
     }
   }
 }
Exemple #2
0
 public static void setDistrict(AreaInfo areaInfo, List<Area> allAreas) {
   if (areaInfo.getAreaLevel() == areaInfo.LEVEL_THREE) {
     Area area = getAreaByAreaCode(areaInfo.getAreaCode(), allAreas);
     if (area != null) {
       areaInfo.setDistrict(area.getName());
     }
   }
   setCity(areaInfo, allAreas);
 }
Exemple #3
0
  public static void setCity(AreaInfo areaInfo, List<Area> allAreas) {
    if (areaInfo.getAreaLevel() >= areaInfo.LEVEL_TWO) {
      Area area = getAreaByAreaCode(areaInfo.getAreaCode().substring(0, 4), allAreas);
      if (area != null) {
        areaInfo.setCity(area.getName());
      }
    }

    setProvince(areaInfo, allAreas);
  }
Exemple #4
0
 public static void setAreaInfo(AreaInfo areaInfo, List<Area> allAreas) {
   int level = areaInfo.getAreaLevel();
   if (level != AreaInfo.LEVEL_NULL) {
     if (AreaInfo.LEVEL_THREE == level) {
       setDistrict(areaInfo, allAreas);
     } else if (AreaInfo.LEVEL_TWO == level) {
       setCity(areaInfo, allAreas);
     } else if (AreaInfo.LEVEL_ONE == level) {
       setProvince(areaInfo, allAreas);
     }
   }
 }