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
/** * Shows all the Linked Pheno data categories. *///from w ww .j ava2s .com @Override public List<LinkPhenoDataSetCategoryField> getLinkPhenoDataSetCategoryFieldLst(Study study, ArkFunction arkFunction, ArkUser arkUser) { Criteria criteria = getSession().createCriteria(LinkPhenoDataSetCategoryField.class); criteria.add(Restrictions.eq("study", study)); criteria.add(Restrictions.eq("arkFunction", arkFunction)); criteria.add(Restrictions.eq("arkUser", arkUser)); return criteria.list(); }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public List<PhenoDataSetField> getLinkedPhenoDataSetFieldsForSelectedCategories(Study study, ArkFunction arkFunction, ArkUser arkUser, List<PhenoDataSetCategory> phenoDataSetCategories) { List<LinkPhenoDataSetCategoryField> linkPhenoDataSetCategoryFields = new ArrayList<LinkPhenoDataSetCategoryField>(); List<PhenoDataSetField> sumofPhenoDataSetFields = new ArrayList<PhenoDataSetField>(); for (PhenoDataSetCategory phenoDataSetCategory : phenoDataSetCategories) { Criteria criteria = getSession().createCriteria(LinkPhenoDataSetCategoryField.class); criteria.add(Restrictions.eq("study", study)); criteria.add(Restrictions.eq("arkFunction", arkFunction)); criteria.add(Restrictions.eq("arkUser", arkUser)); criteria.add(Restrictions.eq("phenoDataSetCategory", phenoDataSetCategory)); criteria.addOrder(Order.asc("orderNumber")); linkPhenoDataSetCategoryFields = (List<LinkPhenoDataSetCategoryField>) criteria.list(); for (LinkPhenoDataSetCategoryField linkPhenoDataSetCategoryField : linkPhenoDataSetCategoryFields) { sumofPhenoDataSetFields.add(linkPhenoDataSetCategoryField.getPhenoDataSetField()); }//from w w w. j av a 2 s . c o m linkPhenoDataSetCategoryFields.clear(); } return sumofPhenoDataSetFields; }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public PickedPhenoDataSetCategory getSwapOverPickedPhenoDataSetCategoryForUpButton( PickedPhenoDataSetCategory pickedPhenoDataSetCategory) { Criteria criteria = getSession().createCriteria(PickedPhenoDataSetCategory.class); criteria.add(Restrictions.eq("arkFunction", pickedPhenoDataSetCategory.getArkFunction())); criteria.add(Restrictions.eq("study", pickedPhenoDataSetCategory.getStudy())); criteria.add(Restrictions.eq("arkUser", pickedPhenoDataSetCategory.getArkUser())); if (pickedPhenoDataSetCategory.getParentPickedPhenoDataSetCategory() != null) { criteria.add(Restrictions.eq("parentPickedPhenoDataSetCategory", pickedPhenoDataSetCategory.getParentPickedPhenoDataSetCategory())); } else {// w w w . ja va2 s. co m criteria.add(Restrictions.isNull("parentPickedPhenoDataSetCategory")); } criteria.add(Restrictions.lt("orderNumber", pickedPhenoDataSetCategory.getOrderNumber())); criteria.addOrder(Order.desc("orderNumber")); criteria.setFirstResult(0); criteria.setMaxResults(1); List<PickedPhenoDataSetCategory> pickedPhenoDataSetCategories = (List<PickedPhenoDataSetCategory>) criteria .list(); if (pickedPhenoDataSetCategories.size() > 0) { return pickedPhenoDataSetCategories.get(0); } else { return null; } }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public PickedPhenoDataSetCategory getSwapOverPickedPhenoDataSetCategoryForDownButton( PickedPhenoDataSetCategory pickedPhenoDataSetCategory) { Criteria criteria = getSession().createCriteria(PickedPhenoDataSetCategory.class); criteria.add(Restrictions.eq("arkFunction", pickedPhenoDataSetCategory.getArkFunction())); criteria.add(Restrictions.eq("study", pickedPhenoDataSetCategory.getStudy())); criteria.add(Restrictions.eq("arkUser", pickedPhenoDataSetCategory.getArkUser())); if (pickedPhenoDataSetCategory.getParentPickedPhenoDataSetCategory() != null) { criteria.add(Restrictions.eq("parentPickedPhenoDataSetCategory", pickedPhenoDataSetCategory.getParentPickedPhenoDataSetCategory())); } else {//from ww w. j a va 2s. c o m criteria.add(Restrictions.isNull("parentPickedPhenoDataSetCategory")); } criteria.add(Restrictions.gt("orderNumber", pickedPhenoDataSetCategory.getOrderNumber())); criteria.addOrder(Order.asc("orderNumber")); criteria.setFirstResult(0); criteria.setMaxResults(1); List<PickedPhenoDataSetCategory> pickedPhenoDataSetCategories = (List<PickedPhenoDataSetCategory>) criteria .list(); if (pickedPhenoDataSetCategories.size() > 0) { return pickedPhenoDataSetCategories.get(0); } else { return null; } }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public LinkPhenoDataSetCategoryField getSwapOverPhenoDataSetFieldForUpButton( LinkPhenoDataSetCategoryField linkPhenoDataSetCategoryField) { Criteria criteria = getSession().createCriteria(LinkPhenoDataSetCategoryField.class); criteria.add(Restrictions.eq("arkFunction", linkPhenoDataSetCategoryField.getArkFunction())); criteria.add(Restrictions.eq("study", linkPhenoDataSetCategoryField.getStudy())); criteria.add(Restrictions.eq("arkUser", linkPhenoDataSetCategoryField.getArkUser())); criteria.add(/*w w w.ja v a2 s. c om*/ Restrictions.eq("phenoDataSetCategory", linkPhenoDataSetCategoryField.getPhenoDataSetCategory())); criteria.add(Restrictions.lt("orderNumber", linkPhenoDataSetCategoryField.getOrderNumber())); criteria.addOrder(Order.desc("orderNumber")); criteria.setFirstResult(0); criteria.setMaxResults(1); List<LinkPhenoDataSetCategoryField> linkPhenoDataSetCategoryFields = (List<LinkPhenoDataSetCategoryField>) criteria .list(); if (linkPhenoDataSetCategoryFields.size() > 0) { return linkPhenoDataSetCategoryFields.get(0); } else { return null; } }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public LinkPhenoDataSetCategoryField getSwapOverPhenoDataSetFieldForDownButton( LinkPhenoDataSetCategoryField linkPhenoDataSetCategoryField) { Criteria criteria = getSession().createCriteria(LinkPhenoDataSetCategoryField.class); criteria.add(Restrictions.eq("arkFunction", linkPhenoDataSetCategoryField.getArkFunction())); criteria.add(Restrictions.eq("study", linkPhenoDataSetCategoryField.getStudy())); criteria.add(Restrictions.eq("arkUser", linkPhenoDataSetCategoryField.getArkUser())); criteria.add(/* www . j a v a 2s . com*/ Restrictions.eq("phenoDataSetCategory", linkPhenoDataSetCategoryField.getPhenoDataSetCategory())); criteria.add(Restrictions.gt("orderNumber", linkPhenoDataSetCategoryField.getOrderNumber())); criteria.addOrder(Order.asc("orderNumber")); criteria.setFirstResult(0); criteria.setMaxResults(1); List<LinkPhenoDataSetCategoryField> linkPhenoDataSetCategoryFields = (List<LinkPhenoDataSetCategoryField>) criteria .list(); if (linkPhenoDataSetCategoryFields.size() > 0) { return linkPhenoDataSetCategoryFields.get(0); } else { return null; } }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public Boolean isPickedPhenoDataSetCategoryIsAParentOfAnotherCategory( PickedPhenoDataSetCategory pickedPhenoDataSetCategory) { Criteria criteria = getSession().createCriteria(PickedPhenoDataSetCategory.class); criteria.add(Restrictions.eq("arkFunction", pickedPhenoDataSetCategory.getArkFunction())); criteria.add(Restrictions.eq("study", pickedPhenoDataSetCategory.getStudy())); criteria.add(Restrictions.eq("arkUser", pickedPhenoDataSetCategory.getArkUser())); criteria.add(Restrictions.eq("parentPickedPhenoDataSetCategory", pickedPhenoDataSetCategory)); return !((List<PickedPhenoDataSetCategory>) criteria.list()).isEmpty(); }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public List<PickedPhenoDataSetCategory> getChildrenOfPickedPhenoDataSetCategory( PickedPhenoDataSetCategory pickedPhenoDataSetCategory) { Criteria criteria = getSession().createCriteria(PickedPhenoDataSetCategory.class); criteria.add(Restrictions.eq("arkFunction", pickedPhenoDataSetCategory.getArkFunction())); criteria.add(Restrictions.eq("study", pickedPhenoDataSetCategory.getStudy())); criteria.add(Restrictions.eq("arkUser", pickedPhenoDataSetCategory.getArkUser())); criteria.add(Restrictions.eq("parentPickedPhenoDataSetCategory", pickedPhenoDataSetCategory)); criteria.addOrder(Order.asc("orderNumber")); return (List<PickedPhenoDataSetCategory>) criteria.list(); }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public List<PickedPhenoDataSetCategory> getAllParentPickedPhenoDataSetCategories(Study study, ArkFunction arkFunction, ArkUser arkUser) { Criteria criteria = getSession().createCriteria(PickedPhenoDataSetCategory.class); criteria.add(Restrictions.eq("arkFunction", arkFunction)); criteria.add(Restrictions.eq("study", study)); criteria.add(Restrictions.eq("arkUser", arkUser)); criteria.add(Restrictions.isNull("parentPickedPhenoDataSetCategory")); criteria.addOrder(Order.asc("orderNumber")); return (List<PickedPhenoDataSetCategory>) criteria.list(); }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public List<LinkPhenoDataSetCategoryField> getLinkPhenoDataSetCategoryFieldsForPickedPhenoDataSetCategory( PickedPhenoDataSetCategory pickedPhenoDataSetCategory) { Criteria criteria = getSession().createCriteria(LinkPhenoDataSetCategoryField.class); criteria.add(Restrictions.eq("study", pickedPhenoDataSetCategory.getStudy())); criteria.add(Restrictions.eq("arkFunction", pickedPhenoDataSetCategory.getArkFunction())); criteria.add(Restrictions.eq("arkUser", pickedPhenoDataSetCategory.getArkUser())); criteria.add(Restrictions.eq("phenoDataSetCategory", pickedPhenoDataSetCategory.getPhenoDataSetCategory())); criteria.addOrder(Order.asc("orderNumber")); return (List<LinkPhenoDataSetCategoryField>) criteria.list(); }