use of com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery in project stdlib by petergeneric.
the class LargeTableQueryTest method testSearchWorks.
/**
* Test that searching works with a simple primary key
*/
@Test
@Transactional
public void testSearchWorks() {
dao.save(new LargeTableSimplePKEntity("Alice"));
dao.save(new LargeTableSimplePKEntity("Bob"));
dao.save(new LargeTableSimplePKEntity("Carol"));
dao.save(new LargeTableSimplePKEntity("Dave"));
dao.save(new LargeTableSimplePKEntity("Eve"));
// Try a regular query
assertEquals(2, dao.countWithAInName());
// Now try a web query
assertEquals(2, dao.findByUriQuery(new WebQuery().contains("name", "a")).getList().size());
}
use of com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery in project stdlib by petergeneric.
the class RoleUIServiceImpl method get.
@Override
@Transactional(readOnly = true)
public String get(final String id) {
TemplateCall call = templater.template("role");
final RoleEntity entity = dao.getById(id);
if (entity == null)
throw new IllegalArgumentException("No such Role: " + id);
call.set("entity", entity);
call.set("allUsers", userDao.getAll());
call.set("users", userDao.findByUriQuery(new WebQuery().eq("roles.id", id)).getList());
call.set("nonce", nonceStore.getValue(NONCE_USE));
return call.process();
}
use of com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery in project stdlib by petergeneric.
the class ServiceUIServiceImpl method getList.
@Override
@Transactional(readOnly = true)
public String getList(final UriInfo query) {
final ConstrainedResultSet<OAuthServiceEntity> resultset = dao.findByUriQuery(new WebQuery().decode(query.getQueryParameters()));
final TemplateCall call = templater.template("services");
call.set("nonce", nonceStore.getValue(NONCE_USE));
call.set("resultset", resultset);
call.set("entities", resultset.getList());
return call.process();
}
use of com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery in project stdlib by petergeneric.
the class UserUIServiceImpl method getUsers.
@Override
@Transactional(readOnly = true)
@AuthConstraint(role = UserLogin.ROLE_ADMIN)
public String getUsers(UriInfo query) {
ConstrainedResultSet<UserEntity> resultset = accountDao.findByUriQuery(new WebQuery().orderAsc("id").decode(query));
TemplateCall call = templater.template("users");
call.set("resultset", resultset);
call.set("users", resultset.getList());
call.set("nonce", nonceStore.getValue(NONCE_USE));
return call.process();
}
Aggregations