use of org.activityinfo.shared.command.GetLocations in project activityinfo by bedatadriven.
the class SiteHistoryTab method setSite.
// retrieve all needed data: sitehistoryresult, schema, and locations
public void setSite(final SiteDTO site) {
renderLoading();
dispatcher.execute(new GetSiteHistory(site.getId()), new AsyncCallback<GetSiteHistoryResult>() {
@Override
public void onFailure(Throwable caught) {
renderNotAvailable(site);
}
@Override
public void onSuccess(final GetSiteHistoryResult historyResult) {
if (historyResult.hasHistories()) {
dispatcher.execute(new GetLocations(historyResult.collectLocationIds()), new AsyncCallback<GetLocationsResult>() {
@Override
public void onFailure(Throwable caught) {
renderNotAvailable(site);
}
@Override
public void onSuccess(final GetLocationsResult locationsResult) {
dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
renderNotAvailable(site);
}
@Override
public void onSuccess(SchemaDTO schema) {
render(schema, locationsResult.getLocations(), site, historyResult.getSiteHistories());
}
});
}
});
} else {
renderNotAvailable(site);
}
}
});
}
use of org.activityinfo.shared.command.GetLocations in project activityinfo by bedatadriven.
the class GetLocationsTest method testGetLocation.
@Test
public void testGetLocation() {
setUser(1);
LocationDTO location = execute(new GetLocations(1)).getLocation();
assertThat(location, notNullValue());
assertThat(location.getName(), equalTo("Penekusu Kivu"));
assertThat(location.getAxe(), nullValue());
assertThat(location.getAdminEntity(1).getName(), equalTo("Sud Kivu"));
assertThat(location.getAdminEntity(2).getName(), equalTo("Shabunda"));
}
Aggregations