当前位置: 首页>>代码示例>>Java>>正文


Java LoadContext.setView方法代码示例

本文整理汇总了Java中com.haulmont.cuba.core.global.LoadContext.setView方法的典型用法代码示例。如果您正苦于以下问题:Java LoadContext.setView方法的具体用法?Java LoadContext.setView怎么用?Java LoadContext.setView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.haulmont.cuba.core.global.LoadContext的用法示例。


在下文中一共展示了LoadContext.setView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTimeEntriesForPeriod

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<TimeEntry> getTimeEntriesForPeriod(Date start, Date end, User user, @Nullable TimeEntryStatus status, @Nullable String viewName) {
    LoadContext<TimeEntry> loadContext = new LoadContext<>(TimeEntry.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    String queryStr = "select e from ts$TimeEntry e where e.user.id = :userId and (e.date between :start and :end)";
    if (status != null) {
        queryStr += " and e.status = :status";
    }
    LoadContext.Query query = loadContext.setQueryString(queryStr)
            .setParameter("start", start)
            .setParameter("end", end)
            .setParameter("userId", user.getId());
    if (status != null) {
        query.setParameter("status", status.getId());
    }
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:20,代码来源:ProjectsServiceBean.java

示例2: getApprovableTimeEntriesForPeriod

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<TimeEntry> getApprovableTimeEntriesForPeriod(
        Date start, Date end, User approver, User user, @Nullable TimeEntryStatus status, @Nullable String viewName
) {
    LoadContext<TimeEntry> loadContext = new LoadContext<>(TimeEntry.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    String queryStr = "select e from ts$TimeEntry e join e.task t join t.project pr join pr.participants p " +
            "where p.user.id = :approverId and (p.role.code = '" + MANAGER.getId() + "' or p.role.code = '" + APPROVER.getId() + "') " +
            "and e.user.id = :userId and (e.date between :start and :end)";
    if (status != null) {
        queryStr += " and e.status = :status";
    }
    LoadContext.Query query = loadContext.setQueryString(queryStr)
            .setParameter("start", start)
            .setParameter("end", end)
            .setParameter("approverId", approver.getId())
            .setParameter("userId", user.getId());
    if (status != null) {
        query.setParameter("status", status.getId());
    }
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:25,代码来源:ProjectsServiceBean.java

示例3: getActiveTasksForUser

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<Task> getActiveTasksForUser(User user, @Nullable String viewName) {
    LoadContext<Task> loadContext = new LoadContext<>(Task.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    loadContext.setQueryString("select e from ts$Task e join e.exclusiveParticipants p " +
            "where p.user.id = :userId and e.status = 'active' order by e.project")
            .setParameter("userId", user.getId());
    List<Task> assignedTasks = dataManager.loadList(loadContext);
    loadContext.setQueryString("select e from ts$Task e join e.project pr join pr.participants p " +
            "where p.user.id = :userId and e.exclusiveParticipants is empty and e.status = 'active' order by e.project")
            .setParameter("userId", user.getId());
    List<Task> commonTasks = dataManager.loadList(loadContext);
    if (assignedTasks.isEmpty() && commonTasks.isEmpty()) {
        return Collections.emptyList();
    }
    List<Task> allTasks = new ArrayList<>(assignedTasks.size() + commonTasks.size());
    allTasks.addAll(assignedTasks);
    allTasks.addAll(commonTasks);
    return allTasks;
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:23,代码来源:ProjectsServiceBean.java

示例4: getEntityByCode

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
public <T extends Entity> T getEntityByCode(Class<T> clazz, String code, @Nullable String viewName) {
    LoadContext<T> loadContext = new LoadContext<>(clazz);
    MetaClass metaClass = metadata.getSession().getClassNN(clazz);
    loadContext.setQueryString("select e from " + metaClass.getName() + " e where e.code = :code")
            .setParameter("code", code);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    return dataManager.load(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:11,代码来源:SystemDataManager.java

示例5: getEntitiesByCodes

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
public <T extends Entity> List<T> getEntitiesByCodes(Class<T> clazz, List<String> codes, @Nullable String viewName) {
    if (codes.isEmpty()) {
        return Collections.emptyList();
    }
    LoadContext<T> loadContext = new LoadContext<>(clazz);
    MetaClass metaClass = metadata.getSession().getClassNN(clazz);
    loadContext.setQueryString("select e from " + metaClass.getName() + " e where e.code in :codes")
            .setParameter("codes", codes);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:14,代码来源:SystemDataManager.java

示例6: getActiveTasksForUserAndProject

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public Map<String, Task> getActiveTasksForUserAndProject(User user, Project project, @Nullable String viewName) {
    LoadContext<Task> loadContext = new LoadContext<>(Task.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    loadContext.setQueryString("select e from ts$Task e join e.exclusiveParticipants p " +
            "where p.user.id = :userId and e.project.id = :projectId and e.status = 'active' order by e.project")
            .setParameter("projectId", project.getId())
            .setParameter("userId", user.getId());
    List<Task> assignedTasks = dataManager.loadList(loadContext);
    loadContext.setQueryString("select e from ts$Task e join e.project pr join pr.participants p " +
            "where p.user.id = :userId and e.project.id = :projectId and e.exclusiveParticipants is empty " +
            "and e.status = 'active' order by e.project")
            .setParameter("projectId", project.getId())
            .setParameter("userId", user.getId());
    List<Task> commonTasks = dataManager.loadList(loadContext);
    if (assignedTasks.isEmpty() && commonTasks.isEmpty()) {
        return Collections.emptyMap();
    }
    List<Task> allTasks = new ArrayList<>(assignedTasks.size() + commonTasks.size());
    allTasks.addAll(assignedTasks);
    allTasks.addAll(commonTasks);
    Map<String, Task> tasksMap = new TreeMap<>();
    for (Task task : allTasks) {
        tasksMap.put(task.getName(), task);
    }
    return tasksMap;
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:30,代码来源:ProjectsServiceBean.java

示例7: getActiveProjectsForUser

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
public List<Project> getActiveProjectsForUser(User user, @Nullable String viewName) {
    LoadContext<Project> loadContext = new LoadContext<>(Project.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    LoadContext.Query query =
            new LoadContext.Query("select pr from ts$Project pr, in(pr.participants) p " +
                    "where p.user.id = :userId and pr.status = 'open' order by pr.name")
                    .setParameter("userId", user.getId());
    loadContext.setQuery(query);
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:13,代码来源:ProjectsServiceBean.java

示例8: getActiveManagedProjectsForUser

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
public List<Project> getActiveManagedProjectsForUser(User user, @Nullable String viewName) {
    LoadContext<Project> loadContext = new LoadContext<>(Project.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    LoadContext.Query query =
            new LoadContext.Query("select pr from ts$Project pr, in(pr.participants) p " +
                    "where p.user.id = :userId " +
                    "and (p.role.code = '" + MANAGER.getId() + "' or p.role.code = '" + APPROVER.getId() + "') " +
                    "and pr.status = 'open'")
                    .setParameter("userId", user.getId());
    loadContext.setQuery(query);
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:15,代码来源:ProjectsServiceBean.java

示例9: getTagsForTheProject

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
public List<Tag> getTagsForTheProject(@Nullable Project project, @Nullable String viewName) {
    LoadContext<Tag> loadContext = new LoadContext<>(Tag.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    LoadContext.Query query =
            new LoadContext.Query("select e from ts$Tag e left join e.tagType.projects pr where pr.id is null" +
                    " or (pr.id = :project)")
                    .setParameter("project", project);
    loadContext.setQuery(query);
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:13,代码来源:ProjectsServiceBean.java

示例10: getTagsWithTheTagType

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<Tag> getTagsWithTheTagType(TagType type, @Nullable String viewName) {
    LoadContext<Tag> loadContext = new LoadContext<>(Tag.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    LoadContext.Query query =
            new LoadContext.Query("select e from ts$Tag e where e.tagType.id = :type")
                    .setParameter("type", type);
    loadContext.setQuery(query);
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:13,代码来源:ProjectsServiceBean.java

示例11: getProjectParticipants

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<ProjectParticipant> getProjectParticipants(Project project, @Nullable String viewName) {
    LoadContext<ProjectParticipant> loadContext = new LoadContext<>(ProjectParticipant.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    loadContext.setQueryString("select e from ts$ProjectParticipant e where e.project.id = :projectId")
            .setParameter("projectId", project.getId());
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:11,代码来源:ProjectsServiceBean.java

示例12: getProjectUsers

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<User> getProjectUsers(Project project, @Nullable String viewName) {
    LoadContext<User> loadContext = new LoadContext<>(User.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    loadContext.setQueryString("select u from sec$User u, ts$ProjectParticipant pp " +
            "where pp.project.id = :projectId and pp.user.id = u.id")
            .setParameter("projectId", project.getId());
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:12,代码来源:ProjectsServiceBean.java

示例13: getManagedUsers

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<User> getManagedUsers(User manager, String viewName) {
    LoadContext<User> loadContext = new LoadContext<>(User.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    loadContext.setQueryString("select distinct u from sec$User u, ts$ProjectParticipant pp " +
            "join pp.project pr join pr.participants me " +
            "where pp.user.id = u.id and me.user.id = :managerId " +
            "and (me.role.code = '" + MANAGER.getId() + "' or me.role.code = '" + APPROVER.getId() + "')")
            .setParameter("managerId", manager.getId());
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:14,代码来源:ProjectsServiceBean.java

示例14: getActivityTypesForProject

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@Override
public List<ActivityType> getActivityTypesForProject(Project project, @Nullable String viewName) {
    LoadContext<ActivityType> loadContext = new LoadContext<>(ActivityType.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    loadContext.setQueryString("select e from ts$ActivityType e left join e.projects pr " +
            "where pr.id is null or (pr.id = :projectId)")
            .setParameter("projectId", project.getId());
    return dataManager.loadList(loadContext);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:12,代码来源:ProjectsServiceBean.java

示例15: getInstances

import com.haulmont.cuba.core.global.LoadContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public List<JmxInstance> getInstances() {
    LoadContext loadContext = new LoadContext(JmxInstance.class);
    loadContext.setView("_local");
    loadContext.setQueryString("select jmx from sys$JmxInstance jmx");

    List<JmxInstance> jmxInstances = new ArrayList<>();
    jmxInstances.add(getLocalInstance());

    List<JmxInstance> clusterInstances = dataService.loadList(loadContext);
    jmxInstances.addAll(clusterInstances);

    return jmxInstances;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:JmxControlBean.java


注:本文中的com.haulmont.cuba.core.global.LoadContext.setView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。