UBL updates
This commit is contained in:
@@ -70,7 +70,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
|
|
||||||
// Bharti's homework 20241126:Streams https://www.youtube.com/watch?v=Lf01cBzmuXw
|
// Bharti's homework 20241126:Streams https://www.youtube.com/watch?v=Lf01cBzmuXw
|
||||||
// and Lambdas https://www.youtube.com/watch?v=HCyx31NW8xg
|
// and Lambdas https://www.youtube.com/watch?v=HCyx31NW8xg
|
||||||
setProduct(new Product());
|
setProduct(new Product(itemMap.getNode("Item").get()));
|
||||||
icnm.getAsString("Name").ifPresent(product::setName);
|
icnm.getAsString("Name").ifPresent(product::setName);
|
||||||
icnm.getAsString("Description").ifPresent(product::setDescription);
|
icnm.getAsString("Description").ifPresent(product::setDescription);
|
||||||
|
|
||||||
@@ -111,14 +111,19 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
product.setUnit(icn.getAttributes().getNamedItem("unitCode").getNodeValue());
|
product.setUnit(icn.getAttributes().getNamedItem("unitCode").getNodeValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itemMap.getAllNodes("DocumentReference").map(ReferencedDocument::fromNode)
|
||||||
|
.forEach(this::addReferencedDocument);
|
||||||
|
|
||||||
|
// ubl
|
||||||
|
|
||||||
itemMap.getAsNodeMap("OrderLineReference")
|
itemMap.getAsNodeMap("OrderLineReference")
|
||||||
|
// ubl
|
||||||
.flatMap(bordNodes -> bordNodes.getAsString("LineID"))
|
.flatMap(bordNodes -> bordNodes.getAsString("LineID"))
|
||||||
.ifPresent(this::addReferencedLineID);
|
.ifPresent(this::addReferencedLineID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
itemMap.getAllNodes("DocumentReference").map(ReferencedDocument::fromNode)
|
|
||||||
.forEach(this::addAdditionalReference);
|
|
||||||
|
|
||||||
itemMap.getAsNodeMap("SpecifiedLineTradeAgreement", "SpecifiedSupplyChainTradeAgreement").ifPresent(icnm -> {
|
itemMap.getAsNodeMap("SpecifiedLineTradeAgreement", "SpecifiedSupplyChainTradeAgreement").ifPresent(icnm -> {
|
||||||
icnm.getAsNodeMap("BuyerOrderReferencedDocument")
|
icnm.getAsNodeMap("BuyerOrderReferencedDocument")
|
||||||
@@ -131,8 +136,8 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
npptpNodes.getAsBigDecimal("BasisQuantity").ifPresent(this::setBasisQuantity);
|
npptpNodes.getAsBigDecimal("BasisQuantity").ifPresent(this::setBasisQuantity);
|
||||||
});
|
});
|
||||||
|
|
||||||
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode)
|
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).
|
||||||
.forEach(this::addReferencedDocument);
|
forEach(this::addReferencedDocument);
|
||||||
});
|
});
|
||||||
|
|
||||||
itemMap.getNode("SpecifiedTradeProduct").map(Product::new).ifPresent(this::setProduct);//CII
|
itemMap.getNode("SpecifiedTradeProduct").map(Product::new).ifPresent(this::setProduct);//CII
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//UBL
|
//UBL
|
||||||
nodeMap.getAsNodeMap("AdditionalItemProperty").ifPresent(aipNodes -> {
|
nodeMap.getAsNodeMap("AdditionalItemProperty").ifPresent(aipNodes -> {
|
||||||
String name = aipNodes.getAsStringOrNull("Name");
|
String name = aipNodes.getAsStringOrNull("Name");
|
||||||
@@ -92,6 +93,13 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
nodeMap.getAsNodeMap("CommodityClassification").ifPresent(dpcNodes -> {
|
||||||
|
String className = dpcNodes.getAsStringOrNull("ClassName");
|
||||||
|
dpcNodes.getNode("ItemClassificationCode").map(ClassCode::fromNode).ifPresent(classCode ->
|
||||||
|
classifications.add(new DesignatedProductClassification(classCode, className)));
|
||||||
|
});
|
||||||
|
|
||||||
|
//UBL
|
||||||
nodeMap.getAsNodeMap("DesignatedProductClassification").ifPresent(dpcNodes -> {
|
nodeMap.getAsNodeMap("DesignatedProductClassification").ifPresent(dpcNodes -> {
|
||||||
String className = dpcNodes.getAsStringOrNull("ClassName");
|
String className = dpcNodes.getAsStringOrNull("ClassName");
|
||||||
dpcNodes.getNode("ClassCode").map(ClassCode::fromNode).ifPresent(classCode ->
|
dpcNodes.getNode("ClassCode").map(ClassCode::fromNode).ifPresent(classCode ->
|
||||||
@@ -132,6 +140,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
* @return e.g. intra-commnunity supply or small business
|
* @return e.g. intra-commnunity supply or small business
|
||||||
|
|||||||
@@ -226,9 +226,10 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
|
|
||||||
if (currentTopElementName.equals("PartyLegalEntity")) {
|
if (currentTopElementName.equals("PartyLegalEntity")) {
|
||||||
NodeList legal = party.item(partyIndex).getChildNodes();
|
NodeList legal = party.item(partyIndex).getChildNodes();
|
||||||
|
LegalOrganisation lo = null;
|
||||||
for (int legalChildIndex = 0; legalChildIndex < legal.getLength(); legalChildIndex++) {
|
for (int legalChildIndex = 0; legalChildIndex < legal.getLength(); legalChildIndex++) {
|
||||||
if (legal.item(legalChildIndex).getLocalName() != null) {
|
if (legal.item(legalChildIndex).getLocalName() != null) {
|
||||||
LegalOrganisation lo = null;
|
|
||||||
if (legal.item(legalChildIndex).getLocalName().equals("RegistrationName")) {
|
if (legal.item(legalChildIndex).getLocalName().equals("RegistrationName")) {
|
||||||
if (lo == null) {
|
if (lo == null) {
|
||||||
lo = new LegalOrganisation();
|
lo = new LegalOrganisation();
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
xpr = xpath.compile("//*[local-name()=\"BuyerTradeParty\"]|//*[local-name()=\"AccountingCustomerParty\"]/*");
|
xpr = xpath.compile("//*[local-name()=\"BuyerTradeParty\"]|//*[local-name()=\"AccountingCustomerParty\"]/*");
|
||||||
NodeList BuyerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList BuyerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
|
|
||||||
xpr = xpath.compile("//*[local-name()=\"PayeeTradeParty\"]|//*[local-name()=\"PayeeParty\"]//*");
|
xpr = xpath.compile("//*[local-name()=\"PayeeTradeParty\"]|//*[local-name()=\"PayeeParty\"]/*");
|
||||||
NodeList payeeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList payeeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
|
|
||||||
xpr = xpath.compile("//*[local-name()=\"ExchangedDocument\"]|//*[local-name()=\"HeaderExchangedDocument\"]");
|
xpr = xpath.compile("//*[local-name()=\"ExchangedDocument\"]|//*[local-name()=\"HeaderExchangedDocument\"]");
|
||||||
|
|||||||
@@ -65,9 +65,6 @@
|
|||||||
<cac:PartyIdentification>
|
<cac:PartyIdentification>
|
||||||
<cbc:ID schemeID="0110">Seller identifier 2</cbc:ID>
|
<cbc:ID schemeID="0110">Seller identifier 2</cbc:ID>
|
||||||
</cac:PartyIdentification>
|
</cac:PartyIdentification>
|
||||||
<cac:PartyIdentification>
|
|
||||||
<cbc:ID schemeID="SEPA">Bank assigned creditor identifier</cbc:ID>
|
|
||||||
</cac:PartyIdentification>
|
|
||||||
<cac:PartyName>
|
<cac:PartyName>
|
||||||
<cbc:Name>Seller trading name</cbc:Name>
|
<cbc:Name>Seller trading name</cbc:Name>
|
||||||
</cac:PartyName>
|
</cac:PartyName>
|
||||||
|
|||||||
Reference in New Issue
Block a user