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

com.tectonica.jonix.onix3.Prize 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.ListOfOnixElement;
import com.tectonica.jonix.common.OnixComposite.OnixDataComposite;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.struct.JonixPrize;

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

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

/**
 * 

Prize composite

*

* An optional group of data elements which together describe a prize or award won by the contributor for a body of work * (rather than for this or other specific works or products). Repeatable to describe multiple prizes or awards. *

* * * * * * * * * * * * * *
Reference name<Prize>
Short tag<prize>
Cardinality0…n
*

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

    *
  • <{@link CollateralDetail}>
  • *
  • <{@link Contributor}>
  • *
*

* Possible placements within ONIX message: *

    *
  • {@link Product} ⯈ {@link CollateralDetail} ⯈ {@link Prize}
  • *
  • {@link Product} ⯈ {@link DescriptiveDetail} ⯈ {@link Contributor} ⯈ {@link Prize}
  • *
  • {@link Product} ⯈ {@link ContentDetail} ⯈ {@link ContentItem} ⯈ {@link Contributor} ⯈ {@link Prize}
  • *
  • {@link Product} ⯈ {@link PromotionDetail} ⯈ {@link PromotionalEvent} ⯈ {@link Contributor} ⯈ {@link Prize}
  • *
  • {@link Product} ⯈ {@link DescriptiveDetail} ⯈ {@link Collection} ⯈ {@link Contributor} ⯈ {@link Prize}
  • *
* * @since Onix-3.03 */ public class Prize implements OnixDataComposite, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "Prize"; public static final String shortname = "prize"; ///////////////////////////////////////////////////////////////////////////////// // 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 Prize EMPTY = new Prize(); public Prize() { exists = false; element = null; initialized = true; // so that no further processing will be done on this intentionally-empty object } public Prize(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 PrizeName.refname: case PrizeName.shortname: prizeNames = JPU.addToList(prizeNames, new PrizeName(e)); break; case PrizeYear.refname: case PrizeYear.shortname: prizeYear = new PrizeYear(e); break; case PrizeCountry.refname: case PrizeCountry.shortname: prizeCountry = new PrizeCountry(e); break; case PrizeRegion.refname: case PrizeRegion.shortname: prizeRegion = new PrizeRegion(e); break; case PrizeCode.refname: case PrizeCode.shortname: prizeCode = new PrizeCode(e); break; case PrizeStatement.refname: case PrizeStatement.shortname: prizeStatements = JPU.addToList(prizeStatements, new PrizeStatement(e)); break; case PrizeJury.refname: case PrizeJury.shortname: prizeJurys = JPU.addToList(prizeJurys, new PrizeJury(e)); break; default: break; } }); } /** * @return whether this tag (<Prize> or <prize>) 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 ListOfOnixElement prizeNames = ListOfOnixElement.empty(); /** *

* The name of a prize or award which the product or work has received. Mandatory in each occurrence of the * <Prize> composite, and repeatable to provide a parallel award name in multiple languages. The * language attribute is optional for a single instance of <PrizeName>, but must be included in each * instance if <PrizeName> is repeated. *

* Jonix-Comment: this list is required to contain at least one item */ public ListOfOnixElement prizeNames() { _initialize(); return prizeNames; } private PrizeYear prizeYear = PrizeYear.EMPTY; /** *

* The year in which a prize or award was given. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public PrizeYear prizeYear() { _initialize(); return prizeYear; } private PrizeCountry prizeCountry = PrizeCountry.EMPTY; /** *

* An ISO standard code identifying the country in which a prize or award is given. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public PrizeCountry prizeCountry() { _initialize(); return prizeCountry; } private PrizeRegion prizeRegion = PrizeRegion.EMPTY; /** *

* An ONIX code identifying the region in which a prize or award is given. Optional and non-repeatable. A region is * an area which is not a country, but which is precisely defined in geographical terms, eg Newfoundland and * Labrador, Florida. If both country and region are specified, the region must be within the country. Note that US * States have region codes, while US overseas territories have distinct ISO Country Codes. *

* Jonix-Comment: this field is optional */ public PrizeRegion prizeRegion() { _initialize(); return prizeRegion; } private PrizeCode prizeCode = PrizeCode.EMPTY; /** *

* An ONIX code indicating the achievement of the product in relation to a prize or award, eg winner, * runner-up, shortlisted. Optional and non-repeating. *

* Jonix-Comment: this field is optional */ public PrizeCode prizeCode() { _initialize(); return prizeCode; } private ListOfOnixElement prizeStatements = ListOfOnixElement.empty(); /** *

* A short free-text description of the prize or award, intended primarily for display. Optional, and repeatable if * the text is provided in more than one language. The language attribute is optional for a single instance * of <PrizeStatement>, but must be included in each instance if <PrizeStatement> is repeated. *

*

* <PrizeStatement> is intended for display purposes only. When used, a <PrizeStatement> must be * complete in itself, ie it should not be treated as merely supplementary to other elements within the * <Prize> composite. Nor should <PrizeStatement> be supplied instead of those other elements – * at minimum, the <PrizeCode> element, and whenever appropriate the <PrizeYear> element should be * supplied. *

* Jonix-Comment: this list may be empty */ public ListOfOnixElement prizeStatements() { _initialize(); return prizeStatements; } private ListOfOnixElement prizeJurys = ListOfOnixElement.empty(); /** *

* Free text listing members of the jury that awarded the prize. Optional, and repeatable if the text is provided in * more than one language. The language attribute is optional for a single instance of <PrizeJury>, but * must be included in each instance if <PrizeJury> is repeated. *

* Jonix-Comment: this list may be empty */ public ListOfOnixElement prizeJurys() { _initialize(); return prizeJurys; } @Override public JonixPrize asStruct() { _initialize(); JonixPrize struct = new JonixPrize(); struct.prizeCode = prizeCode.value; struct.prizeCountry = prizeCountry.value; struct.prizeJurys = prizeJurys.values(); struct.prizeNames = prizeNames.values(); struct.prizeYear = prizeYear.value; return struct; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy