Search in sources :

Example 1 with JsonApiFindManyTargets

use of io.crnk.legacy.repository.annotations.JsonApiFindManyTargets in project crnk-framework by crnk-project.

the class UserToTaskRepository method findManyTargets.

@JsonApiFindManyTargets
public ResourceList<Task> findManyTargets(Long sourceId, String fieldName, QuerySpec querySpec) {
    ResourceList<Task> projects = new DefaultResourceList<>();
    for (Relation<User> relation : THREAD_LOCAL_REPOSITORY.keySet()) {
        if (relation.getSource().getId().equals(sourceId) && relation.getFieldName().equals(fieldName)) {
            Task project = new Task();
            project.setId((Long) relation.getTargetId());
            projects.add(project);
        }
    }
    return projects;
}
Also used : Task(io.crnk.core.mock.models.Task) User(io.crnk.core.mock.models.User) DefaultResourceList(io.crnk.core.resource.list.DefaultResourceList) JsonApiFindManyTargets(io.crnk.legacy.repository.annotations.JsonApiFindManyTargets)

Aggregations

Task (io.crnk.core.mock.models.Task)1 User (io.crnk.core.mock.models.User)1 DefaultResourceList (io.crnk.core.resource.list.DefaultResourceList)1 JsonApiFindManyTargets (io.crnk.legacy.repository.annotations.JsonApiFindManyTargets)1