Class: Repository

Gitana. Repository

Repository


new Repository(platform [, Object])

Parameters:
Name Type Argument Description
platform Gitana.Platform
Object <optional>

object json object (if no callback required for populating)

Source:

Extends

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:

chainCopyState(otherObject)

Override to include:

__system

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)

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

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:
Source:

checkBranchAuthorities(checks, callback)

Performs a bulk check of authorities against permissioned objects of type branch.

Example of checks array:

[{
"permissionedId": "",
"principalId": "",
"authorityId": ""
}]

The callback receives an array of results, example:

[{
"permissionedId": "",
"principalId": "",
"authorityId": "",
"result": true
}]

The order of elements in the array will be the same for checks and results.

Parameters:
Name Type Description
checks
callback
Source:

checkBranchPermissions(checks, callback)

Performs a bulk check of permissions against permissioned objects of type branch.

Example of checks array:

[{
"permissionedId": "",
"principalId": "",
"permissionId": ""
}]

The callback receives an array of results, example:

[{
"permissionedId": "",
"principalId": "",
"permissionId": "",
"result": true
}]

The order of elements in the array will be the same for checks and results.

Parameters:
Name Type Description
checks
callback
Source:

checkConflictAuthorities(checks, callback)

Performs a bulk check of authorities against permissioned objects of type release.

Example of checks array:

[{
"permissionedId": "",
"principalId": "",
"authorityId": ""
}]

The callback receives an array of results, example:

[{
"permissionedId": "",
"principalId": "",
"authorityId": "",
"result": true
}]

The order of elements in the array will be the same for checks and results.

Parameters:
Name Type Description
checks
callback
Source:

checkConflictPermissions(checks, callback)

Performs a bulk check of permissions against permissioned objects of type release.

Example of checks array:

[{
"permissionedId": "",
"principalId": "",
"permissionId": ""
}]

The callback receives an array of results, example:

[{
"permissionedId": "",
"principalId": "",
"permissionId": "",
"result": true
}]

The order of elements in the array will be the same for checks and results.

Parameters:
Name Type Description
checks
callback
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
Inherited From:
Source:

checkReleaseAuthorities(checks, callback)

Performs a bulk check of authorities against permissioned objects of type release.

Example of checks array:

[{
"permissionedId": "",
"principalId": "",
"authorityId": ""
}]

The callback receives an array of results, example:

[{
"permissionedId": "",
"principalId": "",
"authorityId": "",
"result": true
}]

The order of elements in the array will be the same for checks and results.

Parameters:
Name Type Description
checks
callback
Source:

checkReleasePermissions(checks, callback)

Performs a bulk check of permissions against permissioned objects of type release.

Example of checks array:

[{
"permissionedId": "",
"principalId": "",
"permissionId": ""
}]

The callback receives an array of results, example:

[{
"permissionedId": "",
"principalId": "",
"permissionId": "",
"result": true
}]

The order of elements in the array will be the same for checks and results.

Parameters:
Name Type Description
checks
callback
Source:

clone()

Source:

copy(target, asynchronous, config)

Copies this object into the target.

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

copyFrom(sourceBranchId, targetBranchId, config)

Copies nodes from the source branch to the target branch

Parameters:
Name Type Description
sourceBranchId String
targetBranchId String
config Object
Source:

createBranch(branchId, changesetId [, Object])

Creates a branch.

Parameters:
Name Type Argument Description
branchId String

identifies the branch from which the new branch will be forked.

changesetId String

identifies the changeset on the branch which serves as the root changeset that
the new branch will be founded upon.

Object <optional>

object JSON object for the branch

Source:

createRelease( [Object] [, String])

Creates a release.

Parameters:
Name Type Argument Description
Object <optional>

object JSON object for the release

String <optional>

sourceId optional id of the source release that should be copied

Source:

createRole(roleKey, object)

Creates a role.

Parameters:
Name Type Description
roleKey
object
Inherited From:
Source:

createSnapshot(changesetId, object)

Creates a snapshot at a given changeset within the repository.

Parameters:
Name Type Description
changesetId
object
Source:

createTeam(teamKey, object)

Creates a team.

Parameters:
Name Type Description
teamKey
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:

findStack(datastoreType, datastoreId)

Finds the stack for this data store.

Parameters:
Name Type Description
datastoreType
datastoreId
Inherited From:
Source:

get(key)

Get a json property

Parameters:
Name Type Description
key
Inherited From:
Source:

getDescription()

The description for the object.

Inherited From:
Source:
Returns:

the description

Type
String

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:

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:

getUri()

Inherited From:
Overrides:
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

Inherited From:
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:

json()

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

Inherited From:
Source:

listActivities( [Object])

Lists activities.

Parameters:
Name Type Argument Description
Object <optional>

pagination pagination (optional)

Inherited From:
Source:

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:
Source:

listBranches( [Object])

List the branches.

Parameters:
Name Type Argument Description
Object <optional>

pagination

Source:

listChangesetChildren(changesetId)

Acquires a list of the child changesets for a given changeset.

Parameters:
Name Type Description
changesetId String

the id of the changeset

Source:

listChangesetParents(changesetId)

Acquires a list of the parent changesets for a given changeset.

Parameters:
Name Type Description
changesetId String

the id of the changeset

Source:

listChangesets()

List the changesets in this repository.

Source:

listConflicts( [Object])

List the merge conflicts.

Parameters:
Name Type Argument Description
Object <optional>

pagination

Source:

listMerges(sourceBranchId, mergeType)

Lists the branches with which this branch has merge conflicts.

Parameters:
Name Type Description
sourceBranchId
mergeType

Either "outgoing" or "incoming"

Source:

listPullSources(branchId [, Object])

Lists the branches that can be pulled into a given branch

Parameters:
Name Type Argument Description
branchId String
Object <optional>

pagination

Source:

listReleases( [Object])

List the releases.

Parameters:
Name Type Argument Description
Object <optional>

pagination

Source:

listRoles(inherited)

Lists roles.

Parameters:
Name Type Description
inherited

whether to draw from inherited role containers

Inherited From:
Source:

listTeams()

Lists teams.

Inherited From:
Source:

loadACL(callback)

Retrieve full ACL and pass into chaining method.

Parameters:
Name Type Description
callback
Inherited From:
Source:

loadAuthorityGrants(callback)

Loads the authority grants for a given set of principals.

Parameters:
Name Type Description
callback
Inherited From:
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:

loadInfo(callback)

Loads information about the datastore.

Parameters:
Name Type Description
callback
Inherited From:
Source:

queryActivities(query [, Object])

Queries for activities.

Parameters:
Name Type Argument Description
query Object

query.

Object <optional>

pagination pagination (optional)

Inherited From:
Source:

queryBranches(query [, Object])

Queries for branches.

Config should be:

{
Gitana query configs
}

Parameters:
Name Type Argument Description
query Object
Object <optional>

pagination

Source:

queryChangesets(query [, Object])

Queries for changesets.

Config should be:

{
Gitana query configs
}

Parameters:
Name Type Argument Description
query Object
Object <optional>

pagination

Source:

queryConflicts(query [, Object])

Queries for merge conflicts.

Config should be:

{
Gitana query configs
}

Parameters:
Name Type Argument Description
query Object
Object <optional>

pagination

Source:

queryReleases(query [, Object])

Queries for releases.

Config should be:

{
Gitana query configs
}

Parameters:
Name Type Argument Description
query Object
Object <optional>

pagination

Source:

readActivity(activityId)

Read an activity.

Parameters:
Name Type Description
activityId String

the activity id

Inherited From:
Source:

readBranch(branchId)

Reads a branch.

Parameters:
Name Type Description
branchId String

the branch id

Source:

readChangeset(changesetId)

Read a changeset.

Parameters:
Name Type Description
changesetId String

the id of the changeset

Source:

readConflict(conflictId)

Reads a merge conflict.

Parameters:
Name Type Description
conflictId String

the merge conflict id

Source:

readOwnersTeam()

Gets the owners team

Inherited From:
Source:

readRelease(releaseId)

Reads a release.

Parameters:
Name Type Description
releaseId String

the release id

Source:

readRole(roleKeyOrId, inherited)

Reads a role.

Parameters:
Name Type Description
roleKeyOrId
inherited

whether to check inherited role containers

Inherited From:
Source:

readTeam(teamKey)

Reads a team.

Parameters:
Name Type Description
teamKey
Inherited From:
Source:

ref()

Inherited From:
Source:
Returns:

a string denoting a reference to this platform 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:
Source:

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

Inherited From:
Source:

set(key, value)

Set a json property

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

startChanges(sourceBranchId, targetBranchId, view, callback)

Finds the changes that will be applied from a source branch to a target branch. Runs as a background Job

Parameters:
Name Type Description
sourceBranchId
targetBranchId
view
callback
Source:

startCreateRelease( [Object] [, String], callback)

Starts the creation of a new release.
This runs a background job to do the actual indexing and release creation.

Parameters:
Name Type Argument Description
Object <optional>

object JSON object

String <optional>

sourceId optional id of the source release that should be copied

callback
Source:

startDiff(sourceBranchId, targetBranchId)

Performs a diff between a source and target branch. Runs as a background Job

Parameters:
Name Type Description
sourceBranchId
targetBranchId
Source:

startMerge(sourceBranchId, targetBranchId)

Merges a branch into a target branch. Runs as a background Job

Parameters:
Name Type Description
sourceBranchId
targetBranchId
Source:

stringify(pretty)

Helper function to convert the object portion to JSON

Parameters:
Name Type Description
pretty
Inherited From:
Source: