# JSDoc: Class: BRevision

# Class: BRevision

## BRevision()

Revision represents a snapshot of note's title and content at some point in the past. It's used for seamless note versioning.

## Constructor

#### new BRevision()

Source:
  - becca/entities/brevision.js, line 17

### Extends

- AbstractBeccaEntity

### Members

#### (protected) becca

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

#### blobId :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 39

#### contentLength :int

##### Type:

- int

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

#### dateCreated :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 43

#### dateLastEdited :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 41

#### isProtected :boolean

##### Type:

- boolean

Source:
  - becca/entities/brevision.js, line 35

#### mime :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 33

#### noteId :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 29

#### revisionId :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 27

#### title :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 37

#### type :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 31

#### utcDateCreated :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 47

#### utcDateLastEdited :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 45

#### utcDateModified :string

##### Type:

- string

Source:
  - becca/entities/brevision.js, line 49

### 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

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

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

##### Returns:

Type
  string

#### getAttachmentById() → {BAttachment|null}

Source:
  - becca/entities/brevision.js, line 132

##### Returns:

Type
  BAttachment | null

#### getAttachmentByTitle() → {BAttachment}

Source:
  - becca/entities/brevision.js, line 159

##### Returns:

Type
  BAttachment

#### getAttachments() → {Array.<BAttachment>}

Source:
  - becca/entities/brevision.js, line 122

##### Returns:

Type
  Array.<BAttachment>

#### getAttachmentsByRole() → {Array.<BAttachment>}

Source:
  - becca/entities/brevision.js, line 147

##### Returns:

Type
  Array.<BAttachment>

#### getContent() → {string|Buffer}

Source:
  - becca/entities/brevision.js, line 85

##### Returns:

Type
  string | Buffer

#### getJsonContent() → {*}

Source:
  - becca/entities/brevision.js, line 92

##### Throws:

Error in case of invalid JSON

##### Returns:

Type
  *

#### getJsonContentSafely() → {*|null}

Source:
  - becca/entities/brevision.js, line 103

##### Returns:

valid object or null if the content cannot be parsed as JSON

Type
  * | null

#### (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

#### hasStringContent() → {boolean}

Source:
  - becca/entities/brevision.js, line 65

##### 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:
  - 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

#### setContent(content, optsopt)

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`content` |  |  |

`opts`

object

<optional>

###### Properties

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`forceSave` | object | <optional> | false | will also save this BRevision entity

Source:
  - becca/entities/brevision.js, line 117