package eu.etaxonomy.cdm.api.service;\r
\r
import java.io.IOException;\r
+import java.util.Collection;\r
import java.util.List;\r
import java.util.Set;\r
+import java.util.UUID;\r
\r
import org.apache.lucene.index.CorruptIndexException;\r
import org.apache.lucene.queryParser.ParseException;\r
\r
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;\r
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;\r
+import eu.etaxonomy.cdm.api.service.dto.DerivateHierarchyDTO;\r
import eu.etaxonomy.cdm.api.service.pager.Pager;\r
import eu.etaxonomy.cdm.api.service.search.SearchResult;\r
import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;\r
import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;\r
import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
-import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;\r
+import eu.etaxonomy.cdm.model.location.Country;\r
import eu.etaxonomy.cdm.model.media.Media;\r
+import eu.etaxonomy.cdm.model.molecular.DnaSample;\r
+import eu.etaxonomy.cdm.model.molecular.Sequence;\r
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;\r
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;\r
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;\r
-import eu.etaxonomy.cdm.persistence.dao.IBeanInitializer;\r
+import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;\r
import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
\r
/**\r
*/\r
public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenOrObservationBase> {\r
\r
- public WaterbodyOrCountry getCountryByIso(String iso639);\r
+ public Country getCountryByIso(String iso639);\r
\r
- public List<WaterbodyOrCountry> getWaterbodyOrCountryByName(String name);\r
+ public List<Country> getCountryByName(String name);\r
\r
/**\r
* Returns a paged list of occurrences that have been determined to belong\r
*/\r
public Pager<Media> getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);\r
\r
+ /**\r
+ * Returns a count of determinations that have been made for a given occurence and for a given taxon concept\r
+ *\r
+ * @param occurence the occurence associated with these determinations (can be null for all occurrences)\r
+ * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)\r
+ * @return a count of determination events\r
+ */\r
+ public int countDeterminations(SpecimenOrObservationBase occurence,TaxonBase taxonbase);\r
+\r
/**\r
* Returns a List of determinations that have been made for a given occurence\r
*\r
@Override\r
public Pager<SpecimenOrObservationBase> search(Class<? extends SpecimenOrObservationBase> clazz, String query, Integer pageSize,Integer pageNumber, List<OrderHint> orderHints,List<String> propertyPaths);\r
\r
+ /**\r
+ * Retrieves the {@link UUID} and the string representation (title cache) of all\r
+ * {@link FieldUnit}s found in the data base.\r
+ * @return a list of {@link UuidAndTitleCache}\r
+ */\r
public List<UuidAndTitleCache<FieldUnit>> getFieldUnitUuidAndTitleCache();\r
\r
+ /**\r
+ * Retrieves the {@link UUID} and the string representation (title cache) of all\r
+ * {@link DerivedUnit}s found in the data base.\r
+ * @return a list of {@link UuidAndTitleCache}\r
+ */\r
public List<UuidAndTitleCache<DerivedUnit>> getDerivedUnitUuidAndTitleCache();\r
\r
public DerivedUnitFacade getDerivedUnitFacade(DerivedUnit derivedUnit, List<String> propertyPaths) throws DerivedUnitFacadeNotSupportedException;\r
public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,\r
Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
\r
+ /**\r
+ * Lists all instances of {@link FieldUnit} which are\r
+ * associated <b>directly or indirectly</b>with the <code>taxon</code> specified\r
+ * as parameter. "Indirectly" means that a sub derivate of the FieldUnit is\r
+ * directly associated with the given taxon.\r
+ * SpecimenOrObservationBase instances can be associated to taxa in multiple\r
+ * ways, all these possible relations are taken into account:\r
+ * <ul>\r
+ * <li>The {@link IndividualsAssociation} elements in a\r
+ * {@link TaxonDescription} contain {@link DerivedUnit}s</li>\r
+ * <li>{@link SpecimenTypeDesignation}s may be associated with any\r
+ * {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>\r
+ * <li>A {@link Taxon} may be referenced by the {@link DeterminationEvent}\r
+ * of the {@link SpecimenOrObservationBase}</li>\r
+ * </ul>\r
+ * Further more there also can be taxa which are associated with the taxon\r
+ * in question (parameter associatedTaxon) by {@link TaxonRelationship}s. If\r
+ * the parameter <code>includeRelationships</code> is containing elements,\r
+ * these according {@TaxonRelationshipType}s and\r
+ * directional information will be used to collect further\r
+ * {@link SpecimenOrObservationBase} instances found this way.\r
+ *\r
+ * @param <T>\r
+ * @param type\r
+ * @param associatedTaxon\r
+ * @param Set<TaxonRelationshipVector> includeRelationships. TaxonRelationships will not be taken into account if this is <code>NULL</code>.\r
+ * @param maxDepth TODO\r
+ * @param pageSize\r
+ * @param pageNumber\r
+ * @param orderHints\r
+ * @param propertyPaths\r
+ * @return\r
+ */\r
+ public Collection<FieldUnit> listFieldUnitsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,\r
+ Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+ /**\r
+ * Assembles a {@link DerivateHierarchyDTO} for each "associated" {@link FieldUnit} found for the given {@link Taxon}.<br>\r
+ * <br>\r
+ * See also {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}\r
+ * @param includeRelationships\r
+ * @param associatedTaxon\r
+ * @param maxDepth\r
+ * @param pageSize\r
+ * @param pageNumber\r
+ * @param orderHints\r
+ * @param propertyPaths\r
+ * @return\r
+ */\r
+ public Collection<DerivateHierarchyDTO> listDerivateHierarchyDTOsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,\r
+ Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
/**\r
* See {@link #listByAssociatedTaxon(Class, Set, Taxon, Integer, Integer, Integer, List, List)}\r
*\r
public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,\r
Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
\r
+ /**\r
+ * Retrieves all {@link FieldUnit}s for the {@link SpecimenOrObservationBase} with the given {@link UUID}.<br>\r
+ * @param specimenUuid the UUID of the specimen\r
+ * @return either a collection of FieldUnits this specimen was derived from, the FieldUnit itself\r
+ * if this was a FieldUnit or an empty collection if no FieldUnits were found\r
+ */\r
+ public Collection<FieldUnit> getFieldUnits(UUID specimenUuid);\r
+\r
/**\r
* @param clazz\r
* @param queryString\r
String queryString, Rectangle boundingBox, List<Language> languages, boolean highlightFragments, Integer pageSize,\r
Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws CorruptIndexException,\r
IOException, ParseException;\r
+ /**\r
+ * See {@link #listByAssociatedTaxon(Class, Set, String, Integer, Integer, Integer, List, List)}\r
+ *\r
+ * @param type\r
+ * @param includeRelationships\r
+ * @param associatedTaxon\r
+ * @param maxDepth\r
+ * @param pageSize\r
+ * @param pageNumber\r
+ * @param orderHints\r
+ * @param propertyPaths\r
+ * @return a Pager\r
+ */\r
+ public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,\r
+ String taxonUUID, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
\r
+ /**\r
+ * Moves the given {@link Sequence} from one {@link DnaSample} to another\r
+ * @param from the DnaSample from which the sequence will be removed\r
+ * @param to the DnaSample which to which the sequence will be added\r
+ * @param sequence the Sequence to move\r
+ * @return <code>true</code> if successfully moved, <code>false</code> otherwise\r
+ */\r
+ public boolean moveSequence(DnaSample from, DnaSample to, Sequence sequence);\r
+\r
+ /**\r
+ * Moves the given {@link DerivedUnit} from one {@link SpecimenOrObservationBase} to another.\r
+ * @param from the SpecimenOrObservationBase from which the DerivedUnit will be removed\r
+ * @param to the SpecimenOrObservationBase to which the DerivedUnit will be added\r
+ * @param derivate the DerivedUnit to move\r
+ * @return <code>true</code> if successfully moved, <code>false</code> otherwise\r
+ */\r
+ public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate);\r
\r
}\r