Extends
Members
(protected) becca
- Overrides:
- Source:
dateCreated :string
Type:
- string
- Source:
dateModified :string
Type:
- string
- Source:
flatTextCache :string|null
Type:
- string | null
- Source:
isDecrypted :boolean
Type:
- boolean
- Source:
isProtected :boolean
Type:
- boolean
- Source:
mime :string
Type:
- string
- Source:
noteId :string
Type:
- string
- Source:
title :string
Type:
- string
- Source:
type :string
Type:
- string
- Source:
utcDateCreated :string
Type:
- string
- Source:
utcDateModified :string
Type:
- string
- Source:
Methods
addAttribute(type, name, valueopt) → {Attribute}
Adds a new attribute to this note. The attribute is saved and returned.
See addLabel, addRelation for more specific methods.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | attribute type (label / relation) | |
name |
string | name of the attribute, not including the leading ~/# | |
value |
string |
<optional> |
value of the attribute - text for labels, target note ID for relations; optional. |
- Source:
Returns:
- Type
- Attribute
(protected) addEntityChange()
- Overrides:
- Source:
addLabel(name, valueopt) → {Attribute}
Adds a new label to this note. The label attribute is saved and returned.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | name of the label, not including the leading # | |
value |
string |
<optional> |
text value of the label; optional |
- Source:
Returns:
- Type
- Attribute
addRelation(name, value) → {Attribute}
Adds a new relation to this note. The relation attribute is saved and
returned.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of the relation, not including the leading ~ |
value |
string | ID of the target note of the relation |
- Source:
Returns:
- Type
- Attribute
(protected) beforeSaving()
- Overrides:
- Source:
cloneTo(parentNoteId) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
parentNoteId |
- Source:
Returns:
- Type
- Object
deleteNote(deleteIdopt, taskContextopt)
(Soft) delete a note and all its descendants.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
deleteId |
string |
<optional> |
optional delete identified |
taskContext |
TaskContext |
<optional> |
- Source:
(protected) generateHash()
- Overrides:
- Source:
(protected) generateIdIfNecessary()
- Overrides:
- Source:
getAllNotePaths() → {Array.<Array.<string>>}
- Source:
Returns:
- array of notePaths (each represented by array of noteIds constituting the particular note path)
- Type
- Array.<Array.<string>>
getAncestors() → {Array.<Note>}
- Source:
Returns:
- Type
- Array.<Note>
getAttribute(type, name) → {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
- Attribute
getAttributeValue(type, name) → {string|null}
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
- string | null
getAttributes(typeopt, nameopt) → {Array.<Attribute>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string |
<optional> |
(optional) attribute type to filter |
name |
string |
<optional> |
(optional) attribute name to filter |
- Source:
Returns:
all note's attributes, including inherited ones
- Type
- Array.<Attribute>
getBranches() → {Array.<Branch>}
- Deprecated:
- use getParentBranches() instead
- Source:
Returns:
- Type
- Array.<Branch>
getChildBranches() → {Array.<Branch>}
- Source:
Returns:
- Type
- Array.<Branch>
getChildNotes() → {Array.<Note>}
- Source:
Returns:
- Type
- Array.<Note>
getContent() → {*}
- Source:
Returns:
- Type
- *
getContentMetadata() → {Object}
- Source:
Returns:
- Type
- Object
getFlatText() → {string}
This is used for:
- fast searching
- note similarity evaluation
- Source:
Returns:
- returns flattened textual representation of note, prefixes and attributes
- Type
- string
getJsonContent() → {*}
- Source:
Returns:
- Type
- *
getLabel(name) → {Attribute|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | label name |
- Source:
Returns:
label if it exists, null otherwise
- Type
- Attribute | null
getLabelValue(name) → {string|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | label name |
- Source:
Returns:
label value if label exists, null otherwise
- Type
- string | null
getLabelValues(nameopt) → {Array.<string>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string |
<optional> |
label name to filter |
- Source:
Returns:
all note's label values, including inherited ones
- Type
- Array.<string>
getLabels(nameopt) → {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
- Array.<Attribute>
getOwnedAttribute() → {Attribute}
- Source:
Returns:
attribute belonging to this specific note (excludes inherited attributes)
This method can be significantly faster than the getAttribute()
- Type
- Attribute
getOwnedAttributeValue(type, name) → {string|null}
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
- string | null
getOwnedAttributes(typeopt, nameopt, valueopt) → {Array.<Attribute>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string |
<optional> |
(optional) attribute type to filter |
name |
string |
<optional> |
(optional) attribute name to filter |
value |
string |
<optional> |
(optional) attribute value to filter |
- Source:
Returns:
note's "owned" attributes - excluding inherited ones
- Type
- Array.<Attribute>
getOwnedLabel(name) → {Attribute|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | label name |
- Source:
Returns:
label if it exists, null otherwise
- Type
- Attribute | null
getOwnedLabelValue(name) → {string|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | label name |
- Source:
Returns:
label value if label exists, null otherwise
- Type
- string | null
getOwnedLabelValues(nameopt) → {Array.<string>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string |
<optional> |
label name to filter |
- Source:
Returns:
all note's label values, excluding inherited ones
- Type
- Array.<string>
getOwnedLabels(nameopt) → {Array.<Attribute>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string |
<optional> |
label name to filter |
- Source:
Returns:
all note's labels (attributes with type label), excluding inherited ones
- Type
- Array.<Attribute>
getOwnedRelation(name) → {Attribute|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | relation name |
- Source:
Returns:
relation if it exists, null otherwise
- Type
- Attribute | null
getOwnedRelationValue(name) → {string|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | relation name |
- Source:
Returns:
relation value if relation exists, null otherwise
- Type
- string | null
getOwnedRelations(nameopt) → {Array.<Attribute>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string |
<optional> |
relation name to filter |
- Source:
Returns:
all note's relations (attributes with type relation), excluding inherited ones
- Type
- Array.<Attribute>
getParentBranches() → {Array.<Branch>}
- Source:
Returns:
- Type
- Array.<Branch>
getParentNotes() → {Array.<Note>}
- Source:
Returns:
- Type
- Array.<Note>
(protected) getPojoToSave()
- Overrides:
- Source:
getRelation(name) → {Attribute|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | relation name |
- Source:
Returns:
relation if it exists, null otherwise
- Type
- Attribute | null
getRelationValue(name) → {string|null}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | relation name |
- Source:
Returns:
relation value if relation exists, null otherwise
- Type
- string | null
getRelations(nameopt) → {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
- Array.<Attribute>
getScriptEnv() → {string|null}
- Source:
Returns:
JS script environment - either "frontend" or "backend"
- Type
- string | null
getSearchResultNotes() → {Array.<Note>}
- Source:
Returns:
- Type
- Array.<Note>
getSubtree() → {Object}
- Source:
Returns:
- Type
- Object
getSubtreeNoteIds() → {Array.<String>}
- Source:
Returns:
- Type
- Array.<String>
getSubtreeNotesIncludingTemplated() → {Array.<Note>}
- Source:
Returns:
- Type
- Array.<Note>
getTemplatedNotes() → {Array.<Note>}
- Source:
Returns:
- returns only notes which are templated, does not include their subtrees
in effect returns notes which are influenced by note's non-inheritable attributes
- Type
- Array.<Note>
(protected) getUtcDateChanged()
- Overrides:
- Source:
hasAncestor() → {boolean}
- Source:
Returns:
- Type
- boolean
hasAttribute(type, name, valueopt) → {boolean}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
|||
name |
|||
value |
<optional> |
- Source:
Returns:
- Type
- boolean
hasChildren() → {boolean}
- Source:
Returns:
- Type
- boolean
hasLabel(name, valueopt) → {boolean}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | label name | |
value |
string |
<optional> |
label value |
- Source:
Returns:
true if label exists (including inherited)
- Type
- boolean
hasOwnedAttribute(type, name, valueopt) → {boolean}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | attribute type (label, relation, etc.) | |
name |
string | attribute name | |
value |
string |
<optional> |
attribute value |
- Source:
Returns:
true if note has an attribute with given type and name (excluding inherited)
- Type
- boolean
hasOwnedLabel(name, valueopt) → {boolean}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | label name | |
value |
string |
<optional> |
label value |
- Source:
Returns:
true if label exists (excluding inherited)
- Type
- boolean
hasOwnedRelation(name, valueopt) → {boolean}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | relation name | |
value |
string |
<optional> |
relation value |
- Source:
Returns:
true if relation exists (excluding inherited)
- Type
- boolean
hasRelation(name, valueopt) → {boolean}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | relation name | |
value |
string |
<optional> |
relation value |
- Source:
Returns:
true if relation exists (including inherited)
- Type
- boolean
isDescendantOfNote(ancestorNoteId) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
ancestorNoteId |
- Source:
Returns:
- true if ancestorNoteId occurs in at least one of the note's paths
- Type
- boolean
isHtml() → {boolean}
- Source:
Returns:
true if this note is HTML
- Type
- boolean
isJavaScript() → {boolean}
- Source:
Returns:
true if this note is JavaScript (code or attachment)
- Type
- boolean
isJson() → {boolean}
- Source:
Returns:
true if this note is of application/json content type
- Type
- boolean
isRoot() → {boolean}
- Source:
Returns:
true if this note is the root of the note tree. Root note has "root" noteId
- Type
- boolean
isStringNote() → {boolean}
- Source:
Returns:
true if the note has string content (not binary)
- Type
- boolean
markAsDeleted(deleteIdopt)
Mark the entity as (soft) deleted. It will be completely erased later.
This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
deleteId |
<optional> |
null |
- Overrides:
- Source:
removeAttribute(type, name, valueopt)
Removes given attribute name-value pair if it exists.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | attribute type (label, relation, etc.) | |
name |
string | attribute name | |
value |
string |
<optional> |
attribute value (optional) |
- Source:
removeLabel(name, valueopt)
Remove label name-value pair, if it exists.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | label name | |
value |
string |
<optional> |
label value |
- Source:
removeRelation(name, valueopt)
Remove relation name-value pair, if it exists.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | relation name | |
value |
string |
<optional> |
relation value (noteId) |
- Source:
save() → {AbstractEntity}
Saves entity - executes SQL, but doesn't commit the transaction on its own
- Overrides:
- Source:
Returns:
- Type
- AbstractEntity
saveNoteRevision() → {NoteRevision|null}
- Source:
Returns:
- Type
- NoteRevision | null
setAttribute(type, name, valueopt)
Update's given attribute's value or creates it if it doesn't exist
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | attribute type (label, relation, etc.) | |
name |
string | attribute name | |
value |
string |
<optional> |
attribute value (optional) |
- Source:
setLabel(name, valueopt)
Update's given label's value or creates it if it doesn't exist
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | label name | |
value |
string |
<optional> |
label value |
- Source:
setRelation(name, value)
Update's given relation's value or creates it if it doesn't exist
Parameters:
Name | Type | Description |
---|---|---|
name |
string | relation name |
value |
string | relation value (noteId) |
- Source:
toggleAttribute(type, enabled, name, valueopt)
Based on enabled, attribute is either set or removed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | attribute type ('relation', 'label' etc.) | |
enabled |
boolean | toggle On or Off | |
name |
string | attribute name | |
value |
string |
<optional> |
attribute value (optional) |
- Source:
toggleLabel(enabled, name, valueopt)
Based on enabled, label is either set or removed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
enabled |
boolean | toggle On or Off | |
name |
string | label name | |
value |
string |
<optional> |
label value (optional) |
- Source:
toggleRelation(enabled, name, valueopt)
Based on enabled, relation is either set or removed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
enabled |
boolean | toggle On or Off | |
name |
string | relation name | |
value |
string |
<optional> |
relation value (noteId) |
- Source: