use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivitySubscriptionPermissionChecker method checkPermissionForFaQuery.
public SubscriptionPermissionResponse checkPermissionForFaQuery(FAQuery faQuery) throws ActivityModuleException {
SubscriptionDataRequest subscriptionDataRequest = SubscriptionMapper.mapToSubscriptionDataRequest(faQuery);
String subscrPermissionRequest;
try {
subscrPermissionRequest = JAXBUtils.marshallJaxBObjectToString(subscriptionDataRequest);
} catch (JAXBException e) {
throw new ActivityModuleException("JAXBException while trying to unmarshall to SubscriptionDataRequest from Subscription Module!", e);
}
return getPermissionFromSubscription(subscrPermissionRequest, activityConsumerBean.getDestination());
}
use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityToSubscriptionMapperTest method testMapToSubscriptionDataRequest.
@Test
public void testMapToSubscriptionDataRequest() {
SubscriptionDataRequest request = SubscriptionMapper.mapToSubscriptionDataRequest(fluxfaQueryMessage.getFAQuery());
assertEquals(CriteriaType.SENDER, request.getQuery().getCriteria().get(0).getCriteria());
assertEquals(CriteriaType.VESSEL, request.getQuery().getCriteria().get(1).getCriteria());
assertEquals(CriteriaType.VESSEL, request.getQuery().getCriteria().get(2).getCriteria());
assertEquals(CriteriaType.VESSEL, request.getQuery().getCriteria().get(3).getCriteria());
assertEquals(CriteriaType.VESSEL, request.getQuery().getCriteria().get(4).getCriteria());
assertEquals(CriteriaType.VALIDITY_PERIOD, request.getQuery().getCriteria().get(5).getCriteria());
assertEquals(CriteriaType.VALIDITY_PERIOD, request.getQuery().getCriteria().get(6).getCriteria());
assertEquals(SubCriteriaType.ORGANISATION, request.getQuery().getCriteria().get(0).getSubCriteria());
assertEquals(SubCriteriaType.VESSELID, request.getQuery().getCriteria().get(1).getSubCriteria());
assertEquals(SubCriteriaType.VESSELID, request.getQuery().getCriteria().get(2).getSubCriteria());
assertEquals(SubCriteriaType.TRIPID, request.getQuery().getCriteria().get(3).getSubCriteria());
assertEquals(SubCriteriaType.CONSOLIDATED, request.getQuery().getCriteria().get(4).getSubCriteria());
assertEquals(SubCriteriaType.START_DATE, request.getQuery().getCriteria().get(5).getSubCriteria());
assertEquals(SubCriteriaType.END_DATE, request.getQuery().getCriteria().get(6).getSubCriteria());
assertEquals(ValueType.SCHEME_ID, request.getQuery().getCriteria().get(0).getValueType());
assertEquals(ValueType.IRCS, request.getQuery().getCriteria().get(1).getValueType());
assertEquals(ValueType.CFR, request.getQuery().getCriteria().get(2).getValueType());
assertEquals(ValueType.EU_TRIP_ID, request.getQuery().getCriteria().get(3).getValueType());
assertEquals(ValueType.BOOLEAN_VALUE, request.getQuery().getCriteria().get(4).getValueType());
assertEquals(ValueType.YYYY_MM_DD_T_HH_MM_SS_SSSZ, request.getQuery().getCriteria().get(5).getValueType());
assertEquals(ValueType.YYYY_MM_DD_T_HH_MM_SS_SSSZ, request.getQuery().getCriteria().get(6).getValueType());
assertEquals("BEL", request.getQuery().getCriteria().get(0).getValue());
assertEquals("PD2438", request.getQuery().getCriteria().get(1).getValue());
assertEquals("SVN123456789", request.getQuery().getCriteria().get(2).getValue());
assertEquals("FRA-TRP-2016122102030", request.getQuery().getCriteria().get(3).getValue());
assertEquals("Y", request.getQuery().getCriteria().get(4).getValue());
// assertEquals("2016-07-01T02:00:00.000+02:00", request.getQuery().getCriteria().get(5).getValue());
// assertEquals("2017-07-01T02:00:00.000+02:00", request.getQuery().getCriteria().get(6).getValue());
DateUtils.parseToUTCDate("2016-07-01T02:00:00.000+02:00", request.getQuery().getCriteria().get(5).getValueType().value());
DateUtils.parseToUTCDate("2017-07-01T02:00:00.000+02:00", request.getQuery().getCriteria().get(6).getValueType().value());
}
use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class SubscriptionMapper method mapToSubscriptionDataRequest.
public static SubscriptionDataRequest mapToSubscriptionDataRequest(FLUXFAReportMessage fluxfaReportMessage) {
SubscriptionDataRequest request = new SubscriptionDataRequest();
request.setMethod(SubscriptionModuleMethod.MODULE_ACCESS_PERMISSION_REQUEST);
SubscriptionDataQuery query = new SubscriptionDataQuery();
query.setMessageType(MessageType.FLUX_FA_REPORT_MESSAGE);
// TODO implement mapping
request.setQuery(query);
return request;
}
use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class SubscriptionMapper method mapToSubscriptionDataRequest.
public static SubscriptionDataRequest mapToSubscriptionDataRequest(FAQuery faQuery) {
SubscriptionDataRequest request = new SubscriptionDataRequest();
request.setMethod(SubscriptionModuleMethod.MODULE_ACCESS_PERMISSION_REQUEST);
SubscriptionDataQuery query = new SubscriptionDataQuery();
query.setMessageType(MessageType.FLUX_FA_QUERY_MESSAGE);
query.getCriteria().addAll(mapFluxPartyToSenderSubscriptionCriteria(faQuery.getSubmitterFLUXParty()));
query.getCriteria().addAll(mapFAQueryParametersToSubscriptionCriteria(faQuery.getSimpleFAQueryParameters()));
query.getCriteria().addAll(mapDelimitedPeriodToFaQuerySubscriptionCriteria(faQuery.getSpecifiedDelimitedPeriod()));
request.setQuery(query);
return request;
}
use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ReportDocumentResource method test.
@POST
@Produces(value = { MediaType.APPLICATION_XML })
@Consumes(value = { MediaType.APPLICATION_XML })
public Object test(FLUXFAQueryMessage fluxfaQueryMessage) {
SubscriptionDataRequest subscriptionDataRequest = SubscriptionMapper.mapToSubscriptionDataRequest(fluxfaQueryMessage.getFAQuery());
List<SubscriptionDataCriteria> queryCriteria = subscriptionDataRequest.getQuery().getCriteria();
return faQueryService.getReportsByCriteria(queryCriteria);
}
Aggregations