InvoiceExposureEvent.java

package com.tradecloud.domain.model.events;

import com.tradecloud.domain.document.DocumentType;
import org.apache.commons.lang3.builder.ToStringBuilder;

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

@Entity
@Table(name = "InvoiceExposureEvent")
@Access(AccessType.FIELD)
@NamedQuery(query = " select ce from InvoiceExposureEvent ce where ce.consumerTag = :consumerTag", name = "findAllInvoiceExposureEventtForUser")
public class InvoiceExposureEvent extends Event {

    private static final long serialVersionUID = 1L;

    public static enum InvoiceDealExposureType {
        FINALISED, SIGNED_OFF, DELETED;
    }

    @Enumerated(value = EnumType.STRING)
    private DocumentType documentType;
    private Long invoiceId;
    private String shipmentReference;

    public InvoiceExposureEvent() {

    }

    public InvoiceExposureEvent(String reference, Date timestamp, String eventType, String consumerTag, DocumentType documentType,
                                Long invoiceId, String shipmentReference) {
        super(reference, timestamp, null, eventType, consumerTag);
        this.documentType = documentType;
        this.invoiceId = invoiceId;
        this.shipmentReference = shipmentReference;
    }

    @Override
    public Class getInstanceClass() {
        return InvoiceExposureEvent.class;
    }

    public DocumentType getDocumentType() {
        return documentType;
    }

    public Long getInvoiceId() {
        return invoiceId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("documentType", documentType)
                .append("invoiceId", invoiceId)
                .append("eventType", eventType)
                .toString();
    }

    public String getShipmentReference() {
        return shipmentReference;
    }
}