Search in sources :

Example 1 with TestProjectAccessHistory

use of com.ngtesting.platform.entity.TestProjectAccessHistory in project ngtesting-platform by aaronchen2k.

the class ProjectServiceImpl method listRecentProject.

@Override
public List<TestProjectAccessHistory> listRecentProject(Long orgId, Long userId) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestProjectAccessHistory.class);
    dc.add(Restrictions.eq("orgId", orgId));
    dc.add(Restrictions.eq("userId", userId));
    dc.add(Restrictions.ne("deleted", true));
    dc.add(Restrictions.ne("disabled", true));
    dc.createAlias("project", "project");
    // dc.add(Restrictions.ne("project.deleted", true));
    dc.add(Restrictions.ne("project.deleted", true));
    dc.add(Restrictions.ne("project.disabled", true));
    dc.addOrder(Order.desc("lastAccessTime"));
    List<TestProjectAccessHistory> pos = findPage(dc, 0, 4).getItems();
    return pos;
}
Also used : DetachedCriteria(org.hibernate.criterion.DetachedCriteria) TestProjectAccessHistory(com.ngtesting.platform.entity.TestProjectAccessHistory)

Example 2 with TestProjectAccessHistory

use of com.ngtesting.platform.entity.TestProjectAccessHistory in project ngtesting-platform by aaronchen2k.

the class ProjectServiceImpl method genHistoryVos.

@Override
public List<TestProjectAccessHistoryVo> genHistoryVos(List<TestProjectAccessHistory> pos) {
    List<TestProjectAccessHistoryVo> voList = new LinkedList<TestProjectAccessHistoryVo>();
    for (TestProjectAccessHistory po : pos) {
        TestProjectAccessHistoryVo vo = genHistoryVo(po);
        voList.add(vo);
    }
    return voList;
}
Also used : TestProjectAccessHistoryVo(com.ngtesting.platform.vo.TestProjectAccessHistoryVo) TestProjectAccessHistory(com.ngtesting.platform.entity.TestProjectAccessHistory) LinkedList(java.util.LinkedList)

Example 3 with TestProjectAccessHistory

use of com.ngtesting.platform.entity.TestProjectAccessHistory in project ngtesting-platform by aaronchen2k.

the class ProjectServiceImpl method getHistoryPers.

@Override
public TestProjectAccessHistory getHistoryPers(Long orgId, Long userId, Long projectId, String projectName) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestProjectAccessHistory.class);
    dc.add(Restrictions.eq("orgId", orgId));
    dc.add(Restrictions.eq("projectId", projectId));
    dc.add(Restrictions.eq("userId", userId));
    dc.add(Restrictions.eq("deleted", false));
    dc.add(Restrictions.eq("disabled", false));
    TestProjectAccessHistory history;
    List<TestProjectAccessHistory> pos = findAllByCriteria(dc);
    if (pos.size() > 0) {
        history = pos.get(0);
        history.setProjectName(projectName);
    } else {
        history = new TestProjectAccessHistory(orgId, userId, projectId, projectName);
    }
    history.setLastAccessTime(new Date());
    saveOrUpdate(history);
    return history;
}
Also used : DetachedCriteria(org.hibernate.criterion.DetachedCriteria) TestProjectAccessHistory(com.ngtesting.platform.entity.TestProjectAccessHistory) Date(java.util.Date)

Aggregations

TestProjectAccessHistory (com.ngtesting.platform.entity.TestProjectAccessHistory)3 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)2 TestProjectAccessHistoryVo (com.ngtesting.platform.vo.TestProjectAccessHistoryVo)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1