com.serotonin.m2m2.module
Class EventTypeDefinition

java.lang.Object
  extended by com.serotonin.m2m2.module.ModuleElementDefinition
      extended by com.serotonin.m2m2.module.EventTypeDefinition

public abstract class EventTypeDefinition
extends ModuleElementDefinition

Used for creating custom event types.


Constructor Summary
EventTypeDefinition()
           
 
Method Summary
abstract  com.serotonin.m2m2.rt.event.type.EventType createEventType(java.lang.String subtype, int ref1, int ref2)
          Create an instance of the event type using the given parameters.
abstract  java.lang.String getDescriptionKey()
          The reference key to the description of the event type.
abstract  java.lang.String getEventListLink(java.lang.String subtype, int ref1, int ref2, com.serotonin.m2m2.i18n.Translations translations)
          Optional.
abstract  java.lang.Class<? extends com.serotonin.m2m2.rt.event.type.EventType> getEventTypeClass()
          The class that represents the event type.
abstract  java.util.List<com.serotonin.m2m2.vo.event.EventTypeVO> getEventTypeVOs()
          Returns a list of EventTypeVOs representing the list of events to which handlers can be added/edited.
abstract  boolean getHandlersRequireAdmin()
          Whether admin permission is required to create and edit event handlers for this even type.
abstract  java.lang.String getIconPath()
          Optional.
abstract  com.serotonin.m2m2.i18n.TranslatableMessage getSourceDisabledMessage()
          Optional.
abstract  java.lang.String getTypeName()
          The type name of the system event.
 
Methods inherited from class com.serotonin.m2m2.module.ModuleElementDefinition
getModule, initialize, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventTypeDefinition

public EventTypeDefinition()
Method Detail

getTypeName

public abstract java.lang.String getTypeName()
The type name of the system event. Must be unique within the instance, and less than or equal to 30 characters in length.


getEventTypeClass

public abstract java.lang.Class<? extends com.serotonin.m2m2.rt.event.type.EventType> getEventTypeClass()
The class that represents the event type.

Returns:
the event type class

createEventType

public abstract com.serotonin.m2m2.rt.event.type.EventType createEventType(java.lang.String subtype,
                                                                           int ref1,
                                                                           int ref2)
Create an instance of the event type using the given parameters.

Parameters:
subtype - the subtype of the event. May be null
ref1 - the first reference id. Event types define how this number is used
ref2 - the second reference id. Event types define how this number is used
Returns:
the new EventType object.

getHandlersRequireAdmin

public abstract boolean getHandlersRequireAdmin()
Whether admin permission is required to create and edit event handlers for this even type.

Returns:
true if admin permission is required.

getEventTypeVOs

public abstract java.util.List<com.serotonin.m2m2.vo.event.EventTypeVO> getEventTypeVOs()
Returns a list of EventTypeVOs representing the list of events to which handlers can be added/edited.

Returns:
the list of event type VO objects.

getIconPath

public abstract java.lang.String getIconPath()
Optional. The module relative path to an icon that represents the event type.

Returns:
the path to the icon, or null if none.

getDescriptionKey

public abstract java.lang.String getDescriptionKey()
The reference key to the description of the event type.

Returns:
the description key

getEventListLink

public abstract java.lang.String getEventListLink(java.lang.String subtype,
                                                  int ref1,
                                                  int ref2,
                                                  com.serotonin.m2m2.i18n.Translations translations)
Optional. For use on the event list page, this provides a link from an event instance back to the object that raised it.

Parameters:
subtype - the event subtype
ref1 - the first reference id
ref2 - the second reference id
translations - the translations object for the current user
Returns:
the link to display, or null if none

getSourceDisabledMessage

public abstract com.serotonin.m2m2.i18n.TranslatableMessage getSourceDisabledMessage()
Optional. The message to display if the object that raised an event instance is disabled, causing the event to be deactivated.

Returns:
the translatable message instance, or null.