LineItemEvent.java

package com.tradecloud.domain.event;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

@Entity
@Table(name = "lineitemevent")
@Access(AccessType.FIELD)
@XmlAccessorType(XmlAccessType.FIELD)
public class LineItemEvent extends Event implements EnumTypedEvent<LineItemEventType> {

    /**
     * UID.
     */
    private static final long serialVersionUID = 1L;

    /**
     * Event type.
     */
    @Enumerated(EnumType.STRING)
    private LineItemEventType eventType;

    public LineItemEvent() {

    }

    public LineItemEvent(LineItemEventType eventTypeParam, String username) {
        super(username);
        this.eventType = eventTypeParam;
    }

    @Override
    public LineItemEventType getEventType() {
        return eventType;
    }

    @Override
    public void setEventType(LineItemEventType eventTypeParam) {
        this.eventType = eventTypeParam;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((eventType == null) ? 0 : eventType.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        LineItemEvent other = (LineItemEvent) obj;
        if (eventType != other.eventType)
            return false;
        return true;
    }

}