Article types

pull/1/head
Jens Pelzetter 2019-08-29 20:09:51 +02:00
parent 4764ceb184
commit 5d95786be4
10 changed files with 658 additions and 3 deletions

View File

@ -0,0 +1,135 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.scientificcms.publications;
import org.hibernate.envers.Audited;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "ARTICLES_IN_COLLECTED_VOLUME", schema = DB_SCHEMA)
@Audited
public class ArticleInCollectedVolume extends Publication {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "COLLECTED_VOLUME_ID")
private CollectedVolume collectedVolume;
@Column(name = "PAGES_FROM")
private Integer pagesFrom;
@Column(name = "PAGES_TO")
private Integer pagesTo;
@Column(name = "CHAPTER", length = 1024)
private String chapter;
public CollectedVolume getCollectedVolume() {
return collectedVolume;
}
protected void setCollectedVolume(final CollectedVolume collectedVolume) {
this.collectedVolume = collectedVolume;
}
public Integer getPagesFrom() {
return pagesFrom;
}
public void setPagesFrom(final Integer pagesFrom) {
this.pagesFrom = pagesFrom;
}
public Integer getPagesTo() {
return pagesTo;
}
public void setPagesTo(final Integer pagesTo) {
this.pagesTo = pagesTo;
}
public String getChapter() {
return chapter;
}
public void setChapter(final String chapter) {
this.chapter = chapter;
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 47 * hash + Objects.hashCode(collectedVolume);
hash = 47 * hash + Objects.hashCode(pagesFrom);
hash = 47 * hash + Objects.hashCode(pagesTo);
hash = 47 * hash + Objects.hashCode(chapter);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ArticleInCollectedVolume)) {
return false;
}
final ArticleInCollectedVolume other = (ArticleInCollectedVolume) obj;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(chapter, other.getChapter())) {
return false;
}
if (!Objects.equals(collectedVolume, other.getCollectedVolume())) {
return false;
}
if (!Objects.equals(pagesFrom, other.getPagesFrom())) {
return false;
}
return Objects.equals(pagesTo, other.getPagesTo());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof ArticleInCollectedVolume;
}
@Override
public String toString(final String data) {
return super.toString(String.format(", collectedVolume = %s, "
+ "chapter = \"%s\", "
+ "pagesFrom = %d, "
+ "pagesTo = %d%s",
Objects.toString(collectedVolume),
chapter,
pagesFrom,
pagesTo,
data));
}
}

View File

@ -0,0 +1,169 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.scientificcms.publications;
import org.hibernate.envers.Audited;
import java.time.LocalDate;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "ARTICLES_IN_JOURNAL", schema = DB_SCHEMA)
@Audited
public class ArticleInJournal extends Publication {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "JOURNAL_ID")
private Journal journal;
@Column(name = "VOLUME")
private Integer volume;
@Column(name = "ISSUE")
private String issue;
@Column(name = "PAGES_FROM")
private Integer pagesFrom;
@Column(name = "PAGES_TO")
private Integer pagesTo;
@Column(name = "PUBLICATION_DATE")
private LocalDate publicationDate;
public Journal getJournal() {
return journal;
}
protected void setJournal(final Journal journal) {
this.journal = journal;
}
public Integer getVolume() {
return volume;
}
public void setVolume(final Integer volume) {
this.volume = volume;
}
public String getIssue() {
return issue;
}
public void setIssue(final String issue) {
this.issue = issue;
}
public Integer getPagesFrom() {
return pagesFrom;
}
public void setPagesFrom(final Integer pagesFrom) {
this.pagesFrom = pagesFrom;
}
public Integer getPagesTo() {
return pagesTo;
}
public void setPagesTo(final Integer pagesTo) {
this.pagesTo = pagesTo;
}
public LocalDate getPublicationDate() {
return publicationDate;
}
public void setPublicationDate(final LocalDate publicationDate) {
this.publicationDate = publicationDate;
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 67 * hash + Objects.hashCode(journal);
hash = 67 * hash + Objects.hashCode(volume);
hash = 67 * hash + Objects.hashCode(issue);
hash = 67 * hash + Objects.hashCode(pagesFrom);
hash = 67 * hash + Objects.hashCode(pagesTo);
hash = 67 * hash + Objects.hashCode(publicationDate);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ArticleInJournal)) {
return false;
}
final ArticleInJournal other = (ArticleInJournal) obj;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(journal, other.getJournal())) {
return false;
}
if (!Objects.equals(volume, other.getVolume())) {
return false;
}
if (!Objects.equals(issue, other.getIssue())) {
return false;
}
if (!Objects.equals(pagesFrom, other.getPagesFrom())) {
return false;
}
if (!Objects.equals(pagesTo, other.getPagesTo())) {
return false;
}
return Objects.equals(publicationDate, other.getPublicationDate());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof ArticleInJournal;
}
@Override
public String toString(final String data) {
return super.toString(String.format(", journal = %s, "
+ "volume = %d, "
+ "issue = \"%s\", "
+ "pagesFrom = %d, "
+ "pagesTo = %d, "
+ "publicationDate = %s%s",
Objects.toString(journal),
volume,
issue,
pagesFrom,
pagesTo,
Objects.toString(publicationDate),
data));
}
}

View File

@ -0,0 +1,61 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.scientificcms.publications;
import org.hibernate.envers.Audited;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "COLLECTED_VOLUMES", schema = DB_SCHEMA)
@Audited
public class CollectedVolume extends PublicationWithPublisher {
private static final long serialVersionUID = 1L;
@OneToMany(mappedBy = "collectedVolume")
private List<ArticleInCollectedVolume> articles;
public CollectedVolume() {
super();
articles = new ArrayList<>();
}
public List<ArticleInCollectedVolume> getArticles() {
return Collections.unmodifiableList(articles);
}
protected void addArticle(final ArticleInCollectedVolume article) {
articles.add(article);
}
protected void removeArticle(final ArticleInCollectedVolume article) {
articles.remove(article);
}
protected void setArticles(final List<ArticleInCollectedVolume> articles) {
this.articles = new ArrayList<>(articles);
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof CollectedVolume;
}
}

View File

@ -5,6 +5,7 @@
*/ */
package org.scientificcms.publications; package org.scientificcms.publications;
import org.hibernate.envers.Audited;
import org.librecms.assets.Organization; import org.librecms.assets.Organization;
import java.util.Objects; import java.util.Objects;
@ -23,6 +24,7 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
*/ */
@Entity @Entity
@Table(name = "EXPERTISES", schema = DB_SCHEMA) @Table(name = "EXPERTISES", schema = DB_SCHEMA)
@Audited
public class Expertise extends Publication { public class Expertise extends Publication {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -5,6 +5,7 @@
*/ */
package org.scientificcms.publications; package org.scientificcms.publications;
import org.hibernate.envers.Audited;
import org.librecms.assets.Organization; import org.librecms.assets.Organization;
import java.time.LocalDate; import java.time.LocalDate;
@ -24,6 +25,7 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
*/ */
@Entity @Entity
@Table(name = "INTERNET_ARTICLES", schema = DB_SCHEMA) @Table(name = "INTERNET_ARTICLES", schema = DB_SCHEMA)
@Audited
public class InternetArticle extends Publication { public class InternetArticle extends Publication {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,261 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.scientificcms.publications;
import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "JOURNALS", schema = DB_SCHEMA)
@Audited
public class Journal implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "JOURNAL_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private long journalId;
@Column(name = "UUID")
private String uuid;
/**
* Year in which the journal was published first.
*/
@Column(name = "FIRST_YEAR", nullable = true)
private Integer firstYear;
/**
* Year in which the journal was published last
*/
@Column(name = "LAST_YEAR", nullable = true)
private Integer lastYear;
/**
* The ISSN of the journal.
*/
@Column(name = "ISSN", length = 9)
private String issn;
@Column(name = "title", length = 1024, nullable = false)
private String title;
/**
* A short description of the journal.
*/
@Embedded
@AssociationOverride(
name = "values",
joinTable = @JoinTable(name = "JOURNAL_DESCRIPTIONS",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "OBJECT_ID")
})
)
private LocalizedString description;
/**
* The usual symbol/abbrevation used to refer to the journal.
*/
@Column(name = "SYMBOL")
private String symbol;
@OneToMany(mappedBy = "journal")
private List<ArticleInJournal> articles;
public Journal() {
super();
articles = new ArrayList<>();
}
public long getJournalId() {
return journalId;
}
public void setJournalId(final long journalId) {
this.journalId = journalId;
}
public String getUuid() {
return uuid;
}
public void setUuid(final String uuid) {
this.uuid = uuid;
}
public Integer getFirstYear() {
return firstYear;
}
public void setFirstYear(final Integer firstYear) {
this.firstYear = firstYear;
}
public Integer getLastYear() {
return lastYear;
}
public void setLastYear(final Integer lastYear) {
this.lastYear = lastYear;
}
public String getIssn() {
return issn;
}
public void setIssn(final String issn) {
this.issn = issn;
}
public String getTitle() {
return title;
}
public void setTitle(final String title) {
this.title = title;
}
public LocalizedString getDescription() {
return description;
}
public void setDescription(final LocalizedString description) {
this.description = description;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public List<ArticleInJournal> getArticles() {
return Collections.unmodifiableList(articles);
}
protected void addArticle(final ArticleInJournal article) {
articles.add(article);
}
protected void removeArticle(final ArticleInJournal article) {
articles.remove(article);
}
protected void setArticles(final List<ArticleInJournal> articles) {
this.articles = new ArrayList<>(articles);
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 73 * hash + Objects.hashCode(firstYear);
hash = 73 * hash + Objects.hashCode(lastYear);
hash = 73 * hash + Objects.hashCode(issn);
hash = 73 * hash + Objects.hashCode(title);
hash = 73 * hash + Objects.hashCode(description);
hash = 73 * hash + Objects.hashCode(symbol);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Journal)) {
return false;
}
final Journal other = (Journal) obj;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(firstYear, other.getFirstYear())) {
return false;
}
if (!Objects.equals(lastYear, other.getLastYear())) {
return false;
}
if (!Objects.equals(issn, other.getIssn())) {
return false;
}
if (!Objects.equals(title, other.getTitle())) {
return false;
}
if (!Objects.equals(symbol, other.getSymbol())) {
return false;
}
return Objects.equals(description, other.getDescription());
}
public boolean canEqual(final Object obj) {
return obj instanceof Journal;
}
@Override
public final String toString() {
return toString("");
}
public String toString(final String data) {
return String.format("%s{ "
+ "journalId = %d, "
+ "uuid = \"%s\", "
+ "firstYear = %s, "
+ "lastYear = %s, "
+ "issn = \"%s\", "
+ "symbol = \"%s\", "
+ "title = \"%s\", "
+ "description = %s%s"
+ "}",
super.toString(),
journalId,
uuid,
Objects.toString(firstYear),
Objects.toString(lastYear),
issn,
symbol,
title,
description,
data);
}
}

View File

@ -5,6 +5,8 @@
*/ */
package org.scientificcms.publications; package org.scientificcms.publications;
import org.hibernate.envers.Audited;
import java.util.Objects; import java.util.Objects;
import javax.persistence.Column; import javax.persistence.Column;
@ -19,6 +21,7 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
*/ */
@Entity @Entity
@Table(name = "MONOGRAPHS", schema = DB_SCHEMA) @Table(name = "MONOGRAPHS", schema = DB_SCHEMA)
@Audited
public class Monograph extends PublicationWithPublisher { public class Monograph extends PublicationWithPublisher {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -26,7 +26,7 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@Entity @Entity
@Table(name = "JOURNALS", schema = DB_SCHEMA) @Table(name = "JOURNAL_ASSETS", schema = DB_SCHEMA)
@Audited @Audited
public class JournalAsset extends Asset { public class JournalAsset extends Asset {

View File

@ -5,6 +5,7 @@
*/ */
package org.scientificcms.publications.contenttypes; package org.scientificcms.publications.contenttypes;
import org.scientificcms.publications.PublicationWithPublisher;
import org.scientificcms.publications.assets.CollectedVolumeAsset; import org.scientificcms.publications.assets.CollectedVolumeAsset;
import java.util.Objects; import java.util.Objects;
@ -22,7 +23,7 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
*/ */
@Entity @Entity
@Table(name = "COLLECTED_VOLUME_ITEMS", schema = DB_SCHEMA) @Table(name = "COLLECTED_VOLUME_ITEMS", schema = DB_SCHEMA)
public class CollectedVolumeItem { public class CollectedVolumeItem extends AbstractPublicationWithPublisherItem<PublicationWithPublisher>{
// extends Publication { // extends Publication {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -81,4 +82,14 @@ public class CollectedVolumeItem {
// data)); // data));
// } // }
@Override
public PublicationWithPublisher getPublication() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
protected void setPublication(PublicationWithPublisher publication) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} }

View File

@ -5,6 +5,7 @@
*/ */
package org.scientificcms.publications.contenttypes; package org.scientificcms.publications.contenttypes;
import org.scientificcms.publications.PublicationWithPublisher;
import org.scientificcms.publications.assets.ProceedingsAsset; import org.scientificcms.publications.assets.ProceedingsAsset;
import java.util.Objects; import java.util.Objects;
@ -22,7 +23,17 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
*/ */
@Entity @Entity
@Table(name = "PROCEEDINGS_ITEMS", schema = DB_SCHEMA) @Table(name = "PROCEEDINGS_ITEMS", schema = DB_SCHEMA)
public class ProceedingsItem { public class ProceedingsItem extends AbstractPublicationWithPublisherItem<PublicationWithPublisher>{
@Override
public PublicationWithPublisher getPublication() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
protected void setPublication(PublicationWithPublisher publication) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
// extends Publication { // extends Publication {
// private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;