[
https://issues.apache.org/jira/browse/UNOMI-508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jonathan Sinovassin resolved UNOMI-508.
---------------------------------------
Resolution: Fixed
> 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
> Priority: Major
> Fix For: 2.0.0, 1.6.0
>
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> 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.20.1#820001)