use of io.crnk.core.mock.models.User 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;
}
use of io.crnk.core.mock.models.User in project crnk-framework by crnk-project.
the class UserToProjectRepository method findOneTarget.
@JsonApiFindOneTarget
public Project 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)) {
Project project = new Project();
project.setId((Long) relation.getTargetId());
return project;
}
}
return null;
}
use of io.crnk.core.mock.models.User in project crnk-framework by crnk-project.
the class UserToProjectRepository method findManyTargets.
@JsonApiFindManyTargets
public Iterable<Project> findManyTargets(Long sourceId, String fieldName, QuerySpec querySpec) {
List<Project> projects = new LinkedList<>();
for (Relation<User> relation : THREAD_LOCAL_REPOSITORY.keySet()) {
if (relation.getSource().getId().equals(sourceId) && relation.getFieldName().equals(fieldName)) {
Project project = new Project();
project.setId((Long) relation.getTargetId());
projects.add(project);
}
}
return projects;
}
use of io.crnk.core.mock.models.User in project crnk-framework by crnk-project.
the class RegistryEntryFacadeTest method checkCreate.
@Test
public void checkCreate() {
User updatedUser = new User();
updatedUser.setName("updated");
facade.save(updatedUser);
ResourceList<User> list = facade.findAll(new QuerySpec(User.class));
Assert.assertEquals(3, list.size());
}
use of io.crnk.core.mock.models.User in project crnk-framework by crnk-project.
the class RegistryEntryFacadeTest method checkSave.
@Test
public void checkSave() {
User updatedUser = new User();
updatedUser.setId(user1.getId());
updatedUser.setName("updated");
facade.save(updatedUser);
User facadeUser = facade.findOne(user1.getId(), new QuerySpec(User.class));
Assert.assertSame(updatedUser, facadeUser);
}
Aggregations