Package org.springframework.data.domain

Examples of org.springframework.data.domain.Sort


     * @throws java.sql.SQLException
     */
    private Element getGroups(ServiceContext context, Profile profile, boolean includingSystemGroups) throws SQLException {
        final GroupRepository groupRepository = context.getBean(GroupRepository.class);
        final UserGroupRepository userGroupRepository = context.getBean(UserGroupRepository.class);
        final Sort sort = SortUtils.createSort(Group_.id);

        UserSession session = context.getUserSession();
        if (!session.isAuthenticated()) {
            return groupRepository.findAllAsXml(Specifications.not(GroupSpecs.isReserved()), sort);
        }
View Full Code Here


     *
     * @param attributes the attributes to use for building a sort.
     * @return a sort object from the path objects
     */
    public static Sort createSort(SingularAttribute<?, ?>... attributes) {
        return new Sort(createPath(attributes));
    }
View Full Code Here

        cbQuery.multiselect(cb.count(root));
        Long total = (Long) _entityManager.createQuery(cbQuery).getSingleResult().get(0);
        cbQuery.multiselect(root.get(Metadata_.id), root.get(Metadata_.dataInfo).get(MetadataDataInfo_.changeDate));

        if (pageable != null && pageable.getSort() != null) {
            final Sort sort = pageable.getSort();
            List<Order> orders = SortUtils.sortToJpaOrders(cb, sort, root);

            cbQuery.orderBy(orders);
        }
View Full Code Here

     * @param editor ISVNEditor for commits to subversion repo
     * @param id     Id number of metadata record being tracked for changes
     * @throws Exception if something goes wrong
     */
    private void commitMetadataPrivileges(ISVNEditor editor, String id) throws Exception {
        Sort sort = SortUtils.createSort(OperationAllowed_.id, OperationAllowedId_.operationId);
        Specification<OperationAllowed> hasMetadataId = OperationAllowedSpecs.hasMetadataId(Integer.valueOf(id));
        List<OperationAllowed> opsAllowed = _operationAllowedRepository.findAll(hasMetadataId, sort);
        Element privs = new Element("response");
        for (OperationAllowed operationAllowed : opsAllowed) {
            Element record = new Element("record");
View Full Code Here

    }

    @Test
    public void testHasMetadataId() {
        Specification<OperationAllowed> hasMetadataId = OperationAllowedSpecs.hasMetadataId(_md1.getId());
        List<OperationAllowed> found = _opAllowRepo.findAll(hasMetadataId, new Sort(operationIdPath(), metadataIdPath()));

        assertEquals(found.size(), 3);
        assertEquals(_viewOp.getId(), found.get(0).getId().getOperationId());
        assertEquals(_viewOp.getId(), found.get(1).getId().getOperationId());
        assertEquals(_downloadOp.getId(), found.get(2).getId().getOperationId());
View Full Code Here

    }

    @Test
    public void testHasMetadataIdIn() {
        Specification<OperationAllowed> hasMetadataId = OperationAllowedSpecs.hasMetadataIdIn(Arrays.asList(_md1.getId(), _md2.getId()));
        List<OperationAllowed> found = _opAllowRepo.findAll(hasMetadataId, new Sort(operationIdPath(), metadataIdPath()));

        assertEquals(found.size(), 4);
    }
View Full Code Here

    }

    @Test
    public void testHasGroupIdIn() {
        Specification<OperationAllowed> hasGroupIdIn = OperationAllowedSpecs.hasGroupIdIn(Arrays.asList(_intranetGroup.getId()));
        List<OperationAllowed> found = _opAllowRepo.findAll(hasGroupIdIn, new Sort(operationIdPath(), metadataIdPath()));

        assertEquals(found.size(), 3);
    }
View Full Code Here

    }

    @Test
    public void testHasGroupId() {
        Specification<OperationAllowed> hasMetadataId = OperationAllowedSpecs.hasGroupId(_intranetGroup.getId());
        List<OperationAllowed> found = _opAllowRepo.findAll(hasMetadataId, new Sort(groupIdPath(), metadataIdPath()));

        assertEquals(found.size(), 3);
        assertEquals(_intranetGroup.getId(), found.get(0).getId().getGroupId());
        assertEquals(_intranetGroup.getId(), found.get(1).getId().getGroupId());
        assertEquals(_intranetGroup.getId(), found.get(2).getId().getGroupId());
View Full Code Here

    }

    @Test
    public void testHasOperationId() {
        Specification<OperationAllowed> hasMetadataId = OperationAllowedSpecs.hasOperationId(_viewOp.getId());
        List<OperationAllowed> found = _opAllowRepo.findAll(hasMetadataId, new Sort(groupIdPath(), metadataIdPath()));

        assertEquals(found.size(), 2);
        assertEquals(_allGroup.getId(), found.get(0).getId().getGroupId());

        assertEquals(_viewOp.getId(), found.get(0).getId().getOperationId());
View Full Code Here

        request3 = _requestRepo.save(request3);

        assertEquals(2, _requestRepo.count(isMoreRecentThanOrEqualTo(request2.getRequestDate())));
        assertEquals(1, _requestRepo.count(isMoreRecentThanOrEqualTo(request3.getRequestDate())));
        assertEquals(3, _requestRepo.count(isMoreRecentThanOrEqualTo(request1.getRequestDate())));
        final Sort sort = new Sort(Sort.Direction.DESC, SearchRequest_.requestDate.getName());
        final List<SearchRequest> all = _requestRepo.findAll(isMoreRecentThanOrEqualTo(request2.getRequestDate()), sort);

        assertEquals(2, all.size());
        assertEquals(request3.getId(), all.get(0).getId());
        assertEquals(request2.getId(), all.get(1).getId());
View Full Code Here

TOP

Related Classes of org.springframework.data.domain.Sort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.