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.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

@SuppressWarnings("unchecked")
public List<PhenoDataSetField> searchPageablePhenoFields(PhenoDataSetField phenoDataSetCriteria, int first,
        int count) {
    Criteria criteria = buildGeneralPhenoFieldCritera(phenoDataSetCriteria);
    criteria.setFirstResult(first);//from ww w.j a  v a  2 s  . c o m
    criteria.setMaxResults(count);
    criteria.addOrder(Order.asc("name"));
    List<PhenoDataSetField> phenoDataSetList = (List<PhenoDataSetField>) criteria.list();
    return phenoDataSetList;
}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

@Override
public List<PhenoDataSetCategory> getAvailableAllCategoryListInStudy(Study study, ArkFunction arkFunction)
        throws ArkSystemException {
    Criteria criteria = getSession().createCriteria(PhenoDataSetCategory.class);
    criteria.add(Restrictions.eq("arkFunction", arkFunction));
    criteria.add(Restrictions.eq("study", study));
    List<PhenoDataSetCategory> phenoFiedCategoryList = (List<PhenoDataSetCategory>) criteria.list();
    return phenoFiedCategoryList;

}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

public List<PhenoDataSetCategory> getAllSubCategoriesOfThisCategory(Study study, ArkFunction arkFunction,
        PhenoDataSetCategory parentphenoDataSetFieldCategory) {
    Criteria criteria = getSession().createCriteria(PhenoDataSetCategory.class);
    criteria.add(Restrictions.eq("study", study));
    criteria.add(Restrictions.eq("arkFunction", arkFunction));
    criteria.add(Restrictions.eq("parentCategory", parentphenoDataSetFieldCategory));
    return (List<PhenoDataSetCategory>) criteria.list();

}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

@Override
public List<PhenoDataSetField> getPhenoDataSetFieldsLinkedToPhenoDataSetFieldGroup(
        PhenoDataSetGroup phenoDataSetGroupCriteria) {
    Criteria criteria = getSession().createCriteria(PhenoDataSetFieldDisplay.class);
    criteria.add(Restrictions.eq("phenoDataSetGroup", phenoDataSetGroupCriteria));
    ProjectionList projectionList = Projections.projectionList();
    projectionList.add(Projections.property("phenoDataSetField"));
    criteria.setProjection(projectionList);
    criteria.addOrder(Order.asc("phenoDataSetFiledOrderNumber"));
    List<PhenoDataSetField> fieldsList = criteria.list();
    return fieldsList;
}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

private List<PhenoDataSetFieldDisplay> getPhenoDataSetFieldDisplayForPhenoDataSetFieldGrroup(
        PhenoDataSetGroup phenoDataSetGroup) {
    Criteria criteria = getSession().createCriteria(PhenoDataSetFieldDisplay.class);
    criteria.add(Restrictions.eq("phenoDataSetGroup", phenoDataSetGroup));
    criteria.addOrder(Order.asc("phenoDataSetFiledOrderNumber"));
    return criteria.list();
}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

@Override
public List<PhenoDataSetField> getPhenoDataSetFieldList(PhenoDataSetField phenoDataSetFieldCriteria) {
    Criteria criteria = buildGeneralPhenoFieldCritera(phenoDataSetFieldCriteria);
    // Return fields ordered alphabetically
    criteria.addOrder(Order.asc("name"));
    List<PhenoDataSetField> phenoDataSetFieldList = (List<PhenoDataSetField>) criteria.list();
    //log.warn("custom field criteria (just using name got a list of size " + customFieldList.size());
    return phenoDataSetFieldList;
}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

@Override
public List<PhenoDataSetGroup> getPhenoDataSetGroups(PhenoDataSetGroup phenoDataSetGroup, int first,
        int count) {
    Criteria criteria = buildGenericPhenoDataSetFieldGroupCriteria(phenoDataSetGroup);
    criteria.setFirstResult(first);/*  ww w . j  av a 2s .c  om*/
    criteria.setMaxResults(count);
    List<PhenoDataSetGroup> list = (List<PhenoDataSetGroup>) criteria.list();
    return list;
}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

public List<PickedPhenoDataSetCategory> getPickedPhenoDataSetCategories(Study study, ArkFunction arkFunction,
        ArkUser arkUser) {/*w  w  w .  ja v  a 2 s  . c om*/
    Criteria criteria = getSession().createCriteria(PickedPhenoDataSetCategory.class);
    criteria.add(Restrictions.eq("study", study));
    criteria.add(Restrictions.eq("arkFunction", arkFunction));
    criteria.add(Restrictions.eq("arkUser", arkUser));
    criteria.addOrder(Order.asc("orderNumber"));
    return (List<PickedPhenoDataSetCategory>) criteria.list();
}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

@Override
public List<PhenoDataSetCategory> getAvailablePhenoCategoryListNotPicked(Study study,
        ArkFunction arkFunctionPhenoCat, ArkFunction arkFunctionPhenoCollection, ArkUser arkUser)
        throws ArkSystemException {

    List<PickedPhenoDataSetCategory> pickedPhenoSetCatLst = getPickedPhenoDataSetCategories(study,
            arkFunctionPhenoCollection, arkUser);
    List<Long> pickedPhenoDataIdLst = new ArrayList<Long>();
    for (PickedPhenoDataSetCategory pickedPhenoDataSetCategory : pickedPhenoSetCatLst) {
        pickedPhenoDataIdLst.add(pickedPhenoDataSetCategory.getPhenoDataSetCategory().getId());
    }// w w  w.  java 2s .  c o m
    Criteria criteria = getSession().createCriteria(PhenoDataSetCategory.class);
    criteria.add(Restrictions.eq("arkFunction", arkFunctionPhenoCat));
    criteria.add(Restrictions.eq("study", study));
    if (!pickedPhenoDataIdLst.isEmpty()) {
        criteria.add(Restrictions.not(Restrictions.in("id", pickedPhenoDataIdLst)));
    }
    return criteria.list();
}

From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java

License:Open Source License

/**
 * Shows all the available pheno fields which not linked with categories.
 *//*from   w w w  .  jav a 2  s  . c  om*/
@Override
public List<PhenoDataSetField> getAvailablePhenoFieldListNotInLinked(Study study,
        ArkFunction arkFunctionPhenoField, ArkFunction arkFunctionPhenoCollection, ArkUser arkUser)
        throws ArkSystemException {
    List<LinkPhenoDataSetCategoryField> linkPhenoDataSetCategoryFields = getLinkPhenoDataSetCategoryFieldLst(
            study, arkFunctionPhenoCollection, arkUser);
    List<Long> linkedPhenoDataIdLst = new ArrayList<Long>();
    for (LinkPhenoDataSetCategoryField linkPhenoDataSetCategoryField : linkPhenoDataSetCategoryFields) {
        linkedPhenoDataIdLst.add(linkPhenoDataSetCategoryField.getPhenoDataSetField().getId());
    }
    Criteria criteria = getSession().createCriteria(PhenoDataSetField.class);
    criteria.add(Restrictions.eq("arkFunction", arkFunctionPhenoField));
    criteria.add(Restrictions.eq("study", study));
    if (!linkedPhenoDataIdLst.isEmpty()) {
        criteria.add(Restrictions.not(Restrictions.in("id", linkedPhenoDataIdLst)));
    }
    return criteria.list();
}