Search in sources :

Example 1 with SubscriptionDataCriteria

use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class FAQueryServiceBean method getReportsByCriteria.

@Override
public Object getReportsByCriteria(List<SubscriptionDataCriteria> subscriptionDataCriteria) {
    if (CollectionUtils.isNotEmpty(subscriptionDataCriteria)) {
        String consolidated = "N";
        String tripID = null;
        String vesselId = null;
        String schemeId = null;
        String endDate = null;
        String startDate = null;
        for (SubscriptionDataCriteria dataCriteria : subscriptionDataCriteria) {
            SubCriteriaType subCriteria = dataCriteria.getSubCriteria();
            String valueType = dataCriteria.getValueType().value();
            String value = dataCriteria.getValue();
            if (subCriteria == SubCriteriaType.END_DATE) {
                endDate = value;
            } else if (subCriteria == SubCriteriaType.START_DATE) {
                startDate = value;
            } else if (subCriteria == SubCriteriaType.TRIPID) {
                tripID = value;
            } else if (subCriteria == SubCriteriaType.CONSOLIDATED) {
                consolidated = value;
            } else if (subCriteria == SubCriteriaType.VESSELID) {
                schemeId = valueType;
                vesselId = value;
            }
        }
        List<FaReportDocumentEntity> faReportDocumentsForTrip = FAReportDAO.loadReports(tripID, consolidated, vesselId, schemeId, startDate, endDate);
        ActivityEntityToModelMapper faReportEntityToModelMapper = new ActivityEntityToModelMapper();
        return faReportEntityToModelMapper.mapToFLUXFAReportMessage(faReportDocumentsForTrip);
    }
    return null;
}
Also used : SubCriteriaType(eu.europa.ec.fisheries.wsdl.subscription.module.SubCriteriaType) ActivityEntityToModelMapper(eu.europa.ec.fisheries.ers.service.mapper.ActivityEntityToModelMapper) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) SubscriptionDataCriteria(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria)

Example 2 with SubscriptionDataCriteria

use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class SubscriptionMapper method mapDelimitedPeriodToFaQuerySubscriptionCriteria.

private static List<SubscriptionDataCriteria> mapDelimitedPeriodToFaQuerySubscriptionCriteria(DelimitedPeriod period) {
    List<SubscriptionDataCriteria> dataCriteriaList = new ArrayList<>();
    if (period != null) {
        SubscriptionDataCriteria startDateTimeCriteria = createCriteria(VALIDITY_PERIOD, START_DATE, YYYY_MM_DD_T_HH_MM_SS_SSSZ, period.getStartDateTime().getDateTime().toString());
        dataCriteriaList.add(startDateTimeCriteria);
        SubscriptionDataCriteria endDateTimeCriteria = createCriteria(VALIDITY_PERIOD, END_DATE, YYYY_MM_DD_T_HH_MM_SS_SSSZ, period.getEndDateTime().getDateTime().toString());
        dataCriteriaList.add(endDateTimeCriteria);
    }
    return dataCriteriaList;
}
Also used : ArrayList(java.util.ArrayList) SubscriptionDataCriteria(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria)

Example 3 with SubscriptionDataCriteria

use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class SubscriptionMapper method mapFAQueryParametersToSubscriptionCriteria.

private static List<SubscriptionDataCriteria> mapFAQueryParametersToSubscriptionCriteria(List<FAQueryParameter> faQueryParameters) {
    List<SubscriptionDataCriteria> dataCriteriaList = new ArrayList<>();
    for (FAQueryParameter faQueryParameter : faQueryParameters) {
        SubscriptionDataCriteria criteria = new SubscriptionDataCriteria();
        criteria.setCriteria(CriteriaType.VESSEL);
        CodeType faQueryParameterTypeCode = faQueryParameter.getTypeCode();
        if (faQueryParameterTypeCode != null) {
            criteria.setSubCriteria(SubCriteriaType.valueOf(faQueryParameterTypeCode.getValue()));
        }
        IDType valueID = faQueryParameter.getValueID();
        if (valueID != null) {
            criteria.setValueType(ValueType.valueOf(faQueryParameter.getValueID().getSchemeID()));
            criteria.setValue(faQueryParameter.getValueID().getValue());
        }
        CodeType valueCode = faQueryParameter.getValueCode();
        if (valueCode != null) {
            criteria.setValueType(ValueType.valueOf(faQueryParameter.getValueCode().getListID()));
            criteria.setValue(faQueryParameter.getValueCode().getValue());
        }
        dataCriteriaList.add(criteria);
    }
    return dataCriteriaList;
}
Also used : FAQueryParameter(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQueryParameter) ArrayList(java.util.ArrayList) SubscriptionDataCriteria(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)

Example 4 with SubscriptionDataCriteria

use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class SubscriptionMapper method createCriteria.

private static SubscriptionDataCriteria createCriteria(CriteriaType criteriaType, SubCriteriaType subCriteriaType, ValueType valueType, String value) {
    SubscriptionDataCriteria criteria = new SubscriptionDataCriteria();
    criteria.setCriteria(criteriaType);
    criteria.setSubCriteria(subCriteriaType);
    criteria.setValueType(valueType);
    criteria.setValue(value);
    return criteria;
}
Also used : SubscriptionDataCriteria(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria)

Example 5 with SubscriptionDataCriteria

use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria 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

SubscriptionDataCriteria (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria)6 ArrayList (java.util.ArrayList)3 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)2 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)1 ActivityEntityToModelMapper (eu.europa.ec.fisheries.ers.service.mapper.ActivityEntityToModelMapper)1 SubCriteriaType (eu.europa.ec.fisheries.wsdl.subscription.module.SubCriteriaType)1 SubscriptionDataRequest (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1 FAQueryParameter (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQueryParameter)1 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)1