Project

General

Profile

Actions

task #8456

closed

FieldUnitDTO: remove newInstanceMethod

Added by Andreas Kohlbecker over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
New
Assignee:
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
normal

Description

copied from #8414

FieldUnitDTO providing a newInstance method. This has to be removed:

    /**
     * @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)


Related issues

Related to EDIT - task #8425: FieldUnitDTO: remove taxonRelatedDerivedUnitsClosedKatja Luther

Actions
Copied from EDIT - task #8414: occurrence controller code cleaning and harmonizationClosedAndreas Kohlbecker

Actions
Actions

Also available in: Atom PDF