$k. Folder

A folder which can contain queries, topic collections and other folders

Constructor

new $k.Folder(optionsopt)

Constructs a new folder

Parameters:
NameTypeAttributesDescription
optionsobject<optional>

Options object

Properties
NameTypeDescription
namestring

The name of the folder

cluster$k.RegistryElement | string

Folder element whose cluster should be used for the new element, 'new' to create new persistent element, or 'local' to create a non persistent temporary element

Since
  • 6.1.1

Extends

Methods

addElement(folderElement)

Add the folder element to this folder

Parameters:
NameTypeDescription
folderElement$k.FolderElement

The element to be added

Since
  • 6.1.0
Throws:

addFolderElement(folderElement)

Add the folder element to this folder

Parameters:
NameTypeDescription
folderElement$k.FolderElement

The folder element to be added

Deprecated
  • Use addElement()

createSemanticCollection(name) → {$k.SemanticCollection}

Creates a semantic collection and adds it to this folder

Parameters:
NameTypeDescription
namestring

The name of the new semantic collection

Since
  • 5.3.3
Deprecated
  • Use new $k.SemanticCollection() to build a collection, and add it to the folder with addFolderElement()
See
Throws:

If no write transaction is active

Type
$k.exception.TransactionError
Returns:

the new semantic collection

Type: 
$k.SemanticCollection

deregister()

Deregisters the element. The ID will be undefined afterwards. Equivalent to setId(undefined)

See
  • setId
Throws:

jsDocNoAdminRights

Type
$k.exception.AccessDenied

elements() → {Array.<($k.FolderElement|$k.SemanticElement)>}

Returns the elements of the collection

Returns:
Type: 
Array.<($k.FolderElement|$k.SemanticElement)>

id() → {string|undefined}

Returns the registered ID, or undefined if not registered.

Inherited From
Returns:
Type: 
string | undefined

leafElements() → {Array.<($k.FolderElement|$k.SemanticElement)>}

Returns the elements which are not folders

Returns:
Type: 
Array.<($k.FolderElement|$k.SemanticElement)>

name() → {string}

Returns the name

Returns:
Type: 
string

parentFolders() → {Array.<$k.Folder>}

Returns the folders that contain this element

Returns:
Type: 
Array.<$k.Folder>

register(replaceScriptReferencesopt) → {string}

Registers the element with a private ID, if it has no registered ID yet.

Parameters:
NameTypeAttributesDefaultDescription
replaceScriptReferencesboolean<optional>
false

True if ID references in scripts should be replaced. Only done when the old and the new ID is not undefined.

Since
  • 6.1.1
Throws:

jsDocNoAdminRights

Type
$k.exception.AccessDenied
Returns:

The registered ID

Type: 
string

registryType() → {string}

Returns the name of the registry that contains elements of this type

Returns:
Type: 
string

remove()

Deletes the element and removes it from all containing registries and folders

Throws:

removeElement(folderElement)

Remove the folder element from this folder

Parameters:
NameTypeDescription
folderElement$k.FolderElement

The element to be removed

Since
  • 6.1.1
Throws:

If the element was not contained in the folder

Type
$k.exception.ObjectNotFound

removeFolderElement(folderElement)

Remove the folder element from this folder

Parameters:
NameTypeDescription
folderElement$k.FolderElement

The folder element to be removed

Since
  • 6.1.0
Deprecated
  • Use removeElement()

setId(id, replaceScriptReferencesopt)

Registers the element with the given ID. If the element has already been registered, the current ID will be changed to the new ID.

Deprecated option: If the given ID is undefined or null, the element will be deregistered. Use deregister() instead

Parameters:
NameTypeAttributesDefaultDescription
idstring | null

The ID to set

replaceScriptReferencesboolean<optional>
false

True if ID references in scripts should be replaced. Only done when the old and the new ID is not undefined.

See
  • deregister
Throws:

jsDocNoAdminRights

Type
$k.exception.AccessDenied

setName()

Sets the name of the element

Since
  • 6.1.1
Throws:

jsDocNoAdminRights

Type
$k.exception.AccessDenied

subfolders() → {Array.<$k.Folder>}

Returns the subfolders

Returns:
Type: 
Array.<$k.Folder>