@Override public Iterable<Object> invokeFindAll(Pageable pageable) { return delegate.invokeFindAll(pageable); }
@Override public Iterable<Object> invokeFindAll(Sort sort) { return delegate.invokeFindAll(sort); }
@Override public JsonSchemaProperty customize(JsonSchemaProperty property, TypeInformation<?> type) { List<String> result = new ArrayList<String>(); for (Object element : factory.getInvokerFor(type.getType()).invokeFindAll((Sort) null)) { result.add(element.toString()); } Collections.sort(result); return new EnumProperty(property.getName(), property.getTitle(), result, property.description, true); } };
/** * <code>GET /{repository}</code> - Returns the collection resource (paged or unpaged). * * @param resourceInformation * @param pageable * @param sort * @param assembler * @return * @throws ResourceNotFoundException * @throws HttpRequestMethodNotSupportedException */ @ResponseBody @RequestMapping(value = BASE_MAPPING, method = RequestMethod.GET) public Resources<?> getCollectionResource(@QuerydslPredicate RootResourceInformation resourceInformation, DefaultedPageable pageable, Sort sort, PersistentEntityResourceAssembler assembler) throws ResourceNotFoundException, HttpRequestMethodNotSupportedException { resourceInformation.verifySupportedMethod(HttpMethod.GET, ResourceType.COLLECTION); RepositoryInvoker invoker = resourceInformation.getInvoker(); if (null == invoker) { throw new ResourceNotFoundException(); } Iterable<?> results = pageable.getPageable() != null ? invoker.invokeFindAll(pageable.getPageable()) : invoker.invokeFindAll(sort); ResourceMetadata metadata = resourceInformation.getResourceMetadata(); Optional<Link> baseLink = Optional.of(entityLinks.linkToPagedResource(resourceInformation.getDomainType(), pageable.isDefault() ? null : pageable.getPageable())); Resources<?> result = toResources(results, assembler, metadata.getDomainType(), baseLink); result.add(getCollectionResourceLinks(resourceInformation, pageable)); return result; }
@Override public JsonSchemaProperty customize(JsonSchemaProperty property, TypeInformation<?> type) { List<String> result = new ArrayList<String>(); for (Object element : factory.getInvokerFor(type.getType()).invokeFindAll((Sort) null)) { result.add(element.toString()); } Collections.sort(result); return new EnumProperty(property.getName(), property.getTitle(), result, property.description, true); } };
/** * <code>GET /{repository}</code> - Returns the collection resource (paged or unpaged). * * @param resourceInformation * @param pageable * @param sort * @param assembler * @return * @throws ResourceNotFoundException * @throws HttpRequestMethodNotSupportedException */ @ResponseBody @RequestMapping(value = BASE_MAPPING, method = RequestMethod.GET) public Resources<?> getCollectionResource(@QuerydslPredicate RootResourceInformation resourceInformation, DefaultedPageable pageable, Sort sort, PersistentEntityResourceAssembler assembler) throws ResourceNotFoundException, HttpRequestMethodNotSupportedException { resourceInformation.verifySupportedMethod(HttpMethod.GET, ResourceType.COLLECTION); RepositoryInvoker invoker = resourceInformation.getInvoker(); if (null == invoker) { throw new ResourceNotFoundException(); } Iterable<?> results = pageable.getPageable() != null ? invoker.invokeFindAll(pageable.getPageable()) : invoker.invokeFindAll(sort); ResourceMetadata metadata = resourceInformation.getResourceMetadata(); Optional<Link> baseLink = Optional.of(entityLinks.linkToPagedResource(resourceInformation.getDomainType(), pageable.isDefault() ? null : pageable.getPageable())); Resources<?> result = toResources(results, assembler, metadata.getDomainType(), baseLink); result.add(getCollectionResourceLinks(resourceInformation, pageable)); return result; }