use of io.crnk.core.engine.internal.repository.ResourceRepositoryAdapter in project crnk-framework by crnk-project.
the class FormRelationshipRepository method findOneTarget.
@Override
public F findOneTarget(String taskId, String fieldName, QuerySpec querySpec) {
if (RELATIONSHIP_NAME.equals(fieldName)) {
ResourceRepositoryAdapter resourceRepository = resourceRegistry.getEntry(formClass).getResourceRepository();
QuerySpecAdapter querySpecAdapter = new QuerySpecAdapter(querySpec, resourceRegistry);
return (F) resourceRepository.findOne(taskId, querySpecAdapter).getEntity();
} else {
throw new UnsupportedOperationException("unknown fieldName '" + fieldName + "'");
}
}
use of io.crnk.core.engine.internal.repository.ResourceRepositoryAdapter in project crnk-framework by crnk-project.
the class CrnkClient method getQueryParamsRepository.
/**
* @param resourceClass resource class
* @return stub for the given resourceClass
* @deprecated make use of QuerySpec
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Deprecated
public <T, I extends Serializable> ResourceRepositoryStub<T, I> getQueryParamsRepository(Class<T> resourceClass) {
init();
RegistryEntry entry = resourceRegistry.findEntry(resourceClass);
// TODO fix this in crnk, should be able to get original document
ResourceRepositoryAdapter repositoryAdapter = entry.getResourceRepository(null);
return (ResourceRepositoryStub<T, I>) repositoryAdapter.getResourceRepository();
}
use of io.crnk.core.engine.internal.repository.ResourceRepositoryAdapter in project crnk-framework by crnk-project.
the class CrnkClient method getRepositoryForType.
/**
* @param resourceClass repository class
* @return stub for the given resourceClass
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T, I extends Serializable> ResourceRepositoryV2<T, I> getRepositoryForType(Class<T> resourceClass) {
init();
RegistryEntry entry = resourceRegistry.findEntry(resourceClass);
ResourceRepositoryAdapter repositoryAdapter = entry.getResourceRepository(null);
return (ResourceRepositoryV2<T, I>) repositoryAdapter.getResourceRepository();
}
use of io.crnk.core.engine.internal.repository.ResourceRepositoryAdapter in project crnk-framework by crnk-project.
the class ForwardingStrategyContext method findAll.
public <Q> Iterable<Q> findAll(RegistryEntry entry, Iterable<?> targetIds) {
ResourceRepositoryAdapter targetAdapter = entry.getResourceRepository();
QueryAdapter queryAdapter = new QuerySpecAdapter(new QuerySpec(entry.getResourceInformation()), resourceRegistry);
return (Iterable) targetAdapter.findAll(targetIds, queryAdapter).getEntity();
}
use of io.crnk.core.engine.internal.repository.ResourceRepositoryAdapter in project crnk-framework by crnk-project.
the class ForwardingStrategyContext method findOne.
public <Q> Q findOne(RegistryEntry entry, Serializable id) {
ResourceRepositoryAdapter targetAdapter = entry.getResourceRepository();
QueryAdapter queryAdapter = new QuerySpecAdapter(new QuerySpec(entry.getResourceInformation()), resourceRegistry);
return (Q) targetAdapter.findOne(id, queryAdapter).getEntity();
}
Aggregations