-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#30 RepositoryFilter to allow metrics collection #194
Conversation
new RepositoryFilter interface introduced that sits in the repository layer and allows to intercept request, respones and links/meta information gathering. - repository adapters modified to invoke filters - filters get a chain class to decide whether to proceed with the request or return a result on its own. - RepositoryRequestSpec to specify the contents of a request - existing Filter interface should be renamed to make clear that they operate on a different layer (transport vs repository). - Module api extended to allow RepositoryFilter registration - minor refactoring to ResourceRegistry/ModuleRegistry dependency to allow access to RepositoryFilter
- unused imports - fixed a invalid package name (for non-public one)
} | ||
|
||
@SuppressWarnings({ "unchecked", "rawtypes" }) | ||
private LinksInformation doGetLinksInformation(Object repository, Iterable<?> resources, RepositoryRequestSpec requestSpec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@SuppressWarnings({ "unchecked", "rawtypes" }) | ||
private MetaInformation doGetMetaInformation(Object repository, Iterable<?> resources, RepositoryRequestSpec requestSpec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
import io.katharsis.module.ModuleRegistry; | ||
import io.katharsis.queryParams.QueryParams; | ||
import io.katharsis.queryspec.DefaultQuerySpecConverter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
|
||
private <T> String toUrl(QueryAdapter queryAdapter, PagedResultList<T> pagedResultList, RepositoryRequestSpec requestSpec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import io.katharsis.module.ModuleRegistry; | ||
import io.katharsis.queryParams.QueryParams; | ||
import io.katharsis.queryspec.DefaultQuerySpecConverter; | ||
import io.katharsis.queryspec.QuerySpec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
private <S extends T> JsonApiResponse save(S entity, QueryAdapter queryAdapter, HttpMethod method) { | ||
RepositoryRequestFilterChainImpl chain = new RepositoryRequestFilterChainImpl() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
public JsonApiResponse findOne(I id, QueryAdapter queryAdapter) { | ||
RepositoryRequestFilterChainImpl chain = new RepositoryRequestFilterChainImpl() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
public JsonApiResponse findAll(Iterable ids, QueryAdapter queryAdapter) { | ||
RepositoryRequestFilterChainImpl chain = new RepositoryRequestFilterChainImpl() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
public JsonApiResponse findAll(QueryAdapter queryAdapter) { | ||
RepositoryRequestFilterChainImpl chain = new RepositoryRequestFilterChainImpl() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
@SuppressWarnings("rawtypes") | ||
public JsonApiResponse findOneTarget(I sourceId, String fieldName, QueryAdapter queryAdapter) { | ||
RepositoryRequestFilterChainImpl chain = new RepositoryRequestFilterChainImpl() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.findOneTarget(sourceId, fieldName, request.getQueryParams()); | ||
} | ||
return getResponse(relationshipRepository, resource, request); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
@SuppressWarnings("rawtypes") | ||
public JsonApiResponse findManyTargets(I sourceId, String fieldName, QueryAdapter queryAdapter) { | ||
RepositoryRequestFilterChainImpl chain = new RepositoryRequestFilterChainImpl() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new RepositoryFilter interface introduced that sits in the repository layer and allows to intercept request, respones and links/meta information gathering.
use cases: