Search in sources :

Example 1 with IdentifierDto

use of eu.europa.ec.fisheries.ers.service.dto.view.IdentifierDto in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityTranshipmentViewMapper method populateActivityDetails.

protected ActivityDetailsDto populateActivityDetails(FishingActivityEntity faEntity, ActivityDetailsDto activityDetails) {
    Map<String, String> idMap = new HashMap<>();
    for (FishingActivityIdentifierEntity idEntity : faEntity.getFishingActivityIdentifiers()) {
        idMap.put(idEntity.getFaIdentifierId(), idEntity.getFaIdentifierSchemeId());
    }
    Set<IdentifierDto> identifierDtos = FishingActivityIdentifierMapper.INSTANCE.mapToIdentifierDTOSet(faEntity.getFishingActivityIdentifiers());
    activityDetails.setIdentifiers(identifierDtos);
    Set<DelimitedPeriodEntity> delimitedPeriodEntitySet = faEntity.getDelimitedPeriods();
    if (!Collections.isEmpty(delimitedPeriodEntitySet)) {
        DelimitedPeriodEntity delimitedPeriod = delimitedPeriodEntitySet.iterator().next();
        DelimitedPeriodDTO delimitedPeriodDTO = DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodDTO(delimitedPeriod);
        activityDetails.setTranshipmentTime(delimitedPeriodDTO);
        // Override occurrence date from delimited period
        activityDetails.setOccurrence(delimitedPeriod.getStartDate());
    }
    return activityDetails;
}
Also used : DelimitedPeriodEntity(eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity) IdentifierDto(eu.europa.ec.fisheries.ers.service.dto.view.IdentifierDto) HashMap(java.util.HashMap) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity) DelimitedPeriodDTO(eu.europa.ec.fisheries.ers.service.dto.DelimitedPeriodDTO)

Aggregations

DelimitedPeriodEntity (eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity)1 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)1 DelimitedPeriodDTO (eu.europa.ec.fisheries.ers.service.dto.DelimitedPeriodDTO)1 IdentifierDto (eu.europa.ec.fisheries.ers.service.dto.view.IdentifierDto)1 HashMap (java.util.HashMap)1