Search in sources :

Example 1 with UserRoleDto

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

the class UserViewerTx method addRelatedDtos.

// .//GEN-END:_buildDto_3_be
// .//GEN-BEGIN:_addRelatedDtos_1_be
private void addRelatedDtos(UOW uow, UserViewerOutDto output, User user) throws UOWException {
    // .//GEN-BEGIN:_addRelatedDtos_UserRole_1_be
    if (user.getUserName() != null) {
        Criteria criteria = new Criteria();
        criteria.setTable(UserRoleMeta.getName());
        criteria.addCriteria(UserRoleMeta.USER_NAME, user.getUserName());
        criteria.addOrderBy("UserName", Criteria.ORDER_BY_ASC);
        criteria.addOrderBy("RoleName", Criteria.ORDER_BY_ASC);
        // .//GEN-END:_addRelatedDtos_UserRole_1_be
        // Add custom code to set the criteria before the query //GEN-FIRST:_addRelatedDtos_UserRole_1
        // .//GEN-LAST:_addRelatedDtos_UserRole_1
        // .//GEN-BEGIN:_addRelatedDtos_UserRole_2_be
        Iterator itr = uow.query(criteria).iterator();
        while (itr.hasNext()) {
            UserRole userRole = (UserRole) itr.next();
            UserRoleDto dto = new UserRoleDto();
            // .//GEN-END:_addRelatedDtos_UserRole_2_be
            // Add custom code before all the setters //GEN-FIRST:_addRelatedDtos_UserRole_2
            // .//GEN-LAST:_addRelatedDtos_UserRole_2
            // .//GEN-BEGIN:_addRelatedDtos_UserRole_UserName_1_be
            dto.setUserName(userRole.getUserName());
            // .//GEN-END:_addRelatedDtos_UserRole_UserName_1_be
            // .//GEN-BEGIN:_addRelatedDtos_UserRole_RoleName_1_be
            dto.setRoleName(userRole.getRoleName());
            // .//GEN-END:_addRelatedDtos_UserRole_RoleName_1_be
            // Add custom code to pass values to the dto //GEN-FIRST:_addRelatedDtos_UserRole_3
            // .//GEN-LAST:_addRelatedDtos_UserRole_3
            // .//GEN-BEGIN:_addRelatedDtos_UserRole_3_be
            output.addUserRole(dto);
        }
    }
// .//GEN-END:_addRelatedDtos_UserRole_3_be
// .//GEN-BEGIN:_addRelatedDtos_2_be
}
Also used : UserRoleDto(org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserRoleDto) UserRole(org.jaffa.applications.jaffa.modules.admin.domain.UserRole) Criteria(org.jaffa.persistence.Criteria)

Example 2 with UserRoleDto

use of org.jaffa.applications.jaffa.modules.admin.components.userviewer.dto.UserRoleDto 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

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