All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tectonica.jonix.onix3.Prize Maven / Gradle / Ivy

There is a newer version: 2024-10-onix308
Show newest version
/*
 * 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.onix3;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.tectonica.jonix.JPU;
import com.tectonica.jonix.OnixComposite.OnixDataComposite;
import com.tectonica.jonix.codelist.CountryCodes;
import com.tectonica.jonix.codelist.PrizeOrAwardAchievements;
import com.tectonica.jonix.codelist.RecordSourceTypes;
import com.tectonica.jonix.struct.JonixPrize;

/*
 * NOTE: THIS IS AN AUTO-GENERATED FILE, DON'T EDIT MANUALLY
 */

@SuppressWarnings("serial")
public class Prize implements OnixDataComposite, Serializable
{
	public static final String refname = "Prize";
	public static final String shortname = "prize";

	public String datestamp; // dt.DateOrDateTime
	public RecordSourceTypes sourcetype;
	public String sourcename;

	public List prizeNames; // OneOrMore
	public PrizeYear prizeYear; // Optional
	public PrizeCountry prizeCountry; // Optional
	public PrizeCode prizeCode; // Optional
	public List prizeStatements; // ZeroOrMore
	public List prizeJurys; // ZeroOrMore

	public Prize()
	{}

	public Prize(org.w3c.dom.Element element)
	{
		this.datestamp = JPU.getAttribute(element, "datestamp");
		this.sourcetype = RecordSourceTypes.byValue(JPU.getAttribute(element, "sourcetype"));
		this.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(PrizeName.refname) || name.equals(PrizeName.shortname))
					prizeNames = JPU.addToList(prizeNames, new PrizeName(element));
				else if (name.equals(PrizeYear.refname) || name.equals(PrizeYear.shortname))
					prizeYear = new PrizeYear(element);
				else if (name.equals(PrizeCountry.refname) || name.equals(PrizeCountry.shortname))
					prizeCountry = new PrizeCountry(element);
				else if (name.equals(PrizeCode.refname) || name.equals(PrizeCode.shortname))
					prizeCode = new PrizeCode(element);
				else if (name.equals(PrizeStatement.refname) || name.equals(PrizeStatement.shortname))
					prizeStatements = JPU.addToList(prizeStatements, new PrizeStatement(element));
				else if (name.equals(PrizeJury.refname) || name.equals(PrizeJury.shortname))
					prizeJurys = JPU.addToList(prizeJurys, new PrizeJury(element));
			}
		});
	}

	public List getPrizeNameValues()
	{
		if (prizeNames != null)
		{
			List list = new ArrayList<>();
			for (PrizeName i : prizeNames)
				list.add(i.value);
			return list;
		}
		return null;
	}

	public String getPrizeYearValue()
	{
		return (prizeYear == null) ? null : prizeYear.value;
	}

	public CountryCodes getPrizeCountryValue()
	{
		return (prizeCountry == null) ? null : prizeCountry.value;
	}

	public PrizeOrAwardAchievements getPrizeCodeValue()
	{
		return (prizeCode == null) ? null : prizeCode.value;
	}

	public List getPrizeStatementValues()
	{
		if (prizeStatements != null)
		{
			List list = new ArrayList<>();
			for (PrizeStatement i : prizeStatements)
				list.add(i.value);
			return list;
		}
		return null;
	}

	public List getPrizeJuryValues()
	{
		if (prizeJurys != null)
		{
			List list = new ArrayList<>();
			for (PrizeJury i : prizeJurys)
				list.add(i.value);
			return list;
		}
		return null;
	}

	public JonixPrize asJonixPrize()
	{
		JonixPrize x = new JonixPrize();
		x.prizeCode = getPrizeCodeValue();
		x.prizeCountry = getPrizeCountryValue();
		x.prizeJurys = getPrizeJuryValues();
		x.prizeNames = getPrizeNameValues();
		x.prizeYear = getPrizeYearValue();
		return x;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy