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

com.tectonica.jonix.onix3.ProductContactIdentifier 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.OnixDataCompositeWithKey;
import com.tectonica.jonix.common.codelist.NameIdentifierTypes;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.struct.JonixProductContactIdentifier;

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

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

/**
 * 

Product contact identifier composite

*

* A group of data elements which together define an identifier of the product contact. The composite is optional, and * repeatable if more than one identifier of different types is sent; but either a <ProductContactName> * or a <ProductContactIdentifier> must be included. *

* * * * * * * * * * * * * *
Reference name<ProductContactIdentifier>
Short tag<productcontactidentifier>
Cardinality0…n
*

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

    *
  • <{@link ProductContact}>
  • *
*

* Possible placements within ONIX message: *

    *
  • {@link Product} ⯈ {@link PublishingDetail} ⯈ {@link ProductContact} ⯈ {@link ProductContactIdentifier}
  • *
  • {@link Product} ⯈ {@link ProductSupply} ⯈ {@link MarketPublishingDetail} ⯈ {@link ProductContact} ⯈ * {@link ProductContactIdentifier}
  • *
* * @since Onix-3.01 */ public class ProductContactIdentifier implements OnixDataCompositeWithKey, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "ProductContactIdentifier"; public static final String shortname = "productcontactidentifier"; ///////////////////////////////////////////////////////////////////////////////// // 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 ProductContactIdentifier EMPTY = new ProductContactIdentifier(); public ProductContactIdentifier() { exists = false; element = null; initialized = true; // so that no further processing will be done on this intentionally-empty object } public ProductContactIdentifier(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 ProductContactIDType.refname: case ProductContactIDType.shortname: productContactIDType = new ProductContactIDType(e); break; case IDValue.refname: case IDValue.shortname: idValue = new IDValue(e); break; case IDTypeName.refname: case IDTypeName.shortname: idTypeName = new IDTypeName(e); break; default: break; } }); } /** * @return whether this tag (<ProductContactIdentifier> or <productcontactidentifier>) 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 ProductContactIDType productContactIDType = ProductContactIDType.EMPTY; /** *

* An ONIX code identifying a scheme from which an identifier in the <IDValue> element is taken. Mandatory in * each occurrence of the <ProductContactIdentifier> composite, and non-repeating. *

* Jonix-Comment: this field is required */ public ProductContactIDType productContactIDType() { _initialize(); return productContactIDType; } private IDValue idValue = IDValue.EMPTY; /** *

* An identifier of the type specified in the <ProductContactIDType> element. Mandatory in each occurrence of * the <ProductContactIdentifier> composite, and non-repeating. *

* Jonix-Comment: this field is required */ public IDValue idValue() { _initialize(); return idValue; } private IDTypeName idTypeName = IDTypeName.EMPTY; /** *

* A name which identifies a proprietary identifier scheme (ie a scheme which is not a standard and for which * there is no individual ID type code). Must be included when, and only when, the code in the * <ProductContactIDType> element indicates a proprietary scheme. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public IDTypeName idTypeName() { _initialize(); return idTypeName; } @Override public JonixProductContactIdentifier asStruct() { _initialize(); JonixProductContactIdentifier struct = new JonixProductContactIdentifier(); struct.productContactIDType = productContactIDType.value; struct.idTypeName = idTypeName.value; struct.idValue = idValue.value; return struct; } @Override public NameIdentifierTypes structKey() { return productContactIDType().value; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy