Example usage for org.springframework.data.domain Sort by

List of usage examples for org.springframework.data.domain Sort by

Introduction

In this page you can find the example usage for org.springframework.data.domain Sort by.

Prototype

public static Sort by(Order... orders) 

Source Link

Document

Creates a new Sort for the given Order s.

Usage

From source file:com._4dconcept.springframework.data.marklogic.repository.support.RepositoryIntegrationTests.java

@Test
public void findAllInRepositorySortedOrder() {
    checkOrder(Sort.by("lastname"), new String[] { "Ktifa", "One", "Toussaint" });
    checkOrder(new Sort(Sort.Direction.DESC, "lastname"), new String[] { "Toussaint", "One", "Ktifa" });
    checkOrder(new Sort(Sort.Direction.DESC, "age", "lastname"), new String[] { "Toussaint", "One", "Ktifa" });
    checkOrder(new Sort(Sort.Direction.DESC, "age").and(Sort.by("lastname")),
            new String[] { "Toussaint", "Ktifa", "One" });
}

From source file:org.jbb.permissions.impl.role.DefaultPermissionRoleService.java

@Override
public void removeRole(Long roleId) {
    Validate.notNull(roleId);//from  ww  w. j a  v  a2 s.  co  m
    AclRoleEntity role = aclRoleRepository.findById(roleId)
            .orElseThrow(() -> new PermissionRoleNotFoundException(roleId));

    if (role.getPredefinedRole() != null) {
        throw new RemovePredefinedRoleException();
    }

    permissionCaches.clearCaches();
    fixRolesOrder(role);
    matrixRepairManager.fixMatrixes(role, getPermissionTable(roleId));
    List<AclRoleEntryEntity> entryToRemove = aclRoleEntryRepository.findAllByRole(role,
            Sort.by("permission.position"));
    aclRoleEntryRepository.deleteAll(entryToRemove);
    aclRoleRepository.deleteById(roleId);
    eventBus.post(eventCreator
            .createRoleRemovedEvent(permissionTypeTranslator.toApiModel(role.getPermissionType()), roleId));
}

From source file:org.jbb.permissions.impl.role.DefaultPermissionRoleService.java

private PermissionTable getPermissionTable(AclRoleEntity roleEntity) {
    List<AclRoleEntryEntity> roleEntries = aclRoleEntryRepository.findAllByRole(roleEntity,
            Sort.by("permission.position"));
    return permissionTableTranslator.fromRoleToApiModel(roleEntries);
}