use of org.molgenis.data.Sort.Order in project molgenis by molgenis.
the class SortTest method sortMultipleAttrAsc.
@Test
void sortMultipleAttrAsc() {
Sort sort = new Sort(Arrays.asList(new Sort.Order("attr0", Sort.Direction.ASC), new Sort.Order("attr1", Sort.Direction.ASC)));
Iterator<Sort.Order> it = sort.iterator();
assertEquals(new Order("attr0", ASC), it.next());
assertEquals(new Order("attr1", ASC), it.next());
}
use of org.molgenis.data.Sort.Order in project molgenis by molgenis.
the class SortTest method sortMultipleAttrDefault.
@Test
void sortMultipleAttrDefault() {
Sort sort = new Sort(Arrays.asList(new Sort.Order("attr0"), new Sort.Order("attr1")));
Iterator<Sort.Order> it = sort.iterator();
assertEquals(new Order("attr0"), it.next());
assertEquals(new Order("attr1"), it.next());
}
use of org.molgenis.data.Sort.Order in project molgenis by molgenis.
the class SortTest method sortMultipleAttrBuilderAscAndDesc.
@Test
void sortMultipleAttrBuilderAscAndDesc() {
Sort sort = new Sort().on("attr0", Sort.Direction.ASC).on("attr1", Sort.Direction.DESC);
Iterator<Sort.Order> it = sort.iterator();
assertEquals(new Order("attr0", ASC), it.next());
assertEquals(new Order("attr1", DESC), it.next());
}
use of org.molgenis.data.Sort.Order in project molgenis by molgenis.
the class AttributeResponseMapperImpl method map.
private List<org.molgenis.api.model.Sort> map(Attribute attr) {
List<org.molgenis.api.model.Sort> orders;
Sort sort = attr.getOrderBy();
if (sort == null) {
orders = emptyList();
} else {
orders = new ArrayList<>(Iterables.size(sort));
for (Order order : sort) {
orders.add(org.molgenis.api.model.Sort.create(order.getAttr(), Direction.valueOf(order.getDirection().name())));
}
}
return orders;
}
use of org.molgenis.data.Sort.Order in project molgenis by molgenis.
the class SortTest method sortMultipleAttrDesc.
@Test
void sortMultipleAttrDesc() {
Sort sort = new Sort(Arrays.asList(new Sort.Order("attr0", Sort.Direction.DESC), new Sort.Order("attr1", Sort.Direction.DESC)));
Iterator<Sort.Order> it = sort.iterator();
assertEquals(new Order("attr0", DESC), it.next());
assertEquals(new Order("attr1", DESC), it.next());
}