Example usage for org.hibernate Criteria list

List of usage examples for org.hibernate Criteria list

Introduction

In this page you can find the example usage for org.hibernate Criteria list.

Prototype

public List list() throws HibernateException;

Source Link

Document

Get the results.

Usage

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkFunction> searchArkFunction(ArkFunction arkFunction) {
    Criteria criteria = getSession().createCriteria(ArkFunction.class);
    if (arkFunction.getId() != null) {
        criteria.add(Restrictions.eq("id", arkFunction.getId()));
    }//from  ww  w . j a  v  a 2 s. com

    if (arkFunction.getName() != null) {
        criteria.add(Restrictions.ilike("name", arkFunction.getName(), MatchMode.ANYWHERE));
    }
    return criteria.list();
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkModule> searchArkModule(ArkModule arkModule) {
    Criteria criteria = getSession().createCriteria(ArkFunction.class);
    if (arkModule.getId() != null) {
        criteria.add(Restrictions.eq("id", arkModule.getId()));
    }//w w w.jav  a  2s.c  om

    if (arkModule.getName() != null) {
        criteria.add(Restrictions.ilike("name", arkModule.getName(), MatchMode.ANYWHERE));
    }
    return criteria.list();
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkModule> searchPageableArkModules(ArkModule arkModuleCriteria, int first, int count) {
    Criteria criteria = buildArkModuleCriteria(arkModuleCriteria);
    criteria.setFirstResult(first);/*from  www  . j a  v a  2  s .c o  m*/
    criteria.setMaxResults(count);
    List<ArkModule> list = criteria.list();

    return list;
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkFunction> searchPageableArkFunctions(ArkFunction arkFunctionCriteria, int first, int count) {
    Criteria criteria = buildArkFunctionCriteria(arkFunctionCriteria);
    criteria.setFirstResult(first);//from  w ww. j  av a2  s.  c o m
    criteria.setMaxResults(count);
    List<ArkFunction> list = criteria.list();

    return list;
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkRoleModuleFunctionVO> searchPageableArkRoleModuleFunctionVO(
        ArkRoleModuleFunctionVO arkRoleModuleFunctionVo, int first, int count) {
    Criteria criteria = buildArkRoleModuleFunctionVoCriteria(arkRoleModuleFunctionVo);
    criteria.setFirstResult(first);//from w w  w . ja va2  s . c  o  m
    criteria.setMaxResults(count);

    // Restrict to NOT show Super Administrator (safety)
    // NOTE arpt alias set in buildarkRoleModuleFunctionVoCriteria 
    criteria.add((Restrictions.ne("arpt.arkRole",
            getArkRoleByName(au.org.theark.core.security.RoleConstants.ARK_ROLE_SUPER_ADMINISTATOR))));

    List<ArkRoleModuleFunctionVO> list = criteria.list();
    return list;
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public ArkRole getArkRoleByName(String name) {
    Criteria criteria = getSession().createCriteria(ArkRole.class);
    criteria.add(Restrictions.eq("name", name));
    return (ArkRole) criteria.list().get(0);
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkRoleModuleFunctionVO> getArkRoleModuleFunctionVoList(ArkRole arkRole) {
    Criteria criteria = getSession().createCriteria(ArkRolePolicyTemplate.class, "arpt");
    criteria.add(Restrictions.eq("arpt.arkRole", arkRole));

    ProjectionList projectionList = Projections.projectionList();
    projectionList.add(Projections.groupProperty("arpt.arkRole"), "arkRole");
    projectionList.add(Projections.groupProperty("arpt.arkModule"), "arkModule");
    projectionList.add(Projections.groupProperty("arpt.arkFunction"), "arkFunction");

    criteria.setProjection(projectionList);

    ResultTransformer resultTransformer = Transformers.aliasToBean(ArkRoleModuleFunctionVO.class);
    criteria.setResultTransformer(resultTransformer);

    return criteria.list();
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkRolePolicyTemplate> getArkRolePolicyTemplateList(
        ArkRolePolicyTemplate arkRolePolicyTemplateCriteria) {
    Criteria criteria = getSession().createCriteria(ArkRolePolicyTemplate.class, "arpt");

    if (arkRolePolicyTemplateCriteria.getId() != null) {
        criteria.add(Restrictions.eq("arpt.id", arkRolePolicyTemplateCriteria.getId()));
    }//from   w w  w .  java  2  s  .c o  m

    if (arkRolePolicyTemplateCriteria.getArkRole() != null) {
        criteria.add(Restrictions.eq("arpt.arkRole", arkRolePolicyTemplateCriteria.getArkRole()));
    }

    if (arkRolePolicyTemplateCriteria.getArkModule() != null) {
        criteria.add(Restrictions.eq("arpt.arkModule", arkRolePolicyTemplateCriteria.getArkModule()));
    }

    if (arkRolePolicyTemplateCriteria.getArkFunction() != null) {
        criteria.add(Restrictions.eq("arpt.arkFunction", arkRolePolicyTemplateCriteria.getArkFunction()));
    }
    return criteria.list();
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkModule> getArkModuleList(ArkRole arkRole) {
    Criteria criteria = getSession().createCriteria(ArkModuleRole.class);

    if (arkRole != null) {
        criteria.add(Restrictions.eq("arkRole", arkRole));
    }//from   www .j a v  a 2s .co  m
    ProjectionList projectionList = Projections.projectionList();
    projectionList.add(Projections.groupProperty("arkModule"), "arkModule");
    criteria.setProjection(projectionList);

    return criteria.list();
}

From source file:au.org.theark.admin.model.dao.AdminDao.java

License:Open Source License

public List<ArkModuleFunction> searchPageableArkModuleFunctions(ArkModuleFunction arkModuleFunctionCriteria,
        int first, int count) {
    Criteria criteria = buildArkModuleFunctionCriteria(arkModuleFunctionCriteria);
    criteria.setFirstResult(first);//w w w  .ja  v a 2 s  .c o m
    criteria.setMaxResults(count);
    List<ArkModuleFunction> list = criteria.list();
    return list;
}