Search in sources :

Example 1 with FluxPartyIdentifierEntity

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;
}
Also used : FluxReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) FluxPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxPartyEntity) FluxPartyIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity)

Example 2 with FluxPartyIdentifierEntity

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;
}
Also used : TypedQuery(javax.persistence.TypedQuery) FluxPartyIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity)

Example 3 with FluxPartyIdentifierEntity

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);
}
Also used : ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) FluxPartyIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity)

Example 4 with FluxPartyIdentifierEntity

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);
    }
}
Also used : ArrayList(java.util.ArrayList) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FluxPartyIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity)

Example 5 with FluxPartyIdentifierEntity

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;
}
Also used : IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FluxPartyIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity) HashSet(java.util.HashSet)

Aggregations

FluxPartyIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity)6 FluxPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxPartyEntity)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)2 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)1 FluxReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity)1 TypedQuery (javax.persistence.TypedQuery)1