List of usage examples for org.hibernate Criteria list
public List list() throws HibernateException;
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);//from w ww . j a va2s . c o m 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())); }//from w ww . ja va2 s. co 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
public Collection<CustomFieldGroup> getCustomFieldGroupList(Study study) { Criteria criteria = getSession().createCriteria(CustomFieldGroup.class); criteria.add(Restrictions.eq("study", study)); Collection<CustomFieldGroup> result = criteria.list(); return result; }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
public List<PhenoDataSetGroup> getPhenoDataSetGroupsByLinkSubjectStudy(LinkSubjectStudy linkSubjectStudy) { Criteria criteria = getSession().createCriteria(PhenoDataSetCollection.class); criteria.add(Restrictions.eq("linkSubjectStudy", linkSubjectStudy)); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.groupProperty("questionnaire"), "questionnaire"); criteria.setProjection(projectionList); criteria.setResultTransformer(Transformers.aliasToBean(PhenoDataSetCollection.class)); List<PhenoDataSetCollection> phenoDataSetCollections = (List<PhenoDataSetCollection>) criteria.list(); List<PhenoDataSetGroup> phenoDataSetGroups = new ArrayList<PhenoDataSetGroup>(); for (PhenoDataSetCollection phenoDataSetCollection : phenoDataSetCollections) { phenoDataSetGroups.add(phenoDataSetCollection.getQuestionnaire()); }/*from ww w .ja va 2 s.c o m*/ return phenoDataSetGroups; }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
public List<PhenoDataSetCollection> getSubjectMatchingPhenoCollections(LinkSubjectStudy subject, PhenoDataSetGroup phenoDataSetGroup, Date recordDate) { log.info("subject " + subject.getSubjectUID()); log.info("phenoDataSetGroup " + phenoDataSetGroup.getName()); log.info("date: " + recordDate); Criteria criteria = getSession().createCriteria(PhenoDataSetCollection.class); criteria.add(Restrictions.eq("linkSubjectStudy", subject)); criteria.add(Restrictions.eq("questionnaire", phenoDataSetGroup)); Calendar cal = Calendar.getInstance(); cal.setTime(recordDate);//from w ww . j av a 2s . com //Removing the "Time" section of the Dates as that's not important in this context cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date low = cal.getTime(); cal.add(Calendar.DATE, 1); Date high = cal.getTime(); criteria.add(Restrictions.lt("recordDate", high)); criteria.add(Restrictions.ge("recordDate", low)); return criteria.list(); }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public List<PhenoDataSetCategory> getAvailableAllCategoryList(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> phenoDataSetCategoryList = (List<PhenoDataSetCategory>) criteria.list(); return phenoDataSetCategoryList; }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public List<PhenoDataSetCategory> getAvailableAllCategoryListExceptThis(Study study, ArkFunction arkFunction, PhenoDataSetCategory thisPhenoDataSetCategory) throws ArkSystemException { Criteria criteria = getSession().createCriteria(PhenoDataSetCategory.class); criteria.add(Restrictions.ne("id", thisPhenoDataSetCategory.getId())); criteria.add(Restrictions.eq("arkFunction", arkFunction)); criteria.add(Restrictions.eq("study", study)); List<PhenoDataSetCategory> phenoDataSetCategoryList = (List<PhenoDataSetCategory>) criteria.list(); return phenoDataSetCategoryList; }
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 w w w .j a v a2s. co m*/ 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
/** * check the Custom field category for the data intergrity. *//*from ww w . j ava 2 s . c o m*/ @Override public boolean isPhenoDataSetCategoryAlreadyUsed(PhenoDataSetCategory phenoDataSetCategory) { /** * if a phenoDatasetCategory been used by the system it should be at least one or more of this table. * PickedPhenoDataSetCategory * LinkPhenoDataSetCategoryField * PhenoDataSetFieldDisplay * */ Boolean status1 = false, status2 = false, status3 = false; StatelessSession stateLessSessionOne = getStatelessSession(); Criteria criteria = stateLessSessionOne.createCriteria(PickedPhenoDataSetCategory.class); ArkFunction arkFunction = iArkCommonService .getArkFunctionByName(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_PHENO_COLLECTION); criteria.add(Restrictions.eq("arkFunction", arkFunction)); criteria.add(Restrictions.eq("study", phenoDataSetCategory.getStudy())); criteria.add(Restrictions.eq("phenoDataSetCategory", phenoDataSetCategory)); List<PickedPhenoDataSetCategory> phenoDataSetCategories = (List<PickedPhenoDataSetCategory>) criteria .list(); if (phenoDataSetCategories.size() > 0) { status1 = true; } else { status1 = false; } StatelessSession stateLessSessionTwo = getStatelessSession(); Criteria criteriaTwo = stateLessSessionTwo.createCriteria(LinkPhenoDataSetCategoryField.class); criteriaTwo.add(Restrictions.eq("arkFunction", arkFunction)); criteriaTwo.add(Restrictions.eq("study", phenoDataSetCategory.getStudy())); criteriaTwo.add(Restrictions.eq("phenoDataSetCategory", phenoDataSetCategory)); List<LinkPhenoDataSetCategoryField> linkPhenoDataSetCategoryFields = (List<LinkPhenoDataSetCategoryField>) criteriaTwo .list(); if (linkPhenoDataSetCategoryFields.size() > 0) { status2 = true; } else { status2 = false; } StatelessSession stateLessSessionThree = getStatelessSession(); Criteria criteriaThree = stateLessSessionThree.createCriteria(PhenoDataSetFieldDisplay.class); criteriaThree.createAlias("phenoDataSetGroup", "phenoDSG"); criteriaThree.add(Restrictions.eq("phenoDSG.arkFunction", arkFunction)); criteriaThree.add(Restrictions.eq("phenoDSG.study", phenoDataSetCategory.getStudy())); criteriaThree.add(Restrictions.eq("phenoDataSetCategory", phenoDataSetCategory)); List<PhenoDataSetFieldDisplay> phenoDataSetFieldDisplays = (List<PhenoDataSetFieldDisplay>) criteriaThree .list(); if (phenoDataSetFieldDisplays.size() > 0) { status3 = true; } else { status3 = false; } return status1 || status2 || status3; }