Class AbstractCIIToUBLConverter<IMPLTYPE extends AbstractCIIToUBLConverter<IMPLTYPE>>

  • Type Parameters:
    IMPLTYPE - The implementation type
    All Implemented Interfaces:
    com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>
    Direct Known Subclasses:
    CIIToUBL21Converter, CIIToUBL22Converter, CIIToUBL23Converter

    public abstract class AbstractCIIToUBLConverter<IMPLTYPE extends AbstractCIIToUBLConverter<IMPLTYPE>>
    extends Object
    implements com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>
    Base class for conversion from CII to UBL.
    Author:
    Philip Helger
    • Constructor Detail

      • AbstractCIIToUBLConverter

        protected AbstractCIIToUBLConverter()
    • Method Detail

      • getCustomizationID

        @Nonnull
        public final String getCustomizationID()
      • getCardAccountNetworkID

        @Nonnull
        public final String getCardAccountNetworkID()
      • isSwapQuantitySignIfNeeded

        public final boolean isSwapQuantitySignIfNeeded()
      • setSwapQuantitySignIfNeeded

        @Nonnull
        public final IMPLTYPE setSwapQuantitySignIfNeeded​(boolean bSwapQuantitySignIfNeeded)
      • isSwapPriceSignIfNeeded

        public final boolean isSwapPriceSignIfNeeded()
      • setSwapPriceSignIfNeeded

        @Nonnull
        public final IMPLTYPE setSwapPriceSignIfNeeded​(boolean bSwapPriceSignIfNeeded)
      • _getDatePattern

        @Nullable
        protected static String _getDatePattern​(@Nonnull @Nonempty
                                                String sFormat,
                                                @Nonnull
                                                com.helger.commons.error.list.IErrorList aErrorList)
        Get the pattern based on https://service.unece.org/trade/untdid/d16b/tred/tred2379.htm
        Parameters:
        sFormat - Format to use. May be null.
        aErrorList - The error list to be filled if an unsupported format is provided.
        Returns:
        null if the format is unknown.
      • _parseDate

        @Nullable
        protected static LocalDate _parseDate​(@Nullable
                                              un.unece.uncefact.data.standard.unqualifieddatatype._100.DateTimeType.DateTimeString aDateObj,
                                              @Nonnull
                                              com.helger.commons.error.list.IErrorList aErrorList)
      • _parseDate

        @Nullable
        protected static LocalDate _parseDate​(@Nullable
                                              un.unece.uncefact.data.standard.qualifieddatatype._100.FormattedDateTimeType.DateTimeString aDateObj,
                                              @Nonnull
                                              com.helger.commons.error.list.IErrorList aErrorList)
      • _parseDate

        @Nullable
        protected static LocalDate _parseDate​(@Nullable
                                              un.unece.uncefact.data.standard.unqualifieddatatype._100.DateType.DateString aDateObj,
                                              @Nonnull
                                              com.helger.commons.error.list.IErrorList aErrorList)
      • _parseIndicator

        @Nonnull
        protected static com.helger.commons.state.ETriState _parseIndicator​(@Nullable
                                                                            un.unece.uncefact.data.standard.unqualifieddatatype._100.IndicatorType aIndicator,
                                                                            @Nonnull
                                                                            com.helger.commons.error.list.IErrorList aErrorList)
      • _copyID

        @Nullable
        protected static <T extends com.helger.xsds.ccts.cct.schemamodule.IdentifierType> T _copyID​(@Nullable
                                                                                                    un.unece.uncefact.data.standard.unqualifieddatatype._100.IDType aCIIID,
                                                                                                    @Nonnull
                                                                                                    T aUBLID)
        Copy all ID parts from a CII ID to a CCTS/UBL ID.
        Parameters:
        aCIIID - CII ID
        aUBLID - UBL ID
        Returns:
        Created UBL ID
      • _copyName

        @Nullable
        protected static <T extends com.helger.xsds.ccts.cct.schemamodule.TextType> T _copyName​(@Nullable
                                                                                                un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType aName,
                                                                                                @Nonnull
                                                                                                T ret)
      • _copyCode

        @Nullable
        protected static <T extends com.helger.xsds.ccts.cct.schemamodule.CodeType> T _copyCode​(@Nullable
                                                                                                un.unece.uncefact.data.standard.unqualifieddatatype._100.CodeType aCode,
                                                                                                @Nonnull
                                                                                                T ret)
      • _copyQuantity

        @Nullable
        protected static <T extends com.helger.xsds.ccts.cct.schemamodule.QuantityType> T _copyQuantity​(@Nullable
                                                                                                        un.unece.uncefact.data.standard.unqualifieddatatype._100.QuantityType aQuantity,
                                                                                                        @Nonnull
                                                                                                        T ret)
      • _copyAmount

        @Nullable
        protected static <T extends com.helger.xsds.ccts.cct.schemamodule.AmountType> T _copyAmount​(@Nullable
                                                                                                    un.unece.uncefact.data.standard.unqualifieddatatype._100.AmountType aAmount,
                                                                                                    @Nonnull
                                                                                                    T ret,
                                                                                                    @Nullable
                                                                                                    String sDefaultCurrencyCode)
      • isPaymentMeansCodeCreditTransfer

        protected static boolean isPaymentMeansCodeCreditTransfer​(@Nullable
                                                                  String s)
      • isPaymentMeansCodePaymentCard

        protected static boolean isPaymentMeansCodePaymentCard​(@Nullable
                                                               String s)
      • isPaymentMeansCodeDirectDebit

        protected static boolean isPaymentMeansCodeDirectDebit​(@Nullable
                                                               String s)
      • isPaymentMeansCodeOtherKnown

        protected static boolean isPaymentMeansCodeOtherKnown​(@Nullable
                                                              String s)
      • isOriginatorDocumentReferenceTypeCode

        protected static boolean isOriginatorDocumentReferenceTypeCode​(@Nullable
                                                                       String s)
      • isValidDocumentReferenceTypeCode

        protected static boolean isValidDocumentReferenceTypeCode​(@Nullable
                                                                  String s)
      • canUseGlobalID

        protected static boolean canUseGlobalID​(@Nonnull
                                                un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._100.TradePartyType aParty)
      • getAllUsableGlobalIDs

        @Nonnull
        protected static com.helger.commons.collection.impl.ICommonsList<un.unece.uncefact.data.standard.unqualifieddatatype._100.IDType> getAllUsableGlobalIDs​(@Nonnull
                                                                                                                                                                un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._100.TradePartyType aParty)
      • swapQuantityAndPriceIfNeeded

        protected void swapQuantityAndPriceIfNeeded​(boolean bLineExtensionAmountIsNegative,
                                                    @Nonnull
                                                    BigDecimal aQuantity,
                                                    @Nonnull
                                                    Consumer<BigDecimal> aQuantitySetter,
                                                    @Nullable
                                                    BigDecimal aPriceAmount,
                                                    @Nullable
                                                    Consumer<BigDecimal> aPriceAmountSetter)
        The goal is to have a positive price, because of EN validation rule BT-146. This method fiddles with Quantity and Price to align this as best as possible.
        Parameters:
        bLineExtensionAmountIsNegative - is the line sum negative?
        aQuantity - Existing line quantity.
        aQuantitySetter - Setter to change line quantity
        aPriceAmount - Optional line price amount
        aPriceAmountSetter - Optional setter to change line price amount
      • isInvoiceType

        @Nonnull
        protected static com.helger.commons.state.ETriState isInvoiceType​(@Nonnull
                                                                          un.unece.uncefact.data.standard.crossindustryinvoice._100.CrossIndustryInvoiceType aCIIInvoice)
      • convertCIItoUBL

        @Nullable
        public Serializable convertCIItoUBL​(@Nonnull
                                            File aFile,
                                            @Nonnull
                                            com.helger.commons.error.list.ErrorList aErrorList)
        Convert CII to UBL
        Parameters:
        aFile - Source file with CII to be parsed. May not be null.
        aErrorList - Error list to be filled. May not be null.
        Returns:
        The parsed Invoice or CreditNote as UBL 2.x. May be null in case of error.
      • convertCIItoUBL

        @Nullable
        public abstract Serializable convertCIItoUBL​(@Nonnull
                                                     un.unece.uncefact.data.standard.crossindustryinvoice._100.CrossIndustryInvoiceType aCIIInvoice,
                                                     @Nonnull
                                                     com.helger.commons.error.list.ErrorList aErrorList)
        Convert CII to UBL
        Parameters:
        aCIIInvoice - The CII invoice to be converted. May not be null. Ideally this is a valid CII invoice only and not some handcrafted domain object.
        aErrorList - Error list to be filled. May not be null.
        Returns:
        The parsed InvoiceType or CreditNoteType. May be null in case of error.