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

public List<BioCollectionUidPadChar> getBioCollectionUidPadChar() {
    Criteria criteria = getSession().createCriteria(BioCollectionUidPadChar.class);
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<SubjectVO> matchSubjectsFromInputFile(FileUpload subjectFileUpload, Study study) {
    List<SubjectVO> subjectVOList = new ArrayList<SubjectVO>();
    List<String> subjectUidList = new ArrayList<String>(0);

    if (subjectFileUpload != null) {
        try {// w w  w  .java  2 s  . c  om
            subjectUidList = CsvListReader.readColumnIntoList(subjectFileUpload.getInputStream());
        } catch (IOException e) {
            log.error("Error in Subject list file");
            return subjectVOList;
        }

        Criteria criteria = getSession().createCriteria(LinkSubjectStudy.class);
        criteria.add(Restrictions.eq("study", study));
        criteria.add(Restrictions.in("subjectUID", subjectUidList));
        List<LinkSubjectStudy> subjectList = criteria.list();

        for (Iterator<LinkSubjectStudy> iterator = subjectList.iterator(); iterator.hasNext();) {
            LinkSubjectStudy linkSubjectStudy = (LinkSubjectStudy) iterator.next();
            // Place the LinkSubjectStudy instance into a SubjectVO and add the SubjectVO into a List
            SubjectVO subject = new SubjectVO();
            subject.setSubjectUID(linkSubjectStudy.getSubjectUID());
            subject.setLinkSubjectStudy(linkSubjectStudy);
            //Person person = subject.getLinkSubjectStudy().getPerson();
            //subject.setSubjectPreviousLastname(getPreviousLastname(person));
            subjectVOList.add(subject);
        }
    }
    return subjectVOList;
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<Study> getAssignedChildStudyListForPerson(Study study, Person person) {
    Criteria criteria = getSession().createCriteria(LinkSubjectStudy.class);
    criteria.createAlias("study", "s");
    criteria.add(Restrictions.eq("person", person));
    criteria.add(Restrictions.eq("s.parentStudy", study));
    criteria.add(Restrictions.ne("s.id", study.getId()));
    criteria.add(Restrictions.ne("subjectStatus", getSubjectStatus("Archive")));
    ProjectionList projectionList = Projections.projectionList();
    projectionList.add(Projections.groupProperty("study"), "study");
    criteria.setProjection(projectionList);

    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<ConsentOption> getConsentOptionList() {
    Criteria criteria = getSession().createCriteria(ConsentOption.class);
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

@SuppressWarnings("unchecked")
public Collection<UploadType> getUploadTypesForSubject(Study study) {
    Criteria criteria = getSession().createCriteria(UploadType.class);
    criteria.add(Restrictions.eq("arkModule", getArkModuleForSubject()));
    if (study != null && study.getParentStudy() != null) { //i.e. study is a child study
        criteria.add(Restrictions.not(Restrictions.eq("name", "Subject Demographic Data")));
    }/*from   w w w .  ja  v a  2  s  . c o m*/
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

@SuppressWarnings("unchecked")
public Collection<UploadType> getUploadTypesForLims() {
    Criteria criteria = getSession().createCriteria(UploadType.class);
    criteria.add(Restrictions.eq("arkModule", getArkModuleForLims()));
    criteria.addOrder(Order.asc("order"));
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<Search> getSearchesForThisStudy(Study study) {
    Criteria criteria = getSession().createCriteria(Search.class);
    criteria.add(Restrictions.eq("study", study));
    List<Search> searchList = criteria.list();
    return searchList;
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

/**
 * //from  w ww  .  ja  v  a 2s .c  o m
 * @param searchName
 * @param anIdToExcludeFromResults
 *           : This is if you want to exclude id, the most obvious case being where we want to exclude the current search itself in the case of an
 *           update
 * @return
 */
public boolean isSearchNameTaken(String searchName, Study study, Long anIdToExcludeFromResults) {
    Criteria criteria = getSession().createCriteria(Search.class);
    criteria.add(Restrictions.eq("study", study));
    criteria.add(Restrictions.eq("name", searchName));

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

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public Collection<ConsentStatusField> getAllConsentStatusFields() {
    Criteria criteria = getSession().createCriteria(ConsentStatusField.class);
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public Collection<DemographicField> getAllDemographicFields() {
    Criteria criteria = getSession().createCriteria(DemographicField.class);
    return criteria.list();
}