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.core.dao.StudyDao.java

License:Open Source License

@Override
public List<StudyComp> getDifferentStudyComponentsInConsentForSubject(Study study,
        LinkSubjectStudy linkSubjectStudy) {
    Criteria criteria = getSession().createCriteria(Consent.class);
    criteria.add(Restrictions.eq("study", study));
    criteria.add(Restrictions.eq("linkSubjectStudy", linkSubjectStudy));
    ProjectionList projectionList = Projections.projectionList();
    projectionList.add(Projections.groupProperty("studyComp"));
    criteria.setProjection(projectionList);
    criteria.addOrder(Order.asc("id"));
    List<StudyComp> fieldsList = criteria.list();
    return fieldsList;
}

From source file:au.org.theark.lims.model.dao.BioCollectionDao.java

License:Open Source License

public java.util.List<BioCollection> searchBioCollection(BioCollection bioCollection)
        throws ArkSystemException {
    Criteria criteria = getSession().createCriteria(BioCollection.class);

    if (bioCollection.getId() != null)
        criteria.add(Restrictions.eq("id", bioCollection.getId()));

    if (bioCollection.getBiocollectionUid() != null)
        criteria.add(Restrictions.eq("biocollectionUid", bioCollection.getBiocollectionUid()));

    if (bioCollection.getName() != null)
        criteria.add(Restrictions.eq("name", bioCollection.getName()));

    if (bioCollection.getLinkSubjectStudy() != null)
        criteria.add(Restrictions.eq("linkSubjectStudy", bioCollection.getLinkSubjectStudy()));

    if (bioCollection.getStudy() != null)
        criteria.add(Restrictions.eq("study", bioCollection.getStudy()));

    if (bioCollection.getCollectionDate() != null)
        criteria.add(Restrictions.eq("collectionDate", bioCollection.getCollectionDate()));

    if (bioCollection.getSurgeryDate() != null)
        criteria.add(Restrictions.eq("surgeryDate", bioCollection.getSurgeryDate()));

    List<BioCollection> list = criteria.list();
    return list;//w w  w  .j av  a  2  s.  c om
}

From source file:au.org.theark.lims.model.dao.BioCollectionDao.java

License:Open Source License

public boolean doesSomeoneElseHaveThisUid(String biocollectionUid, final Study study,
        Long idToExcludeFromSearch) {
    Criteria criteria = getSession().createCriteria(BioCollection.class);
    criteria.add(Restrictions.eq("biocollectionUid", biocollectionUid));
    if (idToExcludeFromSearch != null) {
        criteria.add(Restrictions.ne("id", idToExcludeFromSearch));
    }/*from   w  w w  .  j  a v a2 s . c  o m*/

    if (study != null) {
        criteria.add(Restrictions.eq("study", study));
    }
    return (criteria.list().size() > 0);
}

From source file:au.org.theark.lims.model.dao.BioCollectionDao.java

License:Open Source License

public List<BioSampletype> getSampleTypes() {
    Criteria criteria = getStatelessSession().createCriteria(BioSampletype.class);
    criteria.addOrder(Order.asc("orderId"));
    List<BioSampletype> list = criteria.list();
    return list;//from w w w  .  j a va 2 s . c o  m
}

From source file:au.org.theark.lims.model.dao.BioCollectionDao.java

License:Open Source License

public List<BioCollection> searchPageableBioCollections(BioCollection bioCollectionCriteria, int first,
        int count) {
    Criteria criteria = buildBioCollectionCriteria(bioCollectionCriteria);
    criteria.setFirstResult(first);/*w w  w  . j  av a2 s  . c o  m*/
    criteria.setMaxResults(count);
    List<BioCollection> list = criteria.list();

    return list;
}

From source file:au.org.theark.lims.model.dao.BioCollectionDao.java

License:Open Source License

public boolean hasBiocllectionGotCustomFieldData(BioCollection bioCollection) {
    Criteria criteria = getSession().createCriteria(BioCollectionCustomFieldData.class);
    criteria.add(Restrictions.eq("bioCollection", bioCollection));
    List<BioCollectionCustomFieldData> list = (List<BioCollectionCustomFieldData>) criteria.list();
    return (list.size() > 0);
}

From source file:au.org.theark.lims.model.dao.BiospecimenDao.java

License:Open Source License

public List<Biospecimen> searchBiospecimen(Biospecimen biospecimen) throws ArkSystemException {
    Criteria criteria = getSession().createCriteria(Biospecimen.class);

    if (biospecimen.getId() != null)
        criteria.add(Restrictions.eq("id", biospecimen.getId()));

    if (biospecimen.getBiospecimenUid() != null)
        criteria.add(Restrictions.ilike("biospecimenUid", biospecimen.getBiospecimenUid(), MatchMode.ANYWHERE));

    if (biospecimen.getLinkSubjectStudy() != null)
        criteria.add(Restrictions.eq("linkSubjectStudy", biospecimen.getLinkSubjectStudy()));

    if (biospecimen.getStudy() != null)
        criteria.add(Restrictions.eq("study", biospecimen.getStudy()));

    if (biospecimen.getSampleType() != null)
        criteria.add(Restrictions.eq("sampleType", biospecimen.getSampleType()));

    if (biospecimen.getSampleDate() != null)
        criteria.add(Restrictions.eq("sampleDate", biospecimen.getSampleDate()));

    if (biospecimen.getQtyCollected() != null)
        criteria.add(Restrictions.eq("qtyCollected", biospecimen.getQtyCollected()));

    List<Biospecimen> list = criteria.list();
    return list;// ww w . j  ava 2s .  c o  m
}

From source file:au.org.theark.lims.model.dao.BiospecimenDao.java

License:Open Source License

public List<Biospecimen> searchPageableBiospecimens(Biospecimen biospecimenCriteria, int first, int count) {
    Criteria criteria = buildBiospecimenCriteria(biospecimenCriteria);
    criteria.setFirstResult(first);//from  w w  w  .  ja va2  s. c o m
    criteria.setMaxResults(count);
    criteria.addOrder(Order.asc("id"));
    List<Biospecimen> list = criteria.list();
    return list;
}

From source file:au.org.theark.lims.model.dao.BiospecimenDao.java

License:Open Source License

public boolean doesSomeoneElseHaveThisUid(String biospecimenUid, final Study study,
        Long idToExcludeFromSearch) {
    Criteria criteria = getSession().createCriteria(Biospecimen.class);
    criteria.add(Restrictions.eq("biospecimenUid", biospecimenUid));
    criteria.add(Restrictions.ne("id", idToExcludeFromSearch));
    if (study != null) {
        criteria.add(Restrictions.eq("study", study));
    }// w  w  w .  j  av a 2  s .  c o m
    return (criteria.list().size() > 0);
}

From source file:au.org.theark.lims.model.dao.BiospecimenDao.java

License:Open Source License

public List<Biospecimen> searchPageableBiospecimens(LimsVO limsVo, int first, int count) {
    Criteria criteria = buildBiospecimenCriteria(limsVo);
    criteria.setFirstResult(first);/*from   w w  w .j a  v a  2  s  .com*/
    criteria.setMaxResults(count);
    List<Biospecimen> list = criteria.list();

    return list;
}