# Class: TraversalResults

## Gitana. TraversalResults

Provides access to traversal results

#### new TraversalResults(branch, Object)

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `branch` | Gitana.Branch |  |
  `Object` |  | <optional> | object

  Source:
    - repository/TraversalResults.js, line 17

### Extends

- Gitana.AbstractPersistable

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

#### association(id)

  Hands back a single association.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `id` |  |

  Source:
    - repository/TraversalResults.js, line 234

#### associationCount(callback)

  Counts the number of associations in teh traversal results

  ##### Parameters:

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

  Source:
    - repository/TraversalResults.js, line 146

#### associations()

  Hands back a map of all of the associations in the traversal results

  Source:
    - repository/TraversalResults.js, line 207

#### center()

  Looks up the node around which this traversal is centered.

  Source:
    - repository/TraversalResults.js, line 115

#### chainCopyState(otherObject)

  Used internally during chain copy going forward or backward through the chain.

  This is wired into the Chain.__copyState method and allows a convenient way to override chain copy behavior on a per-object-type basis.

  ##### Parameters:

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

  Inherited From:
    - Gitana.Chainable#chainCopyState
  Source:
    - Chainable.js, line 542

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

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

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

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

#### getBranch() → {Gitana.Branch}

  Gets the Gitana Branch object.

  Source:
    - repository/TraversalResults.js, line 66

  ##### Returns:

  The Gitana Branch object

  Type
    Gitana.Branch

#### getBranchId() → {String}

  Gets the Gitana Branch id.

  Source:
    - repository/TraversalResults.js, line 75

  ##### Returns:

  The Gitana Branch id

  Type
    String

#### getRepository() → {Gitana.Repository}

  Gets the Gitana Repository object.

  Source:
    - repository/TraversalResults.js, line 48

  ##### Returns:

  The Gitana Repository object

  Type
    Gitana.Repository

#### getRepositoryId() → {String}

  Gets the Gitana Repository id.

  Source:
    - repository/TraversalResults.js, line 57

  ##### Returns:

  The Gitana Repository id

  Type
    String

#### handleResponse(response)

  ##### Parameters:

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

  Source:
    - repository/TraversalResults.js, line 95

#### 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:
    - Gitana.AbstractPersistable#handleSystemProperties
  Source:
    - AbstractPersistable.js, line 57

#### json()

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

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

#### node(nodeId)

  Hands back a single node

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nodeId` |  |

  Source:
    - repository/TraversalResults.js, line 185

#### nodeCount(callback)

  Counts the number of nodes in the traversal results

  ##### Parameters:

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

  Source:
    - repository/TraversalResults.js, line 134

#### nodes()

  Hands back a map of all of the nodes in the traversal results

  Source:
    - repository/TraversalResults.js, line 158