use of org.molgenis.data.elasticsearch.generator.model.SortDirection in project molgenis by molgenis.
the class SortGenerator method toSortOrder.
private SortOrder toSortOrder(org.molgenis.data.Sort.Order order, EntityType entityType) {
String attributeName = order.getAttr();
if (attributeName == null) {
throw new IllegalArgumentException("Sort property is null");
}
Attribute sortAttribute = entityType.getAttribute(attributeName);
if (sortAttribute == null) {
throw new UnknownAttributeException(entityType, attributeName);
}
String sortField = getSortField(sortAttribute);
SortDirection sortDirection = getSortDirection(order.getDirection());
return SortOrder.create(sortField, sortDirection);
}
Aggregations