Import/Export & Dry-Run
Common Contract
Most configuration domains implement:
-
POST /<domain>/import(multipart file upload) – validates and persists. -
POST /<domain>/import/dry-run– validates and reports changes/errors without persisting. -
GET /<domain>/export– exports DB state into a domain format. -
Import mode query parameter:
ImportMode(REPLACEorMERGE) (src/main/java/com/friendly/ftconfigsservice/utils/ImportMode.java).
Dry-run semantics
Dry-run is required as a pre-flight check:
-
If dry-run reports errors, import must be blocked by the caller (UI/backend integration).
-
Imports still perform validation and can fail even when dry-run is skipped.
Domain Example: Tabs JSON import
Implementation: TabImportService (src/main/java/com/friendly/ftconfigsservice/angular/tabs/service/TabImportService.java).
-
Input: JSON array of
TabGroupDtoobjects containing grouppathand nesteditems. -
Dry-run: compares incoming payload against DB state using business keys (group
path, itempath) and emitsDryRunResult. -
Import: recomputes the diff and applies create/update/delete operations depending on
ImportMode.
Important note: the Hazelcast tabs map is not refreshed by this flow today (see Caching Strategy).
Domain Example: Northbound api.properties / Settings.xml
Implementation: NorthboundImportService (src/main/java/com/friendly/ftconfigsservice/northbound/importing/NorthboundImportService.java).
-
Accepts either:
-
api.properties(Java properties format) -
legacy
Settings.xml(auto-detected by filename or leading<bytes)
-
-
Resolves aliases (
NorthboundAliasResolver) and normalizes values (NorthboundValueNormalizer). -
Validates values against entry metadata (
NorthboundConfigValidator) and produces a list of errors during dry-run. -
In
REPLACEmode: any entries missing from the upload are reset to theirdefault_value(or blank). -
Changes are classified by effective value — the stored value, or
default_valuewhen the stored value is blank, which is what northbound-api receives. An entry whose effective value does not change is neither reported nor written, so a blank value is not overwritten with an identical explicit default. -
Dry-run is side-effect free: no
saveAll, no Hazelcast publish (the snapshot is read withgetConfiguration).
Legacy Settings.xml value rules
A legacy value is imported with the meaning the .NET northbound service gave it at runtime, so a migrated
installation keeps its behaviour. Values are trimmed first (unlike .NET, which compared the raw text, so
<Push> true</Push> was false there and is true here).
| Legacy tag | Entry | Rule |
|---|---|---|
|
the matching boolean entries |
only the exact string |
|
|
only |
|
|
only the exact string |
|
the request timeouts |
milliseconds in the file, seconds in the entry |
any tag, empty node |
its entry |
the entry’s |
-
REPLACEresets apply the entry’sdefault_valueas is; the rules above never touch a default. -
An
ENUMvalue is stored in the exact spelling of the allowed value it matches ignoring case (INFOis stored asinfo), for every import source and forPUT, because northbound-api compares enum values case-sensitively. A value that matches no allowed value is still rejected. A value stored in another spelling before this rule existed is not migrated; it stays as it is until it is saved or imported again. -
Known differences from .NET, by decision: the Java defaults, not the .NET ones, apply to an empty or absent node for
AddToProvision,IspEnable,KickDeviceTimeOut,CreateDeviceTimeout,ProcessLogLevel,Priority,GetStatusInterval,LogFolder(~/in .NET) andHttpUrlUpload/FtpUrlUpload(empty in .NET, a localhost URL here). The semantics ofProcessLogMethodsExclude/ProcessLogColumnsExcludealso differ and are out of scope.
Import result contract (northbound)
POST /northbound/config/dry-run, POST /northbound/config/import/xml and POST /northbound/config/import/xml/dry-run
return NorthboundImportResultDto. POST /northbound/config/import still returns only the configuration snapshot.
| Field | Type | Meaning |
|---|---|---|
|
boolean |
|
|
string[] |
Blocking errors collected during dry-run (validation, unknown keys) |
|
object |
Configuration snapshot (current state for dry-run); secrets are write-only, see Write-only secrets (northbound) |
|
int |
Keys from the file whose effective value changes |
|
int |
|
|
int |
Evaluated entries (file keys, plus |
|
object[] |
One item per changed entry; unchanged entries and entries with errors are omitted |
Each changes item (NorthboundConfigChangeDto):
| Field | Type | Meaning |
|---|---|---|
|
string |
Configuration code (api.properties key) |
|
string |
Key of the group the entry belongs to |
|
enum |
Always |
|
boolean |
|
|
boolean |
|
|
string |
Effective value before the import; |
|
string |
Effective value after the import; |
mode=REPLACE{
"applied": false,
"errors": [],
"configuration": { "groups": [ ... ], "updatedAt": "2026-09-15T12:00:00" },
"updatedCount": 1,
"resetToDefaultCount": 1,
"unchangedCount": 30,
"changes": [
{ "code": "api.settings.request.timeout.device-create", "groupKey": "timeouts", "changeType": "UPDATED",
"resetToDefault": false, "secret": false, "currentValue": "5", "incomingValue": "30" },
{ "code": "api.settings.upload.ftp.password", "groupKey": "upload", "changeType": "UPDATED",
"resetToDefault": true, "secret": true, "currentValue": "<redacted>", "incomingValue": "<redacted>" }
]
}
Write-only secrets (northbound)
Entries with secret=true (seeded: api.settings.upload.http.password, api.settings.upload.ftp.password) never leave the
service in clear text through the UI API. The marker is the single constant SensitiveFieldRedactor.REDACTED (<redacted>).
-
GET /northbound/config, thePUT /northbound/configresponse and every import/dry-runconfiguration: a non-blankvalueordefaultValueof a secret entry is<redacted>; a blank one stays blank. Every entry carrieshasValue(true when a non-blank value is stored), which tells a set secret from an unset one. -
PUT /northbound/config, per item of a secret entry:-
valueequals<redacted>→ skipped: not validated, not written, stored value kept (a round-tripped GET never overwrites a secret); -
valueis""→ clears the secret (subject torequiredvalidation); -
any other value → validated and stored.
-
-
Import (
/import,/import/xml, both dry-runs): a secret key whose file value is<redacted>is treated the same way — counted as unchanged, not written, and not reset byREPLACE. -
GET /northbound/config/exportand the Hazelcast snapshot keep real values — they feed northbound-api deployment.
GET /northbound/config{ "id": 30, "code": "api.settings.upload.ftp.password", "label": "FTP password", "description": "...",
"value": "<redacted>", "defaultValue": "", "valueType": "PASSWORD", "allowedValues": [],
"minValue": null, "maxValue": null, "validationPattern": null,
"secret": true, "required": false, "editable": true, "displayOrder": 60,
"updatedAt": "2026-09-15T12:00:00", "updatedBy": "admin", "hasValue": true }