code: private List<TargetWithActionType> getTargetsWithActionType(final String targetFilterQuery, final Long dsId,
              final ActionType type, final int count) {
          final Page<Target> targets = targetManagement.findByTargetFilterQueryAndNonDS(PageRequest.of(0, count), dsId,
                  targetFilterQuery);
          // the action type is set to FORCED per default (when not explicitly
          // specified)
          final ActionType autoAssignActionType = type == null ? ActionType.FORCED : type;
  
          return targets.getContent().stream().map(t -> new TargetWithActionType(t.getControllerId(),
                  autoAssignActionType, RepositoryModelConstants.NO_FORCE_TIME)).collect(Collectors.toList());
      }
docs: Gets all matching targets with the designated action from the target
  management
  
  @param targetFilterQuery
  the query the targets have to match
  @param dsId
  dsId the targets are not allowed to have in their action
  history
  @param type
  action type for targets auto assignment
  @param count
  maximum amount of targets to retrieve
  @return list of targets with action type