Search in sources :

Example 1 with SubCriteriaType

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

Aggregations

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 SubscriptionDataCriteria (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria)1