Search in sources :

Example 1 with SubscriptionDataRequest

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());
}
Also used : JAXBException(javax.xml.bind.JAXBException) SubscriptionDataRequest(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest) ActivityModuleException(eu.europa.ec.fisheries.ers.service.exception.ActivityModuleException)

Example 2 with SubscriptionDataRequest

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());
}
Also used : SubscriptionDataRequest(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest) Test(org.junit.Test)

Example 3 with SubscriptionDataRequest

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;
}
Also used : SubscriptionDataQuery(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataQuery) SubscriptionDataRequest(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest)

Example 4 with SubscriptionDataRequest

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;
}
Also used : SubscriptionDataQuery(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataQuery) SubscriptionDataRequest(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest)

Example 5 with SubscriptionDataRequest

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);
}
Also used : SubscriptionDataCriteria(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria) SubscriptionDataRequest(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes)

Aggregations

SubscriptionDataRequest (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest)7 JAXBException (javax.xml.bind.JAXBException)3 ActivityModuleException (eu.europa.ec.fisheries.ers.service.exception.ActivityModuleException)2 SubscriptionDataQuery (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataQuery)2 MapToSubscriptionRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.MapToSubscriptionRequest)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1 SubscriptionDataCriteria (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria)1 JMSException (javax.jms.JMSException)1 TextMessage (javax.jms.TextMessage)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1 Test (org.junit.Test)1 FLUXFAQueryMessage (un.unece.uncefact.data.standard.fluxfaquerymessage._3.FLUXFAQueryMessage)1 FLUXFAReportMessage (un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage)1