Search in sources :

Example 1 with VesselContactPartyType

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselContactPartyType in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBean method getFishingActivitySummaryList.

/**
 * This method creates FishingActivitySummary object from FishingActivityEntity object retrieved from database.
 *
 * @param uniqueActivityIdList      This method helps parent function to collect FishingActivities for all the fishingTrips. In order to avoid duplicate fishing Activities, we need to maintain uniqueActivityIdList
 * @param fishingActivityEntityList
 * @return
 */
public List<FishingActivitySummary> getFishingActivitySummaryList(List<FishingActivityEntity> fishingActivityEntityList, List<Integer> uniqueActivityIdList) {
    List<FishingActivitySummary> fishingActivitySummaryList = new ArrayList<>();
    if (CollectionUtils.isEmpty(uniqueActivityIdList)) {
        uniqueActivityIdList = new ArrayList<>();
    }
    for (FishingActivityEntity fishingActivityEntity : fishingActivityEntityList) {
        if (fishingActivityEntity != null && uniqueActivityIdList.add(fishingActivityEntity.getId())) {
            FishingActivitySummary fishingActivitySummary = FishingActivityMapper.INSTANCE.mapToFishingActivitySummary(fishingActivityEntity);
            ContactPartyEntity contactParty = getContactParty(fishingActivityEntity);
            if (contactParty != null) {
                VesselContactPartyType vesselContactParty = FishingActivityMapper.INSTANCE.mapToVesselContactParty(contactParty);
                fishingActivitySummary.setVesselContactParty(vesselContactParty);
            }
            if (fishingActivitySummary != null) {
                fishingActivitySummaryList.add(fishingActivitySummary);
            }
        }
    }
    return fishingActivitySummaryList;
}
Also used : FishingActivitySummary(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary) ArrayList(java.util.ArrayList) VesselContactPartyType(eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselContactPartyType) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 2 with VesselContactPartyType

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselContactPartyType in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripIdSearchBuilder method getFishingActivitySummary.

private FishingActivitySummary getFishingActivitySummary(Set<Integer> uniqueFishingActivityIdList, FishingTripEntity entity) {
    FishingActivitySummary fishingActivitySummary = null;
    FishingActivityEntity fishingActivityEntity = entity.getFishingActivity();
    if (fishingActivityEntity != null && uniqueFishingActivityIdList.add(fishingActivityEntity.getId())) {
        fishingActivitySummary = FishingActivityMapper.INSTANCE.mapToFishingActivitySummary(entity.getFishingActivity());
        ContactPartyEntity contactParty = getContactParty(fishingActivityEntity);
        if (contactParty != null) {
            VesselContactPartyType vesselContactParty = FishingActivityMapper.INSTANCE.mapToVesselContactParty(contactParty);
            fishingActivitySummary.setVesselContactParty(vesselContactParty);
        }
    }
    return fishingActivitySummary;
}
Also used : FishingActivitySummary(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary) VesselContactPartyType(eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselContactPartyType) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Aggregations

ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)2 FishingActivitySummary (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary)2 VesselContactPartyType (eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselContactPartyType)2 ArrayList (java.util.ArrayList)1