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

com.tectonica.jonix.onix3.Imprint 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.ListOfOnixDataCompositeWithKey;
import com.tectonica.jonix.common.OnixComposite.OnixSuperComposite;
import com.tectonica.jonix.common.codelist.NameIdentifierTypes;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.struct.JonixImprintIdentifier;

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

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

/**
 * 

Imprint or brand composite

*

* An optional group of data elements which together identify an imprint or brand under which the product is marketed. * The composite must carry either a name identifier or a name or both, and is repeatable to specify multiple imprints * or brands. *

* * * * * * * * * * * * * *
Reference name<Imprint>
Short tag<imprint>
Cardinality0…n
*

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

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

* Possible placements within ONIX message: *

    *
  • {@link Product} ⯈ {@link PublishingDetail} ⯈ {@link Imprint}
  • *
*/ public class Imprint implements OnixSuperComposite, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "Imprint"; public static final String shortname = "imprint"; ///////////////////////////////////////////////////////////////////////////////// // 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 Imprint EMPTY = new Imprint(); public Imprint() { exists = false; element = null; initialized = true; // so that no further processing will be done on this intentionally-empty object } public Imprint(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 ImprintIdentifier.refname: case ImprintIdentifier.shortname: imprintIdentifiers = JPU.addToList(imprintIdentifiers, new ImprintIdentifier(e)); break; case ImprintName.refname: case ImprintName.shortname: imprintName = new ImprintName(e); break; default: break; } }); } /** * @return whether this tag (<Imprint> or <imprint>) 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 ListOfOnixDataCompositeWithKey imprintIdentifiers = JPU.emptyListOfOnixDataCompositeWithKey(ImprintIdentifier.class); /** *

* A group of data elements which together define the identifier of an imprint name. Optional, but mandatory if the * <Imprint> composite does not carry an <ImprintName>. The composite is repeatable in order to specify * multiple identifiers for the same imprint or brand. *

* Jonix-Comment: this list is required to contain at least one item */ public ListOfOnixDataCompositeWithKey imprintIdentifiers() { _initialize(); return imprintIdentifiers; } private ImprintName imprintName = ImprintName.EMPTY; /** *

* The name of an imprint or brand under which the product is issued, as it appears on the product. Mandatory if * there is no imprint identifier in an occurrence of the <Imprint> composite, and optional if an imprint * identifier is included. Non-repeating. *

* Jonix-Comment: this field is optional */ public ImprintName imprintName() { _initialize(); return imprintName; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy