return results;\r
}\r
\r
+ @Override\r
+ public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {\r
+ String queryString = "FROM DeterminationEvent determination WHERE determination.identifiedUnit = :specimen";\r
+\r
+ if(orderHints != null && orderHints.size() > 0){\r
+ queryString += " order by ";\r
+ String orderStr = "";\r
+ for(OrderHint orderHint : orderHints){\r
+ if(orderStr.length() > 0){\r
+ orderStr += ", ";\r
+ }\r
+ queryString += "determination." + orderHint.getPropertyName() + " " + orderHint.getSortOrder().toHql();\r
+ }\r
+ queryString += orderStr;\r
+ }\r
+\r
+ Query query = getSession().createQuery(queryString);\r
+ query.setParameter("specimen", specimen);\r
+\r
+ if(limit != null) {\r
+ if(start != null) {\r
+ query.setFirstResult(start);\r
+ } else {\r
+ query.setFirstResult(0);\r
+ }\r
+ query.setMaxResults(limit);\r
+ }\r
+\r
+ List results = query.list();\r
+ defaultBeanInitializer.initializeAll(results, propertyPaths);\r
+ return results;\r
+ }\r
+\r
@Override\r
public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {\r
String queryString = "FROM SpecimenTypeDesignation designations WHERE designations.typeSpecimen = :specimen";\r
*/\r
public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
\r
+ /**\r
+ * Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.\r
+ * @param specimen the type specimen\r
+ * @param limit\r
+ * @param start\r
+ * @param orderHints\r
+ * @param propertyPaths\r
+ * @return collection of all designations with the given type specimen\r
+ */\r
+\r
+ /**\r
+ * Retrieves all {@link DeterminationEvent}s which have the given specimen set as identified unit.\r
+ * @param specimen\r
+ * @param limit\r
+ * @param start\r
+ * @param orderHints\r
+ * @param propertyPaths\r
+ * @return collection of all determinations with the given specimen\r
+ */\r
+ public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
/**\r
* Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.\r
* @param specimen the type specimen\r
*/\r
public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
\r
+ /**\r
+ * Retrieves all {@link DeterminationEvent}s which have the given specimen set as identified unit.\r
+ * @param specimen the type specimen\r
+ * @param limit\r
+ * @param start\r
+ * @param orderHints\r
+ * @param propertyPaths\r
+ * @return collection of all designations with the given type specimen\r
+ */\r
+ public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
/**\r
* Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.\r
* @param specimen the type specimen\r
@Override
public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start,
List<OrderHint> orderHints, List<String> propertyPaths) {
- //individuals associations
Collection<TaxonBase<?>> associatedTaxa = new HashSet<TaxonBase<?>>();
+
+ //individuals associations
for (IndividualsAssociation individualsAssociation : listIndividualsAssociations(specimen, limit, start, orderHints, propertyPaths)) {
if(individualsAssociation.getInDescription().isInstanceOf(TaxonDescription.class)){
TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(individualsAssociation.getInDescription(), TaxonDescription.class);
- associatedTaxa.add(taxonDescription.getTaxon());
+ if(taxonDescription.getTaxon()!=null){
+ associatedTaxa.add(taxonDescription.getTaxon());
+ }
}
}
//type designation
}
}
}
+ //determinations
+ Collection<DeterminationEvent> determinationEvents = new HashSet<DeterminationEvent>();
+ for (DeterminationEvent determinationEvent : listDeterminationEvents(specimen, limit, start, orderHints, propertyPaths)) {
+ if(determinationEvent.getIdentifiedUnit().equals(specimen)){
+ if(determinationEvent.getTaxon()!=null){
+ associatedTaxa.add(determinationEvent.getTaxon());
+ }
+ if(determinationEvent.getTaxonName()!=null){
+ associatedTaxa.addAll(determinationEvent.getTaxonName().getTaxonBases());
+ }
+ }
+ }
+
return associatedTaxa;
}
+ @Override
+ public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen,
+ Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
+ return dao.listDeterminationEvents(specimen, limit, start, orderHints, propertyPaths);
+ }
+
@Override
public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen,
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {