use of org.activityinfo.legacy.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class DeleteSiteAttachmentHandler method execute.
@Override
public void execute(DeleteSiteAttachment command, ExecutionContext context, AsyncCallback<VoidResult> callback) {
attachmentService.delete(command.getBlobId());
SqlUpdate.delete(Tables.SITE_ATTACHMENT).where("blobid", command.getBlobId()).execute(context.getTransaction());
callback.onSuccess(new VoidResult());
}
use of org.activityinfo.legacy.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class UpdateSiteHandlerAsync method execute.
@Override
public void execute(final UpdateSite command, ExecutionContext context, final AsyncCallback<VoidResult> callback) {
final Map<String, Object> changes = command.getChanges().getTransientMap();
SqlTransaction tx = context.getTransaction();
updateSiteProperties(tx, command, changes);
updateAttributeValues(tx, command.getSiteId(), changes);
updateReportingPeriod(tx, command.getSiteId(), changes);
callback.onSuccess(new VoidResult());
}
use of org.activityinfo.legacy.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class UpdateUserProfileHandler method execute.
@Override
public void execute(final UpdateUserProfile command, ExecutionContext context, final AsyncCallback<VoidResult> callback) {
// Users can ONLY update their own profile
int userId = context.getUser().getId();
UserProfileDTO model = command.getModel();
SqlUpdate.update("userlogin").where("userId", userId).value("name", model.getName()).value("organization", model.getOrganization()).value("jobtitle", model.getJobtitle()).value("locale", validateLocale(model.getLocale())).value("emailNotification", model.isEmailNotification()).execute(context.getTransaction());
callback.onSuccess(new VoidResult());
}
use of org.activityinfo.legacy.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class CreateSiteHandlerAsync method updateExistingSite.
private void updateExistingSite(final CreateSite cmd, ExecutionContext context, final AsyncCallback<CreateResult> callback) {
UpdateSite updateSite = new UpdateSite(cmd.getSiteId(), cmd.getProperties());
context.execute(updateSite, new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(VoidResult result) {
callback.onSuccess(new CreateResult(cmd.getSiteId()));
}
});
}
use of org.activityinfo.legacy.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class SiteDialog method updateSite.
private void updateSite() {
final SiteDTO updated = new SiteDTO(site);
updateModel(updated);
dispatcher.execute(new UpdateSite(site, updated), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
showError(caught);
}
@Override
public void onSuccess(VoidResult result) {
hide();
callback.onSaved();
}
});
}
Aggregations