Project

General

Profile

task #8414

Updated by Andreas Kohlbecker over 4 years ago

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

 * rename to *FieldUnitDTO as it returns `FieldUnitDTO`s 

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

 * `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) 
     * I think this method should be transactional (readonly) 
     * 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? These seem to be missing! This **needs to be FIXED** 

 * FieldUnitDTO: 
     * has the field    `taxonRelatedDerivedUnits`. What is the purpose of this field? Is this field meant to hold derived units associated to taxa via `IndividualsAssociation`s?  
     * 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: 

 ~~~java 
     /** 
      * @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.... 

 `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) 

Back