Class: Node

Gitana. Node

Node


new Node(branch [, object])

Parameters:
Name Type Argument Description
branch Gitana.Branch
object Object <optional>

json object (if no callback required for populating)

Source:

Extends

Members


getPreviewUri

Generates a URI to a preview resource.

Inherited From:
Source:

listAttachments

Lists the attachments of this node.

If local is set to true, the attachments are drawn from precached values on the node.

Inherited From:
Source:

unattach

Deletes an attachment.

Inherited From:
Source:

Methods


__copyState()

Override the Chain.__copyState method so that it utilizes a base method that we can override
on a per-class basis.

Inherited From:
Source:

addFeature(featureId [, Object])

Adds a feature to this node.

Parameters:
Name Type Argument Description
featureId String

the id of the feature

Object <optional>

featureConfig the JSON object configuration for the feature

Inherited From:
Source:

associate(targetNode [, object] [, undirected])

Associates a target node to this node.

Parameters:
Name Type Argument Description
targetNode String | Node

the id of the target node or the target node itself

object Object | String <optional>

either a JSON object or a string identifying the type of association

undirected Boolean <optional>

whether the association is undirected (i.e. mutual)

Source:

associateOf(sourceNode, object [, undirected])

Creates an association from another node to this one.

Parameters:
Name Type Argument Description
sourceNode Node
object Object
undirected Boolean <optional>
Source:

associations(config, pagination)

Retrieves all of the association objects for this node.

Parameters:
Name Type Description
config Object
pagination Object
Source:

attach(attachmentId, contentType, data, filename)

Creates an attachment.

When using this method from within the browser, it really only works for text-based content such
as JSON or text.

Parameters:
Name Type Description
attachmentId

(use null or false for default attachment)

contentType
data
filename
Inherited From:
Source:

attachment(attachmentId)

Picks off a single attachment

Parameters:
Name Type Description
attachmentId

(null for default)

Inherited From:
Source:

attachmentDownloadUri()

Non-chained method for getting a download URI for this node's attachment.

Inherited From:
Source:

chainCopyState(otherObject)

Override to include:

qname type
features stats
__is_association

Parameters:
Name Type Description
otherObject
Inherited From:
Source:

chainCreate(chainable, object, uri, params)

Creates an object on the server (write + read).
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
object
uri
params
Inherited From:
Source:

chainCreateEx(chainable, object, createUri, readUri)

Creates an object on the server using one URL and then reads it back using another URL.
This exists because the security responses don't include _doc fields like other responses.

Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
object
createUri
readUri
Inherited From:
Source:

chainDelete(chainable, uri, params)

Executes an HTTP delete for this object and continues the chain with the chainable.

Parameters:
Name Type Description
chainable
uri
params
Inherited From:
Source:

chainGet(chainable, uri, params)

Performs a GET from the server and populates the chainable.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
Inherited From:
Source:

chainGetResponse(chainable, uri, params)

Performs a GET to the server and pushes the response into the chain.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
Inherited From:
Source:

chainGetResponseRows(chainable, uri, params)

Performs a GET to the server and pushes the "rows" response attribute into the chain.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
Inherited From:
Source:

chainGetResponseText(chainable, uri, params)

Performs a GET to the server and pushes the text response to the callback.

Parameters:
Name Type Description
chainable
uri
params
Inherited From:
Source:

chainHasResponseRow(chainable, uri, value)

Performs a GET to the server and checks whether the "rows" array attribute of the response
has the given value.

Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
value
Inherited From:
Source:

chainPatch(chainable, uri, params, payload)

Performs a PATCH to the server and populates the chainable with results.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
payload
Inherited From:
Source:

chainPost(chainable, uri, params, payload, handleFn)

Performs a POST to the server and populates the chainable with results.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
payload
handleFn
Inherited From:
Source:

chainPostEmpty(chainable, uri, params, payload, contentType)

Performs a POST to the server. The response is not handled.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
payload

(optional)

contentType

(optional) - example "text/plain"

Inherited From:
Source:

chainPostResponse(chainable, uri, params)

Performs a POST to the server and pushes the response into the chain.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
Inherited From:
Source:

chainReload(uri, params)

Reloads this object from the server and then passes control to the chainable.

Parameters:
Name Type Description
uri
params
Inherited From:
Source:

chainUpdate(chainable, uri, params)

Executes an update (write + read) of this object and then passes control to the chainable.

Parameters:
Name Type Description
chainable
uri
params
Inherited From:
Source:

chainUpload(chainable, uri, params, contentType, payload)

Performs a POST to the server. The response is not handled.
Proceeds with the chain as bound to the chainable.

Parameters:
Name Type Description
chainable
uri
params
contentType

(optional) - example "text/plain"

payload

(optional)

Inherited From:
Source:

changeQName(typeQName)

Sets the QName of this node.

Parameters:
Name Type Description
typeQName String

the qname of the type to change to

Inherited From:
Source:

changeTypeQName(typeQName)

Changes the type QName for this node.

Parameters:
Name Type Description
typeQName String

the qname of the type to change to

Inherited From:
Source:

checkAuthority(principal, authorityId, callback)

Checks whether the given principal has a granted authority for this object.
This passes the result (true/false) to the chaining function.

Parameters:
Name Type Description
principal Gitana.Principal | String

the principal or the principal id

authorityId String

the id of the authority

callback function
Overrides:
Source:

checkLocked()

Checks whether the node is locked.
The result is passed into the next method in the chain.

Source:

checkPermission(principal, permissionId, callback)

Checks whether the given principal has a permission against this object.
This passes the result (true/false) to the chaining function.

Parameters:
Name Type Description
principal Gitana.Principal | String

the principal or the principal id

permissionId String

the id of the permission

callback function
Overrides:
Source:

childOf(sourceNode)

Associates this node as an "a:child" of the source node.

This is a convenience function that simply creates an association from another node to this one.

Parameters:
Name Type Description
sourceNode Node
Source:

clone()

Inherited From:
Source:

copy(target, asynchronous, config)

Copies this object into the target.

Parameters:
Name Type Description
target
asynchronous
config
Inherited From:
Source:

createChild( [object])

Create a node as a child of this node.

This is a convenience function around the branch createNode method. It chains a create with a
childOf() call.

Parameters:
Name Type Argument Description
object Object <optional>

JSON object

Source:

createTranslation(edition, locale [, object])

Creates a new translation.

Parameters:
Name Type Argument Description
edition String

the edition of the translation (can be any string)

locale String

the locale string for the translation (i.e. "en_US")

object Object <optional>

JSON object

Source:

del()

Delete

Inherited From:
Source:

editions(callback)

Lists all of the editions for this master node.
Passes them into the next function in the chain.

Parameters:
Name Type Description
callback function
Source:

exportArchive(settings)

Exports an archive.

Parameters:
Name Type Description
settings Object
Inherited From:
Source:

extractPrincipalDomainQualifiedId(principal)

Helper to gets the principal id for a principal object, json structure or principal id itself.
This returns something like "domainId/principalId"

Parameters:
Name Type Description
principal
Inherited From:
Source:

extractPrincipalIdentifiers(principal, defaultDomainId)

Helper to gets the principal id for a principal object, json structure or principal id itself.
This returns something like "domainId/principalId"

Parameters:
Name Type Description
principal

principal object or string (principal id or domain qualified principal id)

defaultDomainId
Inherited From:
Source:

find(config [, pagination])

Finds around a node.

Parameters:
Name Type Argument Description
config Object

search configuration

pagination Object <optional>
Source:

findRelatives(config, associationConfig [, pagination])

Finds relatives of this node.

Config should be:

{
"query": {
... Query Block
},
"search": {
... Elastic Search Config Block
},
"traverse: {
... Traversal Configuration
}
}

Alternatively, the value for "search" in the JSON block above can simply be text.

The associationConfig should look like:

{
"type": "",
"direction": ""
}

Parameters:
Name Type Argument Description
config Object
associationConfig Object
pagination Object <optional>
Source:

get(key)

Get a json property

Parameters:
Name Type Description
key
Inherited From:
Source:

getBranch()

Gets the Gitana Branch object.

Inherited From:
Source:
Returns:

The Gitana Branch object

Type
Gitana.Branch

getBranchId()

Gets the Gitana Branch id.

Inherited From:
Source:
Returns:

The Gitana Branch id

Type
String

getDescription()

The description for the object.

Inherited From:
Source:
Returns:

the description

Type
String

getFeature(featureId [, Function])

Gets the configuration for a given feature.

Parameters:
Name Type Argument Description
featureId String

the id of the feature

Function <optional>

callback optional callback

Inherited From:
Source:
Returns:

the JSON object configuration for the feature

Type
Object

getFeatureIds( [Function])

Hands back a list of the feature ids that this node has.

Parameters:
Name Type Argument Description
Function <optional>

callback optional callback

Inherited From:
Source:
Returns:

An array of strings that are the ids of the features.

Type
Array

getId()

Hands back the ID ("_doc") of this object.

Inherited From:
Source:
Returns:

id

Type
String

getProxiedUri()

Hands back the URI of this object as referenced by the browser.

Inherited From:
Source:

getQName()

Gets the QName for this node.

Inherited From:
Source:
Returns:

the qname of this node.

Type
String

getRepository()

Gets the Gitana Repository object.

Inherited From:
Source:
Returns:

The Gitana Repository object

Type
Gitana.Repository

getRepositoryId()

Gets the Gitana Repository id.

Inherited From:
Source:
Returns:

The Gitana Repository id

Type
String

getSystemMetadata()

Hands back the system metadata for this object.

Inherited From:
Source:
Returns:

system metadata

Type
Gitana.SystemMetadata

getTitle()

The title for the object.

Inherited From:
Source:
Returns:

the title

Type
String

getType()

Inherited From:
Overrides:
Source:

getTypeQName()

Gets the type QName for this node.

Inherited From:
Source:
Returns:

the type qname of this node.

Type
String

getUri()

Inherited From:
Source:

grantAuthority(principal, authorityId)

Grants an authority to a principal against this object.

Parameters:
Name Type Description
principal Gitana.Principal | String

the principal or the principal id

authorityId String

the id of the authority

Overrides:
Source:

handleResponse(response)

Parameters:
Name Type Description
response
Inherited From:
Source:

handleSystemProperties()

Gets called after the response is handled and allows the object to pull out special values from
the "object" field so that they don't sit on the JSON object

Inherited From:
Source:

hasFeature(featureId [, Function])

Indicates whether this node has the given feature.

Parameters:
Name Type Argument Description
featureId String

the id of the feature

Function <optional>

callback optional callback to receive result (for chaining)

Inherited From:
Source:
Returns:

whether this node has this feature

Type
Boolean

importArchive(settings [, Function])

Imports an archive.

Parameters:
Name Type Argument Description
settings Object
Function <optional>

reportFn

Inherited From:
Source:

incomingAssociations( [type] [, pagination])

Retrieves all of the incoming association objects for this node.

Parameters:
Name Type Argument Description
type String <optional>

the type of association

pagination Object <optional>
Source:

isAssociation()

Indicates whether the current object is an association.

Inherited From:
Source:
Returns:

whether this node is an association

Type
Boolean

isContainer()

Indicates whether this node has the "f:container" feature

Inherited From:
Source:
Returns:

whether this node has the "f:container" feature

Type
Boolean

json()

Hands back a cleanup, properties-only JSON simple object.

Inherited From:
Source:

listAuthorities(principal)

Retrieve list of authorities and pass into chaining method.

Parameters:
Name Type Description
principal Gitana.Principal | String

the principal or the principal id

Overrides:
Source:

listChildren( [object])

Acquires the "child nodes" of this node. This is done by fetching all of the nodes that are outgoing-associated to this
node with a association of type "a:child".

Parameters:
Name Type Argument Description
object <optional>

pagination

Source:

listRelatives(config [, pagination])

Acquires the relatives of this node.

Parameters:
Name Type Argument Description
config Object
pagination Object <optional>
Source:

listTranslations(edition [, pagination])

Acquires all of the translations for a master node.

Parameters:
Name Type Argument Description
edition String
pagination Object <optional>
Source:

loadACL()

Retrieve full ACL and pass into chaining method.

Overrides:
Source:

loadAuthorityGrants(principalIds, callback)

Loads the authority grants for a given set of principals.

Parameters:
Name Type Description
principalIds Array
callback function
Overrides:
Source:

loadFrom(anotherObject)

Helper method that loads this object from another object of the same type.

For example, loading a node from another loaded node.

Parameters:
Name Type Description
anotherObject
Inherited From:
Source:

loadTree(config, callback)

Retrieves a tree structure for nested folders starting at this node (as the root).

Parameters:
Name Type Description
config Object

{ "leafPath": "", "basePath": "", "containers": true, "depth": integer, "properties": true|false, "query": {}, "search": {} }

callback function

the callback function to be passed the resulting tree object structure

Source:

locales(edition, callback)

Lists all of the locales for the given edition of this master node.
Passes them into the next function in the chain.

Parameters:
Name Type Description
edition String

the edition

callback function
Source:

lock()

Locks a node

Source:

mount(mountKey)

Mounts a node

Parameters:
Name Type Description
mountKey String

the mount key

Source:

moveToFolder(targetFolder)

Moves this node to another folder.

Parameters:
Name Type Description
targetFolder

either a node or a node ID

Source:

outgoingAssociations( [type] [, pagination])

Retrieves all of the outgoing association objects for this node.

Parameters:
Name Type Argument Description
type String <optional>

the type of association

pagination Object <optional>
Source:

queryRelatives(query, config [, pagination])

Queries for relatives of this node.

Parameters:
Name Type Argument Description
query Object
config Object
pagination Object <optional>
Source:

readTranslation( [edition], locale)

Reads a translation node of the current master node into a given locale and optional edition.
If an edition isn't provided, the tip edition from the master node is assumed.

Parameters:
Name Type Argument Description
edition String <optional>

The edition of the translation to use. If not provided, the tip edition is used from the master node.

locale String

The locale to translate into.

Source:

ref()

Inherited From:
Source:
Returns:

a string denoting a reference to this object.

Type
String

refresh()

Refreshes the node. This allows the node to reindex and regenerate any renditions it may
have associated with it.

Inherited From:
Source:

reload()

Reload

Inherited From:
Source:

removeFeature(featureId)

Removes a feature from this node.

Parameters:
Name Type Description
featureId String

the id of the feature

Inherited From:
Source:

replacePropertiesWith(object)

Replaces all of the properties of this object with those of the given object.
This method should be used to update the state of this object.

Any functions from the incoming object will not be copied.

Parameters:
Name Type Description
object Object

object containing the properties

Inherited From:
Source:

resolvePath(rootNodeId, callback)

Resolves the path to this node relative to the given root node.

Parameters:
Name Type Description
rootNodeId String
callback function
Source:
Returns:
Type
*

revokeAllAuthorities(principal)

Revokes all authorities for a principal against the server.

Parameters:
Name Type Description
principal Gitana.Principal | String

the principal or the principal id

Overrides:
Source:

revokeAuthority(principal, authorityId)

Revokes an authority from a principal against this object.

Parameters:
Name Type Description
principal Gitana.Principal | String

the principal or the principal id

authorityId String

the id of the authority

Overrides:
Source:

set(key, value)

Set a json property

Parameters:
Name Type Description
key
value
Inherited From:
Source:

stats()

Hands back the stats.

Inherited From:
Source:

stringify(pretty)

Helper function to convert the object portion to JSON

Parameters:
Name Type Description
pretty
Inherited From:
Source:

touch()

Touches the node.

Inherited From:
Source:

traverse(config)

Traverses around the node and returns any nodes found to be connected on the graph.

Example config:

{
"associations": {
"a:child": "MUTUAL",
"a:knows": "INCOMING",
"a:related": "OUTGOING"
},
"depth": 1,
"types": [ "custom:type1", "custom:type2" ]
}

Parameters:
Name Type Description
config Object

configuration for the traversal

Source:

unassociate(targetNode [, type] [, undirected])

Unassociates a target node from this node.

Parameters:
Name Type Argument Description
targetNode String | Node

the id of the target node or the target node itself

type String <optional>

A string identifying the type of association

undirected Boolean <optional>

whether the association is undirected (i.e. mutual)

Source:

unlock()

Unlocks a node

Source:

unmount()

Unmounts a node

Source:

update()

Update

Inherited From:
Source: