import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionStatus;
-import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorFactory;
-import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorImpl;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.common.ExcelUtils;
import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.persistence.query.MatchMode;
/**
* @author a.babadshanjan
private void saveRecord(String taxonName, List<String> distributionList,
String status, String literatureNumber, String literature) {
- IdentifiableServiceConfiguratorImpl<TaxonName> config = IdentifiableServiceConfiguratorFactory.getConfigurator(TaxonName.class);
- config.setTitleSearchString(taxonName);
- config.setMatchMode(MatchMode.BEGINNING);
-
try {
// get the matching names from the DB
//List<TaxonName> taxonNames = getNameService().findByTitle(config);
//DEBUG CHENOPODIUM VULVARIA
UUID uuid = UUID.fromString("85234ff5-8e40-4813-8f06-44ab960a905a");
Taxon taxon = (Taxon)getTaxonService().find(uuid);
-
- specimenOrObs = getOccurrenceService().listByAssociatedTaxon(null, null, taxon, null, null, null, null, null);
+ boolean includeUnpublished = true; //for import we always include
+ specimenOrObs = getOccurrenceService().listByAssociatedTaxon(null, null,
+ taxon, includeUnpublished, null, null, null, null, null);
}
Map<String,String> unit=null;
MyHashMap<String,String> myunit;
HttpServletResponse response) throws IOException {
logger.info("doListByAssociatedTaxon()" + requestPathAndQuery(request));
+ boolean includeUnpublished = NO_UNPUBLISHED;
Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(relationshipUuids, relationshipInversUuids, termService);
List<OrderHint> orderHints = null;
return service.pageByAssociatedTaxon(null, includeRelationships, associatedTaxon,
- maxDepth, pagerParams.getPageSize(), pagerParams.getPageIndex(),
+ includeUnpublished, maxDepth, pagerParams.getPageSize(), pagerParams.getPageIndex(),
orderHints, getInitializationStrategy());
}
HttpServletResponse response) throws IOException {
logger.info("doListSpecimensOrObservations() - " + request.getRequestURI());
+ boolean includeUnpublished = NO_UNPUBLISHED;
TaxonBase<?> tb = service.load(uuid);
List<OrderHint> orderHints = new ArrayList<>();
orderHints.add(new OrderHint("titleCache", SortOrder.DESCENDING));
if(tb instanceof Taxon){
- List<SpecimenOrObservationBase<?>> specimensOrObservations = occurrenceService.listByAssociatedTaxon(null, null, (Taxon)tb, null, null, null, orderHints, null);
+ List<SpecimenOrObservationBase<?>> specimensOrObservations = occurrenceService.listByAssociatedTaxon(
+ null, null, (Taxon)tb, includeUnpublished, null, null, null, orderHints, null);
return specimensOrObservations;
} else {
HttpStatusMessage.UUID_REFERENCES_WRONG_TYPE.send(response);
HttpServletResponse response) throws IOException {
logger.info("doGetAssociatedRootUnits() - " + request.getRequestURI());
+ boolean includeUnpublished = NO_UNPUBLISHED;
TaxonBase<?> taxonBase = service.load(uuid);
- taxonBase = checkExistsAndAccess(taxonBase, NO_UNPUBLISHED, response);
+ taxonBase = checkExistsAndAccess(taxonBase, includeUnpublished, response);
List<OrderHint> orderHints = new ArrayList<>();
orderHints.add(new OrderHint("titleCache", SortOrder.ASCENDING));
PagerParameters pagerParams = new PagerParameters(pageSize, pageIndex);
pagerParams.normalizeAndValidate(response);
- return occurrenceService.pageRootUnitsByAssociatedTaxon(null, null, (Taxon) taxonBase, maxDepth, pagerParams.getPageSize(), pagerParams.getPageIndex(), orderHints, null);
+ return occurrenceService.pageRootUnitsByAssociatedTaxon(null, null, (Taxon) taxonBase,
+ includeUnpublished, maxDepth, pagerParams.getPageSize(), pagerParams.getPageIndex(), orderHints, null);
}else{
// FIXME proper HTTP code response
return null;
Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(relationshipUuids, relationshipInversUuids, termService);
List<Media> media = listMediaForTaxon(taxon, includeRelationships,
- includeTaxonDescriptions, includeOccurrences, includeTaxonNameDescriptions, mediaInitStrategy);
+ includeTaxonDescriptions, includeOccurrences, includeOriginals, includeTaxonNameDescriptions, includeUnpublished, mediaInitStrategy);
EntityMediaContext<Taxon> entityMediaContext = new EntityMediaContext<>(taxon, media);
Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(relationshipUuids, relationshipInversUuids, termService);
+ boolean includeOriginals = false; //or when unifying methods, do we want this as webservice parameter, too?
List<Media> media = listMediaForTaxon(taxon, includeRelationships,
- includeTaxonDescriptions, includeOccurrences, includeTaxonNameDescriptions, null);
- media = addTaxonomicChildrenMedia(includeTaxonDescriptions, includeOccurrences, includeTaxonNameDescriptions, taxon,
- includeRelationships, media);
+ includeTaxonDescriptions, includeOccurrences, includeOriginals, includeTaxonNameDescriptions, includeUnpublished, null);
+ media = addTaxonomicChildrenMedia(includeTaxonDescriptions, includeOccurrences, includeOriginals,
+ includeTaxonNameDescriptions, taxon,
+ includeRelationships, media, includeUnpublished);
List<Media> mediafilteredForPreferredRepresentations = mediaToolbox.processAndFilterPreferredMediaRepresentations(type, mimeTypes, widthOrDuration, height, size,
media);
}
public List<Media> addTaxonomicChildrenMedia(Boolean includeTaxonDescriptions, Boolean includeOccurrences,
- Boolean includeTaxonNameDescriptions, Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
- List<Media> media) {
+ boolean includeOriginals, Boolean includeTaxonNameDescriptions, Taxon taxon,
+ Set<TaxonRelationshipEdge> includeRelationships, List<Media> media, boolean includeUnpublished) {
//TODO use treeindex
//looking for all medias of direct children
if(childTaxon != null) {
childTaxon = (Taxon)taxonService.load(childTaxon.getUuid(), NO_UNPUBLISHED, null);
media.addAll(listMediaForTaxon(childTaxon, includeRelationships,
- includeTaxonDescriptions, includeOccurrences, includeTaxonNameDescriptions, MediaPortalController.MEDIA_INIT_STRATEGY.getPropertyPaths()));
+ includeTaxonDescriptions, includeOccurrences, includeOriginals,
+ includeTaxonNameDescriptions, includeUnpublished, MediaPortalController.MEDIA_INIT_STRATEGY.getPropertyPaths()));
}
}
}
}
private List<Media> listMediaForTaxon(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
- Boolean includeTaxonDescriptions, Boolean includeOccurrences, Boolean includeTaxonNameDescriptions, List<String> propertyPath) {
-
- return listMediaForTaxon(taxon, includeRelationships, includeTaxonDescriptions, includeOccurrences, false, includeTaxonNameDescriptions, propertyPath);
- }
-
- private List<Media> listMediaForTaxon(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
- Boolean includeTaxonDescriptions, Boolean includeOccurrences, Boolean includeOriginals, Boolean includeTaxonNameDescriptions, List<String> propertyPath) {
+ Boolean includeTaxonDescriptions, Boolean includeOccurrences, Boolean includeOriginals,
+ Boolean includeTaxonNameDescriptions, boolean includeUnpublished, List<String> propertyPath) {
List<Media> media = service.listMedia(taxon, includeRelationships,
- false, includeTaxonDescriptions, includeOccurrences, includeOriginals, includeTaxonNameDescriptions, propertyPath);
+ false, includeTaxonDescriptions, includeOccurrences, includeOriginals,
+ includeTaxonNameDescriptions, includeUnpublished, propertyPath);
return media;
}
HttpServletRequest request, HttpServletResponse response) throws IOException {
logger.info("doGetOccurrenceSearch() " + requestPathAndQuery(request));
-
ModelAndView mv = new ModelAndView();
+ boolean includeUnpublished = NO_UNPUBLISHED;
Integer pS = null;
Integer pN = null;
specimenOrObs= service.pageByAssociatedTaxon(DerivedUnit.class,
null,
taxon,
+ includeUnpublished,
null,
pagerParams.getPageSize(),
pagerParams.getPageIndex(),
HttpServletResponse response)
throws IOException {
-
logger.info("doGetOccurrenceMapUriParams() " + requestPathAndQuery(request));
+ boolean includeUnpublished = NO_UNPUBLISHED;
Map<SpecimenOrObservationType, Color> specimenOrObservationTypeColors = null;
List<SpecimenOrObservationBase> specimensOrObersvations = occurencesForTaxon(uuid, relationshipUuids,
- relationshipInversUuids, maxDepth, response);
+ relationshipInversUuids, includeUnpublished, maxDepth, response);
OccurrenceServiceRequestParameterDto dto = geoService.getOccurrenceServiceRequestParameters(specimensOrObersvations,
specimenOrObservationTypeColors );
}
private List<SpecimenOrObservationBase> occurencesForTaxon(UUID taxonUuid, UuidList relationshipUuids,
- UuidList relationshipInversUuids, Integer maxDepth, HttpServletResponse response) throws IOException {
- Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(
+ UuidList relationshipInversUuids, boolean includeUnpublished, Integer maxDepth,
+ HttpServletResponse response) throws IOException {
+
+ Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(
relationshipUuids, relationshipInversUuids, termService);
Taxon taxon = getCdmBaseInstance(Taxon.class, taxonUuid, response, (List<String>)null);
orderHints.add(new OrderHint("titleCache", SortOrder.DESCENDING));
List<SpecimenOrObservationBase> specimensOrObersvations = occurrenceService.listByAssociatedTaxon(
- null, includeRelationships, taxon, maxDepth, null, null, orderHints, null);
+ null, includeRelationships, taxon, includeUnpublished, maxDepth, null, null, orderHints, null);
return specimensOrObersvations;
}
HttpServletResponse response)
throws IOException {
-
logger.info("doGetTaxonOccurrenceKml() " + requestPathAndQuery(request));
-
+ boolean includeUnpublished = NO_UNPUBLISHED;
Map<SpecimenOrObservationType, Color> specimenOrObservationTypeColors = null;
List<SpecimenOrObservationBase> specimensOrObersvations = occurencesForTaxon(uuid, relationshipUuids,
- relationshipInversUuids, maxDepth, response);
+ relationshipInversUuids, includeUnpublished, maxDepth, response);
Kml kml = geoservice.occurrencesToKML(specimensOrObersvations, specimenOrObservationTypeColors);
}
private List<SpecimenOrObservationBase> occurencesForTaxon(UUID taxonUuid, UuidList relationshipUuids,
- UuidList relationshipInversUuids, Integer maxDepth, HttpServletResponse response) throws IOException {
- Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(
- relationshipUuids, relationshipInversUuids, termService);
+ UuidList relationshipInversUuids, boolean includeUnpublished, Integer maxDepth,
+ HttpServletResponse response) throws IOException {
+ Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(
+ relationshipUuids, relationshipInversUuids, termService);
Taxon taxon = getCdmBaseInstance(Taxon.class, taxonUuid, response, (List<String>)null);
List<OrderHint> orderHints = new ArrayList<>();
orderHints.add(new OrderHint("titleCache", SortOrder.DESCENDING));
List<SpecimenOrObservationBase> specimensOrObersvations = occurrenceService.listByAssociatedTaxon(
- null, includeRelationships, taxon, maxDepth, null, null, orderHints, null);
+ null, includeRelationships, taxon, includeUnpublished, maxDepth, null, null, orderHints, null);
return specimensOrObersvations;
}
HttpServletRequest request, HttpServletResponse response) throws IOException {
logger.info("doGetMedia() " + AbstractController.requestPathAndQuery(request));
+ boolean includeUnpublished = false;
+
+ boolean includeOriginals = false; //TODO added during refactoring, do we want to add it to the webservice parameters?
EntityInitStrategy taxonInitStrategy = includeTaxonomicChildren? TaxonPortalController.TAXON_WITH_CHILDNODES_INIT_STRATEGY : TaxonPortalController.TAXON_INIT_STRATEGY;
EntityMediaContext<Taxon> entityMediaContext = taxonPortalController.loadMediaForTaxonAndRelated(uuid,
if(includeTaxonomicChildren){
Set<TaxonRelationshipEdge> includeRelationships = ControllerUtils.loadIncludeRelationships(relationshipUuids, relationshipInversUuids, termService);
entityMediaContext.setMedia(
- taxonPortalController.addTaxonomicChildrenMedia(includeTaxonDescriptions, includeOccurrences, includeTaxonNameDescriptions, entityMediaContext.getEntity(), includeRelationships, entityMediaContext.getMedia())
+ taxonPortalController.addTaxonomicChildrenMedia(includeTaxonDescriptions, includeOccurrences, includeOriginals, includeTaxonNameDescriptions,
+ entityMediaContext.getEntity(), includeRelationships, entityMediaContext.getMedia(), includeUnpublished)
);
}
ManifestComposer manifestFactory = new ManifestComposer(HTTP_IIIF_CYBERTAXONOMY_ORG, mediaTools, mediaService, mediaInfoFactory);
IdentifiableServiceConfiguratorImpl<PolytomousKey> serviceConfig = new IdentifiableServiceConfiguratorImpl<>();
serviceConfig.setTitleSearchString(descriptiveDataSet.getTitleCache());
List<PolytomousKey> list = polytomousKeyService.findByTitle(serviceConfig).getRecords();
- if(list!=null){
+ if(list != null){
list.forEach(polytomousKey->polytomousKeyService.delete(polytomousKey));
}
key.setTitleCache(descriptiveDataSet.getTitleCache(), true);
/**
* Returns a paged list of occurrences that have been determined to belong
* to the taxon concept determinedAs, optionally restricted to objects
- * belonging to a class that that extends SpecimenOrObservationBase. This
+ * belonging to a class that extends SpecimenOrObservationBase. This
* will also consider specimens that are determined as a taxon concept
* belonging to the synonymy of the given taxon concept.
* <p>
* @return
*/
public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
- Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ Taxon associatedTaxon, boolean includeUnpublished, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* The method will search for specimen associated with the taxon nodes.<br>
* @return a Pager
*/
public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
- Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ Taxon associatedTaxon, boolean includeUnpublished, Integer maxDepth, Integer pageSize, Integer pageNumber,
+ List<OrderHint> orderHints, List<String> propertyPaths);
/**
* Retrieves all {@link FieldUnit}s for the {@link SpecimenOrObservationBase} with the given {@link UUID}.<br>
String queryString, RectangleDTO boundingBox, List<Language> languages, boolean highlightFragments,
Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
throws IOException, LuceneParseException;
- /**
- * See {@link #listByAssociatedTaxon(Class, Set, String, Integer, Integer, Integer, List, List)}
- *
- * @param type
- * @param includeRelationships
- * @param associatedTaxon
- * @param maxDepth
- * @param pageSize
- * @param pageNumber
- * @param orderHints
- * @param propertyPaths
- * @return a Pager
- */
- public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
- String taxonUUID, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* Moves the given {@link Sequence} from one {@link DnaSample} to another
* @param propertyPaths
* @return a collection of associated taxa
*/
- public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen,
- Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
- /**
- * @see #listIndividualsAssociationTaxa(SpecimenOrObservationBase, Integer, Integer, List, List)
- */
- public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,
+ public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* @param propertyPaths
* @return a collection of all taxa where the given specimen is the type specimen
*/
- public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen,
- Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
- /**
- * @see #listTypeDesignationTaxa(DerivedUnit, Integer, Integer, List, List)a
- */
public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen, boolean includeUnpublished,
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
* @param propertyPaths
* @return map of all designations with the given type specimens
*/
+ //TODO needed?
public Map<DerivedUnit, Collection<SpecimenTypeDesignation>> listTypeDesignations(Collection<DerivedUnit> specimens, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
/**
List<SpecimenOrObservationBaseDTO> listRootUnitDTOsByAssociatedTaxon(Set<TaxonRelationshipEdge> includedRelationships,
UUID associatedTaxonUuid, boolean includeUnpublished, List<String> propertyPaths);
-
/**
* Lists all root units which are
* associated <b>directly or indirectly</b>with the <code>taxon</code> specified
* @param propertyPaths
* @return
*/
- public <T extends SpecimenOrObservationBase> Collection<T> listRootUnitsByAssociatedTaxon(Class<T> type, Taxon associatedTaxon, List<OrderHint> orderHints, List<String> propertyPaths);
-
+ public <T extends SpecimenOrObservationBase> Collection<T> listRootUnitsByAssociatedTaxon(
+ Class<T> type, Taxon associatedTaxon, boolean includeUnpublished, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* See {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}
*/
public <T extends SpecimenOrObservationBase> Pager<T> pageRootUnitsByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
- Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
-
-
+ Taxon associatedTaxon, boolean includeUnpublished, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
public List<Point> findPointsForFieldUnitList(List<UUID> fieldUnitUuids);
public Pager<SearchResult<TaxonBase>> findByDescriptionElementFullText(Class<? extends DescriptionElementBase> clazz,
String queryString, Classification classification, TaxonNode subtree, List<Feature> features, List<Language> languages, boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws IOException, LuceneParseException;
- /**
- * Lists all Media found in an any TaxonDescription associated with this
- * taxon.
- *
- * @param taxon
- * @param includeRelationships
- * the given list of TaxonRelationshipEdges will be taken into
- * account when retrieving media associated with the given taxon.
- * Can be NULL.
- * @param limitToGalleries
- * whether to take only TaxonDescription into account which are
- * marked as gallery
- * @return
- * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
- */
- @Deprecated
- public List<Media> listTaxonDescriptionMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships, boolean limitToGalleries, List<String> propertyPath);
-
- /**
- * Lists all Media found in an any TaxonDescription, NameDescription,
- * SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.
- *
- * @param taxon
- * @param includeRelationships
- * the given list of TaxonRelationshipEdges will be taken into
- * account when retrieving media associated with the given taxon.
- * Can be NULL.
- * @param limitToGalleries
- * whether to take only descriptions into account which are
- * marked as gallery, can be NULL
- * @param includeTaxonDescriptions
- * whether to take TaxonDescriptions into account, can be NULL
- * @param includeOccurrences
- * whether to take TaxonDescriptions into account, can be NULL
- * @param includeTaxonNameDescriptions
- * whether to take TaxonNameDescriptions into account, can be NULL
- * @param propertyPath
- * @return
- */
- public List<Media> listMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
- Boolean limitToGalleries, Boolean includeTaxonDescriptions, Boolean includeOccurrences,
- Boolean includeTaxonNameDescriptions, List<String> propertyPath);
-
- /**
+ /**
* Lists all Media found in an any TaxonDescription, NameDescription,
* SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.
*
*/
public List<Media> listMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
Boolean limitToGalleries, Boolean includeTaxonDescriptions, Boolean includeOccurrences, Boolean includeOriginals,
- Boolean includeTaxonNameDescriptions, List<String> propertyPath);
+ Boolean includeTaxonNameDescriptions, boolean includeUnpublished, List<String> propertyPath);
public List<TaxonBase> findTaxaByID(Set<Integer> listOfIDs);
);
return new DefaultPagerImpl<>(pageNumber, numberOfResults, pageSize, mediaDTOs);
}
+
@Override
public Pager<Media> getMediaInHierarchy(SpecimenOrObservationBase<?> rootOccurence, boolean collectOriginalMedia, boolean collectDerivateMedia, Integer pageSize,
Integer pageNumber, List<String> propertyPaths) {
}
}
-
return new DefaultPagerImpl<>(pageNumber, Long.valueOf(media.size()), pageSize, media);
}
-
@Override
public Pager<Media> getMediaInHierarchy(SpecimenOrObservationBase<?> rootOccurence, Integer pageSize,
Integer pageNumber, List<String> propertyPaths) {
- return getMediaInHierarchy(rootOccurence, false, true, pageSize,
- pageNumber, propertyPaths);
+ return getMediaInHierarchy(rootOccurence, false, true, pageSize,
+ pageNumber, propertyPaths);
}
@Override
@Override
public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
- Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {
+ Taxon associatedTaxon, boolean includeUnpublished, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {
- return pageByAssociatedTaxon(type, includeRelationships, associatedTaxon, maxDepth, pageSize, pageNumber, orderHints, propertyPaths).getRecords();
+ return pageByAssociatedTaxon(type, includeRelationships, associatedTaxon, includeUnpublished, maxDepth, pageSize, pageNumber, orderHints, propertyPaths).getRecords();
}
@Override
}
@Override
- public <T extends SpecimenOrObservationBase> Collection<T> listRootUnitsByAssociatedTaxon(Class<T> type, Taxon associatedTaxon, List<OrderHint> orderHints, List<String> propertyPaths) {
- return pageRootUnitsByAssociatedTaxon(type, null, associatedTaxon, null, null, null, null, propertyPaths).getRecords();
+ public <T extends SpecimenOrObservationBase> Collection<T> listRootUnitsByAssociatedTaxon(
+ Class<T> type, Taxon associatedTaxon, boolean includeUnpublished, List<OrderHint> orderHints, List<String> propertyPaths) {
+ return pageRootUnitsByAssociatedTaxon(type, null, associatedTaxon, includeUnpublished, null, null, null, null, propertyPaths).getRecords();
}
@Override
public <T extends SpecimenOrObservationBase> Pager<T> pageRootUnitsByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
- Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
+ Taxon associatedTaxon, boolean includeUnpublished, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
List<String> propertyPaths) {
if (!getSession().contains(associatedTaxon)) {
// gather the IDs of all relevant root units
Set<UUID> rootUnitUuids = new HashSet<>();
- List<SpecimenOrObservationBase> records = listByAssociatedTaxon(null, includeRelationships, associatedTaxon, maxDepth, null, null, orderHints, propertyPaths);
+ List<SpecimenOrObservationBase> records = listByAssociatedTaxon(null, includeRelationships,
+ associatedTaxon, includeUnpublished, maxDepth, null, null, orderHints, propertyPaths);
for (SpecimenOrObservationBase<?> specimen : records) {
for (SpecimenOrObservationBase<?> rootUnit : findRootUnits(specimen.getUuid(), null)) {
if(type == null || type.isAssignableFrom(rootUnit.getClass())) {
return derivedUnits;
}
-// private Set<DerivateDTO> getDerivedUnitDTOsFor(DerivateDTO specimenDto, DerivedUnit specimen, HashMap<UUID, DerivateDTO> alreadyCollectedSpecimen) {
-// Set<DerivateDTO> derivedUnits = new HashSet<>();
-//// load
-// for (DerivationEvent derivationEvent : specimen.getDerivationEvents()) {
-// for (DerivedUnit derivative : derivationEvent.getDerivatives()) {
-// if (!alreadyCollectedSpecimen.containsKey(specimenDto.getUuid())){
-// PreservedSpecimenDTO dto;
-// if (derivative instanceof DnaSample){
-// dto = DNASampleDTO.newInstance(derivative);
-// }else{
-// dto = PreservedSpecimenDTO.newInstance(derivative);
-// }
-// alreadyCollectedSpecimen.put(dto.getUuid(), dto);
-// dto.addAllDerivates(getDerivedUnitDTOsFor(dto, derivative, alreadyCollectedSpecimen));
-// derivedUnits.add(dto);
-// }
-// }
-// }
-// return derivedUnits;
-// }
-
-
- @SuppressWarnings("unchecked")
@Override
public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includedRelationships,
- Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {
+ Taxon associatedTaxon, boolean includeUnpublished, Integer maxDepth, Integer pageSize, Integer pageNumber,
+ List<OrderHint> orderHints, List<String> propertyPaths) {
Set<Taxon> taxa = new HashSet<>();
Set<Integer> occurrenceIds = new HashSet<>();
List<T> occurrences = new ArrayList<>();
- boolean includeUnpublished = INCLUDE_UNPUBLISHED;
// Integer limit = PagerUtils.limitFor(pageSize);
// Integer start = PagerUtils.startFor(pageSize, pageNumber);
}
- @Override
- public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
- String taxonUUID, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {
-
- UUID uuid = UUID.fromString(taxonUUID);
- Taxon taxon = (Taxon) taxonService.load(uuid);
- return pageByAssociatedTaxon(type, includeRelationships, taxon, maxDepth, pageSize, pageNumber, orderHints, propertyPaths);
- }
-
@Override
@Transactional
public List<SpecimenOrObservationBaseDTO> listRootUnitDTOsByAssociatedTaxon(Set<TaxonRelationshipEdge> includedRelationships,
return associatedTaxa;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen, Integer limit, Integer start,
- List<OrderHint> orderHints, List<String> propertyPaths) {
- return listTypeDesignationTaxa(specimen, INCLUDE_UNPUBLISHED, limit, start, orderHints, propertyPaths);
- }
@Override
public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen, boolean includeUnpublished,
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
return associatedTaxa;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen, Integer limit,
- Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
- return listIndividualsAssociationTaxa(specimen, INCLUDE_UNPUBLISHED, limit, start, orderHints, propertyPaths);
- }
-
@Override
public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
return dao.getUuidAndTitleCache(limit, pattern);
}
- @Override
- public List<Media> listTaxonDescriptionMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships, boolean limitToGalleries, List<String> propertyPath){
- return listMedia(taxon, includeRelationships, limitToGalleries, true, false, false, propertyPath);
- }
-
- @Override
- public List<Media> listMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
- Boolean limitToGalleries, Boolean includeTaxonDescriptions, Boolean includeOccurrences,
- Boolean includeTaxonNameDescriptions, List<String> propertyPath) {
- return listMedia(taxon, includeRelationships, limitToGalleries, includeTaxonDescriptions, includeOccurrences, false,
- includeTaxonNameDescriptions, propertyPath);
- }
-
@Override
public List<Media> listMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
Boolean limitToGalleries, Boolean includeTaxonDescriptions, Boolean includeOccurrences,
Boolean includeOriginalOccurences, Boolean includeTaxonNameDescriptions,
- List<String> propertyPath) {
-
- //TODO let inherit
- boolean includeUnpublished = INCLUDE_UNPUBLISHED;
+ boolean includeUnpublished, List<String> propertyPath) {
// LogUtils.setLevel(logger, Level.TRACE);
// LogUtils.setLevel("org.hibernate.SQL", Level.TRACE);
public List<String> getPropertyPaths();\r
public void setPropertyPaths(List<String> propertyPaths);\r
\r
-}\r
+ public boolean isIncludeUnpublished();\r
+ public void setIncludeUnpublished(boolean includeUnpublished);\r
+}
\ No newline at end of file
import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorImpl;
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.pager.Pager;
-import eu.etaxonomy.cdm.common.DoubleResult;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
import eu.etaxonomy.cdm.persistence.dao.common.Restriction.Operator;
-import eu.etaxonomy.cdm.persistence.dto.TaxonNameParts;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
public void testFindByTitleTitle_using_Configurator(){
String searchString = "*";
- IdentifiableServiceConfiguratorImpl<TaxonName> searchConfigurator = new IdentifiableServiceConfiguratorImpl<TaxonName>();
+ IdentifiableServiceConfiguratorImpl<TaxonName> searchConfigurator = new IdentifiableServiceConfiguratorImpl<>();
searchConfigurator = IdentifiableServiceConfiguratorFactory.getConfigurator(TaxonName.class);
searchConfigurator.setTitleSearchString(searchString);
assertEquals(taxon, associatedTaxa.iterator().next());
//check association (IndividualsAssociations + TypeDesignations) taxon (name) -> specimen
- List<DerivedUnit> byAssociatedTaxon = occurrenceService.listByAssociatedTaxon(DerivedUnit.class, null, taxon, null, null, null, null, null);
+ List<DerivedUnit> byAssociatedTaxon = occurrenceService.listByAssociatedTaxon(
+ DerivedUnit.class, null, taxon, includeUnpublished, null, null, null, null, null);
assertNotNull(byAssociatedTaxon);
assertEquals(2, byAssociatedTaxon.size());
assertTrue(byAssociatedTaxon.contains(associatedSpecimen));