use of org.activityinfo.shared.command.result.BatchResult in project activityinfo by bedatadriven.
the class ImporterWizard method finish.
@Override
public void finish(final AsyncCallback<Void> callback) {
final KeyGenerator keyGenerator = new KeyGenerator();
int numColums = model.getData().getNumColumns();
ColumnBinding[] bindings = bindingsArray();
// do a first pass to match the location
List<Command> matchBatch = Lists.newArrayList();
for (ImportRowModel row : model.getData().getRowStore().getModels()) {
MatchLocation location = new MatchLocation();
location.setLocationType(model.getActivity().getLocationTypeId());
for (int i = 0; i != numColums; ++i) {
bindings[i].bindLocation(row.get(i), location);
}
matchBatch.add(location);
}
dispatcher.execute(new BatchCommand(matchBatch), new AsyncCallback<BatchResult>() {
@Override
public void onFailure(Throwable caught) {
MessageBox.alert("Match locations failed", "Exception", null);
}
@Override
public void onSuccess(BatchResult result) {
submitSites((List) result.getResults(), callback);
}
});
}
use of org.activityinfo.shared.command.result.BatchResult in project activityinfo by bedatadriven.
the class DbUserEditor method save.
private void save() {
BatchCommand batch = new BatchCommand();
for (Record record : store.getModifiedRecords()) {
batch.add(new UpdateUserPermissions(db.getId(), (UserPermissionDTO) record.getModel()));
}
dispatcher.execute(batch, new MaskingAsyncMonitor(this, I18N.CONSTANTS.saving()), new AsyncCallback<BatchResult>() {
@Override
public void onFailure(Throwable caught) {
// handled by monitor
}
@Override
public void onSuccess(BatchResult result) {
store.commitChanges();
}
});
}
Aggregations