use of org.jaffa.components.attachment.domain.Attachment in project jaffa-framework by jaffa-projects.
the class AttachmentViewerTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private AttachmentViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
AttachmentViewerOutDto output = null;
Iterator itr = results.iterator();
if (itr.hasNext()) {
// just return the details for the 1st record retrieved.
Attachment attachment = (Attachment) itr.next();
output = new AttachmentViewerOutDto();
// .//GEN-END:_buildDto_1_be
// Add custom code before all the setters //GEN-FIRST:_buildDto_1
// .//GEN-LAST:_buildDto_1
// .//GEN-BEGIN:_buildDto_AttachmentId_1_be
output.setAttachmentId(attachment.getAttachmentId());
// .//GEN-END:_buildDto_AttachmentId_1_be
// .//GEN-BEGIN:_buildDto_SerializedKey_1_be
output.setSerializedKey(attachment.getSerializedKey());
// .//GEN-END:_buildDto_SerializedKey_1_be
// .//GEN-BEGIN:_buildDto_OriginalFileName_1_be
output.setOriginalFileName(attachment.getOriginalFileName());
// .//GEN-END:_buildDto_OriginalFileName_1_be
// .//GEN-BEGIN:_buildDto_AttachmentType_1_be
output.setAttachmentType(attachment.getAttachmentType());
// .//GEN-END:_buildDto_AttachmentType_1_be
// .//GEN-BEGIN:_buildDto_ContentType_1_be
output.setContentType(attachment.getContentType());
// .//GEN-END:_buildDto_ContentType_1_be
// .//GEN-BEGIN:_buildDto_Description_1_be
output.setDescription(attachment.getDescription());
// .//GEN-END:_buildDto_Description_1_be
// .//GEN-BEGIN:_buildDto_Remarks_1_be
output.setRemarks(attachment.getRemarks());
// .//GEN-END:_buildDto_Remarks_1_be
// .//GEN-BEGIN:_buildDto_SupercededBy_1_be
output.setSupercededBy(attachment.getSupercededBy());
// .//GEN-END:_buildDto_SupercededBy_1_be
// .//GEN-BEGIN:_buildDto_CreatedOn_1_be
output.setCreatedOn(attachment.getCreatedOn());
// .//GEN-END:_buildDto_CreatedOn_1_be
// .//GEN-BEGIN:_buildDto_CreatedBy_1_be
output.setCreatedBy(attachment.getCreatedBy());
// .//GEN-END:_buildDto_CreatedBy_1_be
// .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
output.setLastChangedOn(attachment.getLastChangedOn());
// .//GEN-END:_buildDto_LastChangedOn_1_be
// .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
output.setLastChangedBy(attachment.getLastChangedBy());
// .//GEN-END:_buildDto_LastChangedBy_1_be
// .//GEN-BEGIN:_buildDto_Data_1_be
output.setData(attachment.getData());
// .//GEN-END:_buildDto_Data_1_be
// .//GEN-BEGIN:_buildDto_2_be
// Add related objects, if required
addRelatedDtos(uow, output, attachment);
// .//GEN-END:_buildDto_2_be
// Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
}
return output;
}
use of org.jaffa.components.attachment.domain.Attachment in project jaffa-framework by jaffa-projects.
the class AttachmentFinderTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private AttachmentFinderOutDto buildDto(UOW uow, Collection results, AttachmentFinderInDto input) throws UOWException {
AttachmentFinderOutDto output = new AttachmentFinderOutDto();
int maxRecords = input.getMaxRecords() != null ? input.getMaxRecords().intValue() : 0;
int counter = 0;
for (Iterator i = results.iterator(); i.hasNext(); ) {
if (++counter > maxRecords && maxRecords > 0) {
output.setMoreRecordsExist(Boolean.TRUE);
break;
}
AttachmentFinderOutRowDto row = new AttachmentFinderOutRowDto();
Attachment attachment = (Attachment) i.next();
// .//GEN-END:_buildDto_1_be
// Add custom code before all the setters //GEN-FIRST:_buildDto_1
// .//GEN-LAST:_buildDto_1
// .//GEN-BEGIN:_buildDto_AttachmentId_1_be
row.setAttachmentId(attachment.getAttachmentId());
// .//GEN-END:_buildDto_AttachmentId_1_be
// .//GEN-BEGIN:_buildDto_SerializedKey_1_be
row.setSerializedKey(attachment.getSerializedKey());
// .//GEN-END:_buildDto_SerializedKey_1_be
// .//GEN-BEGIN:_buildDto_OriginalFileName_1_be
row.setOriginalFileName(attachment.getOriginalFileName());
// .//GEN-END:_buildDto_OriginalFileName_1_be
// .//GEN-BEGIN:_buildDto_AttachmentType_1_be
row.setAttachmentType(attachment.getAttachmentType());
// .//GEN-END:_buildDto_AttachmentType_1_be
// .//GEN-BEGIN:_buildDto_ContentType_1_be
row.setContentType(attachment.getContentType());
// .//GEN-END:_buildDto_ContentType_1_be
// .//GEN-BEGIN:_buildDto_Description_1_be
row.setDescription(attachment.getDescription());
// .//GEN-END:_buildDto_Description_1_be
// .//GEN-BEGIN:_buildDto_Remarks_1_be
row.setRemarks(attachment.getRemarks());
// .//GEN-END:_buildDto_Remarks_1_be
// .//GEN-BEGIN:_buildDto_SupercededBy_1_be
row.setSupercededBy(attachment.getSupercededBy());
// .//GEN-END:_buildDto_SupercededBy_1_be
// .//GEN-BEGIN:_buildDto_CreatedOn_1_be
row.setCreatedOn(attachment.getCreatedOn());
// .//GEN-END:_buildDto_CreatedOn_1_be
// .//GEN-BEGIN:_buildDto_CreatedBy_1_be
row.setCreatedBy(attachment.getCreatedBy());
// .//GEN-END:_buildDto_CreatedBy_1_be
// .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
row.setLastChangedOn(attachment.getLastChangedOn());
// .//GEN-END:_buildDto_LastChangedOn_1_be
// .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
row.setLastChangedBy(attachment.getLastChangedBy());
// .//GEN-END:_buildDto_LastChangedBy_1_be
// .//GEN-BEGIN:_buildDto_Data_1_be
row.setData(attachment.getData());
// .//GEN-END:_buildDto_Data_1_be
// Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
output.addRows(row);
}
return output;
}
use of org.jaffa.components.attachment.domain.Attachment in project jaffa-framework by jaffa-projects.
the class AttachmentLookupTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private AttachmentLookupOutDto buildDto(UOW uow, Collection results, AttachmentLookupInDto input) throws UOWException {
AttachmentLookupOutDto output = new AttachmentLookupOutDto();
int maxRecords = input.getMaxRecords() != null ? input.getMaxRecords().intValue() : 0;
int counter = 0;
for (Iterator i = results.iterator(); i.hasNext(); ) {
if (++counter > maxRecords && maxRecords > 0) {
output.setMoreRecordsExist(Boolean.TRUE);
break;
}
AttachmentLookupOutRowDto row = new AttachmentLookupOutRowDto();
Attachment attachment = (Attachment) i.next();
// .//GEN-END:_buildDto_1_be
// Add custom code before all the setters //GEN-FIRST:_buildDto_1
// .//GEN-LAST:_buildDto_1
// .//GEN-BEGIN:_buildDto_AttachmentId_1_be
row.setAttachmentId(attachment.getAttachmentId());
// .//GEN-END:_buildDto_AttachmentId_1_be
// .//GEN-BEGIN:_buildDto_SerializedKey_1_be
row.setSerializedKey(attachment.getSerializedKey());
// .//GEN-END:_buildDto_SerializedKey_1_be
// .//GEN-BEGIN:_buildDto_OriginalFileName_1_be
row.setOriginalFileName(attachment.getOriginalFileName());
// .//GEN-END:_buildDto_OriginalFileName_1_be
// .//GEN-BEGIN:_buildDto_AttachmentType_1_be
row.setAttachmentType(attachment.getAttachmentType());
// .//GEN-END:_buildDto_AttachmentType_1_be
// .//GEN-BEGIN:_buildDto_ContentType_1_be
row.setContentType(attachment.getContentType());
// .//GEN-END:_buildDto_ContentType_1_be
// .//GEN-BEGIN:_buildDto_Description_1_be
row.setDescription(attachment.getDescription());
// .//GEN-END:_buildDto_Description_1_be
// .//GEN-BEGIN:_buildDto_Remarks_1_be
row.setRemarks(attachment.getRemarks());
// .//GEN-END:_buildDto_Remarks_1_be
// .//GEN-BEGIN:_buildDto_SupercededBy_1_be
row.setSupercededBy(attachment.getSupercededBy());
// .//GEN-END:_buildDto_SupercededBy_1_be
// .//GEN-BEGIN:_buildDto_CreatedOn_1_be
row.setCreatedOn(attachment.getCreatedOn());
// .//GEN-END:_buildDto_CreatedOn_1_be
// .//GEN-BEGIN:_buildDto_CreatedBy_1_be
row.setCreatedBy(attachment.getCreatedBy());
// .//GEN-END:_buildDto_CreatedBy_1_be
// .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
row.setLastChangedOn(attachment.getLastChangedOn());
// .//GEN-END:_buildDto_LastChangedOn_1_be
// .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
row.setLastChangedBy(attachment.getLastChangedBy());
// .//GEN-END:_buildDto_LastChangedBy_1_be
// .//GEN-BEGIN:_buildDto_Data_1_be
row.setData(attachment.getData());
// .//GEN-END:_buildDto_Data_1_be
// Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
output.addRows(row);
}
return output;
}
use of org.jaffa.components.attachment.domain.Attachment in project jaffa-framework by jaffa-projects.
the class AttachmentMaintenanceTx method delete.
/**
* Deletes an existing instance of Attachment.
* @param input The key values for the domain object to be deleted.
* @param uow The delete will be performed using the input UOW.
* @throws ApplicationExceptions This will be thrown if the input contains invalid data.
* @throws FrameworkException Indicates some system error.
*/
public void delete(AttachmentMaintenanceDeleteInDto input, UOW uow) throws FrameworkException, ApplicationExceptions {
// Print Debug Information for the input
if (log.isDebugEnabled())
log.debug("Input: " + input);
// Preprocess the input
preprocess(uow, input);
// Retrieve the object
Attachment domain = load(uow, input);
// Ensure the domain object has not been modified
domainObjectChangedTest(input.getPerformDirtyReadCheck(), domain, input.getLastChangedOn());
// Delete the domain object
deleteDomain(uow, input, domain);
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("The domain object has been marked for deletion. It will be deleted when the UOW is committed");
}
use of org.jaffa.components.attachment.domain.Attachment in project jaffa-framework by jaffa-projects.
the class AttachmentMaintenanceTx method load.
// .//GEN-END:_preprocessUpdate_2_be
// .//GEN-BEGIN:_loadUpdate_1_be
/**
* Retrieve the domain object.
*/
private Attachment load(UOW uow, AttachmentMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
Attachment domain = null;
Criteria criteria = new Criteria();
criteria.setTable(AttachmentMeta.getName());
// .//GEN-END:_loadUpdate_1_be
// Add custom criteria //GEN-FIRST:_loadUpdate_1
// .//GEN-LAST:_loadUpdate_1
// .//GEN-BEGIN:_loadUpdate_2_be
criteria.addCriteria(AttachmentMeta.ATTACHMENT_ID, input.getAttachmentId());
criteria.setLocking(Criteria.LOCKING_PARANOID);
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (Attachment) itr.next();
// .//GEN-BEGIN:_loadUpdate_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(AttachmentMeta.getLabelToken()));
throw appExps;
}
return domain;
}
Aggregations