use of org.activityinfo.legacy.shared.command.result.SiteAttachmentResult in project activityinfo by bedatadriven.
the class GetSiteAttachmentsHandler method execute.
@Override
public void execute(GetSiteAttachments command, ExecutionContext context, final AsyncCallback<SiteAttachmentResult> callback) {
dtos = new ArrayList<SiteAttachmentDTO>();
SqlQuery.selectAll().from(Tables.SITE_ATTACHMENT, "s").where("s.siteid").equalTo(command.getSiteId()).execute(context.getTransaction(), new SqlResultCallback() {
@Override
public void onSuccess(SqlTransaction tx, SqlResultSet results) {
for (SqlResultSetRow row : results.getRows()) {
SiteAttachmentDTO dto = new SiteAttachmentDTO();
dto.setSiteId(row.getInt("siteid"));
dto.setBlobId(row.getString("blobid"));
dto.setFileName(row.getString("filename"));
dto.setUploadedBy(row.getInt("uploadedby"));
dto.setBlobSize(row.getInt("blobsize"));
dto.setContentType(row.getString("contenttype"));
dtos.add(dto);
}
callback.onSuccess(new SiteAttachmentResult(dtos));
}
});
}
use of org.activityinfo.legacy.shared.command.result.SiteAttachmentResult in project activityinfo by bedatadriven.
the class AttachmentsTab method setAttachmentStore.
@Override
public void setAttachmentStore(int siteId) {
GetSiteAttachments getAttachments = new GetSiteAttachments();
getAttachments.setSiteId(siteId);
dispatcher.execute(getAttachments, new AsyncCallback<SiteAttachmentResult>() {
@Override
public void onFailure(Throwable caught) {
// callback.onFailure(caught);
}
@Override
public void onSuccess(SiteAttachmentResult result) {
store.removeAll();
store.add(result.getData());
}
});
}
Aggregations