Exemplo n.º 1
0
  @Override
  public List<Genre> search(final GenreSearchCondition condition) {

    final List<Genre> allList = searchAll(condition);

    if (condition.getLotPerCount() < 1) {

      return allList;
    }

    final int tempStartIndex = (condition.getLotNumber() - 1) * condition.getLotPerCount();

    final int startIndex = tempStartIndex < 1 ? 0 : tempStartIndex - 1;
    final int tempEndIndex = startIndex + condition.getLotPerCount();

    final int listLastIndex = allList.size() - 1;
    final int endIndex = listLastIndex < tempEndIndex ? listLastIndex : tempEndIndex;

    return allList.subList(startIndex, endIndex);
  }
Exemplo n.º 2
0
  private boolean isMatchCondition(final GenreSearchCondition condition, final Genre genre) {

    final GenreName genreName = condition.getName();

    if (genreName != null && !genreName.getValue().isEmpty()) {

      if (!genreName.getValue().equals(genre.getName().getValue())) {

        return false;
      }
    }

    return true;
  }