use of com.haulmont.cuba.core.app.DataService in project cuba by cuba-platform.
the class PresentationsImpl method checkLoad.
private void checkLoad() {
if (presentations == null) {
DataService ds = AppBeans.get(DataService.NAME);
LoadContext ctx = new LoadContext(Presentation.class);
ctx.setView("app");
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
UserSession session = sessionSource.getUserSession();
User user = session.getCurrentOrSubstitutedUser();
ctx.setQueryString("select p from sec$Presentation p " + "where p.componentId = :component and (p.user is null or p.user.id = :userId)").setParameter("component", name).setParameter("userId", user.getId());
final List<Presentation> list = ds.loadList(ctx);
presentations = new LinkedHashMap<>(list.size());
for (final Presentation p : list) {
presentations.put(p.getId(), p);
}
}
}
use of com.haulmont.cuba.core.app.DataService in project cuba by cuba-platform.
the class PresentationsImpl method commit.
@Override
public void commit() {
if (!needToUpdate.isEmpty() || !needToRemove.isEmpty()) {
DataService ds = AppBeans.get(DataService.NAME);
CommitContext ctx = new CommitContext(Collections.unmodifiableSet(needToUpdate), Collections.unmodifiableSet(needToRemove));
Set<Entity> commitResult = ds.commit(ctx);
commited(commitResult);
clearCommitList();
firePresentationsSetChanged();
}
}
Aggregations