use of org.activityinfo.legacy.shared.command.result.AdminEntityResult in project activityinfo by bedatadriven.
the class GetAdminEntitiesHandlerTest method testSiteDbQuery.
@Test
public void testSiteDbQuery() {
GetAdminEntities cmd = new GetAdminEntities();
cmd.setParentId(GetAdminEntities.ROOT);
cmd.setFilter(Filter.filter().onDatabase(1));
AdminEntityResult result = execute(cmd);
System.out.println(result.getData());
assertThat(result.getData().size(), equalTo(2));
}
use of org.activityinfo.legacy.shared.command.result.AdminEntityResult in project activityinfo by bedatadriven.
the class GetAdminEntitiesHandlerTest method testIdQuery.
@Test
public void testIdQuery() {
GetAdminEntities cmd = new GetAdminEntities();
cmd.setEntityIds(Arrays.asList(10, 11));
AdminEntityResult result = execute(cmd);
assertThat(result.getData().size(), equalTo(2));
}
use of org.activityinfo.legacy.shared.command.result.AdminEntityResult in project activityinfo by bedatadriven.
the class AdminTreeProxy method load.
/**
* Load nodes in the tree
*
* @param parent
* @param callback
*/
@Override
protected void load(final Object parent, final AsyncCallback<List<AdminEntityDTO>> callback) {
if (filter == null) {
callback.onSuccess(new ArrayList<AdminEntityDTO>());
return;
}
if (!hasRestrictions()) {
callback.onSuccess(new ArrayList<AdminEntityDTO>());
} else {
GetAdminEntities request = new GetAdminEntities();
request.setFilter(filter);
if (parent == null) {
request.setParentId(GetAdminEntities.ROOT);
} else {
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) {
callback.onSuccess(result.getData());
}
});
}
}
use of org.activityinfo.legacy.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