All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tectonica.jonix.onix2.Price Maven / Gradle / Ivy

There is a newer version: 2024-10-onix308
Show newest version
/*
 * Copyright (C) 2012-2023 Zach Melamed
 *
 * Latest version available online at https://github.com/zach-m/jonix
 * Contact me at [email protected]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.tectonica.jonix.onix2;

import com.tectonica.jonix.common.JPU;
import com.tectonica.jonix.common.ListOfOnixCodelist;
import com.tectonica.jonix.common.ListOfOnixDataComposite;
import com.tectonica.jonix.common.ListOfOnixDataCompositeWithKey;
import com.tectonica.jonix.common.OnixComposite.OnixSuperComposite;
import com.tectonica.jonix.common.codelist.Countrys;
import com.tectonica.jonix.common.codelist.DiscountCodeTypes;
import com.tectonica.jonix.common.codelist.Languages;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.codelist.TextCaseFlags;
import com.tectonica.jonix.common.codelist.TextFormats;
import com.tectonica.jonix.common.codelist.TransliterationSchemes;
import com.tectonica.jonix.common.struct.JonixBatchBonus;
import com.tectonica.jonix.common.struct.JonixDiscountCoded;

import java.io.Serializable;
import java.util.function.Consumer;

/*
 * NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
 */

/**
 * 

Price composite

*

* A repeatable group of data elements which together specify a unit price. *

* * * * * * * * * *
Reference name<Price>
Short tag<price>
*

* This tag may be included in the following composites: *

    *
  • <{@link SupplyDetail}>
  • *
  • <{@link Reissue}>
  • *
*

* Possible placements within ONIX message: *

    *
  • {@link Product} ⯈ {@link SupplyDetail} ⯈ {@link Price}
  • *
  • {@link Product} ⯈ {@link SupplyDetail} ⯈ {@link Reissue} ⯈ {@link Price}
  • *
*/ public class Price implements OnixSuperComposite, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "Price"; public static final String shortname = "price"; ///////////////////////////////////////////////////////////////////////////////// // ATTRIBUTES ///////////////////////////////////////////////////////////////////////////////// public TextFormats textformat; public TextCaseFlags textcase; public Languages language; public TransliterationSchemes transliteration; /** * (type: DateOrDateTime) */ public String datestamp; public RecordSourceTypes sourcetype; public String sourcename; ///////////////////////////////////////////////////////////////////////////////// // CONSTRUCTION ///////////////////////////////////////////////////////////////////////////////// private boolean initialized; private final boolean exists; private final org.w3c.dom.Element element; public static final Price EMPTY = new Price(); public Price() { exists = false; element = null; initialized = true; // so that no further processing will be done on this intentionally-empty object } public Price(org.w3c.dom.Element element) { exists = true; initialized = false; this.element = element; textformat = TextFormats.byCode(JPU.getAttribute(element, "textformat")); textcase = TextCaseFlags.byCode(JPU.getAttribute(element, "textcase")); language = Languages.byCode(JPU.getAttribute(element, "language")); transliteration = TransliterationSchemes.byCode(JPU.getAttribute(element, "transliteration")); datestamp = JPU.getAttribute(element, "datestamp"); sourcetype = RecordSourceTypes.byCode(JPU.getAttribute(element, "sourcetype")); sourcename = JPU.getAttribute(element, "sourcename"); } @Override public void _initialize() { if (initialized) { return; } initialized = true; JPU.forElementsOf(element, e -> { final String name = e.getNodeName(); switch (name) { case PriceAmount.refname: case PriceAmount.shortname: priceAmount = new PriceAmount(e); break; case CountryCode.refname: case CountryCode.shortname: countryCodes = JPU.addToList(countryCodes, new CountryCode(e)); break; case PriceTypeCode.refname: case PriceTypeCode.shortname: priceTypeCode = new PriceTypeCode(e); break; case PriceQualifier.refname: case PriceQualifier.shortname: priceQualifier = new PriceQualifier(e); break; case PriceTypeDescription.refname: case PriceTypeDescription.shortname: priceTypeDescription = new PriceTypeDescription(e); break; case PricePer.refname: case PricePer.shortname: pricePer = new PricePer(e); break; case MinimumOrderQuantity.refname: case MinimumOrderQuantity.shortname: minimumOrderQuantity = new MinimumOrderQuantity(e); break; case ClassOfTrade.refname: case ClassOfTrade.shortname: classOfTrade = new ClassOfTrade(e); break; case BICDiscountGroupCode.refname: case BICDiscountGroupCode.shortname: bicDiscountGroupCode = new BICDiscountGroupCode(e); break; case DiscountPercent.refname: case DiscountPercent.shortname: discountPercent = new DiscountPercent(e); break; case PriceStatus.refname: case PriceStatus.shortname: priceStatus = new PriceStatus(e); break; case CurrencyCode.refname: case CurrencyCode.shortname: currencyCode = new CurrencyCode(e); break; case Territory.refname: case Territory.shortname: territory = new Territory(e); break; case CountryExcluded.refname: case CountryExcluded.shortname: countryExcluded = new CountryExcluded(e); break; case TerritoryExcluded.refname: case TerritoryExcluded.shortname: territoryExcluded = new TerritoryExcluded(e); break; case TaxRateCode1.refname: case TaxRateCode1.shortname: taxRateCode1 = new TaxRateCode1(e); break; case TaxRatePercent1.refname: case TaxRatePercent1.shortname: taxRatePercent1 = new TaxRatePercent1(e); break; case TaxableAmount1.refname: case TaxableAmount1.shortname: taxableAmount1 = new TaxableAmount1(e); break; case TaxAmount1.refname: case TaxAmount1.shortname: taxAmount1 = new TaxAmount1(e); break; case TaxRateCode2.refname: case TaxRateCode2.shortname: taxRateCode2 = new TaxRateCode2(e); break; case TaxRatePercent2.refname: case TaxRatePercent2.shortname: taxRatePercent2 = new TaxRatePercent2(e); break; case TaxableAmount2.refname: case TaxableAmount2.shortname: taxableAmount2 = new TaxableAmount2(e); break; case TaxAmount2.refname: case TaxAmount2.shortname: taxAmount2 = new TaxAmount2(e); break; case PriceEffectiveFrom.refname: case PriceEffectiveFrom.shortname: priceEffectiveFrom = new PriceEffectiveFrom(e); break; case PriceEffectiveUntil.refname: case PriceEffectiveUntil.shortname: priceEffectiveUntil = new PriceEffectiveUntil(e); break; case BatchBonus.refname: case BatchBonus.shortname: batchBonuss = JPU.addToList(batchBonuss, new BatchBonus(e)); break; case DiscountCoded.refname: case DiscountCoded.shortname: discountCodeds = JPU.addToList(discountCodeds, new DiscountCoded(e)); break; default: break; } }); } /** * @return whether this tag (<Price> or <price>) is explicitly provided in the ONIX XML */ @Override public boolean exists() { return exists; } public void ifExists(Consumer action) { if (exists) { action.accept(this); } } @Override public org.w3c.dom.Element getXmlElement() { return element; } ///////////////////////////////////////////////////////////////////////////////// // MEMBERS ///////////////////////////////////////////////////////////////////////////////// private PriceAmount priceAmount = PriceAmount.EMPTY; /** *

* The amount of a price. Mandatory in each occurrence of the <Price> composite, and non-repeating. *

* Jonix-Comment: this field is required */ public PriceAmount priceAmount() { _initialize(); return priceAmount; } private ListOfOnixCodelist countryCodes = ListOfOnixCodelist.emptyList(); /** *

* A code identifying a country in which the price given in <PriceAmount> applies. This allows a supplier to * list different prices for specific countries by repeating the <Price> composite rather than having to * repeat the whole of the <SupplyDetail> composite. Optional, and repeatable if a single price applies to * multiple countries. *

* Jonix-Comment: this list is required to contain at least one item */ public ListOfOnixCodelist countryCodes() { _initialize(); return countryCodes; } private PriceTypeCode priceTypeCode = PriceTypeCode.EMPTY; /** *

* An ONIX code indicating the type of the price in the <PriceAmount> field within the <Price> * composite. Optional, provided that a <DefaultPriceTypeCode> has been specified in the message header, and * non-repeating. *

* Jonix-Comment: this field is optional */ public PriceTypeCode priceTypeCode() { _initialize(); return priceTypeCode; } private PriceQualifier priceQualifier = PriceQualifier.EMPTY; /** *

* An ONIX code which further specifies the type of price, eg member price, reduced price when purchased as * part of a set. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public PriceQualifier priceQualifier() { _initialize(); return priceQualifier; } private PriceTypeDescription priceTypeDescription = PriceTypeDescription.EMPTY; /** *

* Free text which further describes the price type. Optional and non-repeating. In the Netherlands, when the * <PriceQualifier> code identifies a “voucher price”, the <PriceTypeDescription> should give the “EAN * action number” that identifies the offer. *

* Jonix-Comment: this field is optional */ public PriceTypeDescription priceTypeDescription() { _initialize(); return priceTypeDescription; } private PricePer pricePer = PricePer.EMPTY; /** *

* An ONIX code indicating the unit of product which is the basis for the price carried in an occurrence of the * <Price> composite. Optional and non-repeating. Where the price applies to a copy of the whole product, this * field is normally omitted. *

* Jonix-Comment: this field is optional */ public PricePer pricePer() { _initialize(); return pricePer; } private MinimumOrderQuantity minimumOrderQuantity = MinimumOrderQuantity.EMPTY; /** *

* The minimum number of copies which must be ordered to obtain the price carried in an occurrence of the * <Price> composite. Optional and non-repeating. If the field is present, the price is a quantity price. If * the field is omitted, the price applies to a single unit. *

* Jonix-Comment: this field is optional */ public MinimumOrderQuantity minimumOrderQuantity() { _initialize(); return minimumOrderQuantity; } private ClassOfTrade classOfTrade = ClassOfTrade.EMPTY; /** *

* Text indicating the class of trade to which the price carried in an occurrence of the <Price> composite is * applicable, eg Institutional, General trade, Wholesale distributor, which may be represented by a * suitable code or abbreviation agreed between trading partners. This element should be used only in the absence of * a “Default class of trade” <m193> in the message header, or when the class of trade is other than the * default. *

* Jonix-Comment: this field is optional */ public ClassOfTrade classOfTrade() { _initialize(); return classOfTrade; } private BICDiscountGroupCode bicDiscountGroupCode = BICDiscountGroupCode.EMPTY; /** *

* A BIC code indicating the supplier’s discount group to which the price carried in an occurrence of the * <Price> composite belongs. This code does not identify an absolute rate of discount, but it allows a * bookseller to derive the actual discount by reference to a look-up table provided separately by the supplier. *

* Jonix-Comment: this field is optional */ public BICDiscountGroupCode bicDiscountGroupCode() { _initialize(); return bicDiscountGroupCode; } private DiscountPercent discountPercent = DiscountPercent.EMPTY; /** *

* The supplier’s discount percentage applicable to the price carried in an occurrence of the <Price> * composite. Optional and non-repeating. Use only when an ONIX message is sent within the context of a specific * trading relationship. *

* Jonix-Comment: this field is optional */ public DiscountPercent discountPercent() { _initialize(); return discountPercent; } private PriceStatus priceStatus = PriceStatus.EMPTY; /** *

* An ONIX code which specifies the status of a price. Optional and non-repeating. If the field is omitted, the * default “unspecified” will apply. *

* Jonix-Comment: this field is optional */ public PriceStatus priceStatus() { _initialize(); return priceStatus; } private CurrencyCode currencyCode = CurrencyCode.EMPTY; /** *

* An ISO standard code identifying the currency in which a price is given in <PriceAmount>, unless it is the * default currency for the exchange. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public CurrencyCode currencyCode() { _initialize(); return currencyCode; } private Territory territory = Territory.EMPTY; /** *

* One or more ONIX codes identifying a territory, other than a country, in which the price given in * <PriceAmount> applies. Successive codes may be separated by spaces. Thus the element can carry an unlimited * number of territory codes. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public Territory territory() { _initialize(); return territory; } private CountryExcluded countryExcluded = CountryExcluded.EMPTY; /** *

* One or more ISO standard codes identifying a country which is excluded from a territory specified in * <Territory>. Successive codes may be separated by spaces. Thus, a single occurrence of the element can * carry an unlimited number of country codes. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public CountryExcluded countryExcluded() { _initialize(); return countryExcluded; } private TerritoryExcluded territoryExcluded = TerritoryExcluded.EMPTY; /** *

* One or more ONIX codes identifying a territory, which is excluded from a country specified in <CountryCode> * or from a territory specified in <Territory>. Successive codes may be separated by spaces. Thus the element * can carry an unlimited number of territory codes. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public TerritoryExcluded territoryExcluded() { _initialize(); return territoryExcluded; } private TaxRateCode1 taxRateCode1 = TaxRateCode1.EMPTY; /** *

* A code which specifies a value added tax rate applying to the whole of the price, or to the amount of the price * which is specified in <TaxableAmount1> if present. Optional and non-repeating. *

*

* If the product is taxable at a single rate, or is wholly exempt or zero-rated, <TaxRateCode1> may be sent * on its own, or with any combination of <TaxRatePercent1>, <TaxableAmount1> and <TaxAmount1>, * although it is best practise to send all these three elements. *

*

* If the product carries mixed tax rates, the minimum requirement is to send <TaxRateCode1>, * <TaxRateCode2>, <TaxableAmount1> and <TaxableAmount2>, though again best practise would be to * send all eight tax elements so that the tax calculation is made entirely explicit. *

* Jonix-Comment: this field is optional */ public TaxRateCode1 taxRateCode1() { _initialize(); return taxRateCode1; } private TaxRatePercent1 taxRatePercent1 = TaxRatePercent1.EMPTY; /** *

* A tax rate expressed numerically as a percentage. See notes on <TaxRateCode1>. *

* Jonix-Comment: this field is optional */ public TaxRatePercent1 taxRatePercent1() { _initialize(); return taxRatePercent1; } private TaxableAmount1 taxableAmount1 = TaxableAmount1.EMPTY; /** *

* The amount of the unit price of the product, excluding tax, which is taxable at the rate specified by * <TaxRateCode1> and/or <TaxRatePercent1>. This may be the whole of the unit price before tax, if the * item carries tax at the same rate on the whole price; or part of the unit price in the case of a mixed tax rate * product. See notes on <TaxRateCode1>. *

* Jonix-Comment: this field is optional */ public TaxableAmount1 taxableAmount1() { _initialize(); return taxableAmount1; } private TaxAmount1 taxAmount1 = TaxAmount1.EMPTY; /** *

* The amount of tax chargeable at the rate specified by <TaxRateCode1> and/or <TaxRatePercent1>. See * notes on <TaxRateCode1>. *

* Jonix-Comment: this field is optional */ public TaxAmount1 taxAmount1() { _initialize(); return taxAmount1; } private TaxRateCode2 taxRateCode2 = TaxRateCode2.EMPTY; /** *

* A code which specifies a value added tax rate applying to the amount of the price which is specified in * <TaxableAmount2>. See notes on <TaxRateCode1>. *

* Jonix-Comment: this field is optional */ public TaxRateCode2 taxRateCode2() { _initialize(); return taxRateCode2; } private TaxRatePercent2 taxRatePercent2 = TaxRatePercent2.EMPTY; /** *

* A tax rate expressed numerically as a percentage. See notes on <TaxRateCode1>. *

* Jonix-Comment: this field is optional */ public TaxRatePercent2 taxRatePercent2() { _initialize(); return taxRatePercent2; } private TaxableAmount2 taxableAmount2 = TaxableAmount2.EMPTY; /** *

* The amount of the unit price of the product, excluding tax, which is taxable at the rate specified by * <TaxRateCode2> and/or <TaxRatePercent2>. This may be the whole of the unit price before tax, if the * item carries tax at the same rate on the whole price; or part of the unit price in the case of a mixed tax rate * product. See notes on <TaxRateCode1>. *

* Jonix-Comment: this field is optional */ public TaxableAmount2 taxableAmount2() { _initialize(); return taxableAmount2; } private TaxAmount2 taxAmount2 = TaxAmount2.EMPTY; /** *

* The amount of tax chargeable at the rate specified by <TaxRateCode2> and/or <TaxRatePercent2>. See * notes on <TaxRateCode1>. *

* Jonix-Comment: this field is optional */ public TaxAmount2 taxAmount2() { _initialize(); return taxAmount2; } private PriceEffectiveFrom priceEffectiveFrom = PriceEffectiveFrom.EMPTY; /** *

* The date from which a price becomes effective. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public PriceEffectiveFrom priceEffectiveFrom() { _initialize(); return priceEffectiveFrom; } private PriceEffectiveUntil priceEffectiveUntil = PriceEffectiveUntil.EMPTY; /** *

* The date until which a price remains effective. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public PriceEffectiveUntil priceEffectiveUntil() { _initialize(); return priceEffectiveUntil; } private ListOfOnixDataComposite batchBonuss = JPU.emptyListOfOnixDataComposite(BatchBonus.class); /** *

* A repeatable group of data elements which together specify a batch bonus, ie a quantity of free copies * which are supplied with a certain order quantity. The <BatchBonus> composite is optional. *

* Jonix-Comment: this list may be empty */ public ListOfOnixDataComposite batchBonuss() { _initialize(); return batchBonuss; } private ListOfOnixDataCompositeWithKey discountCodeds = JPU.emptyListOfOnixDataCompositeWithKey(DiscountCoded.class); /** *

* A repeatable group of data elements which together define a discount code from a specified scheme, and allowing * different discount code schemes to be supported without defining additional data elements. Optional. *

* Jonix-Comment: this list may be empty */ public ListOfOnixDataCompositeWithKey discountCodeds() { _initialize(); return discountCodeds; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy