limit list of queue jobs to the latest 500 entries
This commit is contained in:
parent
aabb5d1781
commit
f934cd3984
@ -92,6 +92,10 @@ public abstract class AbstractModuleImpl implements ModuleInterface {
|
||||
}
|
||||
|
||||
public List<AbstractEntity> search(Class<? extends AbstractEntity> entityClass, String condition, String orderBy) throws HSAdminException {
|
||||
return search(entityClass, condition, orderBy, -1);
|
||||
}
|
||||
|
||||
public List<AbstractEntity> search(Class<? extends AbstractEntity> entityClass, String condition, String orderBy, int limit) throws HSAdminException {
|
||||
UnixUser loginUser = transaction.getLoginUser();
|
||||
condition = restrict(entityClass, loginUser, condition);
|
||||
Entity entityAnnot = entityClass.getAnnotation(Entity.class);
|
||||
@ -109,6 +113,9 @@ public abstract class AbstractModuleImpl implements ModuleInterface {
|
||||
EntityManager entityManager = transaction.getEntityManager();
|
||||
entityManager.clear();
|
||||
Query query = entityManager.createQuery(queryString);
|
||||
if (limit > 0) {
|
||||
query.setMaxResults(limit);
|
||||
}
|
||||
setQueryParameter(query, queryString, "loginUser", loginUser);
|
||||
setQueryParameter(query, queryString, "loginUserName", loginUser.getName());
|
||||
setQueryParameter(query, queryString, "loginUserPac", loginUser.getPac());
|
||||
|
@ -16,7 +16,7 @@ public class QTaskModuleImpl extends AbstractModuleImpl {
|
||||
if (orderBy == null || orderBy.length() == 0) {
|
||||
orderBy = "ORDER BY obj.started DESC";
|
||||
}
|
||||
return super.search(entityClass, condition, orderBy);
|
||||
return super.search(entityClass, condition, orderBy, 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user