MetadataActionBase | R Documentation |
Base class for metadata actions
Base class for metadata actions
This class is the base for metadata actions.
Any action will be executed by calling the method execute_read
in the read direction, and
execute_write
in the write direction. Actions are parametrized with the settings
field;
the settings
are set by merging the class-specific base_settings
with the partial or full
settings
passed on construction (i.e. base settings are overridden by instance settings).
Instance settings are composed from base settings (which override the base settings
and optional params
"sub-settings". The action is executed once for every
params
sub-settings, which are applied on top of the instance base settings.
This sounds complicated, but is quite simple. Examples:
action: mapping explicit: TRUE params: - {source: FIELD1, target: field1} - {source: FIELD2, target: field2}
Here, FIELD1
is mapped to field1
, FIELD2
is mapped to field2
, and
explicit = TRUE
is valid for both entries. Specific entries may override instance settings:
action: mapping explicit: TRUE params: - {source: FIELD1, target: field1} - {source: FIELD2, target: field2, explicit: FALSE} - {source: FIELD3, target: field3}
Here, explicit = TRUE
is valid for the first and third entries.
If no params
are given, a single action is executed using instance settings:
action: mapping explicit: TRUE source: field1 target: FIELD1
Note that explicit=TRUE
overrides the base_settings
value of explicit=FALSE
. Not setting
explicit
at all would result in explicit=FALSE
behaviour.
Implementing classes should
specify appropriate base_settings
implement process_read
and process_write
, which process a single action
(i.e. one params
entry). The action obtains the data
input (an MsBackendMapping
)
and a params
, which is the merged (sic!) version of parameters. I.e., it contains
the base_settings
overridden by the settings
overridden by the params
entry.
Both return the modified data
(i.e. an MsBackendMapping
object) again.
name
Action name
base_settings
Class base settings
settings
Instance settings
log_level()
Log a message with specified level
MetadataActionBase$log_level(level, message)
level
Log level, as specified in package ???
message
Message to log
new()
Constructor
MetadataActionBase$new(settings)
settings
List of class-specific settings which override the base settings.
execute_read()
Execution wrapper: read
MetadataActionBase$execute_read(backend)
backend
MsBackendMapping
to execute the metadata mapping step on
execute
is the wrapper around process
.
If there are params
, i.e. multiple steps are executed, execute
loops through them.
(The basic settings are updated with params, then the action is run.)
If there are no params, only a single step is executed (with the "basic" settings.)
process_read()
Action implementation
MetadataActionBase$process_read(data, params)
data
MsBackendMapping
to execute the metadata mapping step on
params
List of parameters for a single action (one params
entry fully merged.)
process
executes a transformation method and returns the transformed backend.
Here is where the implementation goes.
execute_write()
Execution wrapper: write
MetadataActionBase$execute_write(backend)
backend
MsBackendMapping
to execute the metadata mapping step on
execute
is the wrapper around process
.
If there are params
, i.e. multiple steps are executed, execute
loops through them.
(The basic settings are updated with params, then the action is run.)
If there are no params, only a single step is executed (with the "basic" settings.)
process_write()
Action implementation
MetadataActionBase$process_write(data, params)
data
MsBackendMapping
to execute the metadata mapping step on
params
List of parameters for a single action (one params
entry fully merged.)
process
executes a transformation method and returns the transformed backend.
Here is where the implementation goes.
set_settings()
Set settings and verify that they are OK
Any action may/should check settings for consistency
MetadataActionBase$set_settings(settings)
settings
List of settings, subclass-specific
merge_settings()
Update settings with step-specific entry
MetadataActionBase$merge_settings(param_settings)
param_settings
A params
entry from settings
, i.e. a single action step.
clone()
The objects of this class are cloneable with this method.
MetadataActionBase$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.