use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapper method mapFAReportDocuments.
private void mapFAReportDocuments(FLUXFAReportMessage target, List<FaReportDocumentEntity> faReportDocuments) {
List<FAReportDocument> faReportDocumentList = new ArrayList<>();
for (FaReportDocumentEntity faReportDocumentEntity : faReportDocuments) {
FAReportDocument faReportDocument = new FAReportDocument();
mapFAReportDocument(faReportDocument, faReportDocumentEntity);
faReportDocumentList.add(faReportDocument);
}
target.setFAReportDocuments(faReportDocumentList);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripServiceBean method createMessageCounter.
/**
* Populates the MessageCounter adding to the right counter 1 unit depending on the type of report (typeCode, purposeCode, size()).
*
* @param faReportDocumentList
*/
public MessageCountDTO createMessageCounter(List<FaReportDocumentEntity> faReportDocumentList) {
MessageCountDTO messagesCounter = new MessageCountDTO();
if (CollectionUtils.isEmpty(faReportDocumentList)) {
return messagesCounter;
}
// Reports total
messagesCounter.setNoOfReports(faReportDocumentList.size());
for (FaReportDocumentEntity faReport : faReportDocumentList) {
String faDocumentType = faReport.getTypeCode();
String purposeCode = faReport.getFluxReportDocument().getPurpose();
// Declarations / Notifications
if (ActivityConstants.DECLARATION.equalsIgnoreCase(faDocumentType)) {
messagesCounter.setNoOfDeclarations(messagesCounter.getNoOfDeclarations() + 1);
} else if (ActivityConstants.NOTIFICATION.equalsIgnoreCase(faDocumentType)) {
messagesCounter.setNoOfNotifications(messagesCounter.getNoOfNotifications() + 1);
}
// Fishing operations
Set<FishingActivityEntity> faEntitiyList = faReport.getFishingActivities();
if (isNotEmpty(faEntitiyList)) {
for (FishingActivityEntity faEntity : faEntitiyList) {
if (FishingActivityTypeEnum.FISHING_OPERATION.toString().equalsIgnoreCase(faEntity.getTypeCode())) {
messagesCounter.setNoOfFishingOperations(messagesCounter.getNoOfFishingOperations() + 1);
}
}
}
// PurposeCode : Deletions / Cancellations / Corrections
if (ActivityConstants.DELETE.equalsIgnoreCase(purposeCode)) {
messagesCounter.setNoOfDeletions(messagesCounter.getNoOfDeletions() + 1);
} else if (ActivityConstants.CANCELLATION.equalsIgnoreCase(purposeCode)) {
messagesCounter.setNoOfCancellations(messagesCounter.getNoOfCancellations() + 1);
} else if (ActivityConstants.CORRECTION.equalsIgnoreCase(purposeCode)) {
messagesCounter.setNoOfCorrections(messagesCounter.getNoOfCorrections() + 1);
}
}
return messagesCounter;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxMessageServiceBean method updateFishingTripStartAndEndDate.
private void updateFishingTripStartAndEndDate(Set<FaReportDocumentEntity> faReportDocuments) throws ServiceException {
log.debug("Start update of FishingTrip Start And End Date");
if (CollectionUtils.isEmpty(faReportDocuments)) {
log.error("FaReportDocuments List is EMPTY or NULL in updateFishingTripStartAndEndDate");
return;
}
for (FaReportDocumentEntity faReportDocument : faReportDocuments) {
calculateFishingTripStartAndEndDate(faReportDocument);
}
// Update all the Entities together
faReportDocumentDao.updateAllFaData(new ArrayList<>(faReportDocuments));
log.debug("Update of Start And End Date for all fishingTrips is complete");
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityDataUtil method getFaReportDocumentEntity.
public static FaReportDocumentEntity getFaReportDocumentEntity(String typeCode, String typeCodeListId, Date acceptedDatetime, FluxReportDocumentEntity fluxReportDocumentEntity, VesselTransportMeansEntity vesselTransportMeansEntity, String status) {
FaReportDocumentEntity faReportDocumentEntity = new FaReportDocumentEntity();
faReportDocumentEntity.setTypeCode(typeCode);
faReportDocumentEntity.setTypeCodeListId(typeCodeListId);
faReportDocumentEntity.setAcceptedDatetime(acceptedDatetime);
faReportDocumentEntity.setFluxReportDocument(fluxReportDocumentEntity);
faReportDocumentEntity.setVesselTransportMeans(new HashSet<>(Arrays.asList(vesselTransportMeansEntity)));
faReportDocumentEntity.setStatus(status);
return faReportDocumentEntity;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class MapperUtil method getFishingActivityEntityList.
public static List<FishingActivityEntity> getFishingActivityEntityList() {
FishingTripEntity entity = new FishingTripEntity();
FluxReportDocumentEntity fluxReportDocumentEntity1 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT1", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID1", "flux1");
FluxReportDocumentEntity fluxReportDocumentEntity2 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT2", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID2", "flux2");
FluxReportDocumentEntity fluxReportDocumentEntity3 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT3", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID3", "flux3");
VesselTransportMeansEntity vesselTransportMeansEntity1 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup1", null);
VesselTransportMeansEntity vesselTransportMeansEntity2 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup2", null);
VesselTransportMeansEntity vesselTransportMeansEntity3 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup3", null);
FaReportDocumentEntity faReportDocumentEntity1 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity1, vesselTransportMeansEntity1, "new");
FaReportDocumentEntity faReportDocumentEntity2 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity2, vesselTransportMeansEntity2, "new");
FaReportDocumentEntity faReportDocumentEntity3 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity3, vesselTransportMeansEntity3, "new");
FishingActivityEntity fishingActivityEntity1 = ActivityDataUtil.getFishingActivityEntity("DEPARTURE", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity1, null);
FishingActivityEntity fishingActivityEntity2 = ActivityDataUtil.getFishingActivityEntity("ARRIVAL", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity2, null);
FishingActivityEntity fishingActivityEntity3 = ActivityDataUtil.getFishingActivityEntity("LANDING", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity3, null);
List<FishingActivityEntity> fishingActivityEntityList = new ArrayList<>();
fishingActivityEntityList.add(fishingActivityEntity1);
fishingActivityEntityList.add(fishingActivityEntity2);
fishingActivityEntityList.add(fishingActivityEntity3);
return fishingActivityEntityList;
}
Aggregations