Class ScriptAction
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.migration.action.impl.ScriptAction
- All Implemented Interfaces:
Action
,LogEnabled
,Serviceable
SQL action : A script will be executed
-
Field Summary
Modifier and TypeFieldDescriptionprotected ScriptHandler
Script Handlerprotected SourceResolver
Source resolver -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
doAction
(ActionData actionData) Run the action with the provided datagenerateActionData
(String id, Version version, String comment, String from, String type, String pluginName, Configuration configuration, boolean restartRequired) Generate anActionData
linked to this kind of actionprotected String
getScript
(ScriptActionData scriptActionData) Get the content of the script from the actionDatavoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_sourceResolver
Source resolver -
_scriptHandler
Script Handler
-
-
Constructor Details
-
ScriptAction
public ScriptAction()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
doAction
Description copied from interface:Action
Run the action with the provided data- Specified by:
doAction
in interfaceAction
- Parameters:
actionData
- data needed to do the action (contains the version)- Throws:
MigrationException
- Something went wrong
-
getScript
Get the content of the script from the actionData- Parameters:
scriptActionData
- actionData containing info about the upgrade- Returns:
- The script as a String (either from the config or from a file to parse)
- Throws:
MigrationException
- Something went wrong
-
generateActionData
public ActionData generateActionData(String id, Version version, String comment, String from, String type, String pluginName, Configuration configuration, boolean restartRequired) throws MigrationException, ConfigurationException Description copied from interface:Action
Generate anActionData
linked to this kind of action- Specified by:
generateActionData
in interfaceAction
- Parameters:
id
- id of the actionversion
- original versioncomment
- Comment about this actionfrom
- if this actions is the equivalent of multiple actions, this is the version id just before the 1st action impacted by this actiontype
- type of actionpluginName
- name of the pluginconfiguration
- configuration of the actionrestartRequired
- true if a restart is required after the action- Returns:
- a
ActionData
for this type of action - Throws:
MigrationException
- Something went wrongConfigurationException
- Configuration malformed
-