Search in sources :

Example 11 with VoidResult

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

Example 12 with 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());
}
Also used : VoidResult(org.activityinfo.legacy.shared.command.result.VoidResult) SqlTransaction(com.bedatadriven.rebar.sql.client.SqlTransaction)

Example 13 with 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());
}
Also used : VoidResult(org.activityinfo.legacy.shared.command.result.VoidResult) UserProfileDTO(org.activityinfo.legacy.shared.model.UserProfileDTO)

Example 14 with 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()));
        }
    });
}
Also used : VoidResult(org.activityinfo.legacy.shared.command.result.VoidResult) CreateResult(org.activityinfo.legacy.shared.command.result.CreateResult) UpdateSite(org.activityinfo.legacy.shared.command.UpdateSite)

Example 15 with VoidResult

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();
        }
    });
}
Also used : VoidResult(org.activityinfo.legacy.shared.command.result.VoidResult) SiteDTO(org.activityinfo.legacy.shared.model.SiteDTO) UpdateSite(org.activityinfo.legacy.shared.command.UpdateSite)

Aggregations

VoidResult (org.activityinfo.legacy.shared.command.result.VoidResult)22 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)4 MaskingAsyncMonitor (org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor)4 FormDialogCallback (org.activityinfo.ui.client.page.common.dialog.FormDialogCallback)3 Record (com.extjs.gxt.ui.client.store.Record)2 UpdateEntity (org.activityinfo.legacy.shared.command.UpdateEntity)2 UpdateMonthlyReports (org.activityinfo.legacy.shared.command.UpdateMonthlyReports)2 UpdateReportSubscription (org.activityinfo.legacy.shared.command.UpdateReportSubscription)2 UpdateSite (org.activityinfo.legacy.shared.command.UpdateSite)2 UpdateUserPermissions (org.activityinfo.legacy.shared.command.UpdateUserPermissions)2 ProjectDTO (org.activityinfo.legacy.shared.model.ProjectDTO)2 FormDialogImpl (org.activityinfo.ui.client.page.common.dialog.FormDialogImpl)2 SqlTransaction (com.bedatadriven.rebar.sql.client.SqlTransaction)1 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)1 SafeHtmlUtils.fromString (com.google.gwt.safehtml.shared.SafeHtmlUtils.fromString)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 CreateLocation (org.activityinfo.legacy.shared.command.CreateLocation)1 DeleteReport (org.activityinfo.legacy.shared.command.DeleteReport)1