
com.tectonica.jonix.onix3.Event 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.ListOfOnixComposite;
import com.tectonica.jonix.common.ListOfOnixDataComposite;
import com.tectonica.jonix.common.ListOfOnixElement;
import com.tectonica.jonix.common.OnixComposite.OnixSuperComposite;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.struct.JonixWebsite;
import java.io.Serializable;
import java.util.function.Consumer;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
*/
/**
* Event composite
*
* A group of data elements which together describe an event to which the product is related. Optional, and repeatable
* if the product contains material from or is related to two or more events.
*
*
*
* Reference name
* <Event>
*
*
* Short tag
* <event>
*
*
* Cardinality
* 0…n
*
*
*
* This tag may be included in the following composites:
*
* - <{@link DescriptiveDetail}>
*
*
* Possible placements within ONIX message:
*
* - {@link Product} ⯈ {@link DescriptiveDetail} ⯈ {@link Event}
*
*
* @since Onix-3.03
*/
public class Event implements OnixSuperComposite, Serializable {
private static final long serialVersionUID = 1L;
public static final String refname = "Event";
public static final String shortname = "event";
/////////////////////////////////////////////////////////////////////////////////
// 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 Event EMPTY = new Event();
public Event() {
exists = false;
element = null;
initialized = true; // so that no further processing will be done on this intentionally-empty object
}
public Event(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 EventRole.refname:
case EventRole.shortname:
eventRole = new EventRole(e);
break;
case EventName.refname:
case EventName.shortname:
eventNames = JPU.addToList(eventNames, new EventName(e));
break;
case EventNumber.refname:
case EventNumber.shortname:
eventNumber = new EventNumber(e);
break;
case EventDate.refname:
case EventDate.shortname:
eventDate = new EventDate(e);
break;
case EventAcronym.refname:
case EventAcronym.shortname:
eventAcronyms = JPU.addToList(eventAcronyms, new EventAcronym(e));
break;
case EventTheme.refname:
case EventTheme.shortname:
eventThemes = JPU.addToList(eventThemes, new EventTheme(e));
break;
case EventPlace.refname:
case EventPlace.shortname:
eventPlaces = JPU.addToList(eventPlaces, new EventPlace(e));
break;
case EventSponsor.refname:
case EventSponsor.shortname:
eventSponsors = JPU.addToList(eventSponsors, new EventSponsor(e));
break;
case Website.refname:
case Website.shortname:
websites = JPU.addToList(websites, new Website(e));
break;
default:
break;
}
});
}
/**
* @return whether this tag (<Event> or <event>) 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 EventRole eventRole = EventRole.EMPTY;
/**
*
* An ONIX code which indicates the relationship between the product and an event to which it is related, eg
* Proceedings of conference / Selected papers from conference / Programme for sporting event / Guide for art
* exhibition. Mandatory and non-repeating.
*
* Jonix-Comment: this field is required
*/
public EventRole eventRole() {
_initialize();
return eventRole;
}
private ListOfOnixElement eventNames = ListOfOnixElement.empty();
/**
*
* The name of an event or series of events to which the product is related. This element is mandatory in each
* occurrence of the <Event> composite, and repeatable to provide parallel names for a single event in
* multiple languages (eg ‘United Nations Climate Change Conference’ and « Conférences des Nations unies
* sur les changements climatiques »). The language attribute is optional for a single instance of
* <EventName>, but must be included in each instance if <EventName> is repeated.
*
* Jonix-Comment: this list is required to contain at least one item
*/
public ListOfOnixElement eventNames() {
_initialize();
return eventNames;
}
private EventNumber eventNumber = EventNumber.EMPTY;
/**
*
* The number of an event to which the product is related, within a series of events. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public EventNumber eventNumber() {
_initialize();
return eventNumber;
}
private EventDate eventDate = EventDate.EMPTY;
/**
*
* The date of an event to which the product is related. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public EventDate eventDate() {
_initialize();
return eventDate;
}
private ListOfOnixElement eventAcronyms = ListOfOnixElement.empty();
/**
*
* An acronym used as a short form of the name of an event or series of events given in the <EventName>
* element. Optional, and repeatable to provide parallel acronyms for a single event in multiple languages. The
* language attribute is optional for a single instance of <EventAcronym>, but must be included in each
* instance if <EventAcronym> is repeated.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixElement eventAcronyms() {
_initialize();
return eventAcronyms;
}
private ListOfOnixElement eventThemes = ListOfOnixElement.empty();
/**
*
* The thematic title of an individual event in a series that has an event series name in the <EventName>
* element. Optional, and repeatable to provide parallel thematic titles for a single event in multiple languages.
* The language attribute is optional for a single instance of <EventTheme>, but must be included in
* each instance if <EventTheme> is repeated.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixElement eventThemes() {
_initialize();
return eventThemes;
}
private ListOfOnixElement eventPlaces = ListOfOnixElement.empty();
/**
*
* The place of an event to which the product is related. Optional, and repeatable to provide parallel placenames
* for a single location in multiple languages. The language attribute is optional for a single instance of
* <EventPlace>, but must be included in each instance if <EventPlace> is repeated.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixElement eventPlaces() {
_initialize();
return eventPlaces;
}
private ListOfOnixComposite eventSponsors = JPU.emptyListOfOnixComposite(EventSponsor.class);
/**
*
* An optional group of data elements which together identify an organizer or sponsor of an event. Either
* an identifier, or one or other of <PersonName> or <CorporateName>, or both an
* identifier and a name, must be present in each occurrence of the composite. The composite is repeatable in order
* to specify multiple organizers and sponsors.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixComposite eventSponsors() {
_initialize();
return eventSponsors;
}
private ListOfOnixDataComposite websites = JPU.emptyListOfOnixDataComposite(Website.class);
/**
*
* An optional group of data elements which together identify and provide a pointer to a website which is related to
* the event identified in an occurrence of the <Event> composite. Repeatable in order to provide links to
* multiple websites.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixDataComposite websites() {
_initialize();
return websites;
}
}