Commit a8509816 authored by Martin Lowe's avatar Martin Lowe

Add filter service, update Quarkus version

Signed-off-by: Martin Lowe's avatarMartin Lowe <>
parent 1beff785
......@@ -29,7 +29,7 @@ public final class PersistenceUrlParameterNames implements UrlParameterNamespace
public static final UrlParameter SORT = new UrlParameter("sort");
public static final UrlParameter MANUAL_OFFSET = new UrlParameter("manual_offset");
private static final List<UrlParameter> params = Collections.unmodifiableList(Arrays.asList(SORT));
private static final List<UrlParameter> params = Collections.unmodifiableList(Arrays.asList(SORT, MANUAL_OFFSET));
public List<UrlParameter> getParameters() {
package org.eclipsefoundation.persistence.service;
import org.eclipsefoundation.persistence.dto.BareNode;
import org.eclipsefoundation.persistence.dto.filter.DtoFilter;
* Provides filters for the passed class reference to reduce the number of injections that need to
* be handled by Graph endpoints.
* @author Martin Lowe
public interface FilterService {
* Returns a DTO filter if available for the given class.
* @param <T> the type of entity being filtered
* @param target class ref for the target entity type
* @return a filter instance for the given class if it exists, null otherwise
<T extends BareNode> DtoFilter<T> get(Class<T> target);
package org.eclipsefoundation.persistence.service.impl;
import java.util.Optional;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import org.eclipsefoundation.persistence.dto.BareNode;
import org.eclipsefoundation.persistence.dto.filter.DtoFilter;
import org.eclipsefoundation.persistence.service.FilterService;
public class DefaultFilterService implements FilterService {
@Inject Instance<DtoFilter<?>> filters;
public <T extends BareNode> DtoFilter<T> get(Class<T> target) {
Optional<DtoFilter<?>> filter = -> f.getType().equals(target)).findFirst();
if (filter.isPresent()) {
return (DtoFilter<T>) filter.get();
return null;
......@@ -10,7 +10,7 @@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment