Search in sources :

Example 1 with ComplexPojo

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

the class ComplexPojoRepository method findOne.

@Override
public ComplexPojo findOne(Long aLong, QueryParams queryParams) {
    if (THREAD_LOCAL_REPOSITORY.size() < 1) {
        ComplexPojo complexPojo = new ComplexPojo();
        complexPojo.setContainedPojo(new ContainedPojo());
        complexPojo.getContainedPojo().setUpdateableProperty1("value from repository mock");
        complexPojo.getContainedPojo().setUpdateableProperty2("value from repository mock");
        complexPojo.setId(1l);
        THREAD_LOCAL_REPOSITORY.put(complexPojo.getId(), complexPojo);
    }
    ComplexPojo complexPojo = THREAD_LOCAL_REPOSITORY.get(aLong);
    if (complexPojo == null) {
        throw new ResourceNotFoundException("");
    }
    return complexPojo;
}
Also used : ComplexPojo(io.crnk.core.mock.models.ComplexPojo) ContainedPojo(io.crnk.core.mock.models.ContainedPojo) ResourceNotFoundException(io.crnk.core.exception.ResourceNotFoundException)

Aggregations

ResourceNotFoundException (io.crnk.core.exception.ResourceNotFoundException)1 ComplexPojo (io.crnk.core.mock.models.ComplexPojo)1 ContainedPojo (io.crnk.core.mock.models.ContainedPojo)1