PublisherAction.java 1.99 KB
package org.legrog.entities;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Classe des actions sur des (versions d') éditeurs.
 */
@Entity
public class PublisherAction {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int publisherActionId;

    @Enumerated
    private ActionType actionType;
    @ManyToOne
    private Account publisherActionAuthor;
    @ManyToOne
    private PublisherVersion publisherVersion;

    private Timestamp publisherActionDatetime;

    // Accès simplifié plutôt que de passer par publisherVersion
    @ManyToOne
    private Publisher publisher;

    public void setPublisherActionAuthor(Account publisherActionAuthor) {
        this.publisherActionAuthor = publisherActionAuthor;
    }

    public void setPublisherActionDatetime(Timestamp publisherActionDatetime) {
        this.publisherActionDatetime = publisherActionDatetime;
    }

    public void setActionType(ActionType actionType) {
        this.actionType = actionType;
    }

    public void setPublisherVersion(PublisherVersion publisherVersion) {
        this.publisherVersion = publisherVersion;
    }

    public void setPublisher(Publisher publisher) {
        this.publisher = publisher;
    }

    public ActionType getActionType() {
        return actionType;
    }

    public Account getPublisherActionAuthor() {
        return publisherActionAuthor;
    }

    public PublisherVersion getPublisherVersion() {
        return publisherVersion;
    }

    public Timestamp getPublisherActionDatetime() {
        return publisherActionDatetime;
    }

    public Publisher getPublisher() {
        return publisher;
    }

    @Override
    public String toString() {
        return "publisherActionId = " + publisherActionId + ", actionType = " + actionType +
                ", publisherActionAuthor = " + publisherActionAuthor + ", publisherVersion = " + publisherVersion +
                ", publisherActionDatetime = " + publisherActionDatetime + ", publisher = " + publisher;
    }
}