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

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

/**
 * Pesisted entity for actions made on PublisherVersion
 */
@Entity
public class PublisherAction {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer publisherActionId;

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

    private Timestamp publisherActionDatetime;

    // Simplified access instead of going through PublisherVersion
    @ManyToOne
    private Publisher publisher;

    public void setPublisherActionActor(Account publisherActionActor) {
        this.publisherActionActor = publisherActionActor;
    }

    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 getPublisherActionActor() {
        return publisherActionActor;
    }

    public PublisherVersion getPublisherVersion() {
        return publisherVersion;
    }

    public Timestamp getPublisherActionDatetime() {
        return publisherActionDatetime;
    }

    public Publisher getPublisher() {
        return publisher;
    }

    public Integer getPublisherActionId() {
        return publisherActionId;
    }

    public void setPublisherActionId(Integer publisherActionId) {
        this.publisherActionId = publisherActionId;
    }

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