Project

General

Profile

task #8414

occurrence controller code cleaning and harmonization

Added by Andreas Kohlbecker 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Highest
Category:
cdmlib-remote
Target version:
Start date:
07/25/2019
Due date:
% Done:

100%

Severity:
normal

Description

eu.etaxonomy.cdm.remote.controller.OccurrenceController.doGetOccurencesDTO(@PathVariable(value="uuid") UUID uuid, HttpServletRequest request, HttpServletResponse response) throws IOException

  • rename to *FieldUnitDTO as it returns FieldUnitDTOs DONE

  • In doGetFieldUnitDTO maybe also in other methods, the publish flag is checked only for the derivative for which the uuid is passed to the method. Originals are not checked though! --> #8424

  • FieldUnitDTOOccurrenceServiceImpl.findFieldUnitDTO(DerivateDTO derivedUnitDTO, Collection<FieldUnitDTO> fieldUnits, HashMap<UUID, DerivateDTO> alreadyCollectedSpecimen) misses documentation regarding the optional params which are not being used in most cases (fieldUnits, alreadyCollectedSpecimen) --> #8458

    • I think this method should be transactional (readonly) DONE
    • My first impression is that this method should be split in two methods, one method to get the FieldUnitDTO for a given DerivedUnit (instead of PreservedSpecimenDTO) and another method which does the more fancy stuff.
    • The method only adds the derived unit which is passed as parameter, what about all other derived units? --> This works as explained below
      • This is because this FieldUnitDTO should only contain the subtree of the passed derivedUnitDTO, the whole list of derivates can be seen when clicking on the details button. Therefore the method should be renamed to findFieldUnitDtoSubTree or something like this.
  • FieldUnitDTO:

    • has the field taxonRelatedDerivedUnits. What is the purpose of this field? Is this field meant to hold derived units associated to taxa via IndividualsAssociations?
      • This can be removed, this is a relict of a first approach to get only the derived units belonging to a taxon --> #8425
    • why is FieldUnitDTO providing a newInstance method? As far as I know the only reason for doing so is a situation in which the newInstanceMethod returns difference types, which the new operator can not do. The actual implementation of the newInstance method differs from the constructor:
    /**
     * @param fieldUnit
     */
    public FieldUnitDTO(FieldUnit fieldUnit) {
        super(fieldUnit);
    }


    public static FieldUnitDTO newInstance(FieldUnit fieldUnit){
        FieldUnitDTO fieldUnitDto = new FieldUnitDTO(fieldUnit);
        if (fieldUnit.getGatheringEvent() != null){
            fieldUnitDto.gatheringEvent = GatheringEventDTO.newInstance(fieldUnit.getGatheringEvent());
        }
        fieldUnitDto.setRecordBase(fieldUnit.getRecordBasis().getMessage());
        fieldUnitDto.setListLabel(fieldUnit.getTitleCache());

        return fieldUnitDto;

    }

is this by purpose? To me this looks like an error....

  • maybe this can be included into the constructor.

OccurrenceServiceImpl.assembleFieldUnitDTO(..) is using the constructor and adds the gathering event to the dto which is done in the newInstance method. --> TODO: needs review and harmonization** (I think the newInstance Method should be removed completely as it causes confusion) ---> #8456


Related issues

Related to Edit - bug #8423: OccurrenceServiceImpl.findFieldUnitDTO() fails to merge derivation paths when a FieldUnit has two derivatives New 07/30/2019
Copied from Edit - task #8406: specimens and occurrence code cleaning and harmonization Closed 07/25/2019
Copied to Edit - task #8424: evaluate publish flags in the full derivative path New 07/25/2019
Copied to Edit - task #8425: FieldUnitDTO: remove taxonRelatedDerivedUnits Closed 07/25/2019
Copied to Edit - task #8456: FieldUnitDTO: remove newInstanceMethod Closed 08/12/2019
Copied to Edit - task #8458: document FieldUnitDTOOccurrenceServiceImpl.findFieldUnitDTO() In Progress 08/12/2019

Associated revisions

Revision d2cbce25 (diff)
Added by Andreas Kohlbecker 4 months ago

ref #8414 refactoring OccurrenceController:
- method to load a single FieldUnitDTO
- adding all intermediate derivatives to the FieldUnitDTO
- renaming service endpoint mapping to fieldUnitDTO
- adding missing @Transactional annotations
- Factory method in abstract DerivateDTO to construct specific subtype DTOs

Revision 4c158e4e (diff)
Added by Andreas Kohlbecker 4 months ago

ref #8414 adapting portal to modified service mapping

Revision 2e09903a (diff)
Added by Andreas Kohlbecker 4 months ago

ref #8414 renaming taxon/{uuid}/specimensOrObservationDTOs to taxon/{uuid}/fieldUnitDTOs

Revision af8e4c4e (diff)
Added by Andreas Kohlbecker 4 months ago

ref #8414 adding cycle detection to loadFieldUnitDTO()

History

#1 Updated by Andreas Kohlbecker 4 months ago

  • Copied from task #8406: specimens and occurrence code cleaning and harmonization added

#2 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#3 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#4 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#5 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#6 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#7 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#8 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#9 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#10 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#11 Updated by Katja Luther 4 months ago

  • Description updated (diff)

#12 Updated by Katja Luther 4 months ago

http://test.e-taxonomy.eu/dataportal/preview/algaterra-new/cdm_dataportal/taxon/c3350592-db9d-44cb-80ed-29bfb685e3a0/specimens

in this example several specimen associated to a taxon can be seen in only one tree.

#13 Updated by Andreas Kohlbecker 4 months ago

  • Related to bug #8423: OccurrenceServiceImpl.findFieldUnitDTO() fails to merge derivation paths when a FieldUnit has two derivatives added

#14 Updated by Andreas Kohlbecker 4 months ago

  • Copied to task #8424: evaluate publish flags in the full derivative path added

#15 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#16 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#17 Updated by Andreas Kohlbecker 4 months ago

  • Copied to task #8425: FieldUnitDTO: remove taxonRelatedDerivedUnits added

#18 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#19 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 30

#20 Updated by Andreas Kohlbecker 3 months ago

  • Description updated (diff)

#21 Updated by Andreas Kohlbecker 3 months ago

  • Related to task #8457: FieldUnitDTO: remove taxonRelatedDerivedUnits added

#22 Updated by Andreas Kohlbecker 3 months ago

  • Related to deleted (task #8457: FieldUnitDTO: remove taxonRelatedDerivedUnits)

#23 Updated by Andreas Kohlbecker 3 months ago

  • Copied to task #8457: FieldUnitDTO: remove taxonRelatedDerivedUnits added

#24 Updated by Andreas Kohlbecker 3 months ago

  • Copied to task #8456: FieldUnitDTO: remove newInstanceMethod added

#25 Updated by Andreas Kohlbecker 3 months ago

  • Copied to deleted (task #8457: FieldUnitDTO: remove taxonRelatedDerivedUnits)

#26 Updated by Andreas Kohlbecker 3 months ago

  • Copied to task #8458: document FieldUnitDTOOccurrenceServiceImpl.findFieldUnitDTO() added

#27 Updated by Andreas Kohlbecker 3 months ago

  • Description updated (diff)

#28 Updated by Andreas Kohlbecker 3 months ago

  • Description updated (diff)

#29 Updated by Andreas Kohlbecker 3 months ago

  • Description updated (diff)
  • Status changed from In Progress to Closed
  • % Done changed from 30 to 100

all remaining tasks copied to new tickets

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)