// Save user public int saveNewUser( String firstName, String lastName, String middleName, String userName, String password, String gender, String email, String organisationName, String roleName, String jobFunctionName, String languageName) { logManager.logInfo( "Entering 'saveNewUser(String firstName, String lastName, String middleName, String userName, String password, String gender," + " String email, String organisationName, String roleName, String jobFunctionName, String languageName)' method"); int result = 0; int organisationId = 0; int roleId = 0; int jobFunctionId = 0; int languageId = 0; try { organisationId = organisation.getOrganisationId(organisationName); roleId = role.getRoleId(roleName); jobFunctionId = jobFunction.getJobFunctionId(jobFunctionName); languageId = language.getLanguageId(languageName); result = insertNewUser( firstName, lastName, middleName, userName, password, gender, email, organisationId, roleId, jobFunctionId, languageId); } catch (Exception exception) { logManager.logError( "Exception was thrown and caught in 'saveNewUser(String firstName, String lastName, String middleName, String userName, String password, String gender," + " String email, String organisationName, String roleName, String jobFunctionName, String languageName)' method"); } logManager.logInfo( "Exiting 'saveNewUser(String firstName, String lastName, String middleName, String userName, String password, String gender," + " String email, String organisationName, String roleName, String jobFunctionName, String languageName)' method"); return result; }
public String export() { response.setContentType("Application/excel"); response.addHeader("Content-Disposition", "attachment;filename=RoleList.xls"); int pageNum = getPageNum(); int numPerPage = getNumPerPage(); int startIndex = (pageNum - 1) * numPerPage; Map<RoleSearchFields, Object> criterias = getCriterias(); Collection<Role> roleList = pMgr.searchRole(criterias, realOrderField(), startIndex, numPerPage); XlsExport e = new XlsExport(); int rowIndex = 0; e.createRow(rowIndex++); for (ExportFiled filed : ExportFiled.values()) { e.setCell(filed.ordinal(), filed.getName()); } for (Role role : roleList) { e.createRow(rowIndex++); for (ExportFiled filed : ExportFiled.values()) { switch (filed) { case ROLEID: e.setCell(filed.ordinal(), role.getRoleId()); break; case ROLEDESC: e.setCell(filed.ordinal(), role.getRoleDesc()); break; case ROLENAME: e.setCell(filed.ordinal(), role.getRoleName()); break; default: break; } } } e.exportXls(response); return null; }
public void setRole(Role role) { this.role = role; if (id.getRoleId() == null && role != null) id.setRoleId(role.getRoleId()); }