/** * Creates the {@link Descriptor}s for pagination parameters. * * @param type * @return */ private List<Descriptor> getPaginationDescriptors(Class<?> type, HttpMethod method) { RepositoryInformation information = repositories.getRequiredRepositoryInformation(type); if (!information.isPagingRepository() || !getType(method).equals(Type.SAFE)) { return Collections.emptyList(); } Link linkToCollectionResource = entityLinks.linkToCollectionResource(type); List<TemplateVariable> variables = linkToCollectionResource.getVariables(); List<Descriptor> descriptors = new ArrayList<Descriptor>(variables.size()); ProjectionDefinitionConfiguration projectionConfiguration = configuration.getProjectionConfiguration(); for (TemplateVariable variable : variables) { // Skip projection parameter if (projectionConfiguration.getParameterName().equals(variable.getName())) { continue; } ResourceDescription description = SimpleResourceDescription.defaultFor(variable.getDescription()); descriptors.add(// descriptor().// name(variable.getName()).// type(Type.SEMANTIC).// doc(getDocFor(description)).// build()); } return descriptors; }
@Override public boolean isPagingRepository() { return repositoryInformation.isPagingRepository(); }
@Override public boolean isPagingRepository() { return repositoryInformation.isPagingRepository(); }
@Override public boolean isPagingRepository() { return repositoryInformation.isPagingRepository(); }
@Override public boolean isPagingRepository() { return repositoryInformation.isPagingRepository(); }
@Override public boolean isPagingRepository() { return repositoryInformation.isPagingRepository(); }
@Override public boolean isPagingRepository() { return repositoryInformation.isPagingRepository(); }
@Override public boolean isPagingRepository() { return repositoryInformation.isPagingRepository(); }
private void checkFeatures(RepositoryInformation metadata, boolean isN1qlAvailable, N1qlPrimaryIndexed n1qlPrimaryIndexed, N1qlSecondaryIndexed n1qlSecondaryIndexed) { //paging repo will always need N1QL, also check if the repository requires a N1QL index boolean needsN1ql = metadata.isPagingRepository() || n1qlPrimaryIndexed != null || n1qlSecondaryIndexed != null; //for other repos, they might also need N1QL if they don't have only @View methods if (!needsN1ql) { for (Method method : metadata.getQueryMethods()) { boolean hasN1ql = AnnotationUtils.findAnnotation(method, Query.class) != null; boolean hasView = AnnotationUtils.findAnnotation(method, View.class) != null; if (hasN1ql || !hasView) { needsN1ql = true; break; } } } if (needsN1ql && !isN1qlAvailable) { throw new UnsupportedCouchbaseFeatureException("Repository uses N1QL", CouchbaseFeature.N1QL); } }
private void checkFeatures(RepositoryInformation metadata, boolean isN1qlAvailable, N1qlPrimaryIndexed n1qlPrimaryIndexed, N1qlSecondaryIndexed n1qlSecondaryIndexed) { //paging repo will always need N1QL, also check if the repository requires a N1QL index boolean needsN1ql = metadata.isPagingRepository() || n1qlPrimaryIndexed != null || n1qlSecondaryIndexed != null; //for other repos, they might also need N1QL if they don't have only @View methods if (!needsN1ql) { for (Method method : metadata.getQueryMethods()) { boolean hasN1ql = AnnotationUtils.findAnnotation(method, Query.class) != null; boolean hasView = AnnotationUtils.findAnnotation(method, View.class) != null; if (hasN1ql || !hasView) { needsN1ql = true; break; } } } if (needsN1ql && !isN1qlAvailable) { throw new UnsupportedCouchbaseFeatureException("Repository uses N1QL", CouchbaseFeature.N1QL); } }
private void checkFeatures(RepositoryInformation metadata, boolean isN1qlAvailable, N1qlPrimaryIndexed n1qlPrimaryIndexed, N1qlSecondaryIndexed n1qlSecondaryIndexed) { //paging repo will always need N1QL, also check if the repository requires a N1QL index boolean needsN1ql = metadata.isPagingRepository() || n1qlPrimaryIndexed != null || n1qlSecondaryIndexed != null; //for other repos, they might also need N1QL if they don't have only @View methods if (!needsN1ql) { for (Method method : metadata.getQueryMethods()) { boolean hasN1ql = AnnotationUtils.findAnnotation(method, Query.class) != null; boolean hasView = AnnotationUtils.findAnnotation(method, View.class) != null; if (hasN1ql || !hasView) { needsN1ql = true; break; } } } if (needsN1ql && !isN1qlAvailable) { throw new UnsupportedCouchbaseFeatureException("Repository uses N1QL", CouchbaseFeature.N1QL); } }
private void checkFeatures(RepositoryInformation metadata, boolean isN1qlAvailable, N1qlPrimaryIndexed n1qlPrimaryIndexed, N1qlSecondaryIndexed n1qlSecondaryIndexed) { //paging repo will always need N1QL, also check if the repository requires a N1QL index boolean needsN1ql = metadata.isPagingRepository() || n1qlPrimaryIndexed != null || n1qlSecondaryIndexed != null; //for other repos, they might also need N1QL if they don't have only @View methods if (!needsN1ql) { for (Method method : metadata.getQueryMethods()) { boolean hasN1ql = AnnotationUtils.findAnnotation(method, Query.class) != null; boolean hasView = AnnotationUtils.findAnnotation(method, View.class) != null; if (hasN1ql || !hasView) { needsN1ql = true; break; } } } if (needsN1ql && !isN1qlAvailable) { throw new UnsupportedCouchbaseFeatureException("Repository uses N1QL", CouchbaseFeature.N1QL); } }
/** * Creates the {@link Descriptor}s for pagination parameters. * * @param type * @return */ private List<Descriptor> getPaginationDescriptors(Class<?> type, HttpMethod method) { RepositoryInformation information = repositories.getRequiredRepositoryInformation(type); if (!information.isPagingRepository() || !getType(method).equals(Type.SAFE)) { return Collections.emptyList(); } Link linkToCollectionResource = entityLinks.linkToCollectionResource(type); List<TemplateVariable> variables = linkToCollectionResource.getVariables(); List<Descriptor> descriptors = new ArrayList<Descriptor>(variables.size()); ProjectionDefinitionConfiguration projectionConfiguration = configuration.getProjectionConfiguration(); for (TemplateVariable variable : variables) { // Skip projection parameter if (projectionConfiguration.getParameterName().equals(variable.getName())) { continue; } ResourceDescription description = SimpleResourceDescription.defaultFor(variable.getDescription()); descriptors.add(// descriptor().// name(variable.getName()).// type(Type.SEMANTIC).// doc(getDocFor(description)).// build()); } return descriptors; }