Search in sources :

Example 1 with FLUXReportDocument

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument in project UVMS-ActivityModule-APP by UnionVMS.

the class MapperUtil method getFLUXReportDocument.

public static FLUXReportDocument getFLUXReportDocument() {
    new FLUXReportDocument();
    List<IDType> ids = Arrays.asList(getIdType("FLUX_REPORT_ID_1", "FLUX_SCHEME_ID1"));
    IDType referenceId = getIdType("REF_ID 1", "47rfh-5hry4-thfur75-4hf743");
    DateTimeType creationDateTime = getDateTimeType("2016-07-01 11:15:00");
    CodeType purposeCode = getCodeType("9", "FLUX_GP_PURPOSE");
    CodeType typeCode = getCodeType("type Code1", "fhr574fh-thrud754-kgitjf754-gjtufe89");
    List<IDType> ownerFluxPartyId = Arrays.asList(getIdType("Owner_flux_party_id_1", "flux_Party_scheme_id"));
    List<TextType> names = Arrays.asList(getTextType("fluxPartyOwnerName 1"));
    FLUXParty fluxParty = new FLUXParty(ownerFluxPartyId, names);
    FLUXReportDocument fluxReportDocument = new FLUXReportDocument(ids, referenceId, creationDateTime, purposeCode, getTextType("Purpose"), typeCode, fluxParty);
    return fluxReportDocument;
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FLUXParty(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXParty) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)

Example 2 with FLUXReportDocument

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument in project UVMS-ActivityModule-APP by UnionVMS.

the class FluxReportDocumentMapperTest method testFluxReportDocumentMapper.

@Test
public void testFluxReportDocumentMapper() {
    FLUXReportDocument fluxReportDocument = MapperUtil.getFluxReportDocument();
    FluxReportDocumentEntity entity = FluxReportDocumentMapper.INSTANCE.mapToFluxReportDocumentEntity(fluxReportDocument);
    assertEquals(fluxReportDocument.getIDS().get(0).getValue(), entity.getFluxReportIdentifiers().iterator().next().getFluxReportIdentifierId());
    assertEquals(fluxReportDocument.getIDS().get(0).getSchemeID(), entity.getFluxReportIdentifiers().iterator().next().getFluxReportIdentifierSchemeId());
    assertEquals(fluxReportDocument.getReferencedID().getValue(), entity.getReferenceId());
    assertEquals(fluxReportDocument.getCreationDateTime().getDateTime().toGregorianCalendar().getTime(), entity.getCreationDatetime());
    assertEquals(fluxReportDocument.getPurposeCode().getValue(), entity.getPurposeCode());
    assertEquals(fluxReportDocument.getPurposeCode().getListID(), entity.getPurposeCodeListId());
    assertTrue(entity.getPurpose().startsWith(fluxReportDocument.getPurpose().getValue()));
    assertEquals(fluxReportDocument.getOwnerFLUXParty().getIDS().get(0).getValue(), entity.getFluxParty().getFluxPartyIdentifiers().iterator().next().getFluxPartyIdentifierId());
    assertEquals(fluxReportDocument.getOwnerFLUXParty().getNames().get(0).getValue(), entity.getFluxParty().getFluxPartyName());
    assertNull(entity.getFaReportDocument());
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) Test(org.junit.Test)

Example 3 with FLUXReportDocument

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEventServiceBean method deleteBranchesThatMatchWithTheIdsList.

private void deleteBranchesThatMatchWithTheIdsList(List<ActivityIDType> ids, List<FAReportDocument> faReportDocuments) {
    final Iterator<FAReportDocument> iterator = faReportDocuments.iterator();
    while (iterator.hasNext()) {
        FAReportDocument faRep = iterator.next();
        FLUXReportDocument relatedFLUXReportDocument = faRep.getRelatedFLUXReportDocument();
        if (relatedFLUXReportDocument != null && reportDocumentIdsMatch(relatedFLUXReportDocument.getIDS(), ids)) {
            log.warn("[WARN] Deleted FaReportDocument (from XML MSG Node) since it already exist in the Activity DB..\n" + "Following is the ID : { " + preetyPrintIds(relatedFLUXReportDocument.getIDS()) + " }");
            iterator.remove();
            log.info("[INFO] Remaining [ " + faReportDocuments.size() + " ] FaReportDocuments to be saved.");
        }
    }
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)

Example 4 with FLUXReportDocument

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument in project UVMS-ActivityModule-APP by UnionVMS.

the class FaReportDocumentMapper method getFluxReportDocument.

protected FluxReportDocumentEntity getFluxReportDocument(FLUXReportDocument fluxReportDocument, FaReportDocumentEntity faReportDocumentEntity) {
    if (fluxReportDocument == null) {
        return null;
    }
    FluxReportDocumentEntity fluxReportDocumentEntity = FluxReportDocumentMapper.INSTANCE.mapToFluxReportDocumentEntity(fluxReportDocument);
    if (fluxReportDocument.getOwnerFLUXParty() != null) {
        FluxPartyEntity fluxPartyEntity = FluxPartyMapper.INSTANCE.mapToFluxPartyEntity(fluxReportDocument.getOwnerFLUXParty());
        fluxPartyEntity.setFluxReportDocument(fluxReportDocumentEntity);
        fluxReportDocumentEntity.setFluxParty(fluxPartyEntity);
    }
    Set<FluxReportIdentifierEntity> reportIdentifierEntitySet = new HashSet<>();
    if (CollectionUtils.isNotEmpty(fluxReportDocument.getIDS())) {
        for (IDType idType : fluxReportDocument.getIDS()) {
            FluxReportIdentifierEntity fluxReportIdentifierEntity = FluxReportIdentifierMapper.INSTANCE.mapToFluxReportIdentifierEntity(idType);
            fluxReportIdentifierEntity.setFluxReportDocument(fluxReportDocumentEntity);
            reportIdentifierEntitySet.add(fluxReportIdentifierEntity);
        }
    }
    fluxReportDocumentEntity.setFluxReportIdentifiers(reportIdentifierEntitySet);
    fluxReportDocumentEntity.setFaReportDocument(faReportDocumentEntity);
    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) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) HashSet(java.util.HashSet)

Example 5 with FLUXReportDocument

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEntityToModelMapper method mapToFLUXFAReportMessage.

@SneakyThrows
public FLUXFAReportMessage mapToFLUXFAReportMessage(List<FaReportDocumentEntity> faReportMessageEntity) {
    FLUXFAReportMessage target = new FLUXFAReportMessage();
    FLUXReportDocument fluxReportDocument = new FLUXReportDocument();
    CodeType codeType = new CodeType();
    codeType.setValue("9");
    codeType.setListID("FLUX_GP_PURPOSE");
    fluxReportDocument.setPurposeCode(codeType);
    IDType idType = new IDType();
    idType.setSchemeID("UUID");
    idType.setValue(UUID.randomUUID().toString());
    fluxReportDocument.setIDS(Collections.singletonList(idType));
    DateTimeType dateTimeType = new DateTimeType();
    dateTimeType.setDateTime(DateUtils.getCurrentDate());
    fluxReportDocument.setCreationDateTime(dateTimeType);
    TextType textType = new TextType();
    textType.setValue("LOAD_REPORTS");
    fluxReportDocument.setPurpose(textType);
    FLUXParty party = new FLUXParty();
    IDType idType1 = new IDType();
    idType1.setSchemeID("FLUX_GP_PARTY");
    idType1.setValue("TODO_SET_NODE_ALIAS");
    party.setIDS(Collections.singletonList(idType1));
    fluxReportDocument.setOwnerFLUXParty(party);
    target.setFLUXReportDocument(fluxReportDocument);
    if (CollectionUtils.isNotEmpty(faReportMessageEntity)) {
        mapFAReportDocuments(target, faReportMessageEntity);
    }
    return target;
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FLUXParty(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXParty) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType) SneakyThrows(lombok.SneakyThrows)

Aggregations

FLUXReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument)7 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)6 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)4 DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)4 FAReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)3 FLUXParty (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXParty)3 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)3 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)2 FluxPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxPartyEntity)1 FluxReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity)1 ActivityIDType (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType)1 ActivityTableType (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityTableType)1 ActivityUniquinessList (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList)1 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 SneakyThrows (lombok.SneakyThrows)1 Test (org.junit.Test)1 FLUXFAReportMessage (un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage)1