IndexedPublisher.java 1.57 KB
package org.legrog.entities;
import org.apache.solr.client.solrj.beans.Field;
import javax.persistence.Id;
import javax.persistence.Lob;

/**
 * Simplified class for indexing and searching validated publishers: content from PublisherVersion with id from Publisher
 */
public class IndexedPublisher {
    @Id
    @Field
    private Integer publisherId;
    @Field
    private String publisherName;
    @Lob
    @Field
    private String publisherHistory;

    /**
     * Extracts data needed for indexing from Publisher and its validated PublisherVersion
     *
     * @param publisher Publisher we want to be indexed
     */
    public IndexedPublisher(Publisher publisher) {
        PublisherVersion publisherVersion = publisher.getValidatedVersion();
        this.publisherId = publisher.getPublisherId();
        this.publisherName = publisherVersion.getPublisherName();
        this.publisherHistory = publisherVersion.getPublisherHistory();
    }

    public IndexedPublisher() {
        //no args constructor to make it proxyable
    }

    public Integer getPublisherId() {
        return publisherId;
    }

    public String getPublisherName() {
        return publisherName;
    }

    public String getPublisherHistory() {
        return publisherHistory;
    }

    public void setPublisherId(Integer publisherId) {
        this.publisherId = publisherId;
    }

    public void setPublisherName(String publisherName) {
        this.publisherName = publisherName;
    }

    public void setPublisherHistory(String publisherHistory) {
        this.publisherHistory = publisherHistory;
    }
}