Search in sources :

Example 6 with DataManager

use of com.haulmont.cuba.core.global.DataManager 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);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) User(com.haulmont.cuba.security.entity.User) LoadContext(com.haulmont.cuba.core.global.LoadContext) DataManager(com.haulmont.cuba.core.global.DataManager)

Example 7 with DataManager

use of com.haulmont.cuba.core.global.DataManager 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);
}
Also used : Group(com.haulmont.cuba.security.entity.Group) User(com.haulmont.cuba.security.entity.User) LoadContext(com.haulmont.cuba.core.global.LoadContext) DataManager(com.haulmont.cuba.core.global.DataManager) Before(org.junit.Before)

Aggregations

DataManager (com.haulmont.cuba.core.global.DataManager)7 User (com.haulmont.cuba.security.entity.User)3 EntityManager (com.haulmont.cuba.core.EntityManager)2 Transaction (com.haulmont.cuba.core.Transaction)2 LoadContext (com.haulmont.cuba.core.global.LoadContext)2 Before (org.junit.Before)2 CommitContext (com.haulmont.cuba.core.global.CommitContext)1 Group (com.haulmont.cuba.security.entity.Group)1 Many2ManyA (com.haulmont.cuba.testmodel.many2many.Many2ManyA)1 Many2ManyB (com.haulmont.cuba.testmodel.many2many.Many2ManyB)1 SeveralFetchGroups_Tariff (com.haulmont.cuba.testmodel.severalfetchgroups.SeveralFetchGroups_Tariff)1 SeveralFetchGroups_TariffVersion (com.haulmont.cuba.testmodel.severalfetchgroups.SeveralFetchGroups_TariffVersion)1 SoftDelete_Project (com.haulmont.cuba.testmodel.softdelete_notfounddeleted.SoftDelete_Project)1 SoftDelete_Service (com.haulmont.cuba.testmodel.softdelete_notfounddeleted.SoftDelete_Service)1 SoftDelete_Task (com.haulmont.cuba.testmodel.softdelete_notfounddeleted.SoftDelete_Task)1 SoftDelete_TaskValue (com.haulmont.cuba.testmodel.softdelete_notfounddeleted.SoftDelete_TaskValue)1 LinkedHashSet (java.util.LinkedHashSet)1 Test (org.junit.Test)1