db.Book Maven / Gradle / Ivy
package db;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;
/**
* Created by zua on 13/04/17.
*/
@NodeEntity
public class Book extends GraphEntity implements Comparable{
private static final long serialVersionUID = -5488934119305207913L;
@GraphId
private String advertisementUrl;
private String ISBN;
private String title;
private String description;
//@DateLong
private Date publishedAt;
private String publisher;
private String language;
private String country;
private Set categories;
@Relationship(type = "AUTHORED", direction = Relationship.INCOMING)
private Set authors;
public Book(){
authors = new HashSet<>();
categories = new HashSet<>();
}
public String getISBN() {
return ISBN;
}
public void setISBN(String ISBN) {
this.ISBN = ISBN;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getPublishedAt() {
return publishedAt;
}
public void setPublishedAt(Date publishedAt) {
this.publishedAt = publishedAt;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public Set getCategories() {
return categories;
}
public void setCategories(Set categories) {
this.categories = categories;
}
public Set getAuthors() {
return authors;
}
public void setAuthors(Set authors) {
this.authors = authors;
}
@Override
public String toString() {
if(title == null) {
return "";
}
return title;
}
@Override
public int compareTo(Book o) {
if(this.ISBN != null && o.ISBN != null) {
return this.ISBN.compareTo(o.ISBN);
}
else if(this.ISBN == null && o.ISBN!= null) {
return 1;
}
else if(this.ISBN != null && o.ISBN == null) {
return -1;
}
else {
return 0;
}
}
@Override
public String getPropertyName() {
return "ISBN";
}
@Override
public String getPropertyValue() {
return ISBN;
}
@Override
public boolean hasUrl() {
return false;
}
public void addCategory(String category) {
categories.add(category);
}
@Override
public String getUrl() {
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy