
com.tectonica.jonix.onix3.PriceConstraintLimit Maven / Gradle / Ivy
/*
* Copyright (C) 2012-2024 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.onix3;
import com.tectonica.jonix.common.JPU;
import com.tectonica.jonix.common.OnixComposite.OnixDataComposite;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.struct.JonixPriceConstraintLimit;
import java.io.Serializable;
import java.util.function.Consumer;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
*/
/**
* Price constraint limit composite
*
* An optional and repeatable group of data elements which together specify a quantitative limit on a particular type of
* contractual term or constraint.
*
*
*
* Reference name
* <PriceConstraintLimit>
*
*
* Short tag
* <priceconstraintlimit>
*
*
* Cardinality
* 0…n
*
*
*
* This tag may be included in the following composites:
*
* - <{@link PriceConstraint}>
*
*
* Possible placements within ONIX message:
*
* - {@link Product} ⯈ {@link ProductSupply} ⯈ {@link SupplyDetail} ⯈ {@link Reissue} ⯈ {@link Price} ⯈
* {@link PriceConstraint} ⯈ {@link PriceConstraintLimit}
* - {@link Product} ⯈ {@link ProductSupply} ⯈ {@link SupplyDetail} ⯈ {@link Price} ⯈ {@link PriceConstraint} ⯈
* {@link PriceConstraintLimit}
*
*
* @since Onix-3.03
*/
public class PriceConstraintLimit implements OnixDataComposite, Serializable {
private static final long serialVersionUID = 1L;
public static final String refname = "PriceConstraintLimit";
public static final String shortname = "priceconstraintlimit";
/////////////////////////////////////////////////////////////////////////////////
// ATTRIBUTES
/////////////////////////////////////////////////////////////////////////////////
/**
* (type: dt.DateOrDateTime)
*/
public String datestamp;
/**
* (type: dt.NonEmptyString)
*/
public String sourcename;
public RecordSourceTypes sourcetype;
/////////////////////////////////////////////////////////////////////////////////
// CONSTRUCTION
/////////////////////////////////////////////////////////////////////////////////
private boolean initialized;
private final boolean exists;
private final org.w3c.dom.Element element;
public static final PriceConstraintLimit EMPTY = new PriceConstraintLimit();
public PriceConstraintLimit() {
exists = false;
element = null;
initialized = true; // so that no further processing will be done on this intentionally-empty object
}
public PriceConstraintLimit(org.w3c.dom.Element element) {
exists = true;
initialized = false;
this.element = element;
datestamp = JPU.getAttribute(element, "datestamp");
sourcename = JPU.getAttribute(element, "sourcename");
sourcetype = RecordSourceTypes.byCode(JPU.getAttribute(element, "sourcetype"));
}
@Override
public void _initialize() {
if (initialized) {
return;
}
initialized = true;
JPU.forElementsOf(element, e -> {
final String name = e.getNodeName();
switch (name) {
case Quantity.refname:
case Quantity.shortname:
quantity = new Quantity(e);
break;
case PriceConstraintUnit.refname:
case PriceConstraintUnit.shortname:
priceConstraintUnit = new PriceConstraintUnit(e);
break;
default:
break;
}
});
}
/**
* @return whether this tag (<PriceConstraintLimit> or <priceconstraintlimit>) 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 Quantity quantity = Quantity.EMPTY;
/**
*
* A numeric value representing the maximum permitted quantity or limit of a particular type of constraint.
* Mandatory in each occurrence of the <PriceConstraintLimit> composite, and non-repeating.
*
* Jonix-Comment: this field is required
*/
public Quantity quantity() {
_initialize();
return quantity;
}
private PriceConstraintUnit priceConstraintUnit = PriceConstraintUnit.EMPTY;
/**
*
* An ONIX code for a unit in which a maximum permitted quantity or limit is stated. Mandatory in each occurrence of
* the <PriceConstraintLimit> composite, and non-repeating.
*
* Jonix-Comment: this field is required
*/
public PriceConstraintUnit priceConstraintUnit() {
_initialize();
return priceConstraintUnit;
}
@Override
public JonixPriceConstraintLimit asStruct() {
_initialize();
JonixPriceConstraintLimit struct = new JonixPriceConstraintLimit();
struct.quantity = quantity.value;
struct.priceConstraintUnit = priceConstraintUnit.value;
return struct;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy