Search in sources :

Example 1 with Task

use of io.crnk.example.dropwizard.mongo.domain.model.Task in project crnk-framework by crnk-project.

the class TaskToProjectRepository method findManyTargets.

@Override
public ResourceList<Project> findManyTargets(ObjectId objectId, String fieldName, QuerySpec requestParams) {
    Task task = taskRepository.findOne(objectId, requestParams);
    try {
        DefaultResourceList<Project> result = new DefaultResourceList<>();
        result.addAll((Collection<Project>) PropertyUtils.getProperty(task, fieldName));
        return result;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : Project(io.crnk.example.dropwizard.mongo.domain.model.Project) Task(io.crnk.example.dropwizard.mongo.domain.model.Task) DefaultResourceList(io.crnk.core.resource.list.DefaultResourceList)

Aggregations

DefaultResourceList (io.crnk.core.resource.list.DefaultResourceList)1 Project (io.crnk.example.dropwizard.mongo.domain.model.Project)1 Task (io.crnk.example.dropwizard.mongo.domain.model.Task)1