use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxFaReportMessageMapper method getFaReportDocuments.
protected Set<FaReportDocumentEntity> getFaReportDocuments(List<FAReportDocument> faReportDocuments, FaReportSourceEnum faReportSourceEnum, FluxFaReportMessageEntity fluxFaReportMessage) {
Set<FaReportDocumentEntity> faReportDocumentEntities = new HashSet<>();
for (FAReportDocument faReportDocument : faReportDocuments) {
FaReportDocumentEntity entity = FaReportDocumentMapper.INSTANCE.mapToFAReportDocumentEntity(faReportDocument, new FaReportDocumentEntity(), faReportSourceEnum);
entity.setFluxFaReportMessage(fluxFaReportMessage);
faReportDocumentEntities.add(entity);
}
return faReportDocumentEntities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentDao method findFaReportByIdAndScheme.
/**
* Get FaReportDocument by one or more Report identifiers
*
* @param reportId
* @param schemeId
* @return FaReportDocumentEntity
* @throws ServiceException
*/
public FaReportDocumentEntity findFaReportByIdAndScheme(String reportId, String schemeId) throws ServiceException {
TypedQuery query = getEntityManager().createNamedQuery(FaReportDocumentEntity.FIND_BY_FA_ID_AND_SCHEME, FaReportDocumentEntity.class);
query.setParameter(REPORT_ID, reportId);
query.setParameter(SCHEME_ID, schemeId);
query.setMaxResults(1);
List<FaReportDocumentEntity> entities = query.getResultList();
if (!entities.isEmpty()) {
return entities.get(0);
} else {
return null;
}
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityServiceBeanTest method getMockedFishingActivityReportEntities.
private List<FaReportDocumentEntity> getMockedFishingActivityReportEntities() {
List<FaReportDocumentEntity> faReportDocumentEntities = new ArrayList<>();
FAReportDocument faReportDocument = MapperUtil.getFaReportDocument();
faReportDocumentEntities.add(FaReportDocumentMapper.INSTANCE.mapToFAReportDocumentEntity(faReportDocument, new FaReportDocumentEntity(), FaReportSourceEnum.MANUAL));
return faReportDocumentEntities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class TripCatchEvolutionTest method testHandleCumulatedCatchNoDeletion.
@Test
public void testHandleCumulatedCatchNoDeletion() {
FaReportDocumentEntity faReportDocumentEntity = ActivityDataUtil.getFaReportDocumentEntity(FaReportDocumentType.DECLARATION.name(), "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), null, null, "new");
FishingActivityEntity fishingActivityEntity = ActivityDataUtil.getFishingActivityEntity(FishingActivityTypeEnum.FISHING_OPERATION.name(), "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity, null);
FaCatchEntity faCatchEntity = ActivityDataUtil.getFaCatchEntity(fishingActivityEntity, "LOADED", "FA_CATCH_TYPE", "COD", "FAO_SPECIES", 11112D, 11112.0D, "KGM", "BFT", "WEIGHT_MEANS", null);
faCatchEntity.setCalculatedWeightMeasure(11112D);
CatchEvolutionProgressDTO catchEvolutionProgressDTO = initCatchEvolutionProgressDTO(fishingActivityEntity, FaReportDocumentType.DECLARATION, new HashMap<String, Double>());
handleCumulatedCatchNoDeletion(faCatchEntity, catchEvolutionProgressDTO, new HashMap<String, Double>());
assertTrue(!catchEvolutionProgressDTO.getCatchEvolution().get("cumulated").getSpeciesList().isEmpty());
assertEquals(catchEvolutionProgressDTO.getCatchEvolution().get("cumulated").getSpeciesList().get(0).getSpeciesCode(), "COD");
assertTrue(catchEvolutionProgressDTO.getCatchEvolution().get("cumulated").getSpeciesList().get(0).getWeight() == 11112D);
}
Aggregations