diff --git a/sci-publications/src/main/java/org/scientificcms/publications/Monograph.java b/sci-publications/src/main/java/org/scientificcms/publications/Monograph.java new file mode 100644 index 0000000..e6d5593 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/Monograph.java @@ -0,0 +1,77 @@ +/* + * 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 java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "MONOGRAPHS", schema = DB_SCHEMA) +public class Monograph extends PublicationWithPublisher { + + private static final long serialVersionUID = 1L; + + @Column(name = "REVIEWED") + private Boolean reviewed; + + public Boolean getReviewed() { + return reviewed; + } + + public void setReviewed(Boolean reviewed) { + this.reviewed = reviewed; + } + + @Override + public int hashCode() { + int hash = super.hashCode(); + hash = 23 * hash + Objects.hashCode(reviewed); + 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 Monograph)) { + return false; + } + final Monograph other = (Monograph) obj; + if (!other.canEqual(this)) { + return false; + } + return Objects.equals(reviewed, other.getReviewed()); + } + + @Override + public boolean canEqual(final Object obj) { + return obj instanceof Monograph; + } + + @Override + public String toString(final String data) { + return super.toString(String.format(", reviewed = %b%s", + reviewed, + data)); + } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/BasicPublicationProperties.java b/sci-publications/src/main/java/org/scientificcms/publications/Publication.java similarity index 82% rename from sci-publications/src/main/java/org/scientificcms/publications/BasicPublicationProperties.java rename to sci-publications/src/main/java/org/scientificcms/publications/Publication.java index 5978579..d89e326 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/BasicPublicationProperties.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/Publication.java @@ -5,6 +5,7 @@ */ package org.scientificcms.publications; +import org.hibernate.envers.Audited; import org.libreccm.l10n.LocalizedString; import java.io.Serializable; @@ -13,10 +14,14 @@ import java.util.Objects; import javax.persistence.AssociationOverride; import javax.persistence.Column; -import javax.persistence.Embeddable; 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.Table; import static org.scientificcms.publications.SciPublicationsConstants.*; @@ -25,11 +30,21 @@ import static org.scientificcms.publications.SciPublicationsConstants.*; * * @author Jens Pelzetter */ -@Embeddable -public class BasicPublicationProperties implements Serializable { +@Entity +@Table(name = "PUBLICATIONS", schema = DB_SCHEMA) +@Audited +public class Publication implements Serializable { private static final long serialVersionUID = 1L; + @Id + @Column(name = "PUBLICATION_ID") + @GeneratedValue(strategy = GenerationType.AUTO) + private long publicationId; + + @Column(name = "UUID", unique = true, nullable = false) + private String uuid; + @Column(name = "YEAR_OF_PUBLICATION") private Integer yearOfPublication; @@ -86,6 +101,22 @@ public class BasicPublicationProperties implements Serializable { @Column(name = "LANGUAGE_OF_PUBLICATION") private Locale languageOfPublication; + public long getPublicationId() { + return publicationId; + } + + protected void setPublicationId(final long publicationId) { + this.publicationId = publicationId; + } + + public String getUuid() { + return uuid; + } + + protected void setUuid(final String uuid) { + this.uuid = uuid; + } + public Integer getYearOfPublication() { return yearOfPublication; } @@ -153,6 +184,8 @@ public class BasicPublicationProperties implements Serializable { @Override public int hashCode() { int hash = 5; + hash = 97 * hash + (int) (publicationId ^ (publicationId >>> 32)); + hash = 97 * hash + Objects.hashCode(uuid); hash = 97 * hash + Objects.hashCode(yearOfPublication); hash = 97 * hash + Objects.hashCode(title); hash = 97 * hash + Objects.hashCode(shortDescription); @@ -172,14 +205,20 @@ public class BasicPublicationProperties implements Serializable { if (obj == null) { return false; } - if (!(obj instanceof BasicPublicationProperties)) { + if (!(obj instanceof Publication)) { return false; } - final BasicPublicationProperties other - = (BasicPublicationProperties) obj; + final Publication other + = (Publication) obj; if (!other.canEqual(this)) { return false; } + if (publicationId != other.getPublicationId()) { + return false; + } + if (!Objects.equals(uuid, other.getUuid())) { + return false; + } if (!Objects.equals(yearOfPublication, other.getYearOfPublication())) { return false; } @@ -208,12 +247,14 @@ public class BasicPublicationProperties implements Serializable { public boolean canEqual(final Object obj) { - return obj instanceof BasicPublicationProperties; + return obj instanceof Publication; } public String toString(final String data) { return String.format("%s{ " + + "publicationId = %d, " + + "uuid = \"%s\"" + "yearOfPublication = %d, " + "title = %s, " + "shortDescription = %s, " @@ -224,6 +265,8 @@ public class BasicPublicationProperties implements Serializable { + "languageOfPublication = \"%s\"%d" + " }", super.toString(), + publicationId, + uuid, yearOfPublication, Objects.toString(title), Objects.toString(shortDescription), @@ -234,10 +277,10 @@ public class BasicPublicationProperties implements Serializable { Objects.toString(languageOfPublication), data); } - + @Override public final String toString() { - + return toString(""); } diff --git a/sci-publications/src/main/java/org/scientificcms/publications/PublicationWithPublisherProperties.java b/sci-publications/src/main/java/org/scientificcms/publications/PublicationWithPublisher.java similarity index 90% rename from sci-publications/src/main/java/org/scientificcms/publications/PublicationWithPublisherProperties.java rename to sci-publications/src/main/java/org/scientificcms/publications/PublicationWithPublisher.java index a0b49a3..d4f4043 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/PublicationWithPublisherProperties.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/PublicationWithPublisher.java @@ -5,8 +5,8 @@ */ package org.scientificcms.publications; +import org.hibernate.envers.Audited; import org.libreccm.l10n.LocalizedString; -import org.scientificcms.publications.assets.Publisher; import java.io.Serializable; import java.util.Objects; @@ -15,9 +15,12 @@ import javax.persistence.AssociationOverride; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.Embedded; +import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; +import javax.persistence.ManyToOne; import javax.persistence.OneToOne; +import javax.persistence.Table; import static org.scientificcms.publications.SciPublicationsConstants.*; @@ -25,12 +28,14 @@ import static org.scientificcms.publications.SciPublicationsConstants.*; * * @author Jens Pelzetter */ -@Embeddable -public class PublicationWithPublisherProperties implements Serializable { +@Entity +@Table(name = "PUBLICATIONS_WITH_PUBLISHER") +@Audited +public class PublicationWithPublisher extends Publication { private static final long serialVersionUID = 1L; - @OneToOne + @ManyToOne private Publisher publisher; @Column(name = "ISBN10", length = 13) @@ -139,11 +144,11 @@ public class PublicationWithPublisherProperties implements Serializable { if (!super.equals(obj)) { return false; } - if (!(obj instanceof PublicationWithPublisherProperties)) { + if (!(obj instanceof PublicationWithPublisher)) { return false; } - final PublicationWithPublisherProperties other - = (PublicationWithPublisherProperties) obj; + final PublicationWithPublisher other + = (PublicationWithPublisher) obj; if (!other.canEqual(this)) { return false; } @@ -168,10 +173,12 @@ public class PublicationWithPublisherProperties implements Serializable { return Objects.equals(edition, other.getEdition()); } + @Override public boolean canEqual(final Object obj) { - return obj instanceof PublicationWithPublisherProperties; + return obj instanceof PublicationWithPublisher; } + @Override public String toString(final String data) { return (String.format("%s{ " @@ -194,9 +201,4 @@ public class PublicationWithPublisherProperties implements Serializable { data)); } - @Override - public String toString() { - return toString(""); - } - } diff --git a/sci-publications/src/main/java/org/scientificcms/publications/Publisher.java b/sci-publications/src/main/java/org/scientificcms/publications/Publisher.java new file mode 100644 index 0000000..09bedf1 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/Publisher.java @@ -0,0 +1,181 @@ +/* + * 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.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "PUBLISHERS", schema = DB_SCHEMA) +@Audited +public class Publisher implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "PUBLISHER_ID") + @GeneratedValue(strategy = GenerationType.AUTO) + private long publisherId; + + @Column(name = "UUID", unique = true, nullable = false) + private String uuid; + + /** + * Name of the publisher. The title of the asset is only for internal use, + * this property should be used for name of the publisher which is displayed + * on public pages. + */ + @Column(name = "NAME", length = 2048, nullable = false) + private String name; + + /** + * The place of the publisher. + */ + @Column(name = "PLACE", length = 2048) + private String place; + + @OneToMany(mappedBy = "publisher") + private List publications; + + public Publisher() { + super(); + + publications = new ArrayList<>(); + } + + public long getPublisherId() { + return publisherId; + } + + protected void setPublisherId(final long publisherId) { + this.publisherId = publisherId; + } + + public String getUuid() { + return uuid; + } + + protected void setUuid(final String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getPlace() { + return place; + } + + public void setPlace(final String place) { + this.place = place; + } + + public List getPublications() { + if (publications == null) { + return null; + } else { + return Collections.unmodifiableList(publications); + } + } + + protected void addPublication(final PublicationWithPublisher publication) { + publications.add(publication); + } + + protected void removePublication( + final PublicationWithPublisher publication) { + publications.remove(publication); + } + + protected void setPublications( + final List publications) { + this.publications = new ArrayList<>(publications); + } + + @Override + public int hashCode() { + int hash = super.hashCode(); + hash = 29 * hash + (int) (publisherId ^ (publisherId >>> 32)); + hash = 29 * hash + Objects.hashCode(uuid); + hash = 29 * hash + Objects.hashCode(name); + hash = 29 * hash + Objects.hashCode(place); + 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 Publisher)) { + return false; + } + final Publisher other = (Publisher) obj; + + if (!other.canEqual(this)) { + return false; + } + if (publisherId != other.getPublisherId()) { + return false; + } + if (!Objects.equals(uuid, other.getUuid())) { + return false; + } + if (!Objects.equals(name, other.getName())) { + return false; + } + return Objects.equals(place, other.getPlace()); + } + + public boolean canEqual(final Object obj) { + return obj instanceof Publisher; + } + + public String toString(final String data) { + return String.format("%s{ " + + "publisherId = %d, " + + "uuid = \"%s\", " + + "name = \"%s\", " + + "place = \"%s\"%s", + super.toString(), + publisherId, + uuid, + name, + place, + data); + } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/CollectedVolume.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/CollectedVolume.java deleted file mode 100644 index 6450de4..0000000 --- a/sci-publications/src/main/java/org/scientificcms/publications/assets/CollectedVolume.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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.assets; - -import org.librecms.contentsection.Asset; -import org.scientificcms.publications.BasicPublicationProperties; -import org.scientificcms.publications.PublicationWithPublisherProperties; - -import java.util.Objects; - -import javax.persistence.Entity; -import javax.persistence.Table; - -import static org.scientificcms.publications.SciPublicationsConstants.*; - -/** - * - * @author Jens Pelzetter - */ -@Entity -@Table(name = "COLLECTED_VOLUMES", schema = DB_SCHEMA) -public class CollectedVolume extends Asset { - - private static final long serialVersionUID = 1L; - - private BasicPublicationProperties basicProperties; - - private PublicationWithPublisherProperties withPublisherProperties; - - public CollectedVolume() { - - super(); - - basicProperties = new BasicPublicationProperties(); - withPublisherProperties = new PublicationWithPublisherProperties(); - } - - public BasicPublicationProperties getBasicProperties() { - return basicProperties; - } - - protected void setBasicProperties( - final BasicPublicationProperties basicProperties) { - this.basicProperties = basicProperties; - } - - public PublicationWithPublisherProperties getWithPublisherProperties() { - return withPublisherProperties; - } - - protected void setWithPublisherProperties( - final PublicationWithPublisherProperties withPublisherProperties) { - this.withPublisherProperties = withPublisherProperties; - } - - @Override - public int hashCode() { - int hash = super.hashCode(); - hash = 19 * hash + Objects.hashCode(basicProperties); - hash = 19 * hash + Objects.hashCode(withPublisherProperties); - 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 CollectedVolume)) { - return false; - } - final CollectedVolume other = (CollectedVolume) obj; - if (!other.canEqual(this)) { - return false; - } - if (!Objects.equals(basicProperties, other.getBasicProperties())) { - return false; - } - return Objects.equals(withPublisherProperties, - other.getWithPublisherProperties()); - } - - @Override - public boolean canEqual(final Object obj) { - - return obj instanceof CollectedVolume; - } - - @Override - public String toString(final String data) { - - return super.toString(String.format( - "basicProperties = %s, " - + "withPublisherProperties = %s%s", - Objects.toString(basicProperties), - Objects.toString( - withPublisherProperties), - data)); - } - -} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/CollectedVolumeAsset.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/CollectedVolumeAsset.java new file mode 100644 index 0000000..9318782 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/assets/CollectedVolumeAsset.java @@ -0,0 +1,110 @@ +/* + * 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.assets; + +import org.librecms.contentsection.Asset; +import org.scientificcms.publications.Publication; +import org.scientificcms.publications.PublicationWithPublisher; + +import java.util.Objects; + +import javax.persistence.Entity; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "COLLECTED_VOLUMES", schema = DB_SCHEMA) +public class CollectedVolumeAsset extends Asset { + +// private static final long serialVersionUID = 1L; +// +// private Publication basicProperties; +// +// private PublicationWithPublisher withPublisherProperties; +// +// public CollectedVolumeAsset() { +// +// super(); +// +// basicProperties = new Publication(); +// withPublisherProperties = new PublicationWithPublisher(); +// } +// +// public Publication getBasicProperties() { +// return basicProperties; +// } +// +// protected void setBasicProperties( +// final Publication basicProperties) { +// this.basicProperties = basicProperties; +// } +// +// public PublicationWithPublisher getWithPublisherProperties() { +// return withPublisherProperties; +// } +// +// protected void setWithPublisherProperties( +// final PublicationWithPublisher withPublisherProperties) { +// this.withPublisherProperties = withPublisherProperties; +// } +// +// @Override +// public int hashCode() { +// int hash = super.hashCode(); +// hash = 19 * hash + Objects.hashCode(basicProperties); +// hash = 19 * hash + Objects.hashCode(withPublisherProperties); +// 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 CollectedVolumeAsset)) { +// return false; +// } +// final CollectedVolumeAsset other = (CollectedVolumeAsset) obj; +// if (!other.canEqual(this)) { +// return false; +// } +// if (!Objects.equals(basicProperties, other.getBasicProperties())) { +// return false; +// } +// return Objects.equals(withPublisherProperties, +// other.getWithPublisherProperties()); +// } +// +// @Override +// public boolean canEqual(final Object obj) { +// +// return obj instanceof CollectedVolumeAsset; +// } +// +// @Override +// public String toString(final String data) { +// +// return super.toString(String.format( +// "basicProperties = %s, " +// + "withPublisherProperties = %s%s", +// Objects.toString(basicProperties), +// Objects.toString( +// withPublisherProperties), +// data)); +// } +// +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/Journal.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/Journal.java deleted file mode 100644 index 4dc9698..0000000 --- a/sci-publications/src/main/java/org/scientificcms/publications/assets/Journal.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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.assets; - -import org.hibernate.envers.Audited; -import org.libreccm.l10n.LocalizedString; -import org.librecms.contentsection.Asset; - -import java.util.Objects; - -import javax.persistence.AssociationOverride; -import javax.persistence.Embedded; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.Table; - -import static org.scientificcms.publications.SciPublicationsConstants.*; - -/** - * Asset for storing informations about a journal. - * - * @author Jens Pelzetter - */ -@Entity -@Table(name = "JOURNALS", schema = DB_SCHEMA) -@Audited -public class Journal extends Asset { - - private static final long serialVersionUID = 1L; - - /** - * Year in which the journal was published first. - */ - private Integer firstYear; - - /** - * Year in which the journal was published last - */ - private Integer lastYear; - - /** - * The ISSN of the journal. - */ - private String issn; - - /** - * 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. - */ - private String symbol; - - 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 LocalizedString getDescription() { - return description; - } - - public void setDescription(final LocalizedString description) { - this.description = description; - } - - public String getSymbol() { - return symbol; - } - - public void setSymbol(final String symbol) { - this.symbol = symbol; - } - - @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(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(symbol, other.getSymbol())) { - return false; - } - return Objects.equals(description, other.getDescription()); - } - - @Override - public boolean canEqual(final Object obj) { - return obj instanceof Journal; - } - - @Override - public String toString(final String data) { - - return super.toString(String.format( - ", firstYear = %s, " - + "lastYear = %s, " - + "issn = \"%s\", " - + "symbol = \"%s\", " - + "description = %s%s", - Objects.toString(firstYear), - Objects.toString(lastYear), - issn, - symbol, - description, - data)); - } - -} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/JournalAsset.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/JournalAsset.java new file mode 100644 index 0000000..fc690a2 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/assets/JournalAsset.java @@ -0,0 +1,175 @@ +/* + * 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.assets; + +import org.hibernate.envers.Audited; +import org.libreccm.l10n.LocalizedString; +import org.librecms.contentsection.Asset; + +import java.util.Objects; + +import javax.persistence.AssociationOverride; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * Asset for storing informations about a journal. + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "JOURNALS", schema = DB_SCHEMA) +@Audited +public class JournalAsset extends Asset { + +// private static final long serialVersionUID = 1L; +// +// /** +// * Year in which the journal was published first. +// */ +// private Integer firstYear; +// +// /** +// * Year in which the journal was published last +// */ +// private Integer lastYear; +// +// /** +// * The ISSN of the journal. +// */ +// private String issn; +// +// /** +// * 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. +// */ +// private String symbol; +// +// 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 LocalizedString getDescription() { +// return description; +// } +// +// public void setDescription(final LocalizedString description) { +// this.description = description; +// } +// +// public String getSymbol() { +// return symbol; +// } +// +// public void setSymbol(final String symbol) { +// this.symbol = symbol; +// } +// +// @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(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 JournalAsset)) { +// return false; +// } +// final JournalAsset other = (JournalAsset) 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(symbol, other.getSymbol())) { +// return false; +// } +// return Objects.equals(description, other.getDescription()); +// } +// +// @Override +// public boolean canEqual(final Object obj) { +// return obj instanceof JournalAsset; +// } +// +// @Override +// public String toString(final String data) { +// +// return super.toString(String.format( +// ", firstYear = %s, " +// + "lastYear = %s, " +// + "issn = \"%s\", " +// + "symbol = \"%s\", " +// + "description = %s%s", +// Objects.toString(firstYear), +// Objects.toString(lastYear), +// issn, +// symbol, +// description, +// data)); +// } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/Proceedings.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/Proceedings.java deleted file mode 100644 index c62bc81..0000000 --- a/sci-publications/src/main/java/org/scientificcms/publications/assets/Proceedings.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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.assets; - -import org.librecms.contentsection.Asset; -import org.scientificcms.publications.BasicPublicationProperties; -import org.scientificcms.publications.PublicationWithPublisherProperties; - -import java.time.LocalDate; -import java.util.Objects; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -import static org.scientificcms.publications.SciPublicationsConstants.*; - -/** - * - * @author Jens Pelzetter - */ -@Entity -@Table(name = "PROCEEDINGS", schema = DB_SCHEMA) -public class Proceedings extends Asset { - - private static final long serialVersionUID = 1L; - - private BasicPublicationProperties basicProperties; - - private PublicationWithPublisherProperties withPublisherProperties; - - @Column(name = "NAME_OF_CONFERENCE", length = 1024) - private String nameOfConference; - - @Column(name = "PLACE_OF_CONFERENCE", length = 1024) - private String placeOfConference; - - @Column(name = "START_DATE_OF_CONFERENCE") - private LocalDate startDateOfConference; - - @Column(name = "END_DATE_OF_CONFERENCE") - private LocalDate endDateOfConference; - - public Proceedings() { - - super(); - - basicProperties = new BasicPublicationProperties(); - withPublisherProperties = new PublicationWithPublisherProperties(); - } - - public BasicPublicationProperties getBasicProperties() { - return basicProperties; - } - - protected void setBasicProperties( - final BasicPublicationProperties basicProperties) { - this.basicProperties = basicProperties; - } - - public PublicationWithPublisherProperties getWithPublisherProperties() { - return withPublisherProperties; - } - - protected void setWithPublisherProperties( - final PublicationWithPublisherProperties withPublisherProperties) { - this.withPublisherProperties = withPublisherProperties; - } - - public String getNameOfConference() { - return nameOfConference; - } - - public void setNameOfConference(final String nameOfConference) { - this.nameOfConference = nameOfConference; - } - - public String getPlaceOfConference() { - return placeOfConference; - } - - public void setPlaceOfConference(final String placeOfConference) { - this.placeOfConference = placeOfConference; - } - - public LocalDate getStartDateOfConference() { - return startDateOfConference; - } - - public void setStartDateOfConference(final LocalDate startDateOfConference) { - this.startDateOfConference = startDateOfConference; - } - - public LocalDate getEndDateOfConference() { - return endDateOfConference; - } - - public void setEndDateOfConference(final LocalDate endDateOfConference) { - this.endDateOfConference = endDateOfConference; - } - - @Override - public int hashCode() { - int hash = super.hashCode(); - hash = 19 * hash + Objects.hashCode(basicProperties); - hash = 19 * hash + Objects.hashCode(withPublisherProperties); - hash = 19 * hash + Objects.hashCode(nameOfConference); - hash = 19 * hash + Objects.hashCode(placeOfConference); - hash = 19 * hash + Objects.hashCode(startDateOfConference); - hash = 19 * hash + Objects.hashCode(endDateOfConference); - 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 Proceedings)) { - return false; - } - final Proceedings other = (Proceedings) obj; - if (!other.canEqual(this)) { - return false; - } - if (!Objects.equals(basicProperties, other.getBasicProperties())) { - return false; - } - if (!Objects.equals(withPublisherProperties, - other.getWithPublisherProperties())) { - return false; - } - if (!Objects.equals(nameOfConference, other.getNameOfConference())) { - return false; - } - if (!Objects.equals(placeOfConference, other.getPlaceOfConference())) { - return false; - } - if (!Objects.equals(startDateOfConference, - other.getStartDateOfConference())) { - return false; - } - return Objects.equals(endDateOfConference, - other.getEndDateOfConference()); - } - - @Override - public boolean canEqual(final Object obj) { - - return obj instanceof Proceedings; - } - - @Override - public String toString(final String data) { - - return super.toString(String.format( - "basicProperties = %s, " - + "withPublisherProperties = %s, " - + "nameOfConference = \"%s\", " - + "placeOfConference = \"%s\", " - + "startDateOfConference = \"%s\", " - + "endDateOfConference = \"%s\"%s", - Objects.toString(basicProperties), - Objects.toString(withPublisherProperties), - nameOfConference, - placeOfConference, - Objects.toString(startDateOfConference), - Objects.toString(endDateOfConference), - data)); - } - -} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/ProceedingsAsset.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/ProceedingsAsset.java new file mode 100644 index 0000000..7beba21 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/assets/ProceedingsAsset.java @@ -0,0 +1,181 @@ +/* + * 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.assets; + +import org.librecms.contentsection.Asset; +import org.scientificcms.publications.Publication; +import org.scientificcms.publications.PublicationWithPublisher; + +import java.time.LocalDate; +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "PROCEEDINGS", schema = DB_SCHEMA) +public class ProceedingsAsset extends Asset { + +// private static final long serialVersionUID = 1L; +// +// private Publication basicProperties; +// +// private PublicationWithPublisher withPublisherProperties; +// +// @Column(name = "NAME_OF_CONFERENCE", length = 1024) +// private String nameOfConference; +// +// @Column(name = "PLACE_OF_CONFERENCE", length = 1024) +// private String placeOfConference; +// +// @Column(name = "START_DATE_OF_CONFERENCE") +// private LocalDate startDateOfConference; +// +// @Column(name = "END_DATE_OF_CONFERENCE") +// private LocalDate endDateOfConference; +// +// public ProceedingsAsset() { +// +// super(); +// +// basicProperties = new Publication(); +// withPublisherProperties = new PublicationWithPublisher(); +// } +// +// public Publication getBasicProperties() { +// return basicProperties; +// } +// +// protected void setBasicProperties( +// final Publication basicProperties) { +// this.basicProperties = basicProperties; +// } +// +// public PublicationWithPublisher getWithPublisherProperties() { +// return withPublisherProperties; +// } +// +// protected void setWithPublisherProperties( +// final PublicationWithPublisher withPublisherProperties) { +// this.withPublisherProperties = withPublisherProperties; +// } +// +// public String getNameOfConference() { +// return nameOfConference; +// } +// +// public void setNameOfConference(final String nameOfConference) { +// this.nameOfConference = nameOfConference; +// } +// +// public String getPlaceOfConference() { +// return placeOfConference; +// } +// +// public void setPlaceOfConference(final String placeOfConference) { +// this.placeOfConference = placeOfConference; +// } +// +// public LocalDate getStartDateOfConference() { +// return startDateOfConference; +// } +// +// public void setStartDateOfConference(final LocalDate startDateOfConference) { +// this.startDateOfConference = startDateOfConference; +// } +// +// public LocalDate getEndDateOfConference() { +// return endDateOfConference; +// } +// +// public void setEndDateOfConference(final LocalDate endDateOfConference) { +// this.endDateOfConference = endDateOfConference; +// } +// +// @Override +// public int hashCode() { +// int hash = super.hashCode(); +// hash = 19 * hash + Objects.hashCode(basicProperties); +// hash = 19 * hash + Objects.hashCode(withPublisherProperties); +// hash = 19 * hash + Objects.hashCode(nameOfConference); +// hash = 19 * hash + Objects.hashCode(placeOfConference); +// hash = 19 * hash + Objects.hashCode(startDateOfConference); +// hash = 19 * hash + Objects.hashCode(endDateOfConference); +// 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 ProceedingsAsset)) { +// return false; +// } +// final ProceedingsAsset other = (ProceedingsAsset) obj; +// if (!other.canEqual(this)) { +// return false; +// } +// if (!Objects.equals(basicProperties, other.getBasicProperties())) { +// return false; +// } +// if (!Objects.equals(withPublisherProperties, +// other.getWithPublisherProperties())) { +// return false; +// } +// if (!Objects.equals(nameOfConference, other.getNameOfConference())) { +// return false; +// } +// if (!Objects.equals(placeOfConference, other.getPlaceOfConference())) { +// return false; +// } +// if (!Objects.equals(startDateOfConference, +// other.getStartDateOfConference())) { +// return false; +// } +// return Objects.equals(endDateOfConference, +// other.getEndDateOfConference()); +// } +// +// @Override +// public boolean canEqual(final Object obj) { +// +// return obj instanceof ProceedingsAsset; +// } +// +// @Override +// public String toString(final String data) { +// +// return super.toString(String.format( +// "basicProperties = %s, " +// + "withPublisherProperties = %s, " +// + "nameOfConference = \"%s\", " +// + "placeOfConference = \"%s\", " +// + "startDateOfConference = \"%s\", " +// + "endDateOfConference = \"%s\"%s", +// Objects.toString(basicProperties), +// Objects.toString(withPublisherProperties), +// nameOfConference, +// placeOfConference, +// Objects.toString(startDateOfConference), +// Objects.toString(endDateOfConference), +// data)); +// } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/Publisher.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/Publisher.java deleted file mode 100644 index dfd9d4d..0000000 --- a/sci-publications/src/main/java/org/scientificcms/publications/assets/Publisher.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.assets; - -import org.hibernate.envers.Audited; -import org.librecms.contentsection.Asset; - -import java.util.Objects; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -import static org.scientificcms.publications.SciPublicationsConstants.*; - -/** - * An asset for storing the informations about a publisher required to create - * correct bibliographic references. - * - * @author Jens Pelzetter - */ -@Entity -@Table(name = "PUBLISHERS", schema = DB_SCHEMA) -@Audited -public class Publisher extends Asset { - - private static final long serialVersionUID = 1L; - - /** - * Name of the publisher. The title of the asset is only for internal use, - * this property should be used for name of the publisher which is displayed - * on public pages. - */ - @Column(name = "NAME", length = 2048, nullable = false) - private String name; - - /** - * The place of the publisher. - */ - @Column(name = "PLACE", length = 2048) - private String place; - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public String getPlace() { - return place; - } - - public void setPlace(final String place) { - this.place = place; - } - - @Override - public int hashCode() { - int hash = super.hashCode(); - hash = 29 * hash + Objects.hashCode(name); - hash = 29 * hash + Objects.hashCode(place); - 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 Publisher)) { - return false; - } - final Publisher other = (Publisher) obj; - if (!other.canEqual(this)) { - return false; - } - if (!Objects.equals(name, other.getName())) { - return false; - } - return Objects.equals(place, other.getPlace()); - } - - @Override - public boolean canEqual(final Object obj) { - return obj instanceof Publisher; - } - - @Override - public String toString(final String data) { - return super.toString(String.format( - ", name = \"%s\", " - + "place = \"%s\"%s", - name, - place, - data)); - } - -} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/PublisherAsset.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/PublisherAsset.java new file mode 100644 index 0000000..70a0ce1 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/assets/PublisherAsset.java @@ -0,0 +1,109 @@ +/* + * 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.assets; + +import org.hibernate.envers.Audited; +import org.librecms.contentsection.Asset; + +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * An asset for storing the informations about a publisher required to create + * correct bibliographic references. + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "PUBLISHERS", schema = DB_SCHEMA) +@Audited +public class PublisherAsset extends Asset { + +// private static final long serialVersionUID = 1L; +// +// /** +// * Name of the publisher. The title of the asset is only for internal use, +// * this property should be used for name of the publisher which is displayed +// * on public pages. +// */ +// @Column(name = "NAME", length = 2048, nullable = false) +// private String name; +// +// /** +// * The place of the publisher. +// */ +// @Column(name = "PLACE", length = 2048) +// private String place; +// +// public String getName() { +// return name; +// } +// +// public void setName(final String name) { +// this.name = name; +// } +// +// public String getPlace() { +// return place; +// } +// +// public void setPlace(final String place) { +// this.place = place; +// } +// +// @Override +// public int hashCode() { +// int hash = super.hashCode(); +// hash = 29 * hash + Objects.hashCode(name); +// hash = 29 * hash + Objects.hashCode(place); +// 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 PublisherAsset)) { +// return false; +// } +// final PublisherAsset other = (PublisherAsset) obj; +// if (!other.canEqual(this)) { +// return false; +// } +// if (!Objects.equals(name, other.getName())) { +// return false; +// } +// return Objects.equals(place, other.getPlace()); +// } +// +// @Override +// public boolean canEqual(final Object obj) { +// return obj instanceof PublisherAsset; +// } +// +// @Override +// public String toString(final String data) { +// return super.toString(String.format( +// ", name = \"%s\", " +// + "place = \"%s\"%s", +// name, +// place, +// data)); +// } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/AbstractPublicationItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/AbstractPublicationItem.java new file mode 100644 index 0000000..f798ab3 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/AbstractPublicationItem.java @@ -0,0 +1,95 @@ +/* + * 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.contenttypes; + +import org.librecms.contentsection.ContentItem; +import org.scientificcms.publications.Publication; + +import javax.persistence.Entity; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * + * @author Jens Pelzetter + * @param + */ +@Entity +@Table(name = "PUBLICATION_ITEMS", schema = DB_SCHEMA) +public abstract class AbstractPublicationItem + extends ContentItem { +//extends Publication { + + private static final long serialVersionUID = 1L; + + public abstract T getPublication(); + + protected abstract void setPublication(T publication); +// +// @Embedded +// private Publication basicProperties; +// +// public AbstractPublicationItem() { +// +// super(); +// +// basicProperties = new Publication(); +// } +// +// public Publication getBasicProperties() { +// return basicProperties; +// } +// +// protected void setBasicProperties( +// final Publication basicProperties) { +// +// this.basicProperties = basicProperties; +// } +// +// @Override +// public int hashCode() { +// int hash = super.hashCode(); +// hash = 59 * hash + Objects.hashCode(basicProperties); +// return hash; +// } +// +// @Override +// public boolean equals(Object obj) { +// +// if (this == obj) { +// return true; +// } +// if (obj == null) { +// return false; +// } +// if (!super.equals(obj)) { +// return false; +// } +// if (!(obj instanceof AbstractPublicationItem)) { +// return false; +// } +// final AbstractPublicationItem other = (AbstractPublicationItem) obj; +// if (!other.canEqual(this)) { +// return false; +// } +// return Objects.equals(basicProperties, other.getBasicProperties()); +// } +// + @Override + public boolean canEqual(final Object obj) { + + return obj instanceof AbstractPublicationItem; + } +// +// @Override +// public String toString(final String data) { +// return super.toString(String.format("basicProperties = %s%s", +// Objects.toString(basicProperties), +// data)); +// } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/AbstractPublicationWithPublisherItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/AbstractPublicationWithPublisherItem.java new file mode 100644 index 0000000..3aeb223 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/AbstractPublicationWithPublisherItem.java @@ -0,0 +1,82 @@ +/* + * 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.contenttypes; + +import org.scientificcms.publications.PublicationWithPublisher; + + +/** + * + * @author Jens Pelzetter + * @param + */ +public abstract class AbstractPublicationWithPublisherItem + extends AbstractPublicationItem { +//extends PublicationItem { + + private static final long serialVersionUID = 1L; +// +// @Embedded +// private AbstractPublicationWithPublisherItem withPublisherProperties; +// +// public AbstractPublicationWithPublisherItem() { +// +// this.withPublisherProperties = new AbstractPublicationWithPublisherItem(); +// } +// +// public AbstractPublicationWithPublisherItem getWithPublisherProperties() { +// return withPublisherProperties; +// } +// +// protected void setWithPublisherProperties( +// final AbstractPublicationWithPublisherItem withPublisherProperties) { +// this.withPublisherProperties = withPublisherProperties; +// } +// +// @Override +// public int hashCode() { +// int hash = super.hashCode(); +// hash = 79 * hash + Objects.hashCode(withPublisherProperties); +// return hash; +// } +// +// @Override +// public boolean equals(final Object obj) { +// if (this == obj) { +// return true; +// } +// if (obj == null) { +// return false; +// } +// if (!super.equals(this)) { +// return false; +// } +// if (!(obj instanceof AbstractPublicationWithPublisherItem)) { +// return false; +// } +// final AbstractPublicationWithPublisherItem other = (AbstractPublicationWithPublisherItem) obj; +// if (!other.canEqual(this)) { +// return false; +// } +// return Objects.equals(withPublisherProperties, +// other.getWithPublisherProperties()); +// } +// + @Override + public boolean canEqual(final Object obj) { + return obj instanceof AbstractPublicationWithPublisherItem; + } +// +// @Override +// public String toString(final String data) { +// +// return super.toString(String.format("withPublisherProperties = %s%s", +// Objects.toString( +// withPublisherProperties), +// data)); +// } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java index 4fd05d9..7d22c7b 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java @@ -5,7 +5,7 @@ */ package org.scientificcms.publications.contenttypes; -import org.scientificcms.publications.assets.CollectedVolume; +import org.scientificcms.publications.assets.CollectedVolumeAsset; import java.util.Objects; @@ -22,62 +22,63 @@ import static org.scientificcms.publications.SciPublicationsConstants.*; */ @Entity @Table(name = "COLLECTED_VOLUME_ITEMS", schema = DB_SCHEMA) -public class CollectedVolumeItem extends Publication { +public class CollectedVolumeItem { +// extends Publication { private static final long serialVersionUID = 1L; - - @OneToOne - @JoinColumn(name = "DATA_ID") - private CollectedVolume publicationData; - - public CollectedVolume getPublicationData() { - return publicationData; - } - - protected void setPublicationData(final CollectedVolume publicationData) { - this.publicationData = publicationData; - } - - @Override - public int hashCode() { - int hash = super.hashCode(); - hash = 43 * hash + Objects.hashCode(publicationData); - 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 CollectedVolumeItem)) { - return false; - } - final CollectedVolumeItem other = (CollectedVolumeItem) obj; - if (!other.canEqual(this)) { - return false; - } - return Objects.equals(publicationData, other.getPublicationData()); - } - - @Override - public boolean canEqual(final Object obj) { - - return obj instanceof CollectedVolumeItem; - } - - @Override - public String toString(final String data) { - - return super.toString(String.format("data = %s%s", - Objects.toString(publicationData), - data)); - } +// +// @OneToOne +// @JoinColumn(name = "DATA_ID") +// private CollectedVolumeAsset publicationData; +// +// public CollectedVolumeAsset getPublicationData() { +// return publicationData; +// } +// +// protected void setPublicationData(final CollectedVolumeAsset publicationData) { +// this.publicationData = publicationData; +// } +// +// @Override +// public int hashCode() { +// int hash = super.hashCode(); +// hash = 43 * hash + Objects.hashCode(publicationData); +// 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 CollectedVolumeItem)) { +// return false; +// } +// final CollectedVolumeItem other = (CollectedVolumeItem) obj; +// if (!other.canEqual(this)) { +// return false; +// } +// return Objects.equals(publicationData, other.getPublicationData()); +// } +// +// @Override +// public boolean canEqual(final Object obj) { +// +// return obj instanceof CollectedVolumeItem; +// } +// +// @Override +// public String toString(final String data) { +// +// return super.toString(String.format("data = %s%s", +// Objects.toString(publicationData), +// data)); +// } } diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/MonographItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/MonographItem.java new file mode 100644 index 0000000..83e7912 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/MonographItem.java @@ -0,0 +1,88 @@ +/* + * 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.contenttypes; + +import org.scientificcms.publications.Monograph; + +import java.util.Objects; + +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import static org.scientificcms.publications.SciPublicationsConstants.*; + +/** + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "MONOGRAPH_ITEMS", schema = DB_SCHEMA) +public class MonographItem extends AbstractPublicationWithPublisherItem { + + private static final long serialVersionUID = 1L; + + @OneToOne + @JoinColumn(name = "PUBLICATION_ID") + private Monograph publication; + + @Override + public Monograph getPublication() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + + + + @Override + protected void setPublication(final Monograph publication) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public int hashCode() { + int hash = super.hashCode(); + hash = 29 * hash + Objects.hashCode(publication); + 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 MonographItem)) { + return false; + } + final MonographItem other = (MonographItem) obj; + if (!other.canEqual(this)) { + return false; + } + return Objects.equals(publication, other.getPublication()); + } + + @Override + public boolean canEqual(Object obj) { + return obj instanceof MonographItem; + } + + + @Override + public String toString(final String data) { + return super.toString(String.format(", publication = %s%s", + Objects.toString(publication), + data)); + } + + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ProceedingsItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ProceedingsItem.java index 86baf9a..97647b4 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ProceedingsItem.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ProceedingsItem.java @@ -5,7 +5,7 @@ */ package org.scientificcms.publications.contenttypes; -import org.scientificcms.publications.assets.Proceedings; +import org.scientificcms.publications.assets.ProceedingsAsset; import java.util.Objects; @@ -22,62 +22,63 @@ import static org.scientificcms.publications.SciPublicationsConstants.*; */ @Entity @Table(name = "PROCEEDINGS_ITEMS", schema = DB_SCHEMA) -public class ProceedingsItem extends Publication { +public class ProceedingsItem { +// extends Publication { - private static final long serialVersionUID = 1L; - - @OneToOne - @JoinColumn(name = "DATA_ID") - private Proceedings publicationData; - - public Proceedings getPublicationData() { - return publicationData; - } - - protected void setPublicationData(final Proceedings publicationData) { - this.publicationData = publicationData; - } - - @Override - public int hashCode() { - int hash = super.hashCode(); - hash = 43 * hash + Objects.hashCode(publicationData); - 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 ProceedingsItem)) { - return false; - } - final ProceedingsItem other = (ProceedingsItem) obj; - if (!other.canEqual(this)) { - return false; - } - return Objects.equals(publicationData, other.getPublicationData()); - } - - @Override - public boolean canEqual(final Object obj) { - - return obj instanceof ProceedingsItem; - } - - @Override - public String toString(final String data) { - - return super.toString(String.format("data = %s%s", - Objects.toString(publicationData), - data)); - } +// private static final long serialVersionUID = 1L; +// +// @OneToOne +// @JoinColumn(name = "DATA_ID") +// private ProceedingsAsset publicationData; +// +// public ProceedingsAsset getPublicationData() { +// return publicationData; +// } +// +// protected void setPublicationData(final ProceedingsAsset publicationData) { +// this.publicationData = publicationData; +// } +// +// @Override +// public int hashCode() { +// int hash = super.hashCode(); +// hash = 43 * hash + Objects.hashCode(publicationData); +// 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 ProceedingsItem)) { +// return false; +// } +// final ProceedingsItem other = (ProceedingsItem) obj; +// if (!other.canEqual(this)) { +// return false; +// } +// return Objects.equals(publicationData, other.getPublicationData()); +// } +// +// @Override +// public boolean canEqual(final Object obj) { +// +// return obj instanceof ProceedingsItem; +// } +// +// @Override +// public String toString(final String data) { +// +// return super.toString(String.format("data = %s%s", +// Objects.toString(publicationData), +// data)); +// } } diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/Publication.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/Publication.java deleted file mode 100644 index 6af19e9..0000000 --- a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/Publication.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.contenttypes; - -import org.librecms.contentsection.ContentItem; - -import javax.persistence.Entity; -import javax.persistence.Table; - -import static org.scientificcms.publications.SciPublicationsConstants.*; - -/** - * - * @author Jens Pelzetter - */ -@Entity -@Table(name = "PUBLICATIONS", schema = DB_SCHEMA) -public class Publication extends ContentItem { - - private static final long serialVersionUID = 1L; - -} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/PublicationItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/PublicationItem.java deleted file mode 100644 index adb2d1e..0000000 --- a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/PublicationItem.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.contenttypes; - -import org.librecms.contentsection.ContentItem; -import org.scientificcms.publications.BasicPublicationProperties; - -import java.util.Objects; - -import javax.persistence.Embedded; -import javax.persistence.Entity; -import javax.persistence.Table; - -import static org.scientificcms.publications.SciPublicationsConstants.*; - -/** - * - * @author Jens Pelzetter - */ -@Entity -@Table(name = "PUBLICATION_ITEMS", schema = DB_SCHEMA) -public class PublicationItem extends Publication { - - private static final long serialVersionUID = 1L; - - @Embedded - private BasicPublicationProperties basicProperties; - - public PublicationItem() { - - super(); - - basicProperties = new BasicPublicationProperties(); - } - - public BasicPublicationProperties getBasicProperties() { - return basicProperties; - } - - protected void setBasicProperties( - final BasicPublicationProperties basicProperties) { - - this.basicProperties = basicProperties; - } - - @Override - public int hashCode() { - int hash = super.hashCode(); - hash = 59 * hash + Objects.hashCode(basicProperties); - return hash; - } - - @Override - public boolean equals(Object obj) { - - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!super.equals(obj)) { - return false; - } - if (!(obj instanceof PublicationItem)) { - return false; - } - final PublicationItem other = (PublicationItem) obj; - if (!other.canEqual(this)) { - return false; - } - return Objects.equals(basicProperties, other.getBasicProperties()); - } - - @Override - public boolean canEqual(final Object obj) { - - return obj instanceof PublicationItem; - } - - @Override - public String toString(final String data) { - return super.toString(String.format("basicProperties = %s%s", - Objects.toString(basicProperties), - data)); - } - -} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/PublicationWithPublisher.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/PublicationWithPublisher.java deleted file mode 100644 index 5ffb874..0000000 --- a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/PublicationWithPublisher.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.contenttypes; - -import org.scientificcms.publications.PublicationWithPublisherProperties; - -import java.util.Objects; - -import javax.persistence.Embedded; - -/** - * - * @author Jens Pelzetter - */ -public class PublicationWithPublisher extends PublicationItem { - - private static final long serialVersionUID = 1L; - - @Embedded - private PublicationWithPublisherProperties withPublisherProperties; - - public PublicationWithPublisher() { - - this.withPublisherProperties = new PublicationWithPublisherProperties(); - } - - public PublicationWithPublisherProperties getWithPublisherProperties() { - return withPublisherProperties; - } - - protected void setWithPublisherProperties( - final PublicationWithPublisherProperties withPublisherProperties) { - this.withPublisherProperties = withPublisherProperties; - } - - @Override - public int hashCode() { - int hash = super.hashCode(); - hash = 79 * hash + Objects.hashCode(withPublisherProperties); - return hash; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!super.equals(this)) { - return false; - } - if (!(obj instanceof PublicationWithPublisher)) { - return false; - } - final PublicationWithPublisher other = (PublicationWithPublisher) obj; - if (!other.canEqual(this)) { - return false; - } - return Objects.equals(withPublisherProperties, - other.getWithPublisherProperties()); - } - - @Override - public boolean canEqual(final Object obj) { - return obj instanceof PublicationWithPublisher; - } - - @Override - public String toString(final String data) { - - return super.toString(String.format("withPublisherProperties = %s%s", - Objects.toString( - withPublisherProperties), - data)); - } - -} diff --git a/sci-publications/src/test/java/org/scientificcms/publications/assets/EqualsAndHashCodeTest.java b/sci-publications/src/test/java/org/scientificcms/publications/assets/EqualsAndHashCodeTest.java index 6accc3f..90fc610 100644 --- a/sci-publications/src/test/java/org/scientificcms/publications/assets/EqualsAndHashCodeTest.java +++ b/sci-publications/src/test/java/org/scientificcms/publications/assets/EqualsAndHashCodeTest.java @@ -37,8 +37,8 @@ public class EqualsAndHashCodeTest extends EqualsVerifier { public static Collection> data() { return Arrays.asList(new Class[]{ - Journal.class, - Publisher.class + JournalAsset.class, + PublisherAsset.class }); } @@ -50,122 +50,122 @@ public class EqualsAndHashCodeTest extends EqualsVerifier { protected void addPrefabValues( final nl.jqno.equalsverifier.EqualsVerifier verifier) { - final Journal journal1 = new Journal(); - journal1.setFirstYear(1953); - journal1.setSymbol("foo"); - - final Journal journal2 = new Journal(); - journal2.setSymbol("bar"); - - verifier.withPrefabValues(Journal.class, journal1, journal2); - - final Publisher publisher1 = new Publisher(); - publisher1.setName("Muster Verlag"); - publisher1.setPlace("Musterburg"); - - final Publisher publisher2 = new Publisher(); - publisher2.setName("Example Press"); - publisher2.setPlace("Riverton"); - - verifier.withPrefabValues(Publisher.class, publisher1, publisher2); - - final ContentSection contentSection1 = new ContentSection(); - contentSection1.setObjectId(401); - contentSection1.setDisplayName("section1"); - - final ContentSection contentSection2 = new ContentSection(); - contentSection2.setObjectId(402); - contentSection2.setDisplayName("section2"); - - verifier.withPrefabValues(ContentSection.class, - contentSection1, - contentSection2); - - final ContentType contentType1 = new ContentType(); - contentType1.setObjectId(501); - contentType1.setDisplayName("type-1"); - - final ContentType contentType2 = new ContentType(); - contentType2.setObjectId(502); - contentType2.setDisplayName("type-2"); - - verifier.withPrefabValues(ContentType.class, - contentType1, - contentType2); - - final ContentItem item1 = new ContentItem(); - item1.setObjectId(601); - item1.setDisplayName("item1"); - - final ContentItem item2 = new ContentItem(); - item2.setObjectId(602); - item2.setDisplayName("item2"); - - verifier.withPrefabValues(ContentItem.class, item1, item2); - - final Lifecycle lifecycle1 = new Lifecycle(); - lifecycle1.setLifecycleId(801); - lifecycle1.setStarted(true); - - final Lifecycle lifecycle2 = new Lifecycle(); - lifecycle2.setLifecycleId(802); - lifecycle2.setStarted(false); - - verifier.withPrefabValues(Lifecycle.class, lifecycle1, lifecycle2); - - final Workflow workflow1 = new Workflow(); - final LocalizedString workflow1Name = new LocalizedString(); - workflow1Name.addValue(Locale.ROOT, "workflow1"); - workflow1.setName(workflow1Name); - - final Workflow workflow2 = new Workflow(); - final LocalizedString workflow2Name = new LocalizedString(); - workflow2Name.addValue(Locale.ROOT, "workflow2"); - workflow2.setName(workflow2Name); - - verifier.withPrefabValues(Workflow.class, workflow1, workflow2); - - final CcmObject ccmObj1 = new CcmObject(); - ccmObj1.setObjectId(1001); - ccmObj1.setDisplayName("obj1"); - - final CcmObject ccmObj2 = new CcmObject(); - ccmObj2.setObjectId(1002); - ccmObj2.setDisplayName("obj2"); - - verifier.withPrefabValues(CcmObject.class, ccmObj1, ccmObj2); - - SecurityEntitiesPrefabProvider.addPrefabEntities(verifier); - - final Category category1 = new Category(); - category1.setObjectId(5001); - category1.setName("category1"); - - final Category category2 = new Category(); - category2.setCategoryOrder(5002); - category2.setName("category2"); - - verifier.withPrefabValues(Category.class, category1, category2); - - final Organization organization1 = new Organization(); - organization1.setName("orga1"); - - final Organization organization2 = new Organization(); - organization1.setName("orga2"); - - verifier.withPrefabValues(Organization.class, - organization1, - organization2); - - final ItemAttachment itemAttachment1 = new ItemAttachment<>(); - itemAttachment1.setUuid("927ac9de-029d-4233-9015-1135eb861c34"); - - final ItemAttachment itemAttachment2 = new ItemAttachment<>(); - itemAttachment2.setUuid("d1bd98a1-75c2-4e61-8f9f-2e2eadd30812"); - - verifier.withPrefabValues(ItemAttachment.class, - itemAttachment1, - itemAttachment2); +// final JournalAsset journal1 = new JournalAsset(); +// journal1.setFirstYear(1953); +// journal1.setSymbol("foo"); +// +// final JournalAsset journal2 = new JournalAsset(); +// journal2.setSymbol("bar"); +// +// verifier.withPrefabValues(JournalAsset.class, journal1, journal2); +// +// final PublisherAsset publisher1 = new PublisherAsset(); +// publisher1.setName("Muster Verlag"); +// publisher1.setPlace("Musterburg"); +// +// final PublisherAsset publisher2 = new PublisherAsset(); +// publisher2.setName("Example Press"); +// publisher2.setPlace("Riverton"); +// +// verifier.withPrefabValues(PublisherAsset.class, publisher1, publisher2); +// +// final ContentSection contentSection1 = new ContentSection(); +// contentSection1.setObjectId(401); +// contentSection1.setDisplayName("section1"); +// +// final ContentSection contentSection2 = new ContentSection(); +// contentSection2.setObjectId(402); +// contentSection2.setDisplayName("section2"); +// +// verifier.withPrefabValues(ContentSection.class, +// contentSection1, +// contentSection2); +// +// final ContentType contentType1 = new ContentType(); +// contentType1.setObjectId(501); +// contentType1.setDisplayName("type-1"); +// +// final ContentType contentType2 = new ContentType(); +// contentType2.setObjectId(502); +// contentType2.setDisplayName("type-2"); +// +// verifier.withPrefabValues(ContentType.class, +// contentType1, +// contentType2); +// +// final ContentItem item1 = new ContentItem(); +// item1.setObjectId(601); +// item1.setDisplayName("item1"); +// +// final ContentItem item2 = new ContentItem(); +// item2.setObjectId(602); +// item2.setDisplayName("item2"); +// +// verifier.withPrefabValues(ContentItem.class, item1, item2); +// +// final Lifecycle lifecycle1 = new Lifecycle(); +// lifecycle1.setLifecycleId(801); +// lifecycle1.setStarted(true); +// +// final Lifecycle lifecycle2 = new Lifecycle(); +// lifecycle2.setLifecycleId(802); +// lifecycle2.setStarted(false); +// +// verifier.withPrefabValues(Lifecycle.class, lifecycle1, lifecycle2); +// +// final Workflow workflow1 = new Workflow(); +// final LocalizedString workflow1Name = new LocalizedString(); +// workflow1Name.addValue(Locale.ROOT, "workflow1"); +// workflow1.setName(workflow1Name); +// +// final Workflow workflow2 = new Workflow(); +// final LocalizedString workflow2Name = new LocalizedString(); +// workflow2Name.addValue(Locale.ROOT, "workflow2"); +// workflow2.setName(workflow2Name); +// +// verifier.withPrefabValues(Workflow.class, workflow1, workflow2); +// +// final CcmObject ccmObj1 = new CcmObject(); +// ccmObj1.setObjectId(1001); +// ccmObj1.setDisplayName("obj1"); +// +// final CcmObject ccmObj2 = new CcmObject(); +// ccmObj2.setObjectId(1002); +// ccmObj2.setDisplayName("obj2"); +// +// verifier.withPrefabValues(CcmObject.class, ccmObj1, ccmObj2); +// +// SecurityEntitiesPrefabProvider.addPrefabEntities(verifier); +// +// final Category category1 = new Category(); +// category1.setObjectId(5001); +// category1.setName("category1"); +// +// final Category category2 = new Category(); +// category2.setCategoryOrder(5002); +// category2.setName("category2"); +// +// verifier.withPrefabValues(Category.class, category1, category2); +// +// final Organization organization1 = new Organization(); +// organization1.setName("orga1"); +// +// final Organization organization2 = new Organization(); +// organization1.setName("orga2"); +// +// verifier.withPrefabValues(Organization.class, +// organization1, +// organization2); +// +// final ItemAttachment itemAttachment1 = new ItemAttachment<>(); +// itemAttachment1.setUuid("927ac9de-029d-4233-9015-1135eb861c34"); +// +// final ItemAttachment itemAttachment2 = new ItemAttachment<>(); +// itemAttachment2.setUuid("d1bd98a1-75c2-4e61-8f9f-2e2eadd30812"); +// +// verifier.withPrefabValues(ItemAttachment.class, +// itemAttachment1, +// itemAttachment2); } }