# Class: JobMap

## Gitana. JobMap

Map of jobs

#### new JobMap(cluster, Object)

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `cluster` | Gitana.Cluster |  | Gitana cluster instance.
  `Object` |  | <optional> | object

  Source:
    - cluster/JobMap.js, line 17

### Extends

- Gitana.AbstractMap

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

#### buildObject(json)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `json` |  |

  Source:
    - cluster/JobMap.js, line 46

#### chainCopyState(otherObject)

  Override to include:

  keys totalRows size offset

  ##### Parameters:

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

  Inherited From:
    - Gitana.AbstractMap#chainCopyState
  Source:
    - AbstractMap.js, line 109

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

#### clone()

  Source:
    - cluster/JobMap.js, line 38

#### count()

  Counts the number of elements in the map and fires it into a callback function.

  Inherited From:
    - Gitana.AbstractMap#count
  Source:
    - AbstractMap.js, line 585

#### each(callback)

  Iterates over the map and fires the callback function in SERIAL for each element in the map. The scope for the callback is the object from the map (i.e. repository object, node object).

  The arguments to the callback function are (key, value) where value is the same as "this".

  NOTE: This works against elements in the map in SERIAL. One at a time. If you are doing concurrent remote operations for members of the set such that each operation is independent, you may want to use the eachX() method.

  ##### Parameters:

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

  Inherited From:
    - Gitana.AbstractMap#each
  Source:
    - AbstractMap.js, line 318

#### eachX(callback)

  Iterates over the map and fires the callback function in PARALLEL for each element in the map. The scope for the callback is the object from the map (i.e. repository object, node object).

  The arguments to the callback function are (key, value) where value is the same as "this".

  NOTE: This works against elements in the map in PARALLEL. All map members are fired against at the same time on separate timeouts. There is no guaranteed order for their completion. If you require serial execution, use the each() method.

  ##### Parameters:

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

  Inherited From:
    - Gitana.AbstractMap#eachX
  Source:
    - AbstractMap.js, line 367

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

#### filter(callback)

  Iterates over the map and applies the callback filter function to each element. It should hand back true if it wants to keep the value and false to remove it.

  NOTE: the "this" for the callback is the object from the map.

  ##### Parameters:

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

  Inherited From:
    - Gitana.AbstractMap#filter
  Source:
    - AbstractMap.js, line 412

#### handleResponse(response)

  ##### Parameters:

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

  Inherited From:
    - Gitana.AbstractMap#handleResponse
  Source:
    - AbstractMap.js, line 152

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

#### keepOne()

  Keeps the first element in the map

  Inherited From:
    - Gitana.AbstractMap#keepOne
  Source:
    - AbstractMap.js, line 600

#### limit(size)

  Limits the number of elements in the map.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `size` |  |

  Inherited From:
    - Gitana.AbstractMap#limit
  Source:
    - AbstractMap.js, line 500

#### paginate(pagination)

  Paginates elements in the map.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pagination` |  |

  Inherited From:
    - Gitana.AbstractMap#paginate
  Source:
    - AbstractMap.js, line 546

#### select(key)

  Selects an individual element from the map and continues the chain.

  ##### Parameters:

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

  Inherited From:
    - Gitana.AbstractMap#select
  Source:
    - AbstractMap.js, line 658

#### sort(comparator)

  Applies a comparator to sort the map.

  If no comparator is applied, the map will be sorted by its modification timestamp (if possible).

  The comparator can be a string that uses dot-notation to identify a field in the JSON that should be sorted. (example: "title" or "property1.property2.property3")

  Finally, the comparator can be a function. It takes (previousValue, currentValue) and hands back: -1 if the currentValue is less than the previousValue (should be sorted lower) 0 if they are equivalent 1 if they currentValue is greater than the previousValue (should be sorted higher)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `comparator` |  |

  Inherited From:
    - Gitana.AbstractMap#sort
  Source:
    - AbstractMap.js, line 469