Class: NoteShort

NoteShort(treeCache, row, branches)

FIXME: rethink how attributes are cached in Note entities since they are long lived inside the cache. Attribute cache should be limited to "transaction". This note's representation is used in note tree and is kept in TreeCache.

Constructor

new NoteShort(treeCache, row, branches)

Parameters:
Name Type Description
treeCache TreeCache
row Object.<string, Object>
branches Array.<Branch> all relevant branches, i.e. where this note is either child or parent
Source:

Members

archived

Source:

children :Array.<string>

Type:
  • Array.<string>
Source:

childToBranch :Object.<string, string>

Type:
  • Object.<string, string>
Source:

cssClass

Source:

isProtected

Source:

mime

Source:

noteId

Source:

parents :Array.<string>

Type:
  • Array.<string>
Source:

parentToBranch :Object.<string, string>

Type:
  • Object.<string, string>
Source:

title

Source:

type

Source:

Methods

(async) getAttribute(type, name) → {Promise.<Attribute>}

Parameters:
Name Type Description
type string attribute type (label, relation, etc.)
name string attribute name
Source:
Returns:
attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
Type
Promise.<Attribute>

(async) getAttributes(nameopt) → {Promise.<Array.<Attribute>>}

Parameters:
Name Type Attributes Description
name string <optional>
attribute name to filter
Source:
Returns:
Type
Promise.<Array.<Attribute>>

(async) getAttributeValue(type, name) → {Promise.<string>}

Parameters:
Name Type Description
type string attribute type (label, relation, etc.)
name string attribute name
Source:
Returns:
attribute value of given type and name or null if no such attribute exists.
Type
Promise.<string>

(async) getBranches() → {Promise.<Array.<Branch>>}

Source:
Returns:
Type
Promise.<Array.<Branch>>

(async) getChildBranches() → {Promise.<Array.<Branch>>}

Source:
Returns:
Type
Promise.<Array.<Branch>>

getChildNoteIds() → {Array.<string>}

Source:
Returns:
Type
Array.<string>

(async) getChildNotes() → {Promise.<Array.<NoteShort>>}

Source:
Returns:
Type
Promise.<Array.<NoteShort>>

(async) getLabel(name) → {Promise.<Attribute>}

Parameters:
Name Type Description
name string label name
Source:
Returns:
label if it exists, null otherwise
Type
Promise.<Attribute>

(async) getLabelDefinitions(nameopt) → {Promise.<Array.<Attribute>>}

Parameters:
Name Type Attributes Description
name string <optional>
label name to filter
Source:
Returns:
all note's label definitions, including inherited ones
Type
Promise.<Array.<Attribute>>

(async) getLabels(nameopt) → {Promise.<Array.<Attribute>>}

Parameters:
Name Type Attributes Description
name string <optional>
label name to filter
Source:
Returns:
all note's labels (attributes with type label), including inherited ones
Type
Promise.<Array.<Attribute>>

(async) getLabelValue(name) → {Promise.<string>}

Parameters:
Name Type Description
name string label name
Source:
Returns:
label value if label exists, null otherwise
Type
Promise.<string>

getParentNoteIds() → {Array.<string>}

Source:
Returns:
Type
Array.<string>

(async) getParentNotes() → {Promise.<Array.<NoteShort>>}

Source:
Returns:
Type
Promise.<Array.<NoteShort>>

(async) getRelation(name) → {Promise.<Attribute>}

Parameters:
Name Type Description
name string relation name
Source:
Returns:
relation if it exists, null otherwise
Type
Promise.<Attribute>

(async) getRelationDefinitions(nameopt) → {Promise.<Array.<Attribute>>}

Parameters:
Name Type Attributes Description
name string <optional>
relation name to filter
Source:
Returns:
all note's relation definitions including inherited ones
Type
Promise.<Array.<Attribute>>

(async) getRelations(nameopt) → {Promise.<Array.<Attribute>>}

Parameters:
Name Type Attributes Description
name string <optional>
relation name to filter
Source:
Returns:
all note's relations (attributes with type relation), including inherited ones
Type
Promise.<Array.<Attribute>>

(async) getRelationTarget(name) → {Promise.<NoteShort>|null}

Parameters:
Name Type Description
name string
Source:
Returns:
target note of the relation or null (if target is empty or note was not found)
Type
Promise.<NoteShort> | null

(async) getRelationTargets(nameopt) → {Promise.<Array.<NoteShort>>}

Parameters:
Name Type Attributes Description
name string <optional>
relation name to filter
Source:
Returns:
Type
Promise.<Array.<NoteShort>>

(async) getRelationValue(name) → {Promise.<string>}

Parameters:
Name Type Description
name string relation name
Source:
Returns:
relation value if relation exists, null otherwise
Type
Promise.<string>

(async) getTargetRelations() → {Promise.<Array.<Attribute>>}

Get relations which target this note
Source:
Returns:
Type
Promise.<Array.<Attribute>>

(async) hasAttribute(type, name) → {Promise.<boolean>}

Parameters:
Name Type Description
type string attribute type (label, relation, etc.)
name string attribute name
Source:
Returns:
true if note has an attribute with given type and name (including inherited)
Type
Promise.<boolean>

hasChildren() → {boolean}

Source:
Returns:
Type
boolean

(async) hasLabel(name) → {Promise.<boolean>}

Parameters:
Name Type Description
name string label name
Source:
Returns:
true if label exists (including inherited)
Type
Promise.<boolean>

(async) hasRelation(name) → {Promise.<boolean>}

Parameters:
Name Type Description
name string relation name
Source:
Returns:
true if relation exists (including inherited)
Type
Promise.<boolean>

invalidateAttributeCache()

Clear note's attributes cache to force fresh reload for next attribute request. Cache is note instance scoped.
Source:

isJson() → {boolean}

Source:
Returns:
Type
boolean