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;
}
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());
}
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.");
}
}
}
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;
}
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;
}
Aggregations