com.tectonica.jonix.onix2.Reissue 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.ImageAudioVideoFileTypes;
import com.tectonica.jonix.common.codelist.Languages;
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.JonixMediaFile;
import java.io.Serializable;
import java.util.function.Consumer;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
*/
/**
* Reissue composite
*
* A group of data elements which together specify that a product is to be reissued within the market to which the
* <SupplyDetail> composite applies. Optional and non-repeating. The <Reissue> composite is used only when
* the publisher intends to re-launch the product under the same ISBN. There are two possible cases:
*
*
* - When the product is unavailable during the period immediately before reissue. In this case, the
* <AvailabilityCode> should carry the value UR for “unavailable, awaiting reissue”, and the ONIX record can be
* updated to describe the reissued product as soon as details can be made available
* - When the product is still available during the period up to the reissue date. In this case, the ONIX record
* should continue to describe the existing product and the <AvailabilityCode> value should remain IP right up to
* the reissue date. At that date, the record should be updated to describe the reissued product, with the
* <AvailabilityCode> value remaining IP.
*
*
* After reissue, it is recommended that the <Reissue> composite should be retained as a permanent element of the
* ONIX record, carrying only the <ReissueDate> element, which will then indicate “date last reissued”.
*
*
*
* Reference name
* <Reissue>
*
*
* Short tag
* <reissue>
*
*
*
* This tag may be included in the following composites:
*
* - <{@link SupplyDetail}>
*
*
* Possible placements within ONIX message:
*
* - {@link Product} ⯈ {@link SupplyDetail} ⯈ {@link Reissue}
*
*
* @since Onix-2.1
*/
public class Reissue implements OnixSuperComposite, Serializable {
private static final long serialVersionUID = 1L;
public static final String refname = "Reissue";
public static final String shortname = "reissue";
/////////////////////////////////////////////////////////////////////////////////
// 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 Reissue EMPTY = new Reissue();
public Reissue() {
exists = false;
element = null;
initialized = true; // so that no further processing will be done on this intentionally-empty object
}
public Reissue(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 ReissueDate.refname:
case ReissueDate.shortname:
reissueDate = new ReissueDate(e);
break;
case ReissueDescription.refname:
case ReissueDescription.shortname:
reissueDescription = new ReissueDescription(e);
break;
case Price.refname:
case Price.shortname:
prices = JPU.addToList(prices, new Price(e));
break;
case MediaFile.refname:
case MediaFile.shortname:
mediaFiles = JPU.addToList(mediaFiles, new MediaFile(e));
break;
default:
break;
}
});
}
/**
* @return whether this tag (<Reissue> or <reissue>) 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 ReissueDate reissueDate = ReissueDate.EMPTY;
/**
*
* The date on which the product will be reissued, or (after reissue) the date when it was last reissued. Mandatory
* in each occurrence of the <Reissue> composite, and non-repeating.
*
* Jonix-Comment: this field is required
*/
public ReissueDate reissueDate() {
_initialize();
return reissueDate;
}
private ReissueDescription reissueDescription = ReissueDescription.EMPTY;
/**
*
* Text explaining the nature of the reissue. Optional and non-repeating.
*
* Jonix-Comment: this field is optional
*/
public ReissueDescription reissueDescription() {
_initialize();
return reissueDescription;
}
private ListOfOnixComposite prices = JPU.emptyListOfOnixComposite(Price.class);
/**
*
* A optional and repeatable group of data elements which together specify a unit price, used here to indicate a
* price that will apply when the product is reissued. Please see above, within Group PR.24, for
* details.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixComposite prices() {
_initialize();
return prices;
}
private ListOfOnixDataCompositeWithKey mediaFiles =
JPU.emptyListOfOnixDataCompositeWithKey(MediaFile.class);
/**
*
* An optional and repeatable group of data elements which together identify and provide pointers to an image, audio
* or video file, used here to indicate that there is a new cover or jacket image for a reissue. Please see
* Group PR.16 for details.
*
* Jonix-Comment: this list may be empty
*/
public ListOfOnixDataCompositeWithKey mediaFiles() {
_initialize();
return mediaFiles;
}
}