use of org.activityinfo.shared.command.result.AdminEntityResult in project activityinfo by bedatadriven.
the class AdminTreeProxy method load.
@Override
public void load(DataReader<List<AdminEntityDTO>> dataReader, final Object parent, final AsyncCallback<List<AdminEntityDTO>> callback) {
if (filter == null) {
callback.onSuccess(new ArrayList<AdminEntityDTO>());
return;
}
service.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("Failed to load admin entities", caught);
}
@Override
public void onSuccess(SchemaDTO schema) {
final Set<CountryDTO> countries = findCountries(schema);
if (CollectionUtil.isEmpty(countries)) {
callback.onSuccess(new ArrayList<AdminEntityDTO>());
return;
}
initLevelsWithChildren(countries);
GetAdminEntities request = new GetAdminEntities(toIdSet(countries), filter);
if (parent != null) {
assert parent instanceof AdminEntityDTO : "expecting AdminEntityDTO";
request.setParentId(((AdminEntityDTO) parent).getId());
}
service.execute(request, new AsyncCallback<AdminEntityResult>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(AdminEntityResult result) {
prepareData(countries, result.getData());
callback.onSuccess(result.getData());
}
});
}
});
}
use of org.activityinfo.shared.command.result.AdminEntityResult in project activityinfo by bedatadriven.
the class PolygonLayerGenerator method queryBounds.
private void queryBounds(DispatcherSync dispatcher, Filter layerFilter) {
GetAdminEntities query = new GetAdminEntities();
query.setLevelId(layer.getAdminLevelId());
AdminEntityResult entities = dispatcher.execute(query);
for (AdminEntityDTO entity : entities.getData()) {
if (entity.hasBounds()) {
AdminMarker marker = new AdminMarker(entity);
overlay.addPolygon(marker);
}
}
}
Aggregations