Revision 3835ed3e
Added by Patrick Plitzner over 5 years ago
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/occurrence/OccurrenceDaoHibernateImpl.java | ||
---|---|---|
826 | 826 |
return results; |
827 | 827 |
} |
828 | 828 |
|
829 |
/** |
|
830 |
* {@inheritDoc} |
|
831 |
*/ |
|
832 |
@Override |
|
833 |
public List<FieldUnit> getFieldUnitsForGatheringEvent(UUID gatheringEventUuid, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) { |
|
834 |
String queryString = "FROM SpecimenOrObservationBase s WHERE s.gatheringEvent.uuid = :gatheringEventUuid"; |
|
835 |
|
|
836 |
if(orderHints != null && orderHints.size() > 0){ |
|
837 |
queryString += " order by "; |
|
838 |
String orderStr = ""; |
|
839 |
for(OrderHint orderHint : orderHints){ |
|
840 |
if(orderStr.length() > 0){ |
|
841 |
orderStr += ", "; |
|
842 |
} |
|
843 |
queryString += "descriptions." + orderHint.getPropertyName() + " " + orderHint.getSortOrder().toHql(); |
|
844 |
} |
|
845 |
queryString += orderStr; |
|
846 |
} |
|
847 |
|
|
848 |
Query query = getSession().createQuery(queryString); |
|
849 |
query.setParameter("gatheringEventUuid", gatheringEventUuid); |
|
850 |
|
|
851 |
if(limit != null) { |
|
852 |
if(start != null) { |
|
853 |
query.setFirstResult(start); |
|
854 |
} else { |
|
855 |
query.setFirstResult(0); |
|
856 |
} |
|
857 |
query.setMaxResults(limit); |
|
858 |
} |
|
859 |
|
|
860 |
List results = query.list(); |
|
861 |
defaultBeanInitializer.initializeAll(results, propertyPaths); |
|
862 |
return results; |
|
863 |
} |
|
864 |
|
|
829 | 865 |
} |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/occurrence/IOccurrenceDao.java | ||
---|---|---|
23 | 23 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
24 | 24 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
25 | 25 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
26 |
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent; |
|
26 | 27 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
27 | 28 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
28 | 29 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
341 | 342 |
* @return collection of specimen with the given type |
342 | 343 |
*/ |
343 | 344 |
public Collection<SpecimenOrObservationBase> listBySpecimenOrObservationType(SpecimenOrObservationType type, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths); |
345 |
|
|
346 |
/** |
|
347 |
* |
|
348 |
* Returns all {@link FieldUnit}s that are referencing this {@link GatheringEvent} |
|
349 |
* @param gatheringEventUuid the {@link UUID} of the gathering event |
|
350 |
* @param limit |
|
351 |
* @param start |
|
352 |
* @param orderHints |
|
353 |
* @param propertyPaths |
|
354 |
* @return a list of field units referencing the gathering event |
|
355 |
*/ |
|
356 |
public List<FieldUnit> getFieldUnitsForGatheringEvent(UUID gatheringEventUuid, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths); |
|
344 | 357 |
} |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
48 | 48 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
49 | 49 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
50 |
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent; |
|
50 | 51 |
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen; |
51 | 52 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
52 | 53 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
... | ... | |
622 | 623 |
*/ |
623 | 624 |
public List<DerivedUnit> getAllChildDerivatives(UUID specimenUuid); |
624 | 625 |
|
626 |
/** |
|
627 |
* Returns all {@link FieldUnit}s that are referencing this {@link GatheringEvent} |
|
628 |
* @param gatheringEventUuid the {@link UUID} of the gathering event |
|
629 |
* @return a list of field units referencing the gathering event |
|
630 |
*/ |
|
631 |
public List<FieldUnit> getFieldUnitsForGatheringEvent(UUID gatheringEventUuid); |
|
632 |
|
|
625 | 633 |
} |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java | ||
---|---|---|
1571 | 1571 |
return countByTitle(config); |
1572 | 1572 |
} |
1573 | 1573 |
|
1574 |
/** |
|
1575 |
* {@inheritDoc} |
|
1576 |
*/ |
|
1577 |
@Override |
|
1578 |
public List<FieldUnit> getFieldUnitsForGatheringEvent(UUID gatheringEventUuid) { |
|
1579 |
return dao.getFieldUnitsForGatheringEvent(gatheringEventUuid, null, null, null, null); |
|
1580 |
} |
|
1581 |
|
|
1574 | 1582 |
} |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/utility/DerivedUnitConverterTest.java | ||
---|---|---|
1172 | 1172 |
return null; |
1173 | 1173 |
} |
1174 | 1174 |
|
1175 |
/** |
|
1176 |
* {@inheritDoc} |
|
1177 |
*/ |
|
1178 |
@Override |
|
1179 |
public List<FieldUnit> getFieldUnitsForGatheringEvent(UUID gatheringEventUuid) { |
|
1180 |
return null; |
|
1181 |
} |
|
1182 |
|
|
1175 | 1183 |
} |
1176 | 1184 |
|
1177 | 1185 |
|
Also available in: Unified diff
ref #7324 Add new service method getFieldUnitsForGatheringEvent()