Jonathan Sinovassin created UNOMI-508:
-----------------------------------------
Summary: Add groovy action endpoint
Key: UNOMI-508
URL: https://issues.apache.org/jira/browse/UNOMI-508
Project: Apache Unomi
Issue Type: New Feature
Reporter: Jonathan Sinovassin
h3. Needs
We need to create actions from groovy script.
h3. Scope
* Creation of an index to store the script containing the action to be
executed.
* Creation of an endpoint which allows to add/remove actions from a groovy
file.
* Creation of action type from annotations present in the groovy file
* Integrations tests.
* Allow to deploy script on deployment of a Unomi bundle
Example of a groovy script to handle
{code:java}
import org.apache.unomi.api.services.EventService
import org.apache.unomi.groovy.actions.annotations.Action
import org.apache.unomi.groovy.actions.annotations.Parameter
import java.util.logging.Logger
@Action(id = "testGroovyAction",
description = "A test Groovy Action",
actionExecutor = "groovy:MyTest",
systemTags = ["tag1", "tag2"],
hidden = false,
parameters = [
@Parameter(id = "propertyName", type = "string", multivalued =
false),
@Parameter(id = "setPropertyValueBoolean", type = "boolean",
multivalued = false)
])
class MyAction {
Logger logger = Logger.getLogger("")
String execute(action, event) {
logger.info("Groovy action for event type: "+ event.getEventType())
EventService.NO_CHANGE
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)