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;
}
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));
}
}
}
Aggregations