Publisher.java 1.79 KB
package org.legrog.entities;

import javax.persistence.*;
import java.util.Set;

/**
 * Persisted entity for a publisher
 * Has versions of type PublisherVersion
 * May have a validated PublisherVersion among those
 * Has access to PublisherAction related to it
 */
@Entity
public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
// TODO L'éventuel usage de Linkable reste à confirmer https://tree.taiga.io/project/jr-utily-grog-v3/us/48
// TODO Attention, en v2 Linkable implique Traceable (journalisable) qui devrait aussi être évalué
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer publisherId;

    @OneToOne
    private PublisherVersion validatedVersion;

    @OneToMany(mappedBy = "publisher", fetch = FetchType.EAGER)
    private Set<PublisherVersion> versions;

    @OneToMany(mappedBy = "publisher", fetch = FetchType.EAGER)
    private Set<PublisherAction> actions;

    public Integer getPublisherId() {
        return publisherId;
    }

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

    public PublisherVersion getValidatedVersion() {
        return validatedVersion;
    }

    public void setValidatedVersion(PublisherVersion activeVersion) {
        this.validatedVersion = activeVersion;
    }

    public Set<PublisherVersion> getVersions() {
        return versions;
    }

    public void setVersions(Set<PublisherVersion> versions) {
        this.versions = versions;
    }

    public Set<PublisherAction> getActions() {
        return actions;
    }

    public void setActions(Set<PublisherAction> actions) {
        this.actions = actions;
    }

    @Override
    public String toString() {
        return "PUBLISHER_ID = " + publisherId + ", Validated Version = " + validatedVersion;
    }
}