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

com.tectonica.jonix.onix3.CopyrightStatement 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.ListOfOnixElement;
import com.tectonica.jonix.common.OnixComposite.OnixSuperComposite;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;

import java.io.Serializable;
import java.util.function.Consumer;

/*
 * NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
 */

/**
 * 

Copyright statement composite

*

* An optional and repeatable group of data elements which together represent a copyright or neighbouring right * statement for the product. At least one <CopyrightYear> or one instance of the <CopyrightOwner> composite * must be sent within an instance of the composite, but it is recommended that all elements in the composite are * explicitly populated. The Copyright statement may be repeated to provide a full structured rights statement listing * year(s) and rights holder(s). *

* * * * * * * * * * * * * *
Reference name<CopyrightStatement>
Short tag<copyrightstatement>
Cardinality0…n
*

* This tag may be included in the following composites: *

    *
  • <{@link PublishingDetail}>
  • *
*

* Possible placements within ONIX message: *

    *
  • {@link Product} ⯈ {@link PublishingDetail} ⯈ {@link CopyrightStatement}
  • *
*/ public class CopyrightStatement implements OnixSuperComposite, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "CopyrightStatement"; public static final String shortname = "copyrightstatement"; ///////////////////////////////////////////////////////////////////////////////// // 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 CopyrightStatement EMPTY = new CopyrightStatement(); public CopyrightStatement() { exists = false; element = null; initialized = true; // so that no further processing will be done on this intentionally-empty object } public CopyrightStatement(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 CopyrightYear.refname: case CopyrightYear.shortname: copyrightYears = JPU.addToList(copyrightYears, new CopyrightYear(e)); break; case CopyrightType.refname: case CopyrightType.shortname: copyrightType = new CopyrightType(e); break; case CopyrightOwner.refname: case CopyrightOwner.shortname: copyrightOwners = JPU.addToList(copyrightOwners, new CopyrightOwner(e)); break; default: break; } }); } /** * @return whether this tag (<CopyrightStatement> or <copyrightstatement>) 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 ListOfOnixElement copyrightYears = ListOfOnixElement.empty(); /** *

* The copyright year as it appears in a copyright statement on the product. Optional in each occurrence of the * <CopyrightStatement> composite but may be omitted only if <CopyrightOwner> is present, and repeatable * if several years or periods are listed. *

* Jonix-Comment: this list is required to contain at least one item */ public ListOfOnixElement copyrightYears() { _initialize(); return copyrightYears; } private CopyrightType copyrightType = CopyrightType.EMPTY; /** *

* An optional ONIX code indicating the type of right covered by the statement, typically a copyright or * neighbouring right. If omitted, the default is that the statement represents a copyright. *

* Jonix-Comment: this field is optional */ public CopyrightType copyrightType() { _initialize(); return copyrightType; } private ListOfOnixComposite copyrightOwners = JPU.emptyListOfOnixComposite(CopyrightOwner.class); /** *

* A repeatable group of data elements which together name a copyright owner. Optional, but may be omitted only if * <CopyrightYear> is present. Each occurrence of the <CopyrightOwner> composite must carry a single * name (personal or corporate), or an identifier, or both. *

* Jonix-Comment: this list may be empty */ public ListOfOnixComposite copyrightOwners() { _initialize(); return copyrightOwners; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy