new DocloopLink(core, data)
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
core |
DocloopCore | The core system. Since core is a factory for Links, this param will usually be set automatically. |
||||||||||||||||||||
data |
Object |
Properties
|
Properties:
Name | Type | Description |
---|---|---|
id |
bson | |
source |
Endpoint | An endpoint representing a source of annotations |
target |
Endpoint | An endpoint representing a target resource for issues |
export |
LinkData | Getter |
skeleton |
LinkSkeleton | Getter |
Throws:
-
-
If core is missing .
- Type
- ReferenceError
-
-
-
If core is not an instance of DocloopCore.
- Type
- TypeError
-
-
-
If data is missing .
- Type
- ReferenceError
-
Methods
-
<async> _validate(Express)
-
Checks if the current session has acces to source and target with Endpoint#_validate
Parameters:
Name Type Description Express
session session
Returns:
- Type
- undefined
-
importData(data, source, source)
-
Imports source and target data. Mainly used by the constructor.
Parameters:
Name Type Description data
Object source
EndpointData Source endpoint data as used in the DocloopEndpoint#constructor
source
EndpointData Target endpoint data as used in the DocloopEndpoint#constructor
returns {this}
-
<async> preventDuplicate()
-
Check if there already exists a link with the same source identifier and the same target identifier as the link at hand. If so throws and error.
Throws:
-
If duplicate exists
- Type
- DocloopError
Returns:
for chaining
- Type
- this
-
-
<async> remove()
-
Removes the link from the database. First it removes source and target from the database, then the actual link document.
Throws:
-
If this.id is missing. This happens most likely if the link had not been stored.
- Type
- ReferenceError
Returns:
- Type
- undefined
-
-
<async> store()
-
Stores the link to the database as new document. First it stores its source and target, then stores a new document using the data from DocLLoopLink#.skeleton
Returns:
The mongo-db id for the inserted document.
- Type
- bson
-
<async> update()
-
Updates source and target using DocloopEndpoint#update
Type Definitions
-
LinkData
-
Type:
- Object
Properties:
Name Type Argument Description id
bson <optional>
Link id
source
EndpointData Source data
target
EndpointData Target data
-
LinkSkeleton
-
Type:
- Object
Properties:
Name Type Description id
bson Link id
source
EndpointSkeleton Source skeleton
target
EndpointSkeleton Target skeleton