use of hse.holuhoev.domain.Faculty in project hse-cws by holuhoev.
the class FacultyDatasource method getFacultyFilter.
public DataSourceResult getFacultyFilter(final Integer instituteId, final String name) {
QFaculty qFaculty = QFaculty.faculty;
BooleanBuilder builder = new BooleanBuilder();
if (instituteId != null) {
builder.and(qFaculty.instituteId.eq(instituteId));
}
if (name != null && !name.isEmpty()) {
builder.and(qFaculty.name.containsIgnoreCase(name));
}
Sort sort = new Sort(Sort.Direction.ASC, "name");
Iterable<Faculty> faculties = facultyRepository.findAll(builder, sort);
return DataSourceResult.create(faculties);
}
Aggregations