Example usage for org.hibernate Criteria addOrder

List of usage examples for org.hibernate Criteria addOrder

Introduction

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

Prototype

public Criteria addOrder(Order order);

Source Link

Document

Add an Order ordering to the result set.

Usage

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

License:Open Source License

public java.util.Collection<PhenoDataSetCollection> getPhenoCollectionByStudy(Study study) {
    Criteria criteria = getSession().createCriteria(PhenoDataSetCollection.class);

    if (study != null) {
        criteria.add(Restrictions.eq(au.org.theark.phenotypic.web.Constants.PHENO_COLLECTION_STUDY, study));
    }//from ww w .j  ava  2s .co m
    criteria.addOrder(Order.asc("name"));

    java.util.List<PhenoDataSetCollection> collectionList = criteria.list();
    return collectionList;
}

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

License:Open Source License

public List<CustomField> getCustomFieldsLinkedToCustomFieldGroup(CustomFieldGroup customFieldCriteria) {

    Criteria criteria = getSession().createCriteria(CustomFieldDisplay.class);
    criteria.add(Restrictions.eq("customFieldGroup", customFieldCriteria));
    ProjectionList projectionList = Projections.projectionList();
    projectionList.add(Projections.property("customField"));
    criteria.setProjection(projectionList);
    criteria.addOrder(Order.asc("sequence"));
    List<CustomField> fieldsList = criteria.list();
    //log.warn("______________customFieldsList = " + fieldsList.size());
    return fieldsList;

}

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

License:Open Source License

private List<CustomFieldDisplay> getCustomFieldDisplayForCustomFieldGroup(CustomFieldGroup customFieldGroup) {
    Criteria criteria = getSession().createCriteria(CustomFieldDisplay.class);
    criteria.add(Restrictions.eq("customFieldGroup", customFieldGroup));
    criteria.addOrder(Order.asc("sequence"));
    return criteria.list();
}

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

License:Open Source License

public Collection<PhenoDataSetFieldDisplay> getCFDLinkedToQuestionnaire(PhenoDataSetGroup phenoDataSetGroup,
        int first, int count) {
    Criteria criteria = getSession().createCriteria(PhenoDataSetFieldDisplay.class);
    criteria.add(Restrictions.eq("phenoDataSetGroup", phenoDataSetGroup));
    criteria.setFirstResult(first);/*w w  w.j a  v  a  2s  .  com*/
    criteria.setMaxResults(count);
    criteria.addOrder(Order.asc("phenoDataSetFiledOrderNumber"));
    return criteria.list();

}

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

License:Open Source License

public java.util.Collection<Upload> searchUpload(Upload upload) {
    Criteria criteria = getSession().createCriteria(Upload.class);

    if (upload.getId() != null) {
        criteria.add(Restrictions.eq(au.org.theark.phenotypic.web.Constants.UPLOAD_ID, upload.getId()));
    }/*ww w .  j  ava 2 s.  c  o  m*/

    if (upload.getStudy() != null) {
        criteria.add(Restrictions.eq(au.org.theark.phenotypic.web.Constants.UPLOAD_STUDY, upload.getStudy()));
    }

    if (upload.getArkFunction() != null) {
        criteria.add(Restrictions.eq("arkFunction", upload.getArkFunction()));
    }

    if (upload.getFileFormat() != null) {
        criteria.add(Restrictions.ilike(au.org.theark.phenotypic.web.Constants.UPLOAD_FILE_FORMAT,
                upload.getFileFormat()));
    }

    if (upload.getDelimiterType() != null) {
        criteria.add(Restrictions.ilike(au.org.theark.phenotypic.web.Constants.UPLOAD_DELIMITER_TYPE,
                upload.getDelimiterType()));
    }

    if (upload.getFilename() != null) {
        criteria.add(Restrictions.ilike(au.org.theark.phenotypic.web.Constants.UPLOAD_FILENAME,
                upload.getFilename()));
    }

    criteria.addOrder(Order.desc(au.org.theark.phenotypic.web.Constants.UPLOAD_ID));
    java.util.Collection<Upload> uploadCollection = criteria.list();

    return uploadCollection;
}

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

License:Open Source License

@Override
public List<PhenoDataSetCategory> searchPageablePhenoDataSetCategories(
        PhenoDataSetCategory phenoDataSetCategoryCriteria, int first, int count) {
    Criteria criteria = buildGeneralPhenoDataSetCategoryCritera(phenoDataSetCategoryCriteria);
    criteria.setFirstResult(first);/*from   ww  w.ja  v  a  2 s  .  com*/
    criteria.setMaxResults(count);
    criteria.addOrder(Order.asc("name"));
    List<PhenoDataSetCategory> phenoDataSetCategoryList = (List<PhenoDataSetCategory>) criteria.list();
    return phenoDataSetCategoryList;
}

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);/*  w  w  w  . j a  v  a  2  s . co  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<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;
}