use of org.activityinfo.legacy.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class AdminEntityProxy method load.
@Override
protected void load(Object loadConfig, final AsyncCallback<ListResult<AdminEntityDTO>> callback) {
GetAdminEntities query = new GetAdminEntities(levelId);
query.setParentId(parentId);
dispatcher.execute(query, new AsyncCallback<AdminEntityResult>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(AdminEntityResult result) {
callback.onSuccess(result);
}
});
}
use of org.activityinfo.legacy.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class GetAdminEntitiesHandlerTest method testChildQuery.
@Test
public void testChildQuery() throws Exception {
GetAdminEntities cmd = new GetAdminEntities(2, 2);
AdminEntityResult result = execute(cmd);
assertThat(result.getData().size(), equalTo(3));
AdminEntityDTO kalehe = result.getData().get(0);
assertThat(kalehe.getName(), equalTo("Kalehe"));
assertThat(kalehe.getBounds(), is(not(nullValue())));
assertThat(kalehe.getBounds().getMinLon(), equalTo(-44d));
assertThat(kalehe.getBounds().getMinLat(), equalTo(-22d));
assertThat(kalehe.getBounds().getMaxLon(), equalTo(33.5d));
assertThat(kalehe.getBounds().getMaxLat(), equalTo(40d));
}
use of org.activityinfo.legacy.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class GetAdminEntitiesHandlerTest method testRootLevelQuery.
@Test
public void testRootLevelQuery() throws Exception {
GetAdminEntities cmd = new GetAdminEntities(PROVINCE);
AdminEntityResult result = execute(cmd);
assertThat(result.getData().size(), equalTo(4));
}
use of org.activityinfo.legacy.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class GetAdminEntitiesHandlerTest method testSiteQuery.
@Test
public void testSiteQuery() throws Exception {
GetAdminEntities cmd = new GetAdminEntities();
cmd.setLevelId(1);
cmd.setFilter(Filter.filter().onActivity(2));
AdminEntityResult result = execute(cmd);
assertThat(result.getData().size(), equalTo(2));
}
use of org.activityinfo.legacy.shared.command.GetAdminEntities in project activityinfo by bedatadriven.
the class SiteAdminTreeLoaderTest method load.
@Test
public void load() {
DispatcherStub dispatcher = new DispatcherStub();
dispatcher.setResult(new GetSchema(), DTOs.PEAR.SCHEMA);
dispatcher.setResult(new GetAdminEntities(1), DTOs.PROVINCES);
SiteAdminTreeLoader loader = new SiteAdminTreeLoader(dispatcher, new AdminGroupingModel(1));
new TreeStore<ModelData>(loader);
loader.load();
}
Aggregations