Skip to content

Commit

Permalink
#7
Browse files Browse the repository at this point in the history
  • Loading branch information
homebeaver committed Mar 19, 2021
1 parent 173ce5f commit c3ff57a
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/klst/eorder/api/BG4_Seller.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.klst.eorder.api;

import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.PostalAddress;

/**
Expand Down Expand Up @@ -84,7 +84,7 @@ public interface BG4_Seller {
// return null;
// }

public void setSeller(String name, PostalAddress address, IContact contact, String companyId, String companyLegalForm);
public void setSeller(String name, PostalAddress address, ContactInfo contact, String companyId, String companyLegalForm);
public void setSeller(BusinessParty party);
public BusinessParty getSeller();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/klst/eorder/api/BG7_Buyer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.klst.eorder.api;

import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.PostalAddress;

/**
Expand Down Expand Up @@ -41,7 +41,7 @@
*/
public interface BG7_Buyer {

public void setBuyer(String name, PostalAddress address, IContact contact);
public void setBuyer(String name, PostalAddress address, ContactInfo contact);
public void setBuyer(BusinessParty party);
public BusinessParty getBuyer();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/klst/eorder/api/CoreOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.sql.Timestamp;

import com.klst.edoc.api.BusinessPartyFactory;
import com.klst.edoc.api.IContactFactory;
import com.klst.edoc.api.ContactInfoFactory;
import com.klst.edoc.api.PostalAddressFactory;
import com.klst.edoc.api.Reference;
import com.klst.edoc.untdid.DateTimeFormats;
Expand All @@ -13,7 +13,7 @@ public interface CoreOrder extends CoreOrderFactory, BG1_OrderNote, BG2_ProcessC
BG20_DocumentLevelAllowences, BG21_DocumentLevelCharges,
BG22_DocumentTotals, BG25_OrderLine,
ShipTo, ShipFrom,
PostalAddressFactory, IContactFactory, BusinessPartyFactory {
PostalAddressFactory, ContactInfoFactory, BusinessPartyFactory {

/**
* Invoice number - A unique identification of the Invoice.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/klst/eorder/api/IContactExt.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.klst.eorder.api;

import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;

// reusable ABIE (aggregate business information entity) 103 TradeContactType hat ein element
// das zwar in ABIE 100 TradeContactType , aber nicht in UBL existiert
public interface IContactExt extends IContact {
public interface IContactExt extends ContactInfo {

public void setContactDepartment(String department);
public String getContactDepartment();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/klst/eorder/api/ShipFrom.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.klst.eorder.api;

import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.PostalAddress;

public interface ShipFrom {

public void setShipFromParty(String name, PostalAddress address, IContact contact);
public void setShipFromParty(String name, PostalAddress address, ContactInfo contact);
public void setShipFromParty(BusinessParty party);
public BusinessParty getShipFromParty();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/klst/eorder/api/ShipTo.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.klst.eorder.api;

import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.PostalAddress;

/*
Expand Down Expand Up @@ -34,7 +34,7 @@
*/
public interface ShipTo {

public void setShipToParty(String name, PostalAddress address, IContact contact);
public void setShipToParty(String name, PostalAddress address, ContactInfo contact);
public void setShipToParty(BusinessParty party);
public BusinessParty getShipToParty();

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/klst/eorder/impl/CrossIndustryOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.klst.ebXml.reflection.CopyCtor;
import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.IAmount;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.IQuantity;
import com.klst.edoc.api.PostalAddress;
import com.klst.edoc.api.Reference;
Expand Down Expand Up @@ -275,7 +275,7 @@ public Reference getBuyerAccountingReference() {

// BG-4 + 1..1 SELLER @see BG4_Seller
@Override
public void setSeller(String name, PostalAddress address, IContact contact, String companyId, String companyLegalForm) {
public void setSeller(String name, PostalAddress address, ContactInfo contact, String companyId, String companyLegalForm) {
BusinessParty party = createParty(name, address, contact);
party.setCompanyId(companyId);
party.setCompanyLegalForm(companyLegalForm);
Expand All @@ -292,7 +292,7 @@ public BusinessParty getSeller() {

// BG-7 + 1..1 BUYER @see BG7_Buyer
@Override
public void setBuyer(String name, PostalAddress address, IContact contact) {
public void setBuyer(String name, PostalAddress address, ContactInfo contact) {
BusinessParty party = createParty(name, address, contact); // BT-44, BG-8, BG-9
setBuyer(party);
}
Expand All @@ -306,7 +306,7 @@ public BusinessParty getBuyer() {
}

@Override
public void setShipToParty(String name, PostalAddress address, IContact contact) {
public void setShipToParty(String name, PostalAddress address, ContactInfo contact) {
BusinessParty party = createParty(name, address, contact);
setShipToParty(party);
}
Expand All @@ -320,7 +320,7 @@ public BusinessParty getShipToParty() {
}

@Override
public void setShipFromParty(String name, PostalAddress address, IContact contact) {
public void setShipFromParty(String name, PostalAddress address, ContactInfo contact) {
BusinessParty party = createParty(name, address, contact);
setShipFromParty(party);
}
Expand Down Expand Up @@ -590,7 +590,7 @@ public String toString() {

// ----------------- factories to delegate
@Override
public BusinessParty createParty(String name, String tradingName, PostalAddress address, IContact contact) {
public BusinessParty createParty(String name, String tradingName, PostalAddress address, ContactInfo contact) {
return TradeParty.create(name, tradingName, address, contact);
}

Expand All @@ -600,7 +600,7 @@ public PostalAddress createAddress(String countryCode, String postalCode, String
}

@Override
public IContact createContact(String contactName, String contactTel, String contactMail) {
public ContactInfo createContactInfo(String contactName, String contactTel, String contactMail) {
return TradeContact.create(contactName, contactTel, contactMail);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/klst/eorder/impl/HeaderTradeAgreement.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.klst.ebXml.reflection.CopyCtor;
import com.klst.ebXml.reflection.Mapper;
import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.PostalAddress;
import com.klst.eorder.api.BG4_Seller;
import com.klst.eorder.api.BG7_Buyer;
Expand Down Expand Up @@ -69,7 +69,7 @@ public String getPurchaseOrderReference() {

// BG-4 + 1..1 SELLER @see BG4_Seller
@Override
public void setSeller(String name, PostalAddress address, IContact contact, String companyId, String companyLegalForm) {
public void setSeller(String name, PostalAddress address, ContactInfo contact, String companyId, String companyLegalForm) {
BusinessParty party = TradeParty.create(name, null, address, contact);
party.setCompanyId(companyId);
party.setCompanyLegalForm(companyLegalForm);
Expand All @@ -85,7 +85,7 @@ public BusinessParty getSeller() {

// BG-7 + 1..1 BUYER @see BG7_Buyer
@Override
public void setBuyer(String name, PostalAddress address, IContact contact) {
public void setBuyer(String name, PostalAddress address, ContactInfo contact) {
BusinessParty party = TradeParty.create(name, null, address, contact);
setBuyer(party);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/klst/eorder/impl/HeaderTradeDelivery.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.klst.ebXml.reflection.CopyCtor;
import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.PostalAddress;
import com.klst.eorder.api.ShipFrom;
import com.klst.eorder.api.ShipTo;
Expand Down Expand Up @@ -33,7 +33,7 @@ private HeaderTradeDelivery(HeaderTradeDeliveryType object) {
}

@Override
public void setShipToParty(String name, PostalAddress address, IContact contact) {
public void setShipToParty(String name, PostalAddress address, ContactInfo contact) {
BusinessParty party = TradeParty.create(name, null, address, contact);
setShipToParty(party);
}
Expand All @@ -48,7 +48,7 @@ public BusinessParty getShipToParty() {
}

@Override
public void setShipFromParty(String name, PostalAddress address, IContact contact) {
public void setShipFromParty(String name, PostalAddress address, ContactInfo contact) {
BusinessParty party = TradeParty.create(name, null, address, contact);
setShipFromParty(party);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/klst/eorder/impl/TradeContact.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.klst.eorder.impl;

import com.klst.ebXml.reflection.CopyCtor;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.eorder.api.IContactExt;

import un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._103.TradeContactType;
Expand All @@ -10,7 +10,7 @@
public class TradeContact extends TradeContactType implements IContactExt {

@Override // implements IContactFactory
public IContact createContact(String contactName, String contactTel, String contactMail) {
public ContactInfo createContactInfo(String contactName, String contactTel, String contactMail) {
return create(contactName, contactTel, contactMail);
}

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/klst/eorder/impl/TradeParty.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.klst.edoc.api.BusinessPartyAddress;
import com.klst.edoc.api.BusinessPartyContact;
import com.klst.edoc.api.BusinessPartyFactory;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.Identifier;
import com.klst.edoc.api.PostalAddress;

Expand All @@ -24,10 +24,10 @@
public class TradeParty extends TradePartyType implements BusinessParty, BusinessPartyAddress, BusinessPartyContact {

@Override // implements BusinessPartyFactory
public BusinessParty createParty(String name, String tradingName, PostalAddress address, IContact contact) {
public BusinessParty createParty(String name, String tradingName, PostalAddress address, ContactInfo contact) {
return create(name, tradingName, address, contact);
}
static TradeParty create(String name, String tradingName, PostalAddress address, IContact contact) {
static TradeParty create(String name, String tradingName, PostalAddress address, ContactInfo contact) {
return new TradeParty(name, tradingName, address, contact);
}

Expand Down Expand Up @@ -75,12 +75,12 @@ private TradeParty(TradePartyType doc) {
BT-33 ++ 0..1 Seller additional legal information / weitere rechtliche Informationen, wie z. B. Aktienkapital
BT-34 ++ 0..1 Seller electronic address ( mit Schema ) / Elektronische Adresse des Verkäufers
*/
private TradeParty(String registrationName, String businessName, PostalAddress address, IContact contact) {
private TradeParty(String registrationName, String businessName, PostalAddress address, ContactInfo contact) {
super();
setRegistrationName(registrationName);
setBusinessName(businessName);
setAddress(address);
if(contact!=null) setIContact(contact);
if(contact!=null) setContactInfo(contact);
}

public String toString() {
Expand All @@ -96,7 +96,7 @@ public String toString() {
stringBuilder.append(getAddress()==null ? "null" : getAddress());

stringBuilder.append(", Contact:");
stringBuilder.append(getIContact()==null ? "null" : getIContact());
stringBuilder.append(getContactInfo()==null ? "null" : getContactInfo());

stringBuilder.append("]");
return stringBuilder.toString();
Expand All @@ -123,21 +123,21 @@ public PostalAddress createAddress(String countryCode, String postalCode, String

// Contact
@Override
public IContact getIContact() {
public ContactInfo getContactInfo() {
// TradeContactType tradeContact = super.getDefinedTradeContact();
// return tradeContact==null ? null : TradeContact.create(tradeContact);
List<TradeContactType> tradeContactList = super.getDefinedTradeContact();
return tradeContactList.isEmpty() ? null : TradeContact.create(tradeContactList.get(0));
}

@Override
public void setIContact(IContact contact) {
public void setContactInfo(ContactInfo contact) {
// super.setDefinedTradeContact((TradeContact)contact);
super.getDefinedTradeContact().add((TradeContact)contact);
}

@Override
public IContact createContact(String contactName, String contactTel, String contactMail) {
public ContactInfo createContactInfo(String contactName, String contactTel, String contactMail) {
return TradeContact.create(contactName, contactTel, contactMail);
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/klst/readme/OrderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.klst.edoc.api.BusinessParty;
import com.klst.edoc.api.BusinessPartyAddress;
import com.klst.edoc.api.IAmount;
import com.klst.edoc.api.IContact;
import com.klst.edoc.api.ContactInfo;
import com.klst.edoc.api.PostalAddress;
import com.klst.edoc.untdid.DateTimeFormats;
import com.klst.edoc.untdid.DocumentNameCode;
Expand Down Expand Up @@ -66,7 +66,7 @@ public void cioTest() {

order.addNote( order.createNote("AAI", "Content of Note") );

IContact contact = TradeContact.create().createContact(null, null, null);
ContactInfo contact = TradeContact.create().createContactInfo(null, null, null);
IContactExt contactExt = (IContactExt)contact;
contactExt.setContactDepartment("dept");
LOG.info("contact:"+contactExt);
Expand All @@ -90,7 +90,7 @@ public void cioTest() {
// <ram:BuyerReference>BUYER_REF_BU123</ram:BuyerReference>

PostalAddress address = order.createAddress("DE", "123", "Ort");
IContact icontact = order.createContact("name", "tel", "mail");
ContactInfo icontact = order.createContactInfo("name", "tel", "mail");
// order.setSeller("SUPPLIER_ID_321654", address, icontact, null, null);
BusinessParty seller = order.createParty("SELLER_NAME", "SELLER_TRADING_NAME", postalAddress, contact);
seller.setId("SUPPLIER_ID_321654");
Expand Down Expand Up @@ -118,7 +118,7 @@ public void cioTest() {
BusinessPartyAddress buyerAddress = (BusinessPartyAddress)buyer;
LOG.info("buyerAddress (no shortcut):"+buyerAddress.getAddress());
}
LOG.info("buyer Address:"+buyer.getAddress() + " Contact:"+buyer.getContact());
LOG.info("buyer Address:"+buyer.getAddress() + " Contact:"+buyer.getBPContact());

// ---------------
IAmount amount = new Amount(new BigDecimal(60.00));
Expand Down

0 comments on commit c3ff57a

Please sign in to comment.