db.NewsSource Maven / Gradle / Ivy
package db;
import java.util.HashSet;
import java.util.Objects;
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 12/04/17.
*/
@NodeEntity
public class NewsSource extends GraphEntity implements Comparable {
private static final long serialVersionUID = -7869974236968731845L;
@GraphId
private String sourceId;
private String name;
private String description;
private String url;
private String category;
private String language;
private String country;
@Relationship(type = "PUBLISHED", direction = Relationship.OUTGOING)
private Set correspondents;
private String logoUrl;
public NewsSource() {
correspondents = new HashSet<>();
}
public NewsSource(String sourceId, String name, String description, String url, String category, String language, String country) {
this();
this.sourceId = sourceId;
this.name = name;
this.description = description;
this.url = url;
this.category = category;
this.language = language;
setCountry(country);
}
public String getSourceId() {
return sourceId;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getUrl() {
return url;
}
public String getCategory() {
return category;
}
public String getLanguage() {
return language;
}
public String getCountry() {
return country;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId;
}
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setUrl(String url) {
this.url = url;
}
public void setCategory(String category) {
this.category = category;
}
public void setLanguage(String language) {
this.language = language;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public String toString() {
return name;
}
@Override
public int compareTo(NewsSource o) {
return sourceId.compareTo(o.getSourceId());
}
public void addCorrespondent(NewsAuthor author) {
correspondents.add(author);
}
public Set getCorrespondents() {
return correspondents;
}
public void setCorrespondents(Set correspondents) {
this.correspondents = correspondents;
}
@Override
public int hashCode() {
int hash = 7;
hash = 29 * hash + Objects.hashCode(this.sourceId);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final NewsSource other = (NewsSource) obj;
if (!Objects.equals(this.sourceId, other.sourceId)) {
return false;
}
return true;
}
@Override
public String getPropertyName() {
return "sourceId";
}
@Override
public String getPropertyValue() {
return sourceId;
}
@Override
public boolean hasUrl() {
return url != null;
}
public void setLogoUrl(String logoUrl) {
this.logoUrl = logoUrl;
}
public String getLogoUrl() {
return logoUrl;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy