ref #10322, ref #9524 allow loading annotations without type
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / portal / TaxonPageDtoLoaderBase.java
index 8ba993d9e2cbf8938083ac48d2a7989ca80e34ce..9831656cc9a0499897f33151d16a9b4f38983cf1 100644 (file)
@@ -119,7 +119,7 @@ public abstract class TaxonPageDtoLoaderBase {
             //annotation
             for (Annotation annotation : annotatable.getAnnotations()) {
                 if ((annotation.getAnnotationType() != null
-                        //config == null currently needs to be allowed as it is also used by DistributionInfoBuilder an
+                        //config == null currently needs to be allowed as it is also used by DistributionInfoBuilder and
                         //also for now empty annotation types needs to be interpreted as "no filter" as we do not distinguish
                         //null and empty yet, this may change in future
                         && (config == null || config.getAnnotationTypes().isEmpty()
@@ -135,7 +135,7 @@ public abstract class TaxonPageDtoLoaderBase {
                     UUID uuidAnnotationType = annotation.getAnnotationType() == null ? null :annotation.getAnnotationType().getUuid();
                     annotationDto.setTypeUuid(uuidAnnotationType);
                     //language etc. currently not yet used
-                }else if (config != null && !config.getAnnotationTypes().isEmpty() && config.getAnnotationTypes().contains(AnnotationType.uuidUntyped) &&  (annotation.getAnnotationType() == null)){
+                }else if (config != null && config.getAnnotationTypes().contains(AnnotationType.uuidUntyped) &&  (annotation.getAnnotationType() == null)){
                     AnnotationDto annotationDto = new AnnotationDto();
                     annotatableDto.addAnnotation(annotationDto);
                     //TODO id needed? but need to adapt dto and container then
@@ -175,7 +175,7 @@ public abstract class TaxonPageDtoLoaderBase {
             SingleSourcedEntityBase sourced = CdmBase.deproxy(cdmBase, SingleSourcedEntityBase.class);
             SingleSourcedDto sourcedDto = (SingleSourcedDto)dto;
             NamedSource source = sourced.getSource();
-            if (source != null && isPublicSource(source) && !source.checkEmpty()) {
+            if (source != null && isPublicSource(source) && !source.checkEmpty(true)) {
                 SourceDto sourceDto = makeSource(config, source);
                 sourcedDto.setSource(sourceDto);
             }
@@ -218,11 +218,13 @@ public abstract class TaxonPageDtoLoaderBase {
             linkedObject = source.getCdmSource();
         }
 
+        sourceDto.setCitationDetail(source.getCitationMicroReference());
         //citation doi & uri & links
         Reference ref = source.getCitation();
         if (ref != null) {
-            sourceDto.setDoi(ref.getDoiString());
+            sourceDto.setDoi(ref.getDoiUriString());
             sourceDto.setUri(ref.getUri());
+            //TODO do we really want to take the sourceDto.uuid from the ref.uuid?
             sourceDto.setUuid(ref.getUuid());
             sourceDto.setOriginalInfo(source.getOriginalInfo());
             Set<ExternalLink> links = ref.getLinks();
@@ -235,6 +237,7 @@ public abstract class TaxonPageDtoLoaderBase {
                     sourceDto.addLink(link.getUri());
                 }
             }
+            sourceDto.setSortableDate(ref.getSortableDateString());
         }
 
         //label