# Class: Cluster

## Gitana. Cluster

Cluster

#### new Cluster(driver, Object)

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `driver` | Gitana.Driver |  |
  `Object` |  | <optional> | object json object (if no callback required for populating)

  Source:
    - cluster/Cluster.js, line 17

### Extends

- Gitana.DataStore

### 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:
    - Gitana.Chainable#__copyState
  Source:
    - Chainable.js, line 25

#### chainCopyState(otherObject)

  Override to include:

  __system

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `otherObject` |  |

  Inherited From:
    - Gitana.AbstractObject#chainCopyState
  Source:
    - AbstractObject.js, line 149

#### 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:
    - Gitana.Chainable#chainCreate
  Source:
    - Chainable.js, line 135

#### 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:
    - Gitana.Chainable#chainCreateEx
  Source:
    - Chainable.js, line 177

#### 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:
    - Gitana.AbstractObject#chainDelete
  Source:
    - AbstractObject.js, line 43

#### 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:
    - Gitana.Chainable#chainGet
  Source:
    - Chainable.js, line 101

#### 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:
    - Gitana.Chainable#chainGetResponse
  Source:
    - Chainable.js, line 338

#### 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:
    - Gitana.Chainable#chainGetResponseRows
  Source:
    - Chainable.js, line 401

#### 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:
    - Gitana.Chainable#chainGetResponseText
  Source:
    - Chainable.js, line 369

#### 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:
    - Gitana.Chainable#chainHasResponseRow
  Source:
    - Chainable.js, line 418

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

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

  Inherited From:
    - Gitana.Chainable#chainPost
  Source:
    - Chainable.js, line 222

#### 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:
    - Gitana.Chainable#chainPostEmpty
  Source:
    - Chainable.js, line 258

#### 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:
    - Gitana.Chainable#chainPostResponse
  Source:
    - Chainable.js, line 441

#### chainReload(uri, params)

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

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `uri` |  |
  `params` |  |

  Inherited From:
    - Gitana.AbstractObject#chainReload
  Source:
    - AbstractObject.js, line 74

#### 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:
    - Gitana.AbstractObject#chainUpdate
  Source:
    - AbstractObject.js, line 107

#### 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:
    - Gitana.Chainable#chainUpload
  Source:
    - Chainable.js, line 299

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

  Inherited From:
    - Gitana.DataStore#checkAuthority
  Source:
    - DataStore.js, line 105

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

  Inherited From:
    - Gitana.DataStore#checkPermission
  Source:
    - DataStore.js, line 204

#### clone()

  Source:
    - cluster/Cluster.js, line 43

#### createRole(roleKey, object)

  Creates a role.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `roleKey` |  |
  `object` |  |

  Inherited From:
    - Gitana.DataStore#createRole
  Source:
    - DataStore.js, line 452

#### createTeam(teamKey, object)

  Creates a team.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `teamKey` |  |
  `object` |  |

  Inherited From:
    - Gitana.DataStore#createTeam
  Source:
    - DataStore.js, line 275

#### 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:
    - Gitana.Chainable#extractPrincipalDomainQualifiedId
  Source:
    - Chainable.js, line 472

#### 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:
    - Gitana.Chainable#extractPrincipalIdentifiers
  Source:
    - Chainable.js, line 486

#### get(key)

  Get a json property

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `key` |  |

  Inherited From:
    - Gitana.AbstractObject#get
  Source:
    - AbstractObject.js, line 198

#### getDescription() → {String}

  The description for the object.

  Inherited From:
    - Gitana.AbstractObject#getDescription
  Source:
    - AbstractObject.js, line 257

  ##### Returns:

  the description

  Type
    String

#### getId() → {String}

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

  Inherited From:
    - Gitana.AbstractObject#getId
  Source:
    - AbstractObject.js, line 221

  ##### Returns:

  id

  Type
    String

#### getProxiedUri()

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

  Inherited From:
    - Gitana.AbstractObject#getProxiedUri
  Source:
    - AbstractObject.js, line 188

#### getSystemMetadata() → {Gitana.SystemMetadata}

  Hands back the system metadata for this object.

  Inherited From:
    - Gitana.AbstractObject#getSystemMetadata
  Source:
    - AbstractObject.js, line 233

  ##### Returns:

  system metadata

  Type
    Gitana.SystemMetadata

#### getTitle() → {String}

  The title for the object.

  Inherited From:
    - Gitana.AbstractObject#getTitle
  Source:
    - AbstractObject.js, line 245

  ##### Returns:

  the title

  Type
    String

#### getType()

  Source:
    - cluster/Cluster.js, line 35

#### getUri()

  Source:
    - cluster/Cluster.js, line 27

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

  Inherited From:
    - Gitana.DataStore#grantAuthority
  Source:
    - DataStore.js, line 127

#### handleResponse(response)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `response` |  |

  Inherited From:
    - Gitana.AbstractPersistable#handleResponse
  Source:
    - AbstractPersistable.js, line 36

#### handleSystemProperties()

  Inherited From:
    - Gitana.AbstractObject#handleSystemProperties
  Source:
    - AbstractObject.js, line 310

#### json()

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

  Inherited From:
    - Gitana.AbstractPersistable#json
  Source:
    - AbstractPersistable.js, line 66

#### killJob(jobId)

  Kills a job

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `jobId` | String |

  Source:
    - cluster/Cluster.js, line 118

#### listActivities(Object)

  Lists activities.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `Object` |  | <optional> | pagination pagination (optional)

  Inherited From:
    - Gitana.DataStore#listActivities
  Source:
    - DataStore.js, line 336

#### listAuthorities(principal, callback)

  Retrieve list of authorities and pass into chaining method.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `principal` | Gitana.Principal | String | the principal or the principal id
  `callback` |  |

  Inherited From:
    - Gitana.DataStore#listAuthorities
  Source:
    - DataStore.js, line 81

#### listRoles(inherited)

  Lists roles.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `inherited` |  | whether to draw from inherited role containers

  Inherited From:
    - Gitana.DataStore#listRoles
  Source:
    - DataStore.js, line 426

#### listTeams()

  Lists teams.

  Inherited From:
    - Gitana.DataStore#listTeams
  Source:
    - DataStore.js, line 256

#### loadACL(callback)

  Retrieve full ACL and pass into chaining method.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` |  |

  Inherited From:
    - Gitana.DataStore#loadACL
  Source:
    - DataStore.js, line 61

#### loadAuthorityGrants(callback)

  Loads the authority grants for a given set of principals.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` |  |

  Inherited From:
    - Gitana.DataStore#loadAuthorityGrants
  Source:
    - DataStore.js, line 178

#### loadContainedTypes(type, callback)

  Loads the contained types for a type as a string array and passes it into a callback function.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` |  |
  `callback` |  |

  Source:
    - cluster/Cluster.js, line 55

  ##### Returns:

  this

#### 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:
    - Gitana.AbstractObject#loadFrom
  Source:
    - AbstractObject.js, line 342

#### queryActivities(query, Object)

  Queries for activities.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `query` | Object |  | query.
  `Object` |  | <optional> | pagination pagination (optional)

  Inherited From:
    - Gitana.DataStore#queryActivities
  Source:
    - DataStore.js, line 370

#### queryFailedJobs(query, Object)

  Queries for failed jobs.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `query` | Object |  | Query for finding a job.
  `Object` |  | <optional> | pagination pagination (optional)

  Source:
    - cluster/Cluster.js, line 175

#### queryFinishedJobs(query, Object)

  Queries for finished jobs.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `query` | Object |  | Query for finding a job.
  `Object` |  | <optional> | pagination pagination (optional)

  Source:
    - cluster/Cluster.js, line 219

#### queryJobs(query, Object)

  Queries for jobs.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `query` | Object |  | Query for finding a job.
  `Object` |  | <optional> | pagination pagination (optional)

  Source:
    - cluster/Cluster.js, line 83

#### queryRunningJobs(query, Object)

  Queries for running jobs.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `query` | Object |  | Query for finding a job.
  `Object` |  | <optional> | pagination pagination (optional)

  Source:
    - cluster/Cluster.js, line 153

#### queryUnstartedJobs(query, Object)

  Queries for unstarted jobs.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `query` | Object |  | Query for finding a job.
  `Object` |  | <optional> | pagination pagination (optional)

  Source:
    - cluster/Cluster.js, line 131

#### queryWaitingJobs(query, Object)

  Queries for waiting jobs.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `query` | Object |  | Query for finding a job.
  `Object` |  | <optional> | pagination pagination (optional)

  Source:
    - cluster/Cluster.js, line 197

#### readActivity(activityId)

  Read an activity.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `activityId` | String | the activity id

  Inherited From:
    - Gitana.DataStore#readActivity
  Source:
    - DataStore.js, line 356

#### readJob(jobId)

  Read a job.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `jobId` | String |

  Source:
    - cluster/Cluster.js, line 104

#### readOwnersTeam()

  Gets the owners team

  Inherited From:
    - Gitana.DataStore#readOwnersTeam
  Source:
    - DataStore.js, line 309

#### readRole(roleKeyOrId, inherited)

  Reads a role.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `roleKeyOrId` |  |
  `inherited` |  | whether to check inherited role containers

  Inherited From:
    - Gitana.DataStore#readRole
  Source:
    - DataStore.js, line 401

#### readTeam(teamKey)

  Reads a team.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `teamKey` |  |

  Inherited From:
    - Gitana.DataStore#readTeam
  Source:
    - DataStore.js, line 240

#### <abstract> ref() → {String}

  Inherited From:
    - Gitana.DataStore#ref
  Source:
    - DataStore.js, line 43

  ##### Returns:

  a string denoting a reference to this datastore

  Type
    String

#### 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:
    - Gitana.AbstractObject#replacePropertiesWith
  Source:
    - AbstractObject.js, line 280

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

  Inherited From:
    - Gitana.DataStore#revokeAllAuthorities
  Source:
    - DataStore.js, line 166

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

  Inherited From:
    - Gitana.DataStore#revokeAuthority
  Source:
    - DataStore.js, line 147

#### set(key, value)

  Set a json property

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `key` |  |
  `value` |  |

  Inherited From:
    - Gitana.AbstractObject#set
  Source:
    - AbstractObject.js, line 209

#### stringify(pretty)

  Helper function to convert the object portion to JSON

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pretty` |  |

  Inherited From:
    - Gitana.AbstractObject#stringify
  Source:
    - AbstractObject.js, line 330