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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations