Search in sources :

Example 16 with User

use of io.crnk.core.mock.models.User in project crnk-framework by crnk-project.

the class UserToTaskRepository method findOneTarget.

@Override
public Task findOneTarget(Long sourceId, String fieldName, QuerySpec querySpec) {
    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());
            return project;
        }
    }
    return null;
}
Also used : Task(io.crnk.core.mock.models.Task) User(io.crnk.core.mock.models.User)

Aggregations

User (io.crnk.core.mock.models.User)16 Test (org.junit.Test)10 QuerySpec (io.crnk.core.queryspec.QuerySpec)8 Project (io.crnk.core.mock.models.Project)3 Task (io.crnk.core.mock.models.Task)3 CrnkBoot (io.crnk.core.boot.CrnkBoot)2 RepositoryRequestSpec (io.crnk.core.engine.dispatcher.RepositoryRequestSpec)2 ConstantServiceUrlProvider (io.crnk.core.engine.url.ConstantServiceUrlProvider)2 ReflectionsServiceDiscovery (io.crnk.core.module.discovery.ReflectionsServiceDiscovery)2 ResourceRegistryTest (io.crnk.core.resource.registry.ResourceRegistryTest)2 Before (org.junit.Before)2 Response (io.crnk.core.engine.dispatcher.Response)1 Relationship (io.crnk.core.engine.document.Relationship)1 Resource (io.crnk.core.engine.document.Resource)1 ResourceField (io.crnk.core.engine.information.resource.ResourceField)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 BaseControllerTest (io.crnk.core.engine.internal.dispatcher.controller.BaseControllerTest)1 FieldResourceGet (io.crnk.core.engine.internal.dispatcher.controller.FieldResourceGet)1 JsonPath (io.crnk.core.engine.internal.dispatcher.path.JsonPath)1 RelationshipRepositoryAdapter (io.crnk.core.engine.internal.repository.RelationshipRepositoryAdapter)1