
com.tectonica.jonix.onix2.ContentItem 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.ImageAudioVideoFileTypes;
import com.tectonica.jonix.codelist.LanguageCodes;
import com.tectonica.jonix.codelist.OtherTextTypes;
import com.tectonica.jonix.codelist.RecordSourceTypes;
import com.tectonica.jonix.codelist.TextCaseFlags;
import com.tectonica.jonix.codelist.TextFormats;
import com.tectonica.jonix.codelist.TitleTypes;
import com.tectonica.jonix.codelist.TransliterationSchemes;
import com.tectonica.jonix.codelist.WorkIdentifierTypes;
import com.tectonica.jonix.struct.JonixMediaFile;
import com.tectonica.jonix.struct.JonixOtherText;
import com.tectonica.jonix.struct.JonixTitle;
import com.tectonica.jonix.struct.JonixWorkIdentifier;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DON'T EDIT MANUALLY
*/
/**
* Content item composite
*
* A repeatable group of data elements which together describe a content item within a product.
*
*
*
* Reference name
* <ContentItem>
*
*
* Short tag
* <contentitem>
*
*
*/
public class ContentItem implements OnixSuperComposite, Serializable
{
private static final long serialVersionUID = 1L;
public static final String refname = "ContentItem";
public static final String shortname = "contentitem";
// ///////////////////////////////////////////////////////////////////////////////
// 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 field is optional)
*/
public LevelSequenceNumber levelSequenceNumber;
/**
* (this field is required)
*/
public TextItem textItem;
/**
* (this list may be empty)
*/
public List websites;
/**
* (this field is required)
*/
public ComponentTypeName componentTypeName;
/**
* (this field is optional)
*/
public ComponentNumber componentNumber;
/**
* (this field is optional)
*/
public DistinctiveTitle distinctiveTitle;
/**
* (this list may be empty)
*/
public List titles;
/**
* (this list may be empty)
*/
public List workIdentifiers;
/**
* (this list may be empty)
*/
public List contributors;
/**
* (this field is optional)
*/
public ContributorStatement contributorStatement;
/**
* (this list may be empty)
*/
public List subjects;
/**
* (this list may be empty)
*/
public List personAsSubjects;
/**
* (this list may be empty)
*/
public List corporateBodyAsSubjects;
/**
* (this list may be empty)
*/
public List placeAsSubjects;
/**
* (this list may be empty)
*/
public List otherTexts;
/**
* (this list may be empty)
*/
public List mediaFiles;
// ///////////////////////////////////////////////////////////////////////////////
// SERVICES
// ///////////////////////////////////////////////////////////////////////////////
public ContentItem()
{}
public ContentItem(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(LevelSequenceNumber.refname) || name.equals(LevelSequenceNumber.shortname))
levelSequenceNumber = new LevelSequenceNumber(element);
else if (name.equals(TextItem.refname) || name.equals(TextItem.shortname))
textItem = new TextItem(element);
else if (name.equals(Website.refname) || name.equals(Website.shortname))
websites = JPU.addToList(websites, new Website(element));
else if (name.equals(ComponentTypeName.refname) || name.equals(ComponentTypeName.shortname))
componentTypeName = new ComponentTypeName(element);
else if (name.equals(ComponentNumber.refname) || name.equals(ComponentNumber.shortname))
componentNumber = new ComponentNumber(element);
else if (name.equals(DistinctiveTitle.refname) || name.equals(DistinctiveTitle.shortname))
distinctiveTitle = new DistinctiveTitle(element);
else if (name.equals(Title.refname) || name.equals(Title.shortname))
titles = JPU.addToList(titles, new Title(element));
else if (name.equals(WorkIdentifier.refname) || name.equals(WorkIdentifier.shortname))
workIdentifiers = JPU.addToList(workIdentifiers, new WorkIdentifier(element));
else if (name.equals(Contributor.refname) || name.equals(Contributor.shortname))
contributors = JPU.addToList(contributors, new Contributor(element));
else if (name.equals(ContributorStatement.refname) || name.equals(ContributorStatement.shortname))
contributorStatement = new ContributorStatement(element);
else if (name.equals(Subject.refname) || name.equals(Subject.shortname))
subjects = JPU.addToList(subjects, new Subject(element));
else if (name.equals(PersonAsSubject.refname) || name.equals(PersonAsSubject.shortname))
personAsSubjects = JPU.addToList(personAsSubjects, new PersonAsSubject(element));
else if (name.equals(CorporateBodyAsSubject.refname) || name.equals(CorporateBodyAsSubject.shortname))
corporateBodyAsSubjects = JPU.addToList(corporateBodyAsSubjects,
new CorporateBodyAsSubject(element));
else if (name.equals(PlaceAsSubject.refname) || name.equals(PlaceAsSubject.shortname))
placeAsSubjects = JPU.addToList(placeAsSubjects, new PlaceAsSubject(element));
else if (name.equals(OtherText.refname) || name.equals(OtherText.shortname))
otherTexts = JPU.addToList(otherTexts, new OtherText(element));
else if (name.equals(MediaFile.refname) || name.equals(MediaFile.shortname))
mediaFiles = JPU.addToList(mediaFiles, new MediaFile(element));
}
});
}
/**
* Raw Format: Variable-length string of integers, each successive integer being separated by a full stop, suggested
* maximum length 100 characters
*/
public String getLevelSequenceNumberValue()
{
return (levelSequenceNumber == null) ? null : levelSequenceNumber.value;
}
/**
* Raw Format: Variable-length alphanumeric, suggested maximum length 20 characters
*/
public String getComponentTypeNameValue()
{
return (componentTypeName == null) ? null : componentTypeName.value;
}
/**
* Raw Format: Variable-length alphanumeric, suggested maximum length 20 characters
*/
public String getComponentNumberValue()
{
return (componentNumber == null) ? null : componentNumber.value;
}
/**
* Raw Format: Variable-length alphanumeric, suggested maximum length 300 characters
*/
public String getDistinctiveTitleValue()
{
return (distinctiveTitle == null) ? null : distinctiveTitle.value;
}
/**
* Raw Format: Variable-length text, suggested maximum length 1000 characters
*/
public String getContributorStatementValue()
{
return (contributorStatement == null) ? null : contributorStatement.value;
}
/**
* Raw Format: Variable-length text, suggested maximum 200 characters.
*/
public List getCorporateBodyAsSubjectValues()
{
if (corporateBodyAsSubjects != null)
{
List list = new ArrayList<>();
for (CorporateBodyAsSubject i : corporateBodyAsSubjects)
list.add(i.value);
return list;
}
return null;
}
/**
* Raw Format: Variable-length text, suggested maximum 100 characters.
*/
public List getPlaceAsSubjectValues()
{
if (placeAsSubjects != null)
{
List list = new ArrayList<>();
for (PlaceAsSubject i : placeAsSubjects)
list.add(i.value);
return list;
}
return null;
}
public JonixTitle findTitle(TitleTypes titleType)
{
if (titles != null)
{
for (Title x : titles)
{
if (x.getTitleTypeValue() == titleType)
return x.asJonixTitle();
}
}
return null;
}
public List findTitles(java.util.Set titleTypes)
{
if (titles != null)
{
List matches = new ArrayList<>();
for (Title x : titles)
{
if (titleTypes == null || titleTypes.contains(x.getTitleTypeValue()))
matches.add(x.asJonixTitle());
}
return matches;
}
return null;
}
public JonixWorkIdentifier findWorkIdentifier(WorkIdentifierTypes workIDType)
{
if (workIdentifiers != null)
{
for (WorkIdentifier x : workIdentifiers)
{
if (x.getWorkIDTypeValue() == workIDType)
return x.asJonixWorkIdentifier();
}
}
return null;
}
public List findWorkIdentifiers(java.util.Set workIDTypes)
{
if (workIdentifiers != null)
{
List matches = new ArrayList<>();
for (WorkIdentifier x : workIdentifiers)
{
if (workIDTypes == null || workIDTypes.contains(x.getWorkIDTypeValue()))
matches.add(x.asJonixWorkIdentifier());
}
return matches;
}
return null;
}
public JonixOtherText findOtherText(OtherTextTypes textTypeCode)
{
if (otherTexts != null)
{
for (OtherText x : otherTexts)
{
if (x.getTextTypeCodeValue() == textTypeCode)
return x.asJonixOtherText();
}
}
return null;
}
public List findOtherTexts(java.util.Set textTypeCodes)
{
if (otherTexts != null)
{
List matches = new ArrayList<>();
for (OtherText x : otherTexts)
{
if (textTypeCodes == null || textTypeCodes.contains(x.getTextTypeCodeValue()))
matches.add(x.asJonixOtherText());
}
return matches;
}
return null;
}
public JonixMediaFile findMediaFile(ImageAudioVideoFileTypes mediaFileTypeCode)
{
if (mediaFiles != null)
{
for (MediaFile x : mediaFiles)
{
if (x.getMediaFileTypeCodeValue() == mediaFileTypeCode)
return x.asJonixMediaFile();
}
}
return null;
}
public List findMediaFiles(java.util.Set mediaFileTypeCodes)
{
if (mediaFiles != null)
{
List matches = new ArrayList<>();
for (MediaFile x : mediaFiles)
{
if (mediaFileTypeCodes == null || mediaFileTypeCodes.contains(x.getMediaFileTypeCodeValue()))
matches.add(x.asJonixMediaFile());
}
return matches;
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy