code: public static boolean hasAllRoles(RoleHolder roleHolder,
                                        String[] roleNames)
      {
          boolean hasRole = false;
          if (roleHolder != null)
          {
              List<? extends Role> roles = roleHolder.getRoles();
  
              if (roles != null)
              {
                  List<String> heldRoles = new ArrayList<String>();
                  for (Role role : roles)
                  {
                      if (role != null)
                      {
                          heldRoles.add(role.getRoleName());
                      }
                  }
  
                  boolean roleCheckResult = true;
                  for (int i = 0; roleCheckResult && i < roleNames.length; i++)
                  {
                      boolean invert = false;
                      String roleName = roleNames[i];
                      if (roleName.startsWith("!"))
                      {
                          invert = true;
                          roleName = roleName.substring(1);
                      }
                      roleCheckResult = heldRoles.contains(roleName);
  
                      if (invert)
                      {
                          roleCheckResult = !roleCheckResult;
                      }
                  }
                  hasRole = roleCheckResult;
              }
          }
          return hasRole;
      }
docs: Checks if the current user has all of the specified roles.
  
  @param roleHolder the object requiring authorisation
  @param roleNames the role names
  @return true iff the current user has all of the specified roles