Skip to content
Reference > AmiScript API > Classes

JsonSettingsEditor

Definition

JsonSettingsEditor var = .... ;

Extends

Extended By

None

Description

AMI Web editor for a structured JSON-settings document. Mirrors PanelEditor's lifecycle (open/close/validate/test/apply/revert via the base type) but exposes JSON-shaped read/write only -- line-oriented text operations are intentionally absent.

Method Summary

Owner Name Return Type Description
PanelEditor apply() Boolean Persist the editor working copy to the underlying object. Call validate() first.
PanelEditor close() Boolean Dismiss this editor's window and unregister it from the editor registry. Triggers the same lifecycle as the user clicking the window's close button.
PanelEditor getBinding() Map Return the editor's binding metadata as a map: {handle, editorType, contentType, ari, name, parentHandle, scope, capabilities:[...], readonly}. Use this to ask 'what kind of editor is this?' or 'can I setCode on it?' (check capabilities for 'set_code') without runtime-type-checking the editor instance.
Object getClassName() String Returns the string name of this object's class type.
PanelEditor getHandle() String Return this editor's stable session handle.
JsonSettingsEditor getJson() String Return the editor's current JSON document as a string.
JsonSettingsEditor getProperty(path) Object Look up a single property by dotted path (e.g. 'filters.where'). Returns null if the path is empty, any intermediate segment is missing or non-object, or the current JSON document is unparseable. Best-effort read; round-trip via getJson() if you need to distinguish 'missing' from 'explicitly null'.
PanelEditor getRevision() Long Return the editor's monotonic working-copy revision.
PanelEditor hasChanged() Boolean Return true if the working copy differs from persisted state.
PanelEditor open() Boolean Open this editor in the UI, bringing it onto the user's screen if it is not already visible. Editing can be done without calling open().
PanelEditor revert() Boolean Discard unsaved working-copy changes and return to persisted state.
JsonSettingsEditor setJson(json) Boolean Replace the editor's JSON document unconditionally. Use trySetJson() if you want stale-write protection.
JsonSettingsEditor setProperty(path, value) Long Set a single property by dotted path (e.g. 'filters.where'). Intermediate objects are auto-created if missing. Throws if the path is empty or an intermediate segment names a non-object value. Returns the new editor revision after the write.
PanelEditor test() Map Execute the editor's payload in its runtime context without persisting. Returns {ok, revision, returnValue, output, errorMessage}. Only valid when capabilities contains 'test' -- other editor kinds return a not-supported result. Mirrors the editor_test admin/MCP shape.
Object toJson() String Returns a string of a json representation of this object.
JsonSettingsEditor trySetJson(json, expectedRevision) Map Replace the editor's JSON document only if expectedRevision is current. Returns {applied, revision}: applied=true and the new revision on success; applied=false and the editor's current revision on stale (retry with that revision).
PanelEditor validate() Map Validate the editor's working copy. Returns {ok, revision, diagnostics}. Does not surface validation errors as UI alerts -- callers inspect the returned diagnostics list instead.

Method Definitions


apply()

Boolean PanelEditor::apply()

Description

Persist the editor working copy to the underlying object. Call validate() first.


close()

Boolean PanelEditor::close()

Description

Dismiss this editor's window and unregister it from the editor registry. Triggers the same lifecycle as the user clicking the window's close button.


getBinding()

Map PanelEditor::getBinding()

Description

Return the editor's binding metadata as a map: {handle, editorType, contentType, ari, name, parentHandle, scope, capabilities:[...], readonly}. Use this to ask 'what kind of editor is this?' or 'can I setCode on it?' (check capabilities for 'set_code') without runtime-type-checking the editor instance.


getClassName()

String Object::getClassName()

Description

Returns the string name of this object's class type.


getHandle()

String PanelEditor::getHandle()

Description

Return this editor's stable session handle.


getJson()

String JsonSettingsEditor::getJson()

Description

Return the editor's current JSON document as a string.


getProperty(path)

Object JsonSettingsEditor::getProperty(String path)

Description

Look up a single property by dotted path (e.g. 'filters.where'). Returns null if the path is empty, any intermediate segment is missing or non-object, or the current JSON document is unparseable. Best-effort read; round-trip via getJson() if you need to distinguish 'missing' from 'explicitly null'.

Parameter Definition

Name Type Description
path String 

getRevision()

Long PanelEditor::getRevision()

Description

Return the editor's monotonic working-copy revision.


hasChanged()

Boolean PanelEditor::hasChanged()

Description

Return true if the working copy differs from persisted state.


open()

Boolean PanelEditor::open()

Description

Open this editor in the UI, bringing it onto the user's screen if it is not already visible. Editing can be done without calling open().


revert()

Boolean PanelEditor::revert()

Description

Discard unsaved working-copy changes and return to persisted state.


setJson(json)

Boolean JsonSettingsEditor::setJson(String json)

Description

Replace the editor's JSON document unconditionally. Use trySetJson() if you want stale-write protection.

Parameter Definition

Name Type Description
json String 

setProperty(path,value)

Long JsonSettingsEditor::setProperty(String path, Object value)

Description

Set a single property by dotted path (e.g. 'filters.where'). Intermediate objects are auto-created if missing. Throws if the path is empty or an intermediate segment names a non-object value. Returns the new editor revision after the write.

Parameter Definition

Name Type Description
path String 
value Object 

test()

Map PanelEditor::test()

Description

Execute the editor's payload in its runtime context without persisting. Returns {ok, revision, returnValue, output, errorMessage}. Only valid when capabilities contains 'test' -- other editor kinds return a not-supported result. Mirrors the editor_test admin/MCP shape.


toJson()

String Object::toJson()

Description

Returns a string of a json representation of this object.


trySetJson(json,expectedRevision)

Map JsonSettingsEditor::trySetJson(String json, Long expectedRevision)

Description

Replace the editor's JSON document only if expectedRevision is current. Returns {applied, revision}: applied=true and the new revision on success; applied=false and the editor's current revision on stale (retry with that revision).

Parameter Definition

Name Type Description
json String 
expectedRevision Long 

validate()

Map PanelEditor::validate()

Description

Validate the editor's working copy. Returns {ok, revision, diagnostics}. Does not surface validation errors as UI alerts -- callers inspect the returned diagnostics list instead.