Search in sources :

Example 1 with FishingActivityForTripIds

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityForTripIds 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 FishingActivityForTripIds

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

the class ActivityServiceBeanTest method testGetFaAndTripIdsResponse.

@Test
@SneakyThrows
public void testGetFaAndTripIdsResponse() {
    List<String> flRepPurpCodes = new ArrayList<String>() {

        {
            add("1");
            add("9");
        }
    };
    when(fishingActivityDao.getFishingActivityForTrip(any(String.class), any(String.class), any(String.class), any(flRepPurpCodes.getClass()))).thenReturn(mockFishActEntities());
    GetFishingActivitiesForTripResponse response = activityService.getFaAndTripIdsFromTripIds(Arrays.asList(new FishingActivityForTripIds("faTypeCode", "tripId", "tripSchemeId", flRepPurpCodes)));
    assertNotNull(response);
    assertTrue(CollectionUtils.isNotEmpty(response.getFaWithIdentifiers()));
}
Also used : FishingActivityForTripIds(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityForTripIds) ArrayList(java.util.ArrayList) GetFishingActivitiesForTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Aggregations

FishingActivityForTripIds (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityForTripIds)2 GetFishingActivitiesForTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse)2 ArrayList (java.util.ArrayList)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FaIdsListWithTripIdMap (eu.europa.ec.fisheries.uvms.activity.model.schemas.FaIdsListWithTripIdMap)1 SneakyThrows (lombok.SneakyThrows)1 Test (org.junit.Test)1