![JAR search and dependency download from the Maven repository](/logo.png)
org.lockss.tdb.Title Maven / Gradle / Ivy
/*
Copyright (c) 2000-2018, Board of Trustees of Leland Stanford Jr. University,
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.lockss.tdb;
import java.io.Serializable;
import java.util.*;
/**
*
* A lightweight class (struct) to represent a title during TDB processing.
*
*
* @author Thib Guicherd-Callin
* @since 1.67
*/
public class Title implements Serializable {
/**
*
* Makes a new title instance with the given parent publisher (useful for
* tests).
*
*
* @param publisher A parent publisher for the title.
* @since 1.67
*/
protected Title(Publisher publisher) {
this(publisher, new LinkedHashMap());
}
/**
*
* Makes a new title instance with the given parent publisher and map.
*
*
* @param publisher A parent publisher for the title.
* @param map A map of key-value pairs for the title.
* @since 1.67
*/
public Title(Publisher publisher, Mapmap) {
this.publisher = publisher;
this.map = map;
}
/**
*
* Parent publisher.
*
*
* @since 1.67
*/
protected Publisher publisher;
/**
*
* Retrieves the title's parent publisher.
*
*
* @return The title's parent publisher.
* @since 1.67
*/
public Publisher getPublisher() {
return publisher;
}
/**
*
* Internal storage map.
*
*
* @since 1.67
*/
protected Map map;
/**
*
* Retrieves a value from the internal storage map.
*
*
* @param key A key.
* @return The value for the key, or null
if none is set.
* @since 1.67
*/
public String getArbitraryValue(String key) {
return map.get(key);
}
/**
*
* Title's DOI (key).
*
*
* @since 1.67
*/
protected static final String DOI = "doi";
/**
*
* Title's DOI (flag).
*
*
* @since 1.67
*/
protected boolean _doi = false;
/**
*
* Title's DOI (field).
*
*
* @since 1.67
*/
protected String doi = null;
/**
*
* Retrieves the title's DOI.
*
*
* @return The title's DOI, or null
if not set.
* @since 1.67
*/
public String getDoi() {
if (!_doi) {
_doi = true;
doi = map.get(DOI);
}
return doi;
}
/**
*
* Title's eISSN (key).
*
*
* @since 1.67
*/
protected static final String EISSN = "eissn";
/**
*
* Title's eISSN (flag).
*
*
* @since 1.67
*/
protected boolean _eissn = false;
/**
*
* Title's eISSN (field).
*
*
* @since 1.67
*/
protected String eissn = null;
/**
*
* Retrieves the title's eISSN.
*
*
* @return The title's eISSN, or null
if not set.
* @since 1.67
*/
public String getEissn() {
if (!_eissn) {
_eissn = true;
eissn = map.get(EISSN);
}
return eissn;
}
/**
*
* Title's ISSN (key).
*
*
* @since 1.67
*/
protected static final String ISSN = "issn";
/**
*
* Title's ISSN (flag).
*
*
* @since 1.67
*/
protected boolean _issn = false;
/**
*
* Title's ISSN (field).
*
*
* @since 1.67
*/
protected String issn = null;
/**
*
* Retrieves the title's ISSN.
*
*
* @return The title's ISSN, or null
if not set.
* @since 1.67
*/
public String getIssn() {
if (!_issn) {
_issn = true;
issn = map.get(ISSN);
}
return issn;
}
/**
*
* Title's ISSN-L (key).
*
*
* @since 1.67
*/
protected static final String ISSNL = "issnl";
/**
*
* Title's ISSN-L (flag).
*
*
* @since 1.67
*/
protected boolean _issnl = false;
/**
*
* Title's ISSN-L (field).
*
*
* @since 1.67
*/
protected String issnl = null;
/**
*
* Retrieves the title's ISSN-L.
*
*
* @return The title's ISSN-L, or null
if not set.
* @since 1.67
*/
public String getIssnl() {
if (!_issnl) {
_issnl = true;
issnl = map.get(ISSNL);
}
return issnl;
}
/**
*
* Title's name (key).
*
*
* @since 1.67
*/
protected static final String NAME = "name";
/**
*
* Title's name (flag).
*
*
* @since 1.67
*/
protected boolean _name = false;
/**
*
* Title's name (field).
*
*
* @since 1.67
*/
protected String name = null;
/**
*
* Retrieves the title's name.
*
*
* @return The title's name.
* @since 1.67
*/
public String getName() {
if (!_name) {
_name = true;
name = map.get(NAME);
}
return name;
}
/**
*
* Title's type (key).
*
*
* @since 1.67
*/
protected static final String TYPE = "type";
/**
*
* Title's type (flag).
*
*
* @since 1.67
*/
protected boolean _type = false;
/**
*
* Title's type (field).
*
*
* @since 1.67
*/
protected String type = null;
/**
*
* The book title type ({@value}).
*
*
* @since 1.67
* @deprecated As of 1.68, this constant is deprecated in favor of
* {@link #TYPE_BOOK_SERIES}, because the title type was meant to
* refer to the type of a publication (title), not the type of a
* publication's individual component (AU).
* @see #TYPE_BOOK_SERIES
*/
@Deprecated
public static final String TYPE_BOOK = "book";
/**
*
* The book series title type ({@value}).
*
*
* @since 1.68
*/
public static final String TYPE_BOOK_SERIES = "bookSeries";
/**
*
* The journal title type ({@value}).
*
*
* @since 1.67
*/
public static final String TYPE_JOURNAL = "journal";
/**
*
* The proceedings title type ({@value}).
*
*
* @since 1.68
*/
public static final String TYPE_PROCEEDINGS = "proceedings";
/**
*
* The default title type ({@link #TYPE_JOURNAL}).
*
*
* @since 1.67
* @see #TYPE_JOURNAL
*/
public static final String TYPE_DEFAULT = TYPE_JOURNAL;
/**
*
* Retrieves the title's type.
*
*
* @return The title's type, by default {@link #TYPE_DEFAULT}.
* @since 1.67
* @see #TYPE_DEFAULT
* @see #TYPE_BOOK
* @see #TYPE_BOOK_SERIES
* @see #TYPE_JOURNAL
* @see #TYPE_PROCEEDINGS
*/
public String getType() {
if (!_type) {
_type = true;
type = map.get(TYPE);
if (type == null) {
type = TYPE_DEFAULT;
}
}
return type;
}
}