Search in sources :

Example 1 with GetAdminEntities

use of org.activityinfo.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.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.shared.command.GetAdminEntities)

Example 2 with GetAdminEntities

use of org.activityinfo.shared.command.GetAdminEntities in project activityinfo by bedatadriven.

the class AdminEntityCacheTest method testRootLevelCache.

@Test
public void testRootLevelCache() {
    CacheManager proxyMgr = new CacheManager(new MockEventBus());
    new AdminEntityCache(proxyMgr);
    proxyMgr.notifyListenersOfSuccess(new GetAdminEntities(1), DTOs.getProvinces());
    CacheResult<ListResult<AdminEntityDTO>> proxyResult = proxyMgr.execute(new GetAdminEntities(1));
    Assert.assertTrue(proxyResult.isCouldExecute());
    Assert.assertEquals(2, proxyResult.getResult().getData().size());
}
Also used : ListResult(org.activityinfo.shared.command.result.ListResult) MockEventBus(org.activityinfo.client.MockEventBus) GetAdminEntities(org.activityinfo.shared.command.GetAdminEntities) Test(org.junit.Test)

Example 3 with GetAdminEntities

use of org.activityinfo.shared.command.GetAdminEntities in project activityinfo by bedatadriven.

the class AdminFieldSetPresenterTest method setupDispatcher.

@Before
public void setupDispatcher() {
    dispatcher.setResult(new GetAdminEntities(PROVINCE.getId()), PROVINCES);
    dispatcher.setResult(new GetAdminEntities(TERRITOIRE.getId(), NORD_KIVU.getId()), NORD_KIVU_TERRITOIRES);
    dispatcher.setResult(new GetAdminEntities(TERRITOIRE.getId(), SUD_KIVU.getId()), SUD_KIVU_TERRITOIRES);
}
Also used : GetAdminEntities(org.activityinfo.shared.command.GetAdminEntities) Before(org.junit.Before)

Example 4 with GetAdminEntities

use of org.activityinfo.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.shared.dto.AdminEntityDTO) AdminEntityResult(org.activityinfo.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.shared.command.GetAdminEntities) Test(org.junit.Test)

Example 5 with GetAdminEntities

use of org.activityinfo.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.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.shared.command.GetAdminEntities) Test(org.junit.Test)

Aggregations

GetAdminEntities (org.activityinfo.shared.command.GetAdminEntities)10 AdminEntityResult (org.activityinfo.shared.command.result.AdminEntityResult)6 Test (org.junit.Test)6 AdminEntityDTO (org.activityinfo.shared.dto.AdminEntityDTO)3 GetSchema (org.activityinfo.shared.command.GetSchema)2 TreeStore (com.extjs.gxt.ui.client.store.TreeStore)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 MockEventBus (org.activityinfo.client.MockEventBus)1 DispatcherStub (org.activityinfo.client.dispatch.DispatcherStub)1 AdminGroupingModel (org.activityinfo.client.page.entry.grouping.AdminGroupingModel)1 OnDataSet (org.activityinfo.server.database.OnDataSet)1 ListResult (org.activityinfo.shared.command.result.ListResult)1 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)1 AdminMarker (org.activityinfo.shared.report.content.AdminMarker)1 Before (org.junit.Before)1