package com.vst.dto;
import java.util.ArrayList;
import java.util.List;
import com.vst.model.ext.GeoCity;
import com.vst.model.ext.GeoClassificator;
import com.vst.model.ext.GeoCountry;
import com.vst.model.ext.GeoMacroRegion;
import com.vst.model.ext.GeoProvince;
public class GeoTreeItemDto {
private GeoClassificator item;
private List<GeoTreeItemDto> children;
public GeoTreeItemDto(GeoClassificator item) {
this.item = item;
children = new ArrayList<GeoTreeItemDto>();
}
public GeoTreeItemDto(int code) {
if (code == 0) {
item = new GeoCountry();
} else if (code == 1) {
item = new GeoMacroRegion();
} else if (code == 2) {
item = new GeoProvince();
} else if (code == 3) {
item = new GeoCity();
} else {
item = new GeoClassificator();
}
children = new ArrayList<GeoTreeItemDto>();
}
public List<GeoTreeItemDto> getChildren(){
return children;
}
public GeoClassificator getGeoItem(){
return item;
}
public void addChild(GeoClassificator item){
children.add(new GeoTreeItemDto(item));
}
public void addChild(GeoTreeItemDto item){
children.add(item);
}
}