use of org.activityinfo.legacy.shared.model.SiteAttachmentDTO 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));
}
});
}
Aggregations