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<State> getStates(Country country) {

    if (country == null) {
        country = getCountry(Constants.DEFAULT_COUNTRY_CODE);
    }/*  w w  w  .jav  a 2s . c  om*/
    Criteria criteria = getSession().createCriteria(State.class);
    criteria.add(Restrictions.eq("country", country));
    criteria.addOrder(Order.asc("name"));
    return criteria.list();
}

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

License:Open Source License

/**
 * Gets a list of all Address Types/*from  ww w  .  j  a  v  a2  s. c  o m*/
 * 
 * @return
 */
public List<AddressType> getAddressTypes() {
    List<AddressType> AddressTypeLstNew = new ArrayList<AddressType>();
    Criteria criteria = getSession().createCriteria(AddressType.class);
    criteria.addOrder(Order.asc("name"));

    List<AddressType> AddressTypeLst = criteria.list();
    for (AddressType addressType : AddressTypeLst) {
        String name = addressType.getName().toLowerCase();
        addressType.setName(WordUtils.capitalize(name));
        AddressTypeLstNew.add(addressType);
    }
    return AddressTypeLstNew;
}

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

License:Open Source License

/**
 * Gets a list of all Phone Statuses//  ww  w. j a  v a  2s.com
 * 
 * @return
 */
public List<PhoneStatus> getPhoneStatuses() {
    Criteria criteria = getSession().createCriteria(PhoneStatus.class);
    return criteria.list();
}

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

License:Open Source License

/**
 * Gets a list of all Phone Types//from   w  w  w.  j a va  2s .c  o m
 * 
 * @return
 */
public List<PhoneType> getPhoneTypes() {
    Criteria criteria = getSession().createCriteria(PhoneType.class);
    criteria.addOrder(Order.asc("name"));
    return criteria.list();
}

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

License:Open Source License

/**
 * Gets a list of all Address Statuses/*from ww  w .ja v a2s  .c  o m*/
 * 
 * @return
 */
public List<AddressStatus> getAddressStatuses() {
    Criteria criteria = getSession().createCriteria(AddressStatus.class);
    return criteria.list();
}

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

License:Open Source License

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

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

License:Open Source License

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

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

License:Open Source License

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

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

License:Open Source License

@SuppressWarnings("unchecked")
public boolean isSubjectConsentedToComponent(StudyComp studyComponent, Person person, Study study) {
    boolean isConsented = false;
    Criteria criteria = getSession().createCriteria(Consent.class);
    criteria.add(Restrictions.eq("studyComp", studyComponent));
    criteria.add(Restrictions.eq("study", study));
    criteria.createAlias("linkSubjectStudy", "lss");
    criteria.add(Restrictions.eq("lss.person", person));
    List list = criteria.list();
    if (list != null && list.size() > 0) {
        isConsented = true;//w  w  w .ja v  a  2 s  . c  om
    }
    return isConsented;
}

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

License:Open Source License

/**
 * Returns a list of Consent types hardcopy, electronic document etc.
 * /*  www . j  a va  2s . c o m*/
 * @return
 */
public List<ConsentType> getConsentType() {
    Criteria criteria = getSession().createCriteria(ConsentType.class);
    return criteria.list();
}