Search in sources :

Example 1 with AttachmentViewerOutDto

use of org.jaffa.components.attachment.components.attachmentviewer.dto.AttachmentViewerOutDto in project jaffa-framework by jaffa-projects.

the class AttachmentViewerTx method read.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_read_1_be
/**
 * Returns the details for Attachment.
 * @param input The criteria based on which an object will be retrieved.
 * @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
 * @throws FrameworkException Indicates some system error.
 * @return The object details. A null indicates, the object was not found.
 */
public AttachmentViewerOutDto read(AttachmentViewerInDto input) throws FrameworkException, ApplicationExceptions {
    UOW uow = null;
    try {
        // Print Debug Information for the input
        if (log.isDebugEnabled()) {
            log.debug("Input: " + (input != null ? input.toString() : null));
        }
        // create the UOW
        uow = new UOW();
        // Build the Criteria Object
        Criteria criteria = buildCriteria(input, uow);
        // .//GEN-END:_read_1_be
        // Add custom code before the query //GEN-FIRST:_read_1
        // .//GEN-LAST:_read_1
        // .//GEN-BEGIN:_read_2_be
        // Execute The Query
        Collection results = uow.query(criteria);
        // .//GEN-END:_read_2_be
        // Add custom code after the query //GEN-FIRST:_read_2
        // .//GEN-LAST:_read_2
        // .//GEN-BEGIN:_read_3_be
        // Convert the domain objects into the outbound dto
        AttachmentViewerOutDto output = buildDto(uow, results);
        // Print Debug Information for the output
        if (log.isDebugEnabled()) {
            log.debug("Output: " + (output != null ? output.toString() : null));
        }
        return output;
    } finally {
        if (uow != null)
            uow.rollback();
    }
}
Also used : AttachmentViewerOutDto(org.jaffa.components.attachment.components.attachmentviewer.dto.AttachmentViewerOutDto) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Example 2 with AttachmentViewerOutDto

use of org.jaffa.components.attachment.components.attachmentviewer.dto.AttachmentViewerOutDto 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;
}
Also used : AttachmentViewerOutDto(org.jaffa.components.attachment.components.attachmentviewer.dto.AttachmentViewerOutDto) Attachment(org.jaffa.components.attachment.domain.Attachment)

Aggregations

AttachmentViewerOutDto (org.jaffa.components.attachment.components.attachmentviewer.dto.AttachmentViewerOutDto)2 Attachment (org.jaffa.components.attachment.domain.Attachment)1 Criteria (org.jaffa.persistence.Criteria)1 UOW (org.jaffa.persistence.UOW)1