コード例 #1
0
ファイル: RoleServiceImpl.java プロジェクト: sHlyoMa/SS-TC
 public void addRole(Role role, List<Integer> selectedActions) {
   role.setRoleName(stringSplitter.splitter(role.getRoleName(), 30));
   role.setDescription(stringSplitter.splitter(role.getDescription(), 30));
   roleMapper.addRole(role);
   role.setSelectedActionList(selectedActions);
   roleMapper.addRoleActions(role);
 }
コード例 #2
0
  public Role validateUpdateRole(String roleName, String roleNote, int id) {
    Role role = null;

    String roleOldName = roleDaoImpl.getRole(id).getRoleName();
    long count = roleDaoImpl.getCountWithName(roleName);
    if (count > 0 && !roleOldName.equals(roleName)) { // 重复、不能通过
      role = new Role(roleOldName, roleNote);
      role.setRoleId(id);
    }

    return role;
  }
コード例 #3
0
  public void addRole(String roleName, String roleNote, String[] rolePermissions) {

    Role role = new Role(roleName, roleNote);
    roleDaoImpl.addRole(role);

    int permissionID = -1;

    for (String permissionId : rolePermissions) {
      permissionID = Integer.parseInt(permissionId);
      rolePermissionDaoImpl.addRolePermission(role.getRoleId(), permissionID);
    }
  }