/* * © 2010 GX creative online development B.V. All rights reserved. The contents of this work is confidential. * It is prohibited to copy, duplicate or alter this work in any manner without the express prior written * approval of GX creative online development B.V. */ package com.gxwebmanager.solutions.productmaintenancepanel.service; import nl.gx.webmanager.services.event.EntityEvent; import com.gxwebmanager.solutions.productmaintenancepanel.vo.ValueObject; /** * This class is used to publish CRUD events on the ValueObjects. * * @author markvc */ public class ValueObjectEvent implements EntityEvent { // Holds the value object for which the event has occured private ValueObject myValueObject; // Holds the event type of the event private final Type myEventType; // Holds the action that was or is about to be performed private final String myEventAction; // Holds the scope of the event, used by the subscribers private Class myScope = ValueObject.class; // Holds the object the event was published from private final Object mySource; /** * Constructor for the event * * @param eventType The event type which can be either PRE or POST. * @param valueObject The value object which is the result of the performed action. * @param eventAction Action performed on the media item. Typically one defined by the * EntityEvent interface. * @param source The source object on which the event was published. * @param scope Scope of the event. */ public ValueObjectEvent(Type eventType, ValueObject valueObject, String eventAction, Object source, Class scope) { myEventType = eventType; myEventAction = eventAction; mySource = source; myValueObject = valueObject; myScope = scope; } /** * Constructor for the event * * @param eventType The event type which can be either PRE or POST. * @param valueObject The value object which is the result of the performed action. * @param eventAction Action performed on the media item. Typically one defined by the * EntityEvent interface. * @param source The source object on which the event was published. */ public ValueObjectEvent(Type eventType, ValueObject valueObject, String eventAction, Object source) { this(eventType, valueObject, eventAction, source, valueObject.getClass()); } /** * {@inheritDoc} */ public Object getEntity() { return myValueObject; } /** * {@inheritDoc} */ public String getEventAction() { return myEventAction; } /** * {@inheritDoc} */ public Type getEventType() { return myEventType; } /** * {@inheritDoc} */ public Class getScope() { return myScope; } /** * {@inheritDoc} */ public Object getSource() { return mySource; } }