Assets for various data used by publiations

pull/1/head
Jens Pelzetter 2019-09-05 20:29:54 +02:00
parent 0668a827b9
commit 2e613688d8
4 changed files with 229 additions and 464 deletions

View File

@ -5,13 +5,15 @@
*/ */
package org.scientificcms.publications.assets; package org.scientificcms.publications.assets;
import org.hibernate.envers.Audited;
import org.librecms.contentsection.Asset; import org.librecms.contentsection.Asset;
import org.scientificcms.publications.Publication; import org.scientificcms.publications.CollectedVolume;
import org.scientificcms.publications.PublicationWithPublisher;
import java.util.Objects; import java.util.Objects;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*; import static org.scientificcms.publications.SciPublicationsConstants.*;
@ -22,89 +24,61 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
*/ */
@Entity @Entity
@Table(name = "COLLECTED_VOLUMES", schema = DB_SCHEMA) @Table(name = "COLLECTED_VOLUMES", schema = DB_SCHEMA)
@Audited
public class CollectedVolumeAsset extends Asset { public class CollectedVolumeAsset extends Asset {
// private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//
// private Publication basicProperties; @OneToOne
// @JoinColumn(name = "COLLECTED_VOLUME_ID")
// private PublicationWithPublisher withPublisherProperties; private CollectedVolume collectedVolume;
//
// public CollectedVolumeAsset() { public CollectedVolume getCollectedVolume() {
// return collectedVolume;
// super(); }
//
// basicProperties = new Publication(); protected void setCollectedVolume(final CollectedVolume collectedVolume) {
// withPublisherProperties = new PublicationWithPublisher(); this.collectedVolume = collectedVolume;
// } }
//
// public Publication getBasicProperties() { @Override
// return basicProperties; public int hashCode() {
// } int hash = super.hashCode();
// hash = 29 * hash + Objects.hashCode(collectedVolume);
// protected void setBasicProperties( return hash;
// final Publication basicProperties) { }
// this.basicProperties = basicProperties;
// } @Override
// public boolean equals(final Object obj) {
// public PublicationWithPublisher getWithPublisherProperties() { if (this == obj) {
// return withPublisherProperties; return true;
// } }
// if (obj == null) {
// protected void setWithPublisherProperties( return false;
// final PublicationWithPublisher withPublisherProperties) { }
// this.withPublisherProperties = withPublisherProperties; if (!super.equals(obj)) {
// } return false;
// }
// @Override if (!(obj instanceof CollectedVolumeAsset)) {
// public int hashCode() { return false;
// int hash = super.hashCode(); }
// hash = 19 * hash + Objects.hashCode(basicProperties); final CollectedVolumeAsset other = (CollectedVolumeAsset) obj;
// hash = 19 * hash + Objects.hashCode(withPublisherProperties); if (!other.canEqual(this)) {
// return hash; return false;
// } }
// return Objects.equals(this.collectedVolume, other.getCollectedVolume());
// @Override }
// public boolean equals(final Object obj) {
// if (this == obj) { @Override
// return true; public boolean canEqual(final Object obj) {
// } return obj instanceof CollectedVolumeAsset;
// if (obj == null) { }
// return false;
// } @Override
// if (!super.equals(obj)) { public String toString(final String data) {
// return false; return super.toString(String.format("collectedVolume = %s%s",
// } Objects.toString(collectedVolume),
// if (!(obj instanceof CollectedVolumeAsset)) { data));
// 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));
// }
//
} }

View File

@ -6,16 +6,14 @@
package org.scientificcms.publications.assets; package org.scientificcms.publications.assets;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString;
import org.librecms.contentsection.Asset; import org.librecms.contentsection.Asset;
import org.scientificcms.publications.Journal;
import java.util.Objects; import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Embedded;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*; import static org.scientificcms.publications.SciPublicationsConstants.*;
@ -30,146 +28,59 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
@Audited @Audited
public class JournalAsset extends Asset { public class JournalAsset extends Asset {
// private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//
// /** @OneToOne
// * Year in which the journal was published first. @JoinColumn(name = "JOURNAL_ID")
// */ private Journal journal;
// private Integer firstYear;
// public Journal getJournal() {
// /** return journal;
// * Year in which the journal was published last }
// */
// private Integer lastYear; protected void setJournal(final Journal journal) {
// this.journal = journal;
// /** }
// * The ISSN of the journal.
// */ @Override
// private String issn; public int hashCode() {
// int hash = super.hashCode();
// /** hash = 59 * hash + Objects.hashCode(journal);
// * A short description of the journal. return hash;
// */ }
// @Embedded
// @AssociationOverride( @Override
// name = "values", public boolean equals(final Object obj) {
// joinTable = @JoinTable(name = "JOURNAL_DESCRIPTIONS", if (this == obj) {
// schema = DB_SCHEMA, return true;
// joinColumns = { }
// @JoinColumn(name = "OBJECT_ID") if (obj == null) {
// }) return false;
// ) }
// private LocalizedString description; if (!super.equals(obj)) {
// return false;
// /** }
// * The usual symbol/abbrevation used to refer to the journal. if (!(obj instanceof JournalAsset)) {
// */ return false;
// private String symbol; }
// final JournalAsset other = (JournalAsset) obj;
// public Integer getFirstYear() { if (!other.canEqual(this)) {
// return firstYear; return false;
// } }
// return Objects.equals(journal, other.getJournal());
// public void setFirstYear(final Integer firstYear) { }
// this.firstYear = firstYear;
// } @Override
// public boolean canEqual(final Object obj) {
// public Integer getLastYear() { return obj instanceof JournalAsset;
// return lastYear; }
// }
// @Override
// public void setLastYear(final Integer lastYear) { public String toString(final String data) {
// this.lastYear = lastYear;
// } return super.toString(String.format(", journal = %s%s",
// Objects.toString(journal),
// public String getIssn() { data));
// 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));
// }
} }

View File

@ -5,15 +5,15 @@
*/ */
package org.scientificcms.publications.assets; package org.scientificcms.publications.assets;
import org.hibernate.envers.Audited;
import org.librecms.contentsection.Asset; import org.librecms.contentsection.Asset;
import org.scientificcms.publications.Publication; import org.scientificcms.publications.Proceedings;
import org.scientificcms.publications.PublicationWithPublisher;
import java.time.LocalDate;
import java.util.Objects; import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*; import static org.scientificcms.publications.SciPublicationsConstants.*;
@ -24,158 +24,61 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
*/ */
@Entity @Entity
@Table(name = "PROCEEDINGS", schema = DB_SCHEMA) @Table(name = "PROCEEDINGS", schema = DB_SCHEMA)
@Audited
public class ProceedingsAsset extends Asset { public class ProceedingsAsset extends Asset {
// private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//
// private Publication basicProperties; @OneToOne
// @JoinColumn(name = "PROCEEDINGS_ID")
// private PublicationWithPublisher withPublisherProperties; private Proceedings proceedings;
//
// @Column(name = "NAME_OF_CONFERENCE", length = 1024) public Proceedings getProceedings() {
// private String nameOfConference; return proceedings;
// }
// @Column(name = "PLACE_OF_CONFERENCE", length = 1024)
// private String placeOfConference; public void setProceedings(Proceedings proceedings) {
// this.proceedings = proceedings;
// @Column(name = "START_DATE_OF_CONFERENCE") }
// private LocalDate startDateOfConference;
// @Override
// @Column(name = "END_DATE_OF_CONFERENCE") public int hashCode() {
// private LocalDate endDateOfConference; int hash = super.hashCode();
// hash = 59 * hash + Objects.hashCode(proceedings);
// public ProceedingsAsset() { return hash;
// }
// super();
// @Override
// basicProperties = new Publication(); public boolean equals(final Object obj) {
// withPublisherProperties = new PublicationWithPublisher(); if (this == obj) {
// } return true;
// }
// public Publication getBasicProperties() { if (obj == null) {
// return basicProperties; return false;
// } }
// if (!super.equals(obj)) {
// protected void setBasicProperties( return false;
// final Publication basicProperties) { }
// this.basicProperties = basicProperties; if (!(obj instanceof ProceedingsAsset)) {
// } return false;
// }
// public PublicationWithPublisher getWithPublisherProperties() { final ProceedingsAsset other = (ProceedingsAsset) obj;
// return withPublisherProperties; if (!other.canEqual(this)) {
// } return false;
// }
// protected void setWithPublisherProperties( return Objects.equals(this.proceedings, other.getProceedings());
// final PublicationWithPublisher withPublisherProperties) { }
// this.withPublisherProperties = withPublisherProperties;
// } @Override
// public boolean canEqual(final Object obj) {
// public String getNameOfConference() { return obj instanceof ProceedingsAsset;
// return nameOfConference; }
// }
// @Override
// public void setNameOfConference(final String nameOfConference) { public String toString(final String data) {
// this.nameOfConference = nameOfConference; return super.toString(String.format(", proceeeings = %s%s",
// } Objects.toString(proceedings),
// data));
// 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));
// }
} }

View File

@ -7,11 +7,13 @@ package org.scientificcms.publications.assets;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.librecms.contentsection.Asset; import org.librecms.contentsection.Asset;
import org.scientificcms.publications.Publisher;
import java.util.Objects; import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import static org.scientificcms.publications.SciPublicationsConstants.*; import static org.scientificcms.publications.SciPublicationsConstants.*;
@ -27,83 +29,58 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
@Audited @Audited
public class PublisherAsset extends Asset { public class PublisherAsset extends Asset {
// private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//
// /** @OneToOne
// * Name of the publisher. The title of the asset is only for internal use, @JoinColumn(name = "PUBLISHER_ID")
// * this property should be used for name of the publisher which is displayed private Publisher publisher;
// * on public pages.
// */ public Publisher getPublisher() {
// @Column(name = "NAME", length = 2048, nullable = false) return publisher;
// private String name; }
//
// /** protected void setPublisher(final Publisher publisher) {
// * The place of the publisher. this.publisher = publisher;
// */ }
// @Column(name = "PLACE", length = 2048)
// private String place; @Override
// public int hashCode() {
// public String getName() { int hash = super.hashCode();
// return name; hash = 97 * hash + Objects.hashCode(publisher);
// } return hash;
// }
// public void setName(final String name) {
// this.name = name; @Override
// } public boolean equals(final Object obj) {
// if (this == obj) {
// public String getPlace() { return true;
// return place; }
// } if (obj == null) {
// return false;
// public void setPlace(final String place) { }
// this.place = place; if (!super.canEqual(this)) {
// } return false;
// }
// @Override if (!(obj instanceof PublisherAsset)) {
// public int hashCode() { return false;
// int hash = super.hashCode(); }
// hash = 29 * hash + Objects.hashCode(name); final PublisherAsset other = (PublisherAsset) obj;
// hash = 29 * hash + Objects.hashCode(place); if (!other.canEqual(this)) {
// return hash; return false;
// } }
// return Objects.equals(this.publisher, other.getPublisher());
// @Override }
// public boolean equals(final Object obj) {
// if (this == obj) { @Override
// return true; public boolean canEqual(final Object obj) {
// } return obj instanceof PublisherAsset;
// if (obj == null) { }
// return false;
// } @Override
// if (!super.equals(obj)) { public String toString(final String data) {
// return false; return super.toString(String.format(", publisher = %s%s",
// } Objects.toString(publisher),
// if (!(obj instanceof PublisherAsset)) { data));
// 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));
// }
} }