use of com.haulmont.cuba.core.global.LoadContext in project cuba by cuba-platform.
the class JmxControlBean method getInstances.
@SuppressWarnings("unchecked")
@Override
public List<JmxInstance> getInstances() {
LoadContext loadContext = new LoadContext(JmxInstance.class);
loadContext.setView(View.LOCAL);
loadContext.setQueryString("select jmx from sys$JmxInstance jmx");
List<JmxInstance> clusterInstances = dataService.loadList(loadContext);
List<JmxInstance> jmxInstances = new ArrayList<>(clusterInstances.size() + 1);
jmxInstances.add(getLocalInstance());
jmxInstances.addAll(clusterInstances);
return jmxInstances;
}
use of com.haulmont.cuba.core.global.LoadContext in project cuba by cuba-platform.
the class EntityFactory method build.
@Override
public Object build(String string) {
if (StringUtils.isBlank(string))
return null;
EntityLoadInfo info = EntityLoadInfo.parse(string);
if (info == null)
throw new IllegalArgumentException("Invalid entity info: " + string);
LoadContext ctx = new LoadContext(info.getMetaClass()).setId(info.getId());
if (info.getViewName() != null)
ctx.setView(info.getViewName());
return ds.load(ctx);
}
use of com.haulmont.cuba.core.global.LoadContext in project cuba by cuba-platform.
the class DataManagerDistinctResultsTest method load.
private LinkedHashSet<User> load(int firstResult, int maxResults, String queryString) {
DataManager ds = AppBeans.get(DataManager.NAME);
LoadContext<User> lc = new LoadContext<>(User.class);
LoadContext.Query q = lc.setQueryString(queryString);
q.setParameter("groupId", groupId);
q.setFirstResult(firstResult);
q.setMaxResults(maxResults);
List<User> list = ds.loadList(lc);
return new LinkedHashSet<>(list);
}
use of com.haulmont.cuba.core.global.LoadContext in project cuba by cuba-platform.
the class HsqlLikeNullFailTest method setUp.
@Before
public void setUp() throws Exception {
DataManager dataManager = AppBeans.get(DataManager.NAME);
Group group = dataManager.load(new LoadContext<>(Group.class).setId(UUID.fromString("0fa2b1a5-1d68-4d69-9fbd-dff348347f93")));
User user = new User();
user.setGroup(group);
user.setId(UUID.fromString("de0f39d2-e60a-11e1-9b55-3860770d7eaf"));
user.setName("Test");
user.setLogin("tEst");
user.setLoginLowerCase("test");
dataManager.commit(user);
}
use of com.haulmont.cuba.core.global.LoadContext in project cuba by cuba-platform.
the class QueryResultTest method testFirstQuery.
@Test
public void testFirstQuery() throws SQLException {
DataService dataService = AppBeans.get(DataService.class);
LoadContext context = new LoadContext(User.class).setView(View.LOCAL);
context.setQueryString("select u from sec$User u where u.name like :name").setParameter("name", "A-%");
List<Entity> entities = dataService.loadList(context);
assertEquals(20, entities.size());
List<Map<String, Object>> queryResults = getQueryResults();
assertEquals(0, queryResults.size());
}
Aggregations