Entites for proceedings
parent
1f3a4a0baa
commit
e86bcdc2dd
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* 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.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "IN_PROCEEDINGS", schema = DB_SCHEMA)
|
||||
public class InProceedings extends Publication {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "PROCEEDINGS_ID")
|
||||
private Proceedings proceedings;
|
||||
|
||||
private int startPage;
|
||||
|
||||
private int endPage;
|
||||
|
||||
public Proceedings getProceedings() {
|
||||
return proceedings;
|
||||
}
|
||||
|
||||
protected void setProceedings(final Proceedings proceedings) {
|
||||
this.proceedings = proceedings;
|
||||
}
|
||||
|
||||
public int getStartPage() {
|
||||
return startPage;
|
||||
}
|
||||
|
||||
public void setStartPage(final int startPage) {
|
||||
this.startPage = startPage;
|
||||
}
|
||||
|
||||
public int getEndPage() {
|
||||
return endPage;
|
||||
}
|
||||
|
||||
public void setEndPage(final int endPage) {
|
||||
this.endPage = endPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 17 * hash + Objects.hashCode(proceedings);
|
||||
hash = 17 * hash + startPage;
|
||||
hash = 17 * hash + endPage;
|
||||
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 InProceedings)) {
|
||||
return false;
|
||||
}
|
||||
final InProceedings other = (InProceedings) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
if (startPage != other.getStartPage()) {
|
||||
return false;
|
||||
}
|
||||
if (endPage != other.getEndPage()) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(proceedings, other.getProceedings());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof InProceedings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
|
||||
return super.toString(String.format("proceedings = %s, "
|
||||
+ "startPage = %d, "
|
||||
+ "endPage = %d%s",
|
||||
Objects.toString(proceedings),
|
||||
startPage,
|
||||
endPage,
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.publications;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.librecms.assets.Organization;
|
||||
|
||||
import java.time.LocalDate;
|
||||
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.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "PROCEEDINGS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class Proceedings extends PublicationWithPublisher {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "NAME_OF_CONFERENCE", length = 2048)
|
||||
private String nameOfConference;
|
||||
|
||||
@Column(name = "PLACE_OF_CONFERENCE", length = 2048)
|
||||
private String placeOfConference;
|
||||
|
||||
@Column(name = "START_DATE")
|
||||
private LocalDate startDate;
|
||||
|
||||
@Column(name = "END_DATE")
|
||||
private LocalDate endDate;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "ORGANIZER_ID")
|
||||
private Organization organizer;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
private List<InProceedings> papers;
|
||||
|
||||
public Proceedings() {
|
||||
super();
|
||||
|
||||
papers = new ArrayList<>();
|
||||
}
|
||||
|
||||
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 getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Organization getOrganizer() {
|
||||
return organizer;
|
||||
}
|
||||
|
||||
public void setOrganizer(final Organization organizer) {
|
||||
this.organizer = organizer;
|
||||
}
|
||||
|
||||
public List<InProceedings> getPapers() {
|
||||
return Collections.unmodifiableList(papers);
|
||||
}
|
||||
|
||||
protected void addPaper(final InProceedings paper) {
|
||||
papers.add(paper);
|
||||
}
|
||||
|
||||
protected void removePaper(final InProceedings paper) {
|
||||
papers.remove(paper);
|
||||
}
|
||||
|
||||
protected void setPapers(final List<InProceedings> papers) {
|
||||
this.papers = new ArrayList<>(papers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 97 * hash + Objects.hashCode(nameOfConference);
|
||||
hash = 97 * hash + Objects.hashCode(placeOfConference);
|
||||
hash = 97 * hash + Objects.hashCode(startDate);
|
||||
hash = 97 * hash + Objects.hashCode(endDate);
|
||||
hash = 97 * hash + Objects.hashCode(organizer);
|
||||
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(nameOfConference, other.getNameOfConference())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(placeOfConference, other.getPlaceOfConference())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(startDate,
|
||||
other.getStartDate())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(endDate, other.getEndDate())) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(organizer, other.getOrganizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
|
||||
return obj instanceof Proceedings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
|
||||
return super.toString(String.format("nameOfConference = \"%s\", "
|
||||
+ "placeOfConference = \"%s\", "
|
||||
+ "startDate = \"%s\", "
|
||||
+ "endDate = \"%s\", "
|
||||
+ "organizer = %s, "
|
||||
+ "papers = %s%s",
|
||||
nameOfConference,
|
||||
placeOfConference,
|
||||
Objects.toString(startDate),
|
||||
Objects.toString(endDate),
|
||||
Objects.toString(organizer),
|
||||
Objects.toString(papers),
|
||||
data)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue