Class ImportFromFileActivityPreset
- Namespace
- Dynamicweb.DataIntegration.Integration.DataImport
- Assembly
- Dynamicweb.DataIntegration.dll
public abstract class ImportFromFileActivityPreset : BaseActivityPreset
- Inheritance
-
ImportFromFileActivityPreset
- Inherited Members
Properties
ConfigurationFile
public string? ConfigurationFile { get; set; }
Property Value
ConfigurationJob
protected Job? ConfigurationJob { get; }
Property Value
DataImportPreset
Gets a value indicating whether the preset is a simplified data import preset. When true, the
administration UI uses the data import editing experience (file upload, sheet selection, preview) instead of
the generic preset installation screen. The default is false.
public override bool DataImportPreset { get; }
Property Value
DestinationColumnPefixes
protected virtual string[] DestinationColumnPefixes { get; }
Property Value
- string[]
DestinationId
public string? DestinationId { get; set; }
Property Value
DestinationProvider
Gets or sets the destination provider add-in the preset is configured with. When set, the installation UI
renders the provider's add-in parameters as an extra field group and writes the user's values back to the
instance before ValidateSettings() and Install(out string) run. The default is
null.
public override ConfigurableAddIn? DestinationProvider { get; set; }
Property Value
DestinationProviderName
protected abstract string DestinationProviderName { get; }
Property Value
DestinationTableName
protected abstract string DestinationTableName { get; }
Property Value
KeyColumns
[AddInParameter("KeyColumns")]
[AddInLabel("Import keys")]
[AddInParameterEditor(typeof(SelectionBoxParameterEditor), "leftheader=Excluded;rightheader=Included;")]
[AddInParameterOrder(20)]
public string? KeyColumns { get; set; }
Property Value
NeedsPreview
Gets a value indicating whether the preset can supply a data preview. When true, the preset editing
screens call GetPreviewListData(out List<Dictionary<string, object>>, out IEnumerable<string>, out string) and render the returned rows as a preview table.
The default is false.
public override bool NeedsPreview { get; }
Property Value
SelectedTable
[AddInParameterGroup("Source file")]
[AddInParameter("SelectedTable")]
[AddInLabel("Sheet")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "reloadOnChange=true", Explanation = "Select the sheet to import from the source file.")]
[AddInParameterOrder(10)]
public string? SelectedTable { get; set; }
Property Value
SourceFile
public string? SourceFile { get; set; }
Property Value
SourceProvider
Gets or sets the source provider add-in the preset is configured with. When set, the installation UI renders
the provider's add-in parameters as an extra field group and writes the user's values back to the instance
before ValidateSettings() and Install(out string) run. The default is null.
public override ConfigurableAddIn? SourceProvider { get; set; }
Property Value
Methods
GetDataImportMapping(Job)
protected virtual Mapping? GetDataImportMapping(Job job)
Parameters
jobJob
Returns
GetDefaultKeyColumns()
protected virtual string? GetDefaultKeyColumns()
Returns
GetParameterOptions(string)
public virtual IEnumerable<ParameterOption> GetParameterOptions(string parameterName)
Parameters
parameterNamestring
Returns
GetPreviewListData(out List<Dictionary<string, object>>, out IEnumerable<string>, out string)
Supplies the rows and columns shown as a data preview in the preset editing screens. Called when
NeedsPreview is true; the preview is only rendered when the method returns true.
The base implementation returns false with empty data.
public override bool GetPreviewListData(out List<Dictionary<string, object>> listData, out IEnumerable<string> columns, out string error)
Parameters
listDataList<Dictionary<string, object>>Receives the preview rows, each keyed by column name.
columnsIEnumerable<string>Receives the column names in display order.
errorstringReceives a message describing why the preview could not be produced.
Returns
- bool
truewhen preview data is available; otherwisefalse.
GetSourceTables()
protected TableCollection GetSourceTables()
Returns
Install(out string)
Performs the installation — creates the integration activity (job) the preset represents. Called once by the
install command after ValidateSettings() returned an empty string and, when
NeedsEndpoint is true, after SetEndpoint(Endpoint) has been called.
public override bool Install(out string errors)
Parameters
errorsstringReceives a message describing why the installation failed; shown to the user when the method returns
false.
Returns
- bool
truewhen the activity was installed successfully; otherwisefalse.
LoadSettings()
Loads the preset's parameter values from an existing installed activity. Called by the data import query when the editing UI is opened for an already configured activity, after SourceProvider and DestinationProvider have been populated; override to read the persisted configuration back into the add-in parameter properties. The base implementation does nothing.
public override void LoadSettings()
PrepareMapping(Mapping)
protected virtual void PrepareMapping(Mapping mapping)
Parameters
mappingMapping
ValidateSettings()
Validates the preset configuration. Called by the install and update commands after the user's parameter values have been applied to the instance and before Install(out string); a non-empty return value aborts the installation and is shown to the user.
public override string ValidateSettings()
Returns
- string
An empty string when the settings are valid; otherwise a message describing the problems.