Search in sources :

Example 1 with FaIdsListWithTripIdMap

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

the class ActivityServiceBean method getFaAndTripIdsFromTripIds.

@Override
public GetFishingActivitiesForTripResponse getFaAndTripIdsFromTripIds(List<FishingActivityForTripIds> faAndTripIds) throws ServiceException {
    GetFishingActivitiesForTripResponse response = new GetFishingActivitiesForTripResponse();
    List<FaIdsListWithTripIdMap> responseList = new ArrayList<>();
    response.setFaWithIdentifiers(responseList);
    for (FishingActivityForTripIds faTripId : faAndTripIds) {
        List<FishingActivityEntity> fishingActivies = fishingActivityDao.getFishingActivityForTrip(faTripId.getTripId(), faTripId.getTripSchemeId(), faTripId.getFishActTypeCode(), faTripId.getFluxRepDocPurposeCodes());
        for (FishingActivityEntity faEntity : fishingActivies) {
            addToIdsList(responseList, faEntity);
        }
    }
    return response;
}
Also used : FaIdsListWithTripIdMap(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaIdsListWithTripIdMap) FishingActivityForTripIds(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityForTripIds) ArrayList(java.util.ArrayList) GetFishingActivitiesForTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 2 with FaIdsListWithTripIdMap

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

the class ActivityServiceBean method addToIdsList.

private void addToIdsList(List<FaIdsListWithTripIdMap> responseList, FishingActivityEntity faEntity) {
    Set<FishingTripIdentifierEntity> fishingTripIdentifiers = faEntity.getFishingTrips().iterator().next().getFishingTripIdentifiers();
    List<FishingActivityWithIdentifiers> faIdentifiers = mapToActivityIdsAndType(faEntity.getFishingActivityIdentifiers(), faEntity.getTypeCode());
    for (FishingTripIdentifierEntity tripIdentifEntity : fishingTripIdentifiers) {
        FaIdsListWithTripIdMap existingActWithIdentifiers = getElementWithTripId(responseList, tripIdentifEntity.getTripId());
        if (null != existingActWithIdentifiers) {
            existingActWithIdentifiers.getFaIdentifierLists().addAll(faIdentifiers);
        } else {
            responseList.add(new FaIdsListWithTripIdMap(tripIdentifEntity.getTripId(), tripIdentifEntity.getTripSchemeId(), faIdentifiers));
        }
    }
}
Also used : FaIdsListWithTripIdMap(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaIdsListWithTripIdMap) FishingTripIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity) FishingActivityWithIdentifiers(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityWithIdentifiers)

Aggregations

FaIdsListWithTripIdMap (eu.europa.ec.fisheries.uvms.activity.model.schemas.FaIdsListWithTripIdMap)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)1 FishingActivityForTripIds (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityForTripIds)1 FishingActivityWithIdentifiers (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityWithIdentifiers)1 GetFishingActivitiesForTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse)1 ArrayList (java.util.ArrayList)1