Class MailFlagHandler
java.lang.Object
de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
de.aristaflow.adept2.core.eventmanager.mailevents.MailFlagHandler
- All Implemented Interfaces:
EventHandler
@ConfigurationDescription(properties={@Property(name="IsCritical",type=BOOLEAN,defaultValue="true",description="Whether the event handler is critical and problems handling the event should abort all handling of the current event."),,,,,,,,,,,,,,,,,})
public class MailFlagHandler
extends AbstractEventHandler
An event handler for setting flags and/or moving messages from mail events.
This allows for flagging or otherwise change handled messages so that they
do not get handled again.
This handler considers a changed message as consumed.
This handler considers a changed message as consumed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether to change the answered flag of the messages from mail events.protected final booleanWhether to change the deleted flag of the messages from mail events.protected final booleanWhether to change the draft flag of the messages from mail events.protected final booleanWhether to change the flagged flag of the messages from mail events.protected final booleanWhether to change the recent flag of the messages from mail events.protected final booleanWhether to change the seen flag of the messages from mail events.protected final booleanWhether to change the user flag of the messages from mail events.static final StringConfiguration key for whether to change the answered flag of the messages from mail events.static final StringConfiguration key for whether to change the deleted flag of the messages from mail events.static final StringConfiguration key for whether to change the draft flag of the messages from mail events.static final StringConfiguration key for whether to change the flagged flag of the messages from mail events.static final StringConfiguration key for whether to change the recent flag of the messages from mail events.static final StringConfiguration key for whether to change the seen flag of the messages from mail events.static final StringConfiguration key for whether to change the user flag of the messages from mail events.static final StringConfiguration key for whether the folder of messages from mail events should be expunged.static final StringConfiguration key for whether this handler should also handle (set flags, move, expunge) messages of which the corresponding mail event has been consumed.protected static final StringConfiguration key: Whether the event handler is critical and problems handling the event should abort all handling of the current event.static final StringConfiguration key for how to set the answered flag of messages from mail events.static final StringConfiguration key for how to set the deleted flag of messages from mail events.static final StringConfiguration key for how to set the draft flag of messages from mail events.static final StringConfiguration key for how to set the flagged flag of messages from mail events.static final StringConfiguration key for how to set the recent flag of messages from mail events.static final StringConfiguration key for how to set the seen flag of messages from mail events.static final StringConfiguration key for how to set the user flag of messages from mail events.static final StringConfiguration key for the name of the target folder in case the messages of mail events should be moved.protected final booleanWhether the folder of messages from mail events should be expunged.protected final StringThe flags represented as string.protected final booleanWhether this handler should also handle (set flags, move, expunge) messages of which the corresponding mail event has been consumed.protected final booleanHow to set the answered flag of messages from mail events.protected final booleanHow to set the deleted flag of messages from mail events.protected final booleanHow to set the draft flag of messages from mail events.protected final booleanHow to set the flagged flag of messages from mail events.protected final booleanHow to set the recent flag of messages from mail events.protected final booleanHow to set the seen flag of messages from mail events.protected final booleanHow to set the user flag of messages from mail events.protected final StringThe name of the target folder in case the messages of mail events should be moved.Fields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
consuming, critical, exclusive, id, interruptible, logger -
Constructor Summary
ConstructorsConstructorDescriptionMailFlagHandler(Configuration conf, AbstractEventManager eventManager, Registry registry) Default constructor for a plugin of anEventManagercalled by a service registry.MailFlagHandler(Configuration conf, EventManager eventManager, Registry registry) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleEvent(Event eve, boolean consumed) This method actually processes an event.Methods inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
getID, isConsuming, isCritical, isExclusive, isInterruptible
-
Field Details
-
CONF_IS_CRITICAL
Configuration key: Whether the event handler is critical and problems handling the event should abort all handling of the current event.- See Also:
-
CONF_HANDLE_CONSUMED
Configuration key for whether this handler should also handle (set flags, move, expunge) messages of which the corresponding mail event has been consumed.- See Also:
-
HANDLE_CONSUMED
protected final boolean HANDLE_CONSUMEDWhether this handler should also handle (set flags, move, expunge) messages of which the corresponding mail event has been consumed. -
CONF_CHANGE_FLAG_ANSWERED
Configuration key for whether to change the answered flag of the messages from mail events.- See Also:
-
CONF_SET_FLAG_ANSWERED
Configuration key for how to set the answered flag of messages from mail events. This only applies if the corresponding flag should be changed.- See Also:
-
CHANGE_FLAG_ANSWERED
protected final boolean CHANGE_FLAG_ANSWEREDWhether to change the answered flag of the messages from mail events. -
SET_FLAG_ANSWERED
protected final boolean SET_FLAG_ANSWEREDHow to set the answered flag of messages from mail events. This only applies if the corresponding flag should be changed. -
CONF_CHANGE_FLAG_DELETED
Configuration key for whether to change the deleted flag of the messages from mail events.- See Also:
-
CONF_SET_FLAG_DELETED
Configuration key for how to set the deleted flag of messages from mail events. This only applies if the corresponding flag should be changed.- See Also:
-
CHANGE_FLAG_DELETED
protected final boolean CHANGE_FLAG_DELETEDWhether to change the deleted flag of the messages from mail events. -
SET_FLAG_DELETED
protected final boolean SET_FLAG_DELETEDHow to set the deleted flag of messages from mail events. This only applies if the corresponding flag should be changed. -
CONF_CHANGE_FLAG_DRAFT
Configuration key for whether to change the draft flag of the messages from mail events.- See Also:
-
CONF_SET_FLAG_DRAFT
Configuration key for how to set the draft flag of messages from mail events. This only applies if the corresponding flag should be changed.- See Also:
-
CHANGE_FLAG_DRAFT
protected final boolean CHANGE_FLAG_DRAFTWhether to change the draft flag of the messages from mail events. -
SET_FLAG_DRAFT
protected final boolean SET_FLAG_DRAFTHow to set the draft flag of messages from mail events. This only applies if the corresponding flag should be changed. -
CONF_CHANGE_FLAG_FLAGGED
Configuration key for whether to change the flagged flag of the messages from mail events.- See Also:
-
CONF_SET_FLAG_FLAGGED
Configuration key for how to set the flagged flag of messages from mail events. This only applies if the corresponding flag should be changed.- See Also:
-
CHANGE_FLAG_FLAGGED
protected final boolean CHANGE_FLAG_FLAGGEDWhether to change the flagged flag of the messages from mail events. -
SET_FLAG_FLAGGED
protected final boolean SET_FLAG_FLAGGEDHow to set the flagged flag of messages from mail events. This only applies if the corresponding flag should be changed. -
CONF_CHANGE_FLAG_RECENT
Configuration key for whether to change the recent flag of the messages from mail events.- See Also:
-
CONF_SET_FLAG_RECENT
Configuration key for how to set the recent flag of messages from mail events. This only applies if the corresponding flag should be changed.- See Also:
-
CHANGE_FLAG_RECENT
protected final boolean CHANGE_FLAG_RECENTWhether to change the recent flag of the messages from mail events. -
SET_FLAG_RECENT
protected final boolean SET_FLAG_RECENTHow to set the recent flag of messages from mail events. This only applies if the corresponding flag should be changed. -
CONF_CHANGE_FLAG_SEEN
Configuration key for whether to change the seen flag of the messages from mail events.- See Also:
-
CONF_SET_FLAG_SEEN
Configuration key for how to set the seen flag of messages from mail events. This only applies if the corresponding flag should be changed.- See Also:
-
CHANGE_FLAG_SEEN
protected final boolean CHANGE_FLAG_SEENWhether to change the seen flag of the messages from mail events. -
SET_FLAG_SEEN
protected final boolean SET_FLAG_SEENHow to set the seen flag of messages from mail events. This only applies if the corresponding flag should be changed. -
CONF_CHANGE_FLAG_USER
Configuration key for whether to change the user flag of the messages from mail events.- See Also:
-
CONF_SET_FLAG_USER
Configuration key for how to set the user flag of messages from mail events. This only applies if the corresponding flag should be changed.- See Also:
-
CHANGE_FLAG_USER
protected final boolean CHANGE_FLAG_USERWhether to change the user flag of the messages from mail events. -
SET_FLAG_USER
protected final boolean SET_FLAG_USERHow to set the user flag of messages from mail events. This only applies if the corresponding flag should be changed. -
flagString
The flags represented as string. -
CONF_TARGET_FOLDER
Configuration key for the name of the target folder in case the messages of mail events should be moved.- See Also:
-
TARGET_FOLDER
The name of the target folder in case the messages of mail events should be moved. -
CONF_EXPUNGE
Configuration key for whether the folder of messages from mail events should be expunged. This really deletes messages that have deleted flag set. Therefore if you want do delete a handled message finally, set the deleted flag and expunge the folder.- See Also:
-
EXPUNGE
protected final boolean EXPUNGEWhether the folder of messages from mail events should be expunged. This really deletes messages that have deleted flag set. Therefore if you want do delete a handled message finally, set the deleted flag and expunge the folder.
-
-
Constructor Details
-
MailFlagHandler
@Deprecated(since="16.2.0", forRemoval=true) public MailFlagHandler(Configuration conf, EventManager eventManager, Registry registry) Deprecated, for removal: This API element is subject to removal in a future version.Default constructor for a plugin of anEventManagercalled by a service registry. This constructor just reads the configuration values.- Parameters:
conf- The configuration as provided from the registry.eventManager- The event manager this event handler is a plugin of.registry- The registry of this plugin.
-
MailFlagHandler
Default constructor for a plugin of anEventManagercalled by a service registry. This constructor just reads the configuration values.- Parameters:
conf- The configuration as provided from the registry.eventManager- The event manager this event handler is a plugin of.registry- The registry of this plugin.
-
-
Method Details
-
handleEvent
Description copied from interface:EventHandlerThis method actually processes an event. What is done depends on the implementation of the event handler. Some restrictions may apply depending on the produced event. Only events will be received for which the event handler is registered. However, to improve robustness, an event handler should check the event before processing. If it cannot handle the provided event, this method should just return.
Event handling is usually synchronously, that is, this method will only be executed by one thread at a time. If another event of the same type occurs while still handling the previous event, the second event will be suspended until the previous event has been completely handled. There is no need to start a separate thread while handling to improve performance. But it is not forbidden to do so. Handling that takes place in a new thread is not exclusive any more and therefore must not consume the event!- Parameters:
eve- The event that occurred and for which this event handler is registered.consumed- Whether the event has been consumed by a previous event handler.- Returns:
- Whether the event has been consumed (that is changed) while
handling it. If the event has been consumed before the current
handing, it will have to remain consumed (implementations must
return
true). - Throws:
EventHandlingException- If there have been problems handling the event, anEventHandlingExceptionmay be thrown. If this is critical, the event handling for the current event will stop. If it is non-critical, other event handlers will also get the event for handling it.
If event handling fails, the corresponding event handler needs to roll back its changes, especially a consuming event handler.
-
MailFlagHandler(Configuration, AbstractEventManager, Registry)instead.