com.tectonica.jonix.onix2.Series Maven / Gradle / Ivy
Show all versions of jonix-onix2 Show documentation
/*
* 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.ListOfOnixComposite;
import com.tectonica.jonix.common.ListOfOnixDataCompositeWithKey;
import com.tectonica.jonix.common.OnixComposite.OnixSuperComposite;
import com.tectonica.jonix.common.codelist.Languages;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.codelist.SeriesIdentifierTypes;
import com.tectonica.jonix.common.codelist.TextCaseFlags;
import com.tectonica.jonix.common.codelist.TextFormats;
import com.tectonica.jonix.common.codelist.TitleTypes;
import com.tectonica.jonix.common.codelist.TransliterationSchemes;
import com.tectonica.jonix.common.struct.JonixSeriesIdentifier;
import com.tectonica.jonix.common.struct.JonixTitle;
import java.io.Serializable;
import java.util.function.Consumer;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
*/
/**
* Series composite
*
* A repeatable group of data elements which together describe a series of which the product is part.
*
*
*
* Reference name
* <Series>
*
*
* Short tag
* <series>
*
*
*
* This tag may be included in the following composites:
*
* - <{@link Product}>
*
*
* Possible placements within ONIX message:
*
* - {@link Product} ⯈ {@link Series}
*
*/
public class Series implements OnixSuperComposite, Serializable {
private static final long serialVersionUID = 1L;
public static final String refname = "Series";
public static final String shortname = "series";
/////////////////////////////////////////////////////////////////////////////////
// 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 Series EMPTY = new Series();
public Series() {
exists = false;
element = null;
initialized = true; // so that no further processing will be done on this intentionally-empty object
}
public Series(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 TitleOfSeries.refname:
case TitleOfSeries.shortname:
titleOfSeries = new TitleOfSeries(e);
break;
case SeriesISSN.refname:
case SeriesISSN.shortname:
seriesISSN = new SeriesISSN(e);
break;
case PublisherSeriesCode.refname:
case PublisherSeriesCode.shortname:
publisherSeriesCode = new PublisherSeriesCode(e);
break;
case NumberWithinSeries.refname:
case NumberWithinSeries.shortname:
numberWithinSeries = new NumberWithinSeries(e);
break;
case YearOfAnnual.refname:
case YearOfAnnual.shortname:
yearOfAnnual = new YearOfAnnual(e);
break;
case SeriesIdentifier.refname:
case SeriesIdentifier.shortname:
seriesIdentifiers = JPU.addToList(seriesIdentifiers, new SeriesIdentifier(e));
break;
case Title.refname:
case Title.shortname:
titles = JPU.addToList(titles, new Title(e));
break;
case Contributor.refname:
case Contributor.shortname:
contributors = JPU.addToList(contributors, new Contributor(e));
break;
default:
break;
}
});
}
/**
* @return whether this tag (<Series> or <series>) 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 TitleOfSeries titleOfSeries = TitleOfSeries.EMPTY;
/**
*
* The full title of the series, without abbreviation or abridgement. Non-repeating. Either the
* <TitleOfSeries> element or at least one occurrence of the <Title> composite must occur in each
* occurrence of the <Series> composite. The <Title> composite provides a more comprehensive
* representation of a series title, and allows alternative forms to be sent.
*
* Jonix-Comment: this field is required
*/
public TitleOfSeries titleOfSeries() {
_initialize();
return titleOfSeries;
}
private SeriesISSN seriesISSN = SeriesISSN.EMPTY;
/**
*
* International Standard Serial Number identifying a series of which the product forms part. ISSNs are the standard
* numbering scheme for journals, and most publishers’ book series are not eligible to be identified by an ISSN.
* ISSNs may be used, however, for established scholarly series such as Annual Reviews of… or Methods in… which are
* shelved in libraries as if they were journals. The field is optional and non-repeating. The
* <SeriesIdentifier> composite on the next page provides a more general method of handling this and other
* series identifiers, and is to be preferred.
*
* Jonix-Comment: this field is optional
*/
public SeriesISSN seriesISSN() {
_initialize();
return seriesISSN;
}
private PublisherSeriesCode publisherSeriesCode = PublisherSeriesCode.EMPTY;
/**
*
* A code or mnemonic assigned by the publisher to designate a series (and therefore not guaranteed to be unique).
* Optional and non-repeating. The <SeriesIdentifier> composite on the next page provides a more
* general method of handling this and other series identifiers, and is to be preferred.
*
* Jonix-Comment: this field is optional
*/
public PublisherSeriesCode publisherSeriesCode() {
_initialize();
return publisherSeriesCode;
}
private NumberWithinSeries numberWithinSeries = NumberWithinSeries.EMPTY;
/**
*
* The distinctive enumeration of a product within a series. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public NumberWithinSeries numberWithinSeries() {
_initialize();
return numberWithinSeries;
}
private YearOfAnnual yearOfAnnual = YearOfAnnual.EMPTY;
/**
*
* The nominal year of an annual publication. May be entered as either a single year YYYY or a span of two
* consecutive years YYYY-YYYY. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public YearOfAnnual yearOfAnnual() {
_initialize();
return yearOfAnnual;
}
private ListOfOnixDataCompositeWithKey seriesIdentifiers = JPU.emptyListOfOnixDataCompositeWithKey(SeriesIdentifier.class);
/**
*
* A repeatable group of data elements which together define an identifier of a series or subseries. The composite
* is optional, and may only repeat if two or more identifiers of different types are sent. It is not permissible to
* have two identifiers of the same type.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixDataCompositeWithKey
seriesIdentifiers() {
_initialize();
return seriesIdentifiers;
}
private ListOfOnixDataCompositeWithKey titles =
JPU.emptyListOfOnixDataCompositeWithKey(Title.class);
/**
*
* A repeatable group of data elements which together give the text of a title, including a subtitle where
* applicable, and specify its type. Please see Group PR.7 for details.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixDataCompositeWithKey titles() {
_initialize();
return titles;
}
private ListOfOnixComposite contributors = JPU.emptyListOfOnixComposite(Contributor.class);
/**
*
* A repeatable group of data elements which together describe a personal or corporate contributor to the series.
* The composite is optional in any occurrence of the <Series> composite. Please see Group PR.8
* for details.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixComposite contributors() {
_initialize();
return contributors;
}
}