Search in sources :

Example 1 with UserViewerOutDto

use of org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserViewerOutDto in project jaffa-framework by jaffa-projects.

the class UserViewerTx method read.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_read_1_be
/**
 * Returns the details for User.
 * @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 UserViewerOutDto read(UserViewerInDto input) throws FrameworkException, ApplicationExceptions {
    UOW uow = null;
    try {
        // Print Debug Information for the input
        if (log.isDebugEnabled()) {
            log.debug("Input: " + input);
        }
        // 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
        UserViewerOutDto output = buildDto(uow, results);
        // Print Debug Information for the output
        if (log.isDebugEnabled()) {
            log.debug("Output: " + output);
        }
        return output;
    } finally {
        if (uow != null)
            uow.rollback();
    }
}
Also used : UserViewerOutDto(org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserViewerOutDto) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Example 2 with UserViewerOutDto

use of org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserViewerOutDto in project jaffa-framework by jaffa-projects.

the class UserViewerTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private UserViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
    UserViewerOutDto output = null;
    Iterator itr = results.iterator();
    if (itr.hasNext()) {
        // just return the details for the 1st record retrieved.
        User user = (User) itr.next();
        output = new UserViewerOutDto();
        // .//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(user.getUserName());
        // .//GEN-END:_buildDto_UserName_1_be
        // .//GEN-BEGIN:_buildDto_FirstName_1_be
        output.setFirstName(user.getFirstName());
        // .//GEN-END:_buildDto_FirstName_1_be
        // .//GEN-BEGIN:_buildDto_LastName_1_be
        output.setLastName(user.getLastName());
        // .//GEN-END:_buildDto_LastName_1_be
        // .//GEN-BEGIN:_buildDto_Status_1_be
        output.setStatus(user.getStatus());
        // .//GEN-END:_buildDto_Status_1_be
        // .//GEN-BEGIN:_buildDto_StatusDescription_1_be
        output.setStatusDescription(user.getStatus());
        // .//GEN-END:_buildDto_StatusDescription_1_be
        // .//GEN-BEGIN:_buildDto_EMailAddress_1_be
        output.setEMailAddress(user.getEMailAddress());
        // .//GEN-END:_buildDto_EMailAddress_1_be
        // .//GEN-BEGIN:_buildDto_CreatedOn_1_be
        output.setCreatedOn(user.getCreatedOn());
        // .//GEN-END:_buildDto_CreatedOn_1_be
        // .//GEN-BEGIN:_buildDto_CreatedBy_1_be
        output.setCreatedBy(user.getCreatedBy());
        // .//GEN-END:_buildDto_CreatedBy_1_be
        // .//GEN-BEGIN:_buildDto_LastUpdatedOn_1_be
        output.setLastUpdatedOn(user.getLastUpdatedOn());
        // .//GEN-END:_buildDto_LastUpdatedOn_1_be
        // .//GEN-BEGIN:_buildDto_LastUpdatedBy_1_be
        output.setLastUpdatedBy(user.getLastUpdatedBy());
        // .//GEN-END:_buildDto_LastUpdatedBy_1_be
        // .//GEN-BEGIN:_buildDto_2_be
        // Add related objects, if required
        addRelatedDtos(uow, output, user);
    // .//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 : UserViewerOutDto(org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserViewerOutDto) User(org.jaffa.applications.jaffa.modules.admin.domain.User)

Example 3 with UserViewerOutDto

use of org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserViewerOutDto in project jaffa-framework by jaffa-projects.

the class UserViewerForm method populateRelatedUserRole.

private void populateRelatedUserRole(GridModel rows) {
    rows.clearRows();
    UserViewerOutDto outputDto = ((UserViewerComponent) getComponent()).getUserViewerOutDto();
    if (outputDto != null) {
        GridModelRow row = null;
        UserRoleDto[] userRole = outputDto.getUserRole();
        for (int i = 0; i < userRole.length; i++) {
            UserRoleDto rowDto = userRole[i];
            row = rows.newRow();
            row.addElement("userName", rowDto.getUserName());
            row.addElement("roleName", rowDto.getRoleName());
        // .//GEN-END:RelatedUserRole_1_be
        // Add custom code for the row //GEN-FIRST:RelatedUserRole_1
        // .//GEN-LAST:RelatedUserRole_1
        // .//GEN-BEGIN:RelatedUserRole_2_be
        }
    }
}
Also used : UserViewerOutDto(org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserViewerOutDto) UserRoleDto(org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserRoleDto) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Aggregations

UserViewerOutDto (org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserViewerOutDto)3 UserRoleDto (org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserRoleDto)1 User (org.jaffa.applications.jaffa.modules.admin.domain.User)1 Criteria (org.jaffa.persistence.Criteria)1 UOW (org.jaffa.persistence.UOW)1 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)1