@@ -9244,7 +9244,7 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
92449244 return this.getUri() + "/teams/" + teamKey;
92459245 };
92469246
9247- var chainable = this.getFactory().team(this.getPlatform (), this);
9247+ var chainable = this.getFactory().team(this.getCluster (), this);
92489248 return this.chainGet(chainable, uriFunction);
92499249 },
92509250
@@ -9286,7 +9286,7 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
92869286
92879287 var self = this;
92889288
9289- var chainable = this.getFactory().team(this.getPlatform (), this);
9289+ var chainable = this.getFactory().team(this.getCluster (), this);
92909290 return this.chainPostResponse(chainable, uriFunction, {}, object).then(function() {
92919291
92929292 var chain = this;
@@ -11225,11 +11225,16 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
1122511225 /**
1122611226 * @returns {String} the type id of the job
1122711227 */
11228- getType : function()
11228+ getJobType : function()
1122911229 {
1123011230 return this.get("type");
1123111231 },
1123211232
11233+ getType: function()
11234+ {
11235+ return Gitana.TypedIDConstants.TYPE_JOB;
11236+ },
11237+
1123311238 /**
1123411239 * @returns {String} the id of the principal that this job will run as
1123511240 */
@@ -17990,7 +17995,7 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
1799017995 return this.getUri() + "/teams/" + teamKey;
1799117996 };
1799217997
17993- var chainable = this.getFactory().team(this.getPlatform (), this);
17998+ var chainable = this.getFactory().team(this.getCluster (), this);
1799417999 return this.chainGet(chainable, uriFunction);
1799518000 },
1799618001
@@ -18038,7 +18043,7 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
1803818043
1803918044 var self = this;
1804018045
18041- var chainable = this.getFactory().team(this.getPlatform (), this);
18046+ var chainable = this.getFactory().team(this.getCluster (), this);
1804218047 return this.chainPostResponse(chainable, uriFunction, {}, object).then(function() {
1804318048
1804418049 var chain = this;
@@ -29925,6 +29930,40 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
2992529930 "_docs": nodeIds
2992629931 });
2992729932 },
29933+
29934+ /**
29935+ * Moves the nodes described by the given array to the configured target node
29936+ *
29937+ * @hcained branch
29938+ *
29939+ * @param sourceNodeIds array of nodes to delete
29940+ * @param targetNodeId id of move target. Default is "root":
29941+ * @param targetPath optional relative path to targetNodeId for moving to a relative subdirectory
29942+ *
29943+ * @returns Gitana.Branch
29944+ */
29945+ moveNodes: function(sourceNodeIds, targetNodeId, targetPath)
29946+ {
29947+ var self = this;
29948+
29949+ var uriFunction = function()
29950+ {
29951+ return self.getUri() + "/movenodes"
29952+ }
29953+
29954+ if (!targetNodeId) targetNodeId = "root";
29955+
29956+ var payload = {};
29957+ if (targetPath)
29958+ {
29959+ payload.targetPath = targetPath;
29960+ }
29961+
29962+ payload.sourceNodeIds = sourceNodeIds;
29963+ payload.targetNodeId = targetNodeId;
29964+
29965+ return this.chainPost(this, uriFunction, {}, payload);
29966+ },
2992829967
2992929968 /**
2993029969 * Performs a bulk check of permissions against permissioned objects of type node.
@@ -30960,6 +30999,35 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
3096030999 return this.chainPostEmpty(null, uriFunction);
3096131000 },
3096231001
31002+ /**
31003+ * Starts a job to purge all deletions
31004+ *
31005+ * @param callback
31006+ */
31007+ startPurgeAllDeletions: function(callback)
31008+ {
31009+ var self = this;
31010+
31011+ if (typeof(options) === "function") {
31012+ callback = options;
31013+ options = null;
31014+ }
31015+
31016+ var params = {};
31017+
31018+ var uriFunction = function()
31019+ {
31020+ return self.getUri() + "/deletions/purgeall/start";
31021+ };
31022+
31023+ return this.chainPostResponse(this, uriFunction, params).then(function(response) {
31024+
31025+ var jobId = response._doc;
31026+
31027+ callback(jobId);
31028+ });
31029+ },
31030+
3096331031 /**
3096431032 * Archives the branch.
3096531033 *
@@ -31070,7 +31138,100 @@ Gitana.OAuth2Http.TOKEN_METHOD = "POST";
3107031138
3107131139 callback(jobId);
3107231140 });
31073- }
31141+ },
31142+
31143+ //////////////////////////////////////////////////////////////////////////////////////////
31144+ //
31145+ // TEAMABLE
31146+ //
31147+ //////////////////////////////////////////////////////////////////////////////////////////
31148+
31149+ /**
31150+ * Reads a team.
31151+ *
31152+ * @param teamKey
31153+ *
31154+ * @chainable team
31155+ */
31156+ readTeam: function(teamKey)
31157+ {
31158+ var uriFunction = function()
31159+ {
31160+ return this.getUri() + "/teams/" + teamKey;
31161+ };
31162+
31163+ var chainable = this.getFactory().team(this.getCluster(), this);
31164+ return this.chainGet(chainable, uriFunction);
31165+ },
31166+
31167+ /**
31168+ * Lists teams.
31169+ *
31170+ * @chainable map of teams
31171+ */
31172+ listTeams: function()
31173+ {
31174+ var uriFunction = function()
31175+ {
31176+ return this.getUri() + "/teams";
31177+ };
31178+
31179+ var chainable = this.getFactory().teamMap(this.getCluster(), this);
31180+ return this.chainGet(chainable, uriFunction);
31181+ },
31182+
31183+ /**
31184+ * Creates a team.
31185+ *
31186+ * @param teamKey
31187+ * @param object
31188+ *
31189+ * @chainable team
31190+ */
31191+ createTeam: function(teamKey, object)
31192+ {
31193+ if (!object)
31194+ {
31195+ object = {};
31196+ }
31197+
31198+ var uriFunction = function()
31199+ {
31200+ return this.getUri() + "/teams?key=" + teamKey;
31201+ };
31202+
31203+ var self = this;
31204+
31205+ var chainable = this.getFactory().team(this.getCluster(), this);
31206+ return this.chainPostResponse(chainable, uriFunction, {}, object).then(function() {
31207+
31208+ var chain = this;
31209+
31210+ Chain(self).readTeam(teamKey).then(function() {
31211+ chain.handleResponse(this);
31212+ chain.next();
31213+ });
31214+
31215+ // we manually advance the chain
31216+ return false;
31217+ });
31218+ },
31219+
31220+ /**
31221+ * Gets the owners team
31222+ *
31223+ * @chained team
31224+ */
31225+ readOwnersTeam: function()
31226+ {
31227+ return this.readTeam("owners");
31228+ },
31229+
31230+ //////////////////////////////////////////////////////////////////////////////////////////
31231+ //
31232+ // END OF TEAMABLE
31233+ //
31234+ //////////////////////////////////////////////////////////////////////////////////////////
3107431235
3107531236 });
3107631237
0 commit comments