code: private EntityPermission getPermission(Action operation) {
      EntityPermission result;
      switch (operation) {
        case COUNT:
        case READ:
          result = EntityPermission.READ;
          break;
        case UPDATE:
          result = EntityPermission.UPDATE;
          break;
        case DELETE:
          result = EntityPermission.DELETE;
          break;
        case CREATE:
          throw new UnexpectedEnumException(Action.CREATE);
        default:
          throw new IllegalArgumentException("Illegal operation");
      }
      return result;
    }
docs: Finds out what permission to check for an operation that is being performed on this repository.
  
  @param operation the Operation that is being performed on the repository
  @return the EntityPermission to check