Search in sources :

Example 1 with UserTimeEntryViewerOutDto

use of org.jaffa.applications.test.modules.time.components.usertimeentryviewer.dto.UserTimeEntryViewerOutDto in project jaffa-framework by jaffa-projects.

the class UserTimeEntryViewerTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private UserTimeEntryViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
    UserTimeEntryViewerOutDto output = null;
    Iterator itr = results.iterator();
    if (itr.hasNext()) {
        // just return the details for the 1st record retrieved.
        UserTimeEntry userTimeEntry = (UserTimeEntry) itr.next();
        output = new UserTimeEntryViewerOutDto();
        // .//GEN-END:_buildDto_1_be
        // Add custom code before all the setters //GEN-FIRST:_buildDto_1
        // .//GEN-LAST:_buildDto_1
        // .//GEN-BEGIN:_buildDto_UserName_1_be
        output.setUserName(userTimeEntry.getUserName());
        // .//GEN-END:_buildDto_UserName_1_be
        // .//GEN-BEGIN:_buildDto_ProjectCode_1_be
        output.setProjectCode(userTimeEntry.getProjectCode());
        // .//GEN-END:_buildDto_ProjectCode_1_be
        // .//GEN-BEGIN:_buildDto_Activity_1_be
        output.setActivity(userTimeEntry.getActivity());
        // .//GEN-END:_buildDto_Activity_1_be
        // .//GEN-BEGIN:_buildDto_Task_1_be
        output.setTask(userTimeEntry.getTask());
        // .//GEN-END:_buildDto_Task_1_be
        // .//GEN-BEGIN:_buildDto_PeriodStart_1_be
        output.setPeriodStart(userTimeEntry.getPeriodStart());
        // .//GEN-END:_buildDto_PeriodStart_1_be
        // .//GEN-BEGIN:_buildDto_PeriodEnd_1_be
        output.setPeriodEnd(userTimeEntry.getPeriodEnd());
        // .//GEN-END:_buildDto_PeriodEnd_1_be
        // .//GEN-BEGIN:_buildDto_2_be
        // Add related objects, if required
        addRelatedDtos(uow, output, userTimeEntry);
    // .//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 : UserTimeEntry(org.jaffa.applications.test.modules.time.domain.UserTimeEntry) UserTimeEntryViewerOutDto(org.jaffa.applications.test.modules.time.components.usertimeentryviewer.dto.UserTimeEntryViewerOutDto)

Example 2 with UserTimeEntryViewerOutDto

use of org.jaffa.applications.test.modules.time.components.usertimeentryviewer.dto.UserTimeEntryViewerOutDto in project jaffa-framework by jaffa-projects.

the class UserTimeEntryViewerTx method read.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_read_1_be
/**
 * Returns the details for UserTimeEntry.
 * @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 UserTimeEntryViewerOutDto read(UserTimeEntryViewerInDto 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
        UserTimeEntryViewerOutDto 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 : Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW) UserTimeEntryViewerOutDto(org.jaffa.applications.test.modules.time.components.usertimeentryviewer.dto.UserTimeEntryViewerOutDto)

Aggregations

UserTimeEntryViewerOutDto (org.jaffa.applications.test.modules.time.components.usertimeentryviewer.dto.UserTimeEntryViewerOutDto)2 UserTimeEntry (org.jaffa.applications.test.modules.time.domain.UserTimeEntry)1 Criteria (org.jaffa.persistence.Criteria)1 UOW (org.jaffa.persistence.UOW)1