Search in sources :

Example 1 with GetAdminEntities

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);
        }
    });
}
Also used : AdminEntityResult(org.activityinfo.legacy.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities)

Example 2 with GetAdminEntities

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));
}
Also used : AdminEntityDTO(org.activityinfo.legacy.shared.model.AdminEntityDTO) AdminEntityResult(org.activityinfo.legacy.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities) Test(org.junit.Test)

Example 3 with GetAdminEntities

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));
}
Also used : AdminEntityResult(org.activityinfo.legacy.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities) Test(org.junit.Test)

Example 4 with GetAdminEntities

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));
}
Also used : AdminEntityResult(org.activityinfo.legacy.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities) Test(org.junit.Test)

Example 5 with GetAdminEntities

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();
}
Also used : AdminGroupingModel(org.activityinfo.ui.client.page.entry.grouping.AdminGroupingModel) TreeStore(com.extjs.gxt.ui.client.store.TreeStore) DispatcherStub(org.activityinfo.ui.client.dispatch.DispatcherStub) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities) GetSchema(org.activityinfo.legacy.shared.command.GetSchema) Test(org.junit.Test)

Aggregations

GetAdminEntities (org.activityinfo.legacy.shared.command.GetAdminEntities)11 AdminEntityResult (org.activityinfo.legacy.shared.command.result.AdminEntityResult)8 Test (org.junit.Test)7 AdminEntityDTO (org.activityinfo.legacy.shared.model.AdminEntityDTO)3 TreeStore (com.extjs.gxt.ui.client.store.TreeStore)1 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)1 ListResult (org.activityinfo.legacy.shared.command.result.ListResult)1 AdminMarker (org.activityinfo.legacy.shared.reports.content.AdminMarker)1 MockEventBus (org.activityinfo.ui.client.MockEventBus)1 DispatcherStub (org.activityinfo.ui.client.dispatch.DispatcherStub)1 AdminGroupingModel (org.activityinfo.ui.client.page.entry.grouping.AdminGroupingModel)1 Before (org.junit.Before)1