本文整理汇总了Java中com.haulmont.cuba.core.global.DataManager类的典型用法代码示例。如果您正苦于以下问题:Java DataManager类的具体用法?Java DataManager怎么用?Java DataManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataManager类属于com.haulmont.cuba.core.global包,在下文中一共展示了DataManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
@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);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:HsqlLikeNullFailTest.java
示例2: commitFileDescriptor
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
protected FileDescriptor commitFileDescriptor(FileDescriptor fileDescriptor) {
if (datasource != null) {
return datasource.getDataSupplier().commit(fileDescriptor);
}
if (getFrame().getDsContext().getDataSupplier() != null) {
return getFrame().getDsContext().getDataSupplier().commit(fileDescriptor);
}
return AppBeans.get(DataManager.class).commit(fileDescriptor);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:WebFileUploadField.java
示例3: testStaleData_update_DM
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
@Test
public void testStaleData_update_DM() throws Exception {
appender.clearMessages();
loadUser();
assertEquals(2, appender.filterMessages(m -> m.contains("> SELECT")).count()); // User, Group
appender.clearMessages();
loadUser();
assertEquals(0, appender.filterMessages(m -> m.contains("> SELECT")).count());
appender.clearMessages();
DataManager dataManager = AppBeans.get(DataManager.class);
User u = dataManager.load(LoadContext.create(User.class).setId(this.user.getId()).setView("user.browse"));
u.setName("new name");
dataManager.commit(u);
assertEquals(0, appender.filterMessages(m -> m.contains("> SELECT")).count()); // no DB requests - the User has been updated in cache
appender.clearMessages();
u = loadUser();
assertEquals("new name", u.getName());
assertEquals(0, appender.filterMessages(m -> m.contains("> SELECT")).count()); // no DB requests - the User has been updated in cache
appender.clearMessages();
loadUser();
assertEquals(0, appender.filterMessages(m -> m.contains("> SELECT")).count());
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:28,代码来源:EntityCacheTestClass.java
示例4: dataManager_getResultListUserByLoginNamed
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
protected User dataManager_getResultListUserByLoginNamed() {
DataManager dataManager = AppBeans.get(DataManager.NAME);
LoadContext<User> loadContext = new LoadContext<>(User.class).setView("user.browse");
loadContext.setQueryString("select u from sec$User u where u.login = :login")
.setParameter("login", "ECTest-" + this.user.getId())
.setCacheable(true);
return dataManager.load(loadContext);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:QueryCacheTestClass.java
示例5: setUp
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
DataManager dataManager = AppBeans.get(DataManager.class);
many2ManyA = cont.metadata().create(Many2ManyA.class);
many2ManyB = cont.metadata().create(Many2ManyB.class);
many2ManyA.setCollectionOfB(new HashSet<>());
many2ManyA.getCollectionOfB().add(many2ManyB);
dataManager.commit(new CommitContext(many2ManyA, many2ManyB));
many2ManyA2 = cont.metadata().create(Many2ManyA.class);
many2ManyB2 = cont.metadata().create(Many2ManyB.class);
many2ManyA2.setCollectionOfB2(new HashSet<>());
many2ManyA2.getCollectionOfB2().add(many2ManyB2);
dataManager.commit(new CommitContext(many2ManyA2, many2ManyB2));
a1 = cont.metadata().create(Many2ManyA.class);
a2 = cont.metadata().create(Many2ManyA.class);
b1 = cont.metadata().create(Many2ManyB.class);
b2 = cont.metadata().create(Many2ManyB.class);
b3 = cont.metadata().create(Many2ManyB.class);
a1.setCollectionOfB(new HashSet<>());
a1.getCollectionOfB().add(b1);
a1.getCollectionOfB().add(b2);
a2.setCollectionOfB(new HashSet<>());
a2.getCollectionOfB().add(b3);
dataManager.commit(new CommitContext(a1, a2, b1, b2, b3));
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:36,代码来源:SoftDeleteMany2ManyTest.java
示例6: testLoadListCaseInsensitive
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
@Test
public void testLoadListCaseInsensitive() {
LoadContext<User> loadContext = LoadContext.create(User.class);
loadContext.setQueryString("select u from sec$User u " +
"where u.name like :custom_searchString or u.login like :custom_searchString")
.setParameter("custom_searchString", null);
DataManager dataManager = AppBeans.get(DataManager.NAME);
List<User> list = dataManager.loadList(loadContext);
assertEquals(0, list.size());
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:HsqlLikeNullFailTest.java
示例7: load
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
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);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:DataManagerDistinctResultsTest.java
示例8: setUp
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
metadata = cont.metadata();
persistence = cont.persistence();
dataManager = AppBeans.get(DataManager.class);
}
开发者ID:pfurini,项目名称:cuba-component-forgot-password,代码行数:7,代码来源:SampleIntegrationTest.java
示例9: setUp
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
@Before
public void setUp() {
metadata = cont.metadata();
persistence = cont.persistence();
dataManager = AppBeans.get(DataManager.class);
try (Transaction tx = persistence.createTransaction()) {
EntityManager em = persistence.getEntityManager();
SeveralFetchGroups_Tariff tariff1 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId1 = tariff1.getId();
tariff1.setName("tariff1");
em.persist(tariff1);
SeveralFetchGroups_Tariff tariff2_1 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId2_1 = tariff2_1.getId();
tariff2_1.setName("tariff2_1");
tariff2_1.setParent(tariff1);
em.persist(tariff2_1);
SeveralFetchGroups_Tariff tariff3_1 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId3_1 = tariff3_1.getId();
tariff3_1.setName("tariff3_1");
tariff3_1.setParent(tariff1);
em.persist(tariff3_1);
SeveralFetchGroups_Tariff tariff4_2 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId4_2 = tariff4_2.getId();
tariff4_2.setName("tariff4");
tariff4_2.setParent(tariff2_1);
em.persist(tariff4_2);
SeveralFetchGroups_TariffVersion tariffVersion1 =
metadata.create(SeveralFetchGroups_TariffVersion.class);
tariffVersionId1 = tariffVersion1.getId();
tariffVersion1.setName("1");
tariffVersion1.setDescription("tariffVersionDescription1");
tariffVersion1.setParent(tariff1);
tariff1.setActiveVersion(tariffVersion1);
em.persist(tariffVersion1);
SeveralFetchGroups_TariffVersion tariffVersion2 =
metadata.create(SeveralFetchGroups_TariffVersion.class);
tariffVersionId2 = tariffVersion2.getId();
tariffVersion2.setName("2");
tariffVersion2.setDescription("tariffVersionDescription2");
tariffVersion2.setParent(tariff4_2);
tariff4_2.setActiveVersion(tariffVersion2);
em.persist(tariffVersion2);
SeveralFetchGroups_TariffVersion tariffVersion3 =
metadata.create(SeveralFetchGroups_TariffVersion.class);
tariffVersionId3 = tariffVersion3.getId();
tariffVersion3.setName("3");
tariffVersion3.setDescription("tariffVersionDescription3");
tariffVersion3.setParent(tariff2_1);
tariff2_1.setActiveVersion(tariffVersion3);
em.persist(tariffVersion3);
tx.commit();
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:63,代码来源:SeveralFetchGroupsTest.java
示例10: setUp
import com.haulmont.cuba.core.global.DataManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
dataManager = AppBeans.get(DataManager.class);
Transaction tx = cont.persistence().createTransaction();
try {
EntityManager em = cont.persistence().getEntityManager();
SoftDelete_Service service = new SoftDelete_Service();
serviceId = service.getId();
service.setName("service");
service.setCode("serviceCode");
em.persist(service);
SoftDelete_Task task = new SoftDelete_Task();
taskId = task.getId();
task.setMessage("message");
task.setService(service);
em.persist(task);
SoftDelete_TaskValue taskValue = new SoftDelete_TaskValue();
taskValueId = taskValue.getId();
taskValue.setTask(task);
em.persist(taskValue);
SoftDelete_Project project = new SoftDelete_Project();
projectId = project.getId();
project.setName("project");
project.setAValue(taskValue);
project.setTask(task);
em.persist(project);
tx.commitRetaining();
em = cont.persistence().getEntityManager();
task = em.find(SoftDelete_Task.class, taskId);
em.remove(task);
tx.commit();
} finally {
tx.end();
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:45,代码来源:SoftDeleteNotFoundDeletedTest.java
注:本文中的com.haulmont.cuba.core.global.DataManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论