# Class: BBranch

## BBranch()

Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple parents. Note that you should not rely on the branch's identity, since it can change easily with a note's move. Always check noteId instead.

## Constructor

#### new BBranch()

Source:
  - becca/entities/bbranch.js, line 20

### Extends

- AbstractBeccaEntity

### Members

#### (protected) becca

Overrides:
  - AbstractBeccaEntity#becca
Source:
  - becca/entities/abstract_becca_entity.js, line 35

#### branchId :string

##### Type:

- string

Source:
  - becca/entities/bbranch.js, line 51

#### childNote

Source:
  - becca/entities/bbranch.js, line 97

#### isExpanded :boolean

##### Type:

- boolean

Source:
  - becca/entities/bbranch.js, line 61

#### isWeak

Branch is weak when its existence should not hinder deletion of its note. As a result, note with only weak branches should be immediately deleted. An example is shared or bookmarked clones - they are created automatically and exist for technical reasons, not as user-intended actions. From user perspective, they don't count as real clones and for the purpose of deletion should not act as a clone.

Source:
  - becca/entities/bbranch.js, line 134

#### noteId :string

##### Type:

- string

Source:
  - becca/entities/bbranch.js, line 53

#### notePosition :int

##### Type:

- int

Source:
  - becca/entities/bbranch.js, line 59

#### parentNote

Source:
  - becca/entities/bbranch.js, line 112

#### parentNoteId :string

##### Type:

- string

Source:
  - becca/entities/bbranch.js, line 55

#### prefix :string|null

##### Type:

- string | null

Source:
  - becca/entities/bbranch.js, line 57

#### utcDateModified :string

##### Type:

- string

Source:
  - becca/entities/bbranch.js, line 63

### Methods

#### (protected) _getContent() → {string|Buffer}

Overrides:
  - AbstractBeccaEntity#_getContent
Source:
  - becca/entities/abstract_becca_entity.js, line 250

##### Returns:

Type
  string | Buffer

#### (protected) _setContent()

Overrides:
  - AbstractBeccaEntity#_setContent
Source:
  - becca/entities/abstract_becca_entity.js, line 128

#### (protected) beforeSaving()

Overrides:
  - AbstractBeccaEntity#beforeSaving
Source:
  - becca/entities/abstract_becca_entity.js, line 20

#### deleteBranch(deleteIdopt, taskContextopt) → {boolean}

Delete a branch. If this is a last note's branch, delete the note as well.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`deleteId` | string | <optional> | optional delete identified
`taskContext` | TaskContext | <optional> |

Source:
  - becca/entities/bbranch.js, line 146

##### Returns:

- true if note has been deleted, false otherwise

Type
  boolean

#### (protected) generateHash() → {string}

Overrides:
  - AbstractBeccaEntity#generateHash
Source:
  - becca/entities/abstract_becca_entity.js, line 59

##### Returns:

Type
  string

#### getNote() → {BNote}

Source:
  - becca/entities/bbranch.js, line 107

##### Returns:

Type
  BNote

#### (abstract, protected) getPojo()

Overrides:
  - AbstractBeccaEntity#getPojo
Source:
  - becca/entities/abstract_becca_entity.js, line 82

#### (protected) getPojoToSave()

Overrides:
  - AbstractBeccaEntity#getPojoToSave
Source:
  - becca/entities/abstract_becca_entity.js, line 74

#### (protected) getUtcDateChanged()

Overrides:
  - AbstractBeccaEntity#getUtcDateChanged
Source:
  - becca/entities/abstract_becca_entity.js, line 27

#### 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:
  - AbstractBeccaEntity#markAsDeleted
Source:
  - becca/entities/abstract_becca_entity.js, line 267

#### (protected) putEntityChange()

Overrides:
  - AbstractBeccaEntity#putEntityChange
Source:
  - becca/entities/abstract_becca_entity.js, line 44

#### save() → {this}

Saves entity - executes SQL, but doesn't commit the transaction on its own

Overrides:
  - AbstractBeccaEntity#save
Source:
  - becca/entities/abstract_becca_entity.js, line 91

##### Returns:

Type
  this