use of eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityDataUtil method getFluxReportDocumentEntity.
public static FluxReportDocumentEntity getFluxReportDocumentEntity(String fluxDocumentID, String referenceID, Date creationDateTime, String purposeCode, String purposeCodeListId, String purpose, String ownerFluxPartyId, String ownerFluxPartyName) {
FluxReportDocumentEntity fluxReportDocumentEntity = new FluxReportDocumentEntity();
FluxReportIdentifierEntity entity = new FluxReportIdentifierEntity();
entity.setFluxReportIdentifierId(fluxDocumentID);
fluxReportDocumentEntity.setFluxReportIdentifiers(new HashSet<>(Arrays.asList(entity)));
fluxReportDocumentEntity.setCreationDatetime(creationDateTime);
FluxPartyEntity fluxPartyEntity = new FluxPartyEntity();
fluxPartyEntity.setFluxPartyName(ownerFluxPartyName);
FluxPartyIdentifierEntity fluxPartyIdentifierEntity = new FluxPartyIdentifierEntity();
fluxPartyIdentifierEntity.setFluxPartyIdentifierId(ownerFluxPartyId);
fluxReportDocumentEntity.setFluxParty(fluxPartyEntity);
fluxReportDocumentEntity.setPurpose(purpose);
fluxReportDocumentEntity.setPurposeCode(purposeCode);
fluxReportDocumentEntity.setPurposeCodeListId(purposeCodeListId);
fluxReportDocumentEntity.setReferenceId(referenceID);
return fluxReportDocumentEntity;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripDao method getOwnerFluxPartyFromTripId.
public String getOwnerFluxPartyFromTripId(String fishingTripId) {
TypedQuery query = getEntityManager().createNamedQuery(FluxPartyIdentifierEntity.MESSAGE_OWNER_FROM_TRIP_ID, FluxPartyIdentifierEntity.class);
query.setParameter("fishingTripId", fishingTripId).setMaxResults(1).getResultList();
List<FluxPartyIdentifierEntity> resultList = query.getResultList();
return CollectionUtils.isNotEmpty(resultList) ? resultList.get(0).getFluxPartyIdentifierId() : StringUtils.EMPTY;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapper method getFromId.
protected List<String> getFromId(FishingActivityEntity entity) {
if (entity == null || entity.getFaReportDocument() == null || entity.getFaReportDocument().getFluxReportDocument() == null || entity.getFaReportDocument().getFluxReportDocument().getFluxParty() == null || entity.getFaReportDocument().getFluxReportDocument().getFluxParty().getFluxPartyIdentifiers() == null) {
return Collections.emptyList();
}
Set<String> fromIdList = new HashSet<>();
Set<FluxPartyIdentifierEntity> idSet = entity.getFaReportDocument().getFluxReportDocument().getFluxParty().getFluxPartyIdentifiers();
for (FluxPartyIdentifierEntity fluxPartyIdentifierEntity : idSet) {
fromIdList.add(fluxPartyIdentifierEntity.getFluxPartyIdentifierId());
}
fromIdList.remove(null);
return new ArrayList<>(fromIdList);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxPartyMapper method mapFluxPartyIdentifiers.
private void mapFluxPartyIdentifiers(FLUXParty target, Set<FluxPartyIdentifierEntity> fluxPartyIdentifierEntities) {
if (CollectionUtils.isNotEmpty(fluxPartyIdentifierEntities)) {
List<IDType> idTypeList = new ArrayList<>();
for (FluxPartyIdentifierEntity source : fluxPartyIdentifierEntities) {
IDType idType = new IDType();
String fluxPartyIdentifierId = source.getFluxPartyIdentifierId();
String fluxPartyIdentifierSchemeId = source.getFluxPartyIdentifierSchemeId();
idType.setSchemeID(fluxPartyIdentifierSchemeId);
idType.setValue(fluxPartyIdentifierId);
idTypeList.add(idType);
}
target.setIDS(idTypeList);
}
}
use of eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxPartyMapper method mapToFluxPartyIdentifierEntities.
protected Set<FluxPartyIdentifierEntity> mapToFluxPartyIdentifierEntities(List<IDType> idTypes, FluxPartyEntity fluxPartyEntity) {
if (idTypes == null || idTypes.isEmpty()) {
return Collections.emptySet();
}
Set<FluxPartyIdentifierEntity> fluxPartyIdentifierEntities = new HashSet<>();
for (IDType idType : idTypes) {
FluxPartyIdentifierEntity entity = FluxPartyMapper.INSTANCE.mapToFluxPartyIdentifierEntity(idType);
entity.setFluxParty(fluxPartyEntity);
fluxPartyIdentifierEntities.add(entity);
}
return fluxPartyIdentifierEntities;
}
Aggregations