use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method getFishingActivityForTripsRequest.
@Override
public void getFishingActivityForTripsRequest(@Observes @GetFishingActivityForTripsRequestEvent EventMessage message) {
log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + " Fishing activities related to trips.");
try {
log.debug(message.getJmsMessage().getText());
GetFishingActivitiesForTripRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), GetFishingActivitiesForTripRequest.class);
GetFishingActivitiesForTripResponse response = activityServiceBean.getFaAndTripIdsFromTripIds(request.getFaAndTripIds());
String responseStr = JAXBMarshaller.marshallJaxBObjectToString(response);
producer.sendResponseMessageToSender(message.getJmsMessage(), responseStr);
} catch (ActivityModelMarshallException | JMSException | ServiceException | MessageException e) {
sendError(message, e);
}
}
use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse 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.GetFishingActivitiesForTripResponse in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBeanTest method setUp.
@Before
@SneakyThrows
public void setUp() {
nonUniqueIdsMessage = new ActiveMQTextMessage(session);
Whitebox.setInternalState(nonUniqueIdsMessage, "text", new SimpleString(getStrRequest1()));
Whitebox.setInternalState(nonUniqueIdsMessage, "jmsCorrelationID", "SomeCorrId");
nonUniqueIdsMessageEventMessage = new EventMessage(nonUniqueIdsMessage);
faAndTripIdsFromTripIdsMessage = new ActiveMQTextMessage(session);
Whitebox.setInternalState(faAndTripIdsFromTripIdsMessage, "text", new SimpleString(getStrRequest2()));
Whitebox.setInternalState(faAndTripIdsFromTripIdsMessage, "jmsCorrelationID", "SomeCorrId");
faAndTripIdsFromTripIdsEventMessage = new EventMessage(faAndTripIdsFromTripIdsMessage);
getNonUniqueIdsResponse = JAXBMarshaller.unmarshallTextMessage(getResponseStr1(), GetNonUniqueIdsResponse.class);
getFishingActivitiesForTripResponse = JAXBMarshaller.unmarshallTextMessage(getResponseStr2(), GetFishingActivitiesForTripResponse.class);
}
use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse 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()));
}
Aggregations