
com.tectonica.jonix.onix2.NotForSale Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jonix-onix2 Show documentation
Show all versions of jonix-onix2 Show documentation
Collection of classes for processing Onix-2 sources
/*
* Copyright (C) 2012 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 java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.tectonica.jonix.JPU;
import com.tectonica.jonix.OnixComposite.OnixSuperComposite;
import com.tectonica.jonix.codelist.CountryCodes;
import com.tectonica.jonix.codelist.LanguageCodes;
import com.tectonica.jonix.codelist.ProductIdentifierTypes;
import com.tectonica.jonix.codelist.RecordSourceTypes;
import com.tectonica.jonix.codelist.Regions;
import com.tectonica.jonix.codelist.TextCaseFlags;
import com.tectonica.jonix.codelist.TextFormats;
import com.tectonica.jonix.codelist.TransliterationSchemes;
import com.tectonica.jonix.struct.JonixProductIdentifier;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DON'T EDIT MANUALLY
*/
/**
* Not for sale composite
*
* A repeatable group of data elements which together identify a country or countries in which the product is not for
* sale, together with the ISBN and/or other product identifier and/or the name of the publisher of the same work in the
* specified country/ies.
*
*
*
* Reference name
* <NotForSale>
*
*
* Short tag
* <notforsale>
*
*
*/
public class NotForSale implements OnixSuperComposite, Serializable
{
private static final long serialVersionUID = 1L;
public static final String refname = "NotForSale";
public static final String shortname = "notforsale";
// ///////////////////////////////////////////////////////////////////////////////
// ATTRIBUTES
// ///////////////////////////////////////////////////////////////////////////////
public TextFormats textformat;
public TextCaseFlags textcase;
public LanguageCodes language;
public TransliterationSchemes transliteration;
/**
* (type: DateOrDateTime)
*/
public String datestamp;
public RecordSourceTypes sourcetype;
public String sourcename;
// ///////////////////////////////////////////////////////////////////////////////
// MEMBERS
// ///////////////////////////////////////////////////////////////////////////////
/**
* (this list is required to contain at least one item)
*/
public List rightsCountrys;
/**
* (this field is optional)
*/
public RightsTerritory rightsTerritory;
/**
* (this field is optional)
*/
public ISBN isbn;
/**
* (this field is optional)
*/
public EAN13 ean13;
/**
* (this list may be empty)
*/
public List productIdentifiers;
/**
* (this field is optional)
*/
public PublisherName publisherName;
// ///////////////////////////////////////////////////////////////////////////////
// SERVICES
// ///////////////////////////////////////////////////////////////////////////////
public NotForSale()
{}
public NotForSale(org.w3c.dom.Element element)
{
textformat = TextFormats.byCode(JPU.getAttribute(element, "textformat"));
textcase = TextCaseFlags.byCode(JPU.getAttribute(element, "textcase"));
language = LanguageCodes.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");
JPU.forElementsOf(element, new JPU.ElementListener()
{
@Override
public void onElement(org.w3c.dom.Element element)
{
final String name = element.getNodeName();
if (name.equals(RightsCountry.refname) || name.equals(RightsCountry.shortname))
rightsCountrys = JPU.addToList(rightsCountrys, new RightsCountry(element));
else if (name.equals(RightsTerritory.refname) || name.equals(RightsTerritory.shortname))
rightsTerritory = new RightsTerritory(element);
else if (name.equals(ISBN.refname) || name.equals(ISBN.shortname))
isbn = new ISBN(element);
else if (name.equals(EAN13.refname) || name.equals(EAN13.shortname))
ean13 = new EAN13(element);
else if (name.equals(ProductIdentifier.refname) || name.equals(ProductIdentifier.shortname))
productIdentifiers = JPU.addToList(productIdentifiers, new ProductIdentifier(element));
else if (name.equals(PublisherName.refname) || name.equals(PublisherName.shortname))
publisherName = new PublisherName(element);
}
});
}
public List> getRightsCountrySets()
{
if (rightsCountrys != null)
{
List> list = new ArrayList<>();
for (RightsCountry i : rightsCountrys)
list.add(i.value);
return list;
}
return null;
}
public java.util.Set getRightsTerritorySet()
{
return (rightsTerritory == null) ? null : rightsTerritory.value;
}
/**
* Raw Format: Fixed-length, 10 characters, all numeric except last character, which may be letter X.
*/
public String getISBNValue()
{
return (isbn == null) ? null : isbn.value;
}
/**
* Raw Format: Fixed-length, 13 numeric digits.
*/
public String getEAN13Value()
{
return (ean13 == null) ? null : ean13.value;
}
/**
* Raw Format: Variable length text, suggested maximum length 100 characters.
*/
public String getPublisherNameValue()
{
return (publisherName == null) ? null : publisherName.value;
}
public JonixProductIdentifier findProductIdentifier(ProductIdentifierTypes productIDType)
{
if (productIdentifiers != null)
{
for (ProductIdentifier x : productIdentifiers)
{
if (x.getProductIDTypeValue() == productIDType)
return x.asJonixProductIdentifier();
}
}
return null;
}
public List findProductIdentifiers(java.util.Set productIDTypes)
{
if (productIdentifiers != null)
{
List matches = new ArrayList<>();
for (ProductIdentifier x : productIdentifiers)
{
if (productIDTypes == null || productIDTypes.contains(x.getProductIDTypeValue()))
matches.add(x.asJonixProductIdentifier());
}
return matches;
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy