use of org.jaffa.modules.messaging.components.businesseventlogviewer.dto.AttachmentDto in project jaffa-framework by jaffa-projects.
the class BusinessEventLogViewerTx method addRelatedDtos.
// .//GEN-END:_buildDto_3_be
// .//GEN-BEGIN:_addRelatedDtos_1_be
private void addRelatedDtos(UOW uow, BusinessEventLogViewerOutDto output, BusinessEventLog businessEventLog) throws UOWException {
// .//GEN-BEGIN:_addRelatedDtos_Attachment_1_be
if (businessEventLog.getLogId() != null) {
Criteria criteria = new Criteria();
criteria.setTable(AttachmentMeta.getName());
criteria.addCriteria(AttachmentMeta.SERIALIZED_KEY, businessEventLog.getLogId());
criteria.addOrderBy("AttachmentId", Criteria.ORDER_BY_ASC);
// Create a new Criteria, and pass the correct serializedKey
try {
criteria = new Criteria();
criteria.setTable(AttachmentMeta.getName());
criteria.addCriteria(AttachmentMeta.SERIALIZED_KEY, PersistentHelper.generateSerializedKey(businessEventLog));
criteria.addOrderBy(AttachmentMeta.ATTACHMENT_ID, Criteria.ORDER_BY_ASC);
} catch (Exception e) {
String str = "Error in generating the serialized key";
log.error(str, e);
throw new RuntimeException(str, e);
}
// .//GEN-LAST:_addRelatedDtos_Attachment_1
// .//GEN-BEGIN:_addRelatedDtos_Attachment_2_be
Iterator itr = uow.query(criteria).iterator();
while (itr.hasNext()) {
Attachment attachment = (Attachment) itr.next();
AttachmentDto dto = new AttachmentDto();
// .//GEN-END:_addRelatedDtos_Attachment_2_be
// Add custom code before all the setters//GEN-FIRST:_addRelatedDtos_Attachment_2
// .//GEN-LAST:_addRelatedDtos_Attachment_2
// .//GEN-BEGIN:_addRelatedDtos_Attachment_AttachmentId_1_be
dto.setAttachmentId(attachment.getAttachmentId());
// .//GEN-END:_addRelatedDtos_Attachment_AttachmentId_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_SerializedKey_1_be
dto.setSerializedKey(attachment.getSerializedKey());
// .//GEN-END:_addRelatedDtos_Attachment_SerializedKey_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_OriginalFileName_1_be
dto.setOriginalFileName(attachment.getOriginalFileName());
// .//GEN-END:_addRelatedDtos_Attachment_OriginalFileName_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_AttachmentType_1_be
dto.setAttachmentType(attachment.getAttachmentType());
// .//GEN-END:_addRelatedDtos_Attachment_AttachmentType_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_ContentType_1_be
dto.setContentType(attachment.getContentType());
// .//GEN-END:_addRelatedDtos_Attachment_ContentType_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_Description_1_be
dto.setDescription(attachment.getDescription());
// .//GEN-END:_addRelatedDtos_Attachment_Description_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_Remarks_1_be
dto.setRemarks(attachment.getRemarks());
// .//GEN-END:_addRelatedDtos_Attachment_Remarks_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_SupercededBy_1_be
dto.setSupercededBy(attachment.getSupercededBy());
// .//GEN-END:_addRelatedDtos_Attachment_SupercededBy_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_CreatedOn_1_be
dto.setCreatedOn(attachment.getCreatedOn());
// .//GEN-END:_addRelatedDtos_Attachment_CreatedOn_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_CreatedBy_1_be
dto.setCreatedBy(attachment.getCreatedBy());
// .//GEN-END:_addRelatedDtos_Attachment_CreatedBy_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_LastChangedOn_1_be
dto.setLastChangedOn(attachment.getLastChangedOn());
// .//GEN-END:_addRelatedDtos_Attachment_LastChangedOn_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_LastChangedBy_1_be
dto.setLastChangedBy(attachment.getLastChangedBy());
// .//GEN-END:_addRelatedDtos_Attachment_LastChangedBy_1_be
// .//GEN-BEGIN:_addRelatedDtos_Attachment_Data_1_be
dto.setData(attachment.getData());
// .//GEN-END:_addRelatedDtos_Attachment_Data_1_be
// Add custom code to pass values to the dto//GEN-FIRST:_addRelatedDtos_Attachment_3
// .//GEN-LAST:_addRelatedDtos_Attachment_3
// .//GEN-BEGIN:_addRelatedDtos_Attachment_3_be
output.addAttachment(dto);
}
}
// .//GEN-END:_addRelatedDtos_Attachment_3_be
// .//GEN-BEGIN:_addRelatedDtos_2_be
}
use of org.jaffa.modules.messaging.components.businesseventlogviewer.dto.AttachmentDto in project jaffa-framework by jaffa-projects.
the class BusinessEventLogViewerForm method populateRelatedAttachment.
private void populateRelatedAttachment(GridModel rows) {
rows.clearRows();
BusinessEventLogViewerOutDto outputDto = ((BusinessEventLogViewerComponent) getComponent()).getBusinessEventLogViewerOutDto();
if (outputDto != null) {
GridModelRow row = null;
AttachmentDto[] attachment = outputDto.getAttachment();
for (int i = 0; i < attachment.length; i++) {
AttachmentDto rowDto = attachment[i];
row = rows.newRow();
row.addElement("attachmentId", rowDto.getAttachmentId());
row.addElement("serializedKey", rowDto.getSerializedKey());
row.addElement("originalFileName", rowDto.getOriginalFileName());
row.addElement("attachmentType", rowDto.getAttachmentType());
row.addElement("contentType", rowDto.getContentType());
row.addElement("description", rowDto.getDescription());
row.addElement("remarks", rowDto.getRemarks());
row.addElement("supercededBy", rowDto.getSupercededBy());
row.addElement("createdOn", rowDto.getCreatedOn());
row.addElement("createdBy", rowDto.getCreatedBy());
row.addElement("lastChangedOn", rowDto.getLastChangedOn());
row.addElement("lastChangedBy", rowDto.getLastChangedBy());
row.addElement("data", rowDto.getData());
// .//GEN-END:RelatedAttachment_1_be
// Add custom code for the row //GEN-FIRST:RelatedAttachment_1
// .//GEN-LAST:RelatedAttachment_1
// .//GEN-BEGIN:RelatedAttachment_2_be
}
}
}
Aggregations