use of io.crnk.core.mock.repository.util.Relation in project crnk-framework by crnk-project.
the class ProjectToTaskRepository method findOneTarget.
@Override
public Task findOneTarget(Long sourceId, String fieldName, QueryParams queryParams) {
Map<Relation<Project>, Integer> repo = getRepo();
for (Relation<Project> relation : repo.keySet()) {
if (relation.getSource().getId().equals(sourceId) && relation.getFieldName().equals(fieldName)) {
Task task = new Task();
task.setId((Long) relation.getTargetId());
return task;
}
}
return null;
}
use of io.crnk.core.mock.repository.util.Relation in project crnk-framework by crnk-project.
the class ProjectToProjectEagerRepository method findOneTarget.
@Override
public ProjectEager findOneTarget(Long sourceId, String fieldName, QueryParams queryParams) {
Map<Relation<Project>, Integer> repo = getRepo();
for (Relation<Project> relation : repo.keySet()) {
if (relation.getSource().getId().equals(sourceId) && relation.getFieldName().equals(fieldName)) {
ProjectEager task = new ProjectEager();
task.setId((Long) relation.getTargetId());
return task;
}
}
return null;
}
use of io.crnk.core.mock.repository.util.Relation in project crnk-framework by crnk-project.
the class TaskToProjectRepository method findOneTarget.
@Override
public Project findOneTarget(Long sourceId, String fieldName, QueryParams queryParams) {
Map<Relation<Task>, Integer> repo = getRepo();
for (Relation<Task> relation : repo.keySet()) {
if (relation.getSource().getId().equals(sourceId) && relation.getFieldName().equals(fieldName)) {
Project project = new Project();
if (relation.getTargetId().equals(ProjectRepository.FANCY_PROJECT_ID)) {
project = new FancyProject();
}
project.setId((Long) relation.getTargetId());
return project;
}
}
return null;
}
Aggregations