Package org.springframework.data.jpa.domain

Examples of org.springframework.data.jpa.domain.Specification


      }
    }
   
    Object clazz = Class.forName(module.getClassName()).newInstance();
    //Object clazz = null;
    Specification spec = DynamicSpecifications.bySearchFilter(request, clazz.getClass(), filterSet);
   
    CriteriaBuilder builder = em.getCriteriaBuilder();
    CriteriaQuery criteriaQuery = builder.createQuery(clazz.getClass());
    Root root = criteriaQuery.from(clazz.getClass());
   
    Predicate predicate = spec.toPredicate(root, criteriaQuery, builder);
    criteriaQuery.where(predicate);
   
    List<Object> objects = em.createQuery(criteriaQuery).getResultList();
    if (ids != null) {
      if (objects.size() == ids.length) {
View Full Code Here


        PersistentEntity<?, ?> persistentEntity = repoRequest.getPersistentEntity();

        final ScopeMetadata scope = domainTypeAdministrationConfiguration.getScopes().getScope(scopeName);

        final Specification filterSpecification = specificationFromRequest(request, persistentEntity);

        if (isPredicateScope(scope)) {
            final PredicateScopeMetadata predicateScope = (PredicateScopeMetadata) scope;

            return new ResponseEntity(countItemsBySpecificationAndPredicate(repositoryInvoker, filterSpecification, predicateScope.predicate()), HttpStatus.OK);
        }

        if (isSpecificationScope(scope)) {
            final Specification scopeSpecification = ((ScopeMetadataUtils.SpecificationScopeMetadata) scope).specification();

            return new ResponseEntity(countItemsBySpecification(repositoryInvoker, and(scopeSpecification, filterSpecification)), HttpStatus.OK);
        }

        return new ResponseEntity(countItemsBySpecification(repositoryInvoker, filterSpecification), HttpStatus.OK);
View Full Code Here

        DynamicRepositoryInvoker repositoryInvoker = (DynamicRepositoryInvoker) repoRequest.getInvoker();
        PersistentEntity<?, ?> persistentEntity = repoRequest.getPersistentEntity();

        final ScopeMetadata scope = domainTypeAdministrationConfiguration.getScopes().getScope(scopeName);

        final Specification filterSpecification = specificationFromRequest(request, persistentEntity);

        if (isPredicateScope(scope)) {
            final PredicateScopeMetadata predicateScope = (PredicateScopeMetadata) scope;

            final Page page = findBySpecificationAndPredicate(repositoryInvoker, filterSpecification, predicateScope.predicate(), pageable);

            Object resources = resultToResources(page, assembler);

            return new ResponseEntity(resources, HttpStatus.OK);
        }

        if (isSpecificationScope(scope)) {
            final Specification scopeSpecification = ((ScopeMetadataUtils.SpecificationScopeMetadata) scope).specification();

            Page page = findItemsBySpecification(repositoryInvoker, and(scopeSpecification, filterSpecification), pageable);

            Object resources = resultToResources(page, assembler);
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.domain.Specification

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.