com.tectonica.jonix.onix2.PersonAsSubject 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.PersonNameIdentifierTypes;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.codelist.TextCaseFlags;
import com.tectonica.jonix.common.codelist.TextFormats;
import com.tectonica.jonix.common.codelist.TransliterationSchemes;
import com.tectonica.jonix.common.struct.JonixPersonNameIdentifier;
import java.io.Serializable;
import java.util.function.Consumer;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
*/
/**
* Person as subject composite
*
* An optional and repeatable group of data elements which together represent the name of a person who is part of the
* subject of a product.
*
*
*
* Reference name
* <PersonAsSubject>
*
*
* Short tag
* <personassubject>
*
*
*
* This tag may be included in the following composites:
*
* - <{@link Product}>
* - <{@link ContentItem}>
*
*
* Possible placements within ONIX message:
*
* - {@link Product} ⯈ {@link PersonAsSubject}
* - {@link Product} ⯈ {@link ContentItem} ⯈ {@link PersonAsSubject}
*
*/
public class PersonAsSubject implements OnixSuperComposite, Serializable {
private static final long serialVersionUID = 1L;
public static final String refname = "PersonAsSubject";
public static final String shortname = "personassubject";
/////////////////////////////////////////////////////////////////////////////////
// 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 PersonAsSubject EMPTY = new PersonAsSubject();
public PersonAsSubject() {
exists = false;
element = null;
initialized = true; // so that no further processing will be done on this intentionally-empty object
}
public PersonAsSubject(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 PersonName.refname:
case PersonName.shortname:
personName = new PersonName(e);
break;
case PersonNameInverted.refname:
case PersonNameInverted.shortname:
personNameInverted = new PersonNameInverted(e);
break;
case TitlesBeforeNames.refname:
case TitlesBeforeNames.shortname:
titlesBeforeNames = new TitlesBeforeNames(e);
break;
case NamesBeforeKey.refname:
case NamesBeforeKey.shortname:
namesBeforeKey = new NamesBeforeKey(e);
break;
case PrefixToKey.refname:
case PrefixToKey.shortname:
prefixToKey = new PrefixToKey(e);
break;
case KeyNames.refname:
case KeyNames.shortname:
keyNames = new KeyNames(e);
break;
case NamesAfterKey.refname:
case NamesAfterKey.shortname:
namesAfterKey = new NamesAfterKey(e);
break;
case SuffixToKey.refname:
case SuffixToKey.shortname:
suffixToKey = new SuffixToKey(e);
break;
case LettersAfterNames.refname:
case LettersAfterNames.shortname:
lettersAfterNames = new LettersAfterNames(e);
break;
case TitlesAfterNames.refname:
case TitlesAfterNames.shortname:
titlesAfterNames = new TitlesAfterNames(e);
break;
case Name.refname:
case Name.shortname:
names = JPU.addToList(names, new Name(e));
break;
case PersonNameIdentifier.refname:
case PersonNameIdentifier.shortname:
personNameIdentifiers = JPU.addToList(personNameIdentifiers, new PersonNameIdentifier(e));
break;
default:
break;
}
});
}
/**
* @return whether this tag (<PersonAsSubject> or <personassubject>) 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 PersonName personName = PersonName.EMPTY;
/**
* Jonix-Comment: this field is required
*/
public PersonName personName() {
_initialize();
return personName;
}
private PersonNameInverted personNameInverted = PersonNameInverted.EMPTY;
/**
*
* The name of a person who contributed to the creation of the product, presented in inverted order, with the
* element used for alphabetical sorting placed first. Optional and non-repeating: see Group PR.8 introductory
* text for valid options.
*
* Jonix-Comment: this field is optional
*/
public PersonNameInverted personNameInverted() {
_initialize();
return personNameInverted;
}
private TitlesBeforeNames titlesBeforeNames = TitlesBeforeNames.EMPTY;
/**
*
* The first part of a structured name of a person who contributed to the creation of the product: qualifications
* and/or titles preceding a person’s names, eg Professor or HRH Prince or Saint. Optional and
* non-repeating: see Group PR.8 introductory text for valid options.
*
* Jonix-Comment: this field is optional
*/
public TitlesBeforeNames titlesBeforeNames() {
_initialize();
return titlesBeforeNames;
}
private NamesBeforeKey namesBeforeKey = NamesBeforeKey.EMPTY;
/**
*
* The second part of a structured name of a person who contributed to the creation of the product: name(s) and/or
* initial(s) preceding a person’s key name(s), eg James J. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public NamesBeforeKey namesBeforeKey() {
_initialize();
return namesBeforeKey;
}
private PrefixToKey prefixToKey = PrefixToKey.EMPTY;
/**
*
* The third part of a structured name of a person who contributed to the creation of the product: a prefix which
* precedes the key name(s) but which is not to be treated as part of the key name, eg van in Ludwig van
* Beethoven. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public PrefixToKey prefixToKey() {
_initialize();
return prefixToKey;
}
private KeyNames keyNames = KeyNames.EMPTY;
/**
*
* The fourth part of a structured name of a person who contributed to the creation of the product: key name(s),
* ie the name elements normally used to open an entry in an alphabetical list, eg Smith or Garcia
* Marquez or Madonna or Francis de Sales (in Saint Francis de Sales). Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public KeyNames keyNames() {
_initialize();
return keyNames;
}
private NamesAfterKey namesAfterKey = NamesAfterKey.EMPTY;
/**
*
* The fifth part of a structured name of a person who contributed to the creation of the product: name suffix, or
* name(s) following a person’s key name(s), eg Ibrahim (in Anwar Ibrahim). Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public NamesAfterKey namesAfterKey() {
_initialize();
return namesAfterKey;
}
private SuffixToKey suffixToKey = SuffixToKey.EMPTY;
/**
*
* The sixth part of a structured name of a person who contributed to the creation of the product: a suffix
* following a person’s key name(s), eg Jr or III. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public SuffixToKey suffixToKey() {
_initialize();
return suffixToKey;
}
private LettersAfterNames lettersAfterNames = LettersAfterNames.EMPTY;
/**
*
* The seventh part of a structured name of a person who contributed to the creation of the product: qualifications
* and honors following a person’s names, eg CBE FRS. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public LettersAfterNames lettersAfterNames() {
_initialize();
return lettersAfterNames;
}
private TitlesAfterNames titlesAfterNames = TitlesAfterNames.EMPTY;
/**
*
* The eighth part of a structured name of a person who contributed to the creation of the product: titles following
* a person’s names, eg Duke of Edinburgh. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public TitlesAfterNames titlesAfterNames() {
_initialize();
return titlesAfterNames;
}
private ListOfOnixComposite names = JPU.emptyListOfOnixComposite(Name.class);
/**
*
* A repeatable group of data elements which together represent a personal name, and specify its type. The
* <Name> composite may be used to send alternate names for the same person, eg to handle such cases
* as Ian Rankin writing as Jack Harvey.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixComposite names() {
_initialize();
return names;
}
private ListOfOnixDataCompositeWithKey personNameIdentifiers =
JPU.emptyListOfOnixDataCompositeWithKey(PersonNameIdentifier.class);
/**
*
* A repeatable group of data elements which together specify a party name identifier, used here to carry an
* identifier for a name given in an occurrence of the <Contributor> composite. Optional: see Group PR.8
* introductory text for valid options.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixDataCompositeWithKey
personNameIdentifiers() {
_initialize();
return personNameIdentifiers;
}
}