diff --git a/lib/gitana.js b/lib/gitana.js index 7b64b00..fff411f 100644 --- a/lib/gitana.js +++ b/lib/gitana.js @@ -1,5 +1,5 @@ /* -Gitana JavaScript Driver - Version 1.0.225 +Gitana JavaScript Driver - Version 1.0.226 Copyright 2016 Gitana Software, Inc. @@ -2272,7 +2272,7 @@ if (typeof JSON !== 'object') { Gitana.requestCount = 0; // version of the driver - Gitana.VERSION = "1.0.225"; + Gitana.VERSION = "1.0.226"; // allow for optional global assignment // TODO: until we clean up the "window" variable reliance, we have to always set onto window again diff --git a/lib/gitana.min.js b/lib/gitana.min.js index 5e85ae2..d20d341 100644 --- a/lib/gitana.min.js +++ b/lib/gitana.min.js @@ -1 +1 @@ -(function(a,b){if(typeof exports==="object"){module.exports=b()}else{if(typeof define==="function"&&define.amd){define("gitana",[],b)}else{a.Gitana=b()}}}(this,function(){if(typeof window==="undefined"){window={setTimeout:function(func,milliseconds){setTimeout(func,milliseconds)}}}(function(name,global,definition){global[name]=definition()})("Base",this,function(){var Base=function(){};Base.extend=function(_instance,_static){var extend=Base.prototype.extend;Base._prototyping=true;var proto=new this();extend.call(proto,_instance);proto.base=function(){};delete Base._prototyping;var constructor=proto.constructor;var klass=proto.constructor=function(){if(!Base._prototyping){if(this._constructing||this.constructor===klass){this._constructing=true;constructor.apply(this,arguments);delete this._constructing}else{if(arguments[0]!==null){return(arguments[0].extend||extend).call(arguments[0],proto)}}}};klass.ancestor=this;klass.extend=this.extend;klass.forEach=this.forEach;klass.implement=this.implement;klass.prototype=proto;klass.toString=this.toString;klass.valueOf=function(type){return(type==="object")?klass:constructor.valueOf()};extend.call(klass,_static);if(typeof klass.init==="function"){klass.init()}return klass};Base.prototype={extend:function(source,value){if(arguments.length>1){var ancestor=this[source];if(ancestor&&(typeof value==="function")&&(!ancestor.valueOf||ancestor.valueOf()!==value.valueOf())&&/\bbase\b/.test(value)){var method=value.valueOf();value=function(){var previous=this.base||Base.prototype.base;this.base=ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue};value.valueOf=function(type){return(type==="object")?value:method};value.toString=Base.toString}this[source]=value}else{if(source){var extend=Base.prototype.extend;if(!Base._prototyping&&typeof this!=="function"){extend=this.extend||extend}var proto={toSource:null};var hidden=["constructor","toString","valueOf"];for(var i=Base._prototyping?0:1;i-1){var qs=url.substring(x1+1);url=url.substring(0,x1);var parts=qs.split("&");for(var x2=0;x2-1){url=url+"&"+paramKey+"="+paramValue}else{url=url+"?"+paramKey+"="+paramValue}}return this.ajax(method,url,contentType,data,headers,onSuccess,onFailure)},gitanaGet:function(url,params,headers,successCallback,failureCallback){return this.gitanaRequest("GET",url,params,"application/json",null,headers,successCallback,failureCallback)},gitanaDownload:function(url,params,successCallback,failureCallback){return this.gitanaRequest("GET",url,params,null,null,{},successCallback,failureCallback)},gitanaPost:function(url,params,jsonData,successCallback,failureCallback){return this.gitanaRequest("POST",url,params,"application/json",jsonData,{},successCallback,failureCallback)},gitanaUpload:function(url,params,contentType,data,successCallback,failureCallback){return this.gitanaRequest("POST",url,params,contentType,data,{},successCallback,failureCallback)},gitanaPut:function(url,params,jsonData,successCallback,failureCallback){return this.gitanaRequest("PUT",url,params,"application/json",jsonData,{},successCallback,failureCallback)},gitanaDelete:function(url,params,successCallback,failureCallback){return this.gitanaRequest("DELETE",url,params,"application/json",null,{},successCallback,failureCallback)},getFactory:function(){return new Gitana.ObjectFactory()},authenticate:function(settings,authFailureHandler){var driver=this;var config={code:null,redirectUri:null,username:null,password:null,accessToken:null,ticket:null,cookie:null,ticketMaxAge:null};Gitana.copyKeepers(config,Gitana.loadDefaultConfig());Gitana.copyKeepers(config,settings);var platformConfig={key:null,ticket:null,username:null,clientKey:null};Gitana.copyKeepers(platformConfig,this.getOriginalConfiguration());Gitana.copyKeepers(platformConfig,settings);var platformCacheKey=platformConfig.key;if(!platformCacheKey){platformCacheKey=Gitana.determinePlatformCacheKey(platformConfig,true)}if(platformCacheKey){this.platformCacheKey=platformCacheKey}var cluster=new Gitana.Cluster(this,{});var applyPlatformCache=function(driver,platform){var platformCacheKey=driver.platformCacheKey;if(platformCacheKey){Gitana.PLATFORM_CACHE(platformCacheKey,platform)}var ticket=driver.getAuthInfo().getTicket();if(ticket){Gitana.PLATFORM_CACHE(ticket,platform)}};var doAuthenticate=function(){var platform=this;if(!config.code&&!config.username&&!config.accessToken&&!config.cookie&&!config.ticket){config.username="guest";config.password="guest"}if(config.code){config.authorizationFlow=Gitana.OAuth2Http.AUTHORIZATION_CODE;driver.resetHttp(config);Gitana.deleteCookie("GITANA_TICKET","/");driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.username){config.authorizationFlow=Gitana.OAuth2Http.PASSWORD;driver.resetHttp(config);Gitana.deleteCookie("GITANA_TICKET","/");driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.accessToken){config.authorizationFlow=Gitana.OAuth2Http.TOKEN;driver.resetHttp(config);Gitana.deleteCookie("GITANA_TICKET","/");driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.cookie){config.authorizationFlow=Gitana.OAuth2Http.COOKIE;driver.resetHttp(config);driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);if(authInfo.accessToken){driver.http.accessToken(authInfo.accessToken)}Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.ticket){config.authorizationFlow=Gitana.OAuth2Http.TICKET;driver.resetHttp(config);var headers={GITANA_TICKET:config.ticket};driver.gitanaGet("/auth/info",{},headers,function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{var message="Unsupported authentication flow - you must provide either a username, authorization code, access token or select cookie-based authentication";if(authFailureHandler){authFailureHandler.call(platform,{message:message})}else{throw new Error(message)}}}}}}};var result=this.getFactory().platform(cluster);return Chain(result).then(function(){doAuthenticate.call(this);return false})},reloadAuthInfo:function(callback){var driver=this;driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);callback()},function(http){callback(null,http)})},clearAuthentication:function(){if(this.http.clearStorage){this.http.clearStorage()}this.resetHttp();Gitana.deleteCookie("GITANA_TICKET","/")},refreshAuthentication:function(callback){this.http.refresh(function(err){callback(err)})},destroy:function(){this.clearAuthentication()}});Gitana.EVERYONE={name:"everyone",type:"GROUP"};Gitana.toCopyDependencyChain=function(typedID){var array=[];if(typedID.getType()==="node"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getBranch()));array=array.concat({typeId:"changeset",id:typedID.getSystemMetadata().getChangesetId()})}else{if(typedID.getType()==="association"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getBranch()));array=array.concat({typeId:"changeset",id:typedID.getSystemMetadata().getChangesetId()})}else{if(typedID.getType()==="branch"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getRepository()))}else{if(typedID.getType()==="platform"){}else{if(typedID.getType()==="stack"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getPlatform()))}else{if(typedID.getType()==="project"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getPlatform()))}else{array=array.concat(Gitana.toCopyDependencyChain(typedID.getPlatform()))}}}}}}array.push(Gitana.toDependencyObject(typedID));return array};Gitana.toDependencyObject=function(typedID){return{typeId:typedID.getType(),id:typedID.getId()}};Gitana.TypedIDConstants={};Gitana.TypedIDConstants.TYPE_APPLICATION="application";Gitana.TypedIDConstants.TYPE_EMAIL="email";Gitana.TypedIDConstants.TYPE_EMAIL_PROVIDER="emailprovider";Gitana.TypedIDConstants.TYPE_REGISTRATION="registration";Gitana.TypedIDConstants.TYPE_PAGE_RENDITION="pageRendition";Gitana.TypedIDConstants.TYPE_SETTINGS="settings";Gitana.TypedIDConstants.TYPE_CLUSTER="cluster";Gitana.TypedIDConstants.TYPE_JOB="job";Gitana.TypedIDConstants.TYPE_LOG_ENTRY="logEntry";Gitana.TypedIDConstants.TYPE_DIRECTORY="directory";Gitana.TypedIDConstants.TYPE_IDENTITY="identity";Gitana.TypedIDConstants.TYPE_CONNECTION="connection";Gitana.TypedIDConstants.TYPE_DOMAIN="domain";Gitana.TypedIDConstants.TYPE_DOMAIN_GROUP="group";Gitana.TypedIDConstants.TYPE_DOMAIN_USER="user";Gitana.TypedIDConstants.TYPE_PLATFORM="platform";Gitana.TypedIDConstants.TYPE_AUTHENTICATION_GRANT="authenticationGrant";Gitana.TypedIDConstants.TYPE_BILLING_PROVIDERS_CONFIGURATION="billingProviderConfiguration";Gitana.TypedIDConstants.TYPE_CLIENT="client";Gitana.TypedIDConstants.TYPE_DESCRIPTOR="externalServiceDescriptor";Gitana.TypedIDConstants.TYPE_STACK="stack";Gitana.TypedIDConstants.TYPE_PROJECT="project";Gitana.TypedIDConstants.TYPE_SCHEDULED_WORK="scheduled-work";Gitana.TypedIDConstants.TYPE_REPORT="report";Gitana.TypedIDConstants.TYPE_WORKFLOW_INSTANCE="workflowInstance";Gitana.TypedIDConstants.TYPE_WORKFLOW_MODEL="workflowModel";Gitana.TypedIDConstants.TYPE_WORKFLOW_TASK="workflowTask";Gitana.TypedIDConstants.TYPE_WORKFLOW_COMMENT="workflowComment";Gitana.TypedIDConstants.TYPE_UICONFIG="uiconfig";Gitana.TypedIDConstants.TYPE_REGISTRAR="registrar";Gitana.TypedIDConstants.TYPE_METER="meter";Gitana.TypedIDConstants.TYPE_PLAN="plan";Gitana.TypedIDConstants.TYPE_TENANT="tenant";Gitana.TypedIDConstants.TYPE_REPOSITORY="repository";Gitana.TypedIDConstants.TYPE_ASSOCIATION="association";Gitana.TypedIDConstants.TYPE_BRANCH="branch";Gitana.TypedIDConstants.TYPE_CHANGESET="changeset";Gitana.TypedIDConstants.TYPE_NODE="node";Gitana.TypedIDConstants.TYPE_RELEASE="release";Gitana.TypedIDConstants.TYPE_MERGE_CONFLICT="mergeConflict";Gitana.TypedIDConstants.TYPE_VAULT="vault";Gitana.TypedIDConstants.TYPE_ARCHIVE="archive";Gitana.TypedIDConstants.TYPE_WAREHOUSE="warehouse";Gitana.TypedIDConstants.TYPE_INTERACTION="interaction";Gitana.TypedIDConstants.TYPE_INTERACTION_APPLICATION="interactionApplication";Gitana.TypedIDConstants.TYPE_INTERACTION_NODE="interactionNode";Gitana.TypedIDConstants.TYPE_INTERACTION_PAGE="interactionPage";Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT="interactionReport";Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT_ENTRY="interactionReportEntry";Gitana.TypedIDConstants.TYPE_INTERACTION_SESSION="interactionSession";Gitana.TypedIDConstants.TYPE_INTERACTION_USER="interactionUser";Gitana.TypedIDConstants.TYPE_INTERACTION_CONTINENT="interactionContinent";Gitana.TypedIDConstants.TYPE_INTERACTION_COUNTRY="interactionCountry";Gitana.TypedIDConstants.TYPE_INTERACTION_CITY="interactionCity";Gitana.TypedIDConstants.TYPE_INTERACTION_REGION="interactionRegion";Gitana.TypedIDConstants.TYPE_INTERACTION_POSTALCODE="interactionPostalCode";Gitana.TypedIDConstants.TYPE_INTERACTION_USERAGENT="interactionUserAgent";Gitana.TypedIDConstants.TYPE_INTERACTION_OPERATINGSYSTEM="interactionOperatingSystem";Gitana.TypedIDConstants.TYPE_INTERACTION_DEVICE="interactionDevice";Gitana.TypedIDConstants.TYPE_CONVERSION_TRIGGER="conversionTrigger";Gitana.TypedIDConstants.TYPE_WEB_HOST="webhost";Gitana.TypedIDConstants.TYPE_AUTO_CLIENT_MAPPING="autoClientMapping";Gitana.TypedIDConstants.TYPE_TRUSTED_DOMAIN_MAPPING="trustedDomainMapping";Gitana.TypedIDConstants.TYPE_DEPLOYED_APPLICATION="deployedApplication";Gitana.handleJobCompletion=function(chain,cluster,jobId,synchronous,reportFn){var jobFinalizer=function(){return Chain(cluster).readJob(jobId).then(function(){if(reportFn){reportFn(this)}if(!synchronous||(synchronous&&(this.getState()=="FINISHED"||this.getState()=="ERROR"))){chain.loadFrom(this);chain.next()}else{window.setTimeout(jobFinalizer,1000)}})};window.setTimeout(jobFinalizer,1000)};Gitana.loadDefaultConfig=function(){};Gitana.MemoryCache=function(){var cache={};return function(k,v){if(!Gitana.isUndefined(v)){if(v){cache[k]=v}else{delete cache[k]}}if(k=="clear"){var za=[];for(var z in cache){za.push(z)}for(var i=0;i=200&&xhr.status<=226)||xhr.status==304){if(typeof(Gitana.XHR_CACHE_FN)!=="undefined"&&Gitana.XHR_CACHE_FN!==null){Gitana.XHR_CACHE_FN({method:method,url:url,headers:headers},responseObject)}success(responseObject,xhr)}else{if(xhr.status>=400&&xhr.status!==0){failure(responseObject,xhr)}else{if(xhr.status>=300&&xhr.status<=303){failure(responseObject,xhr)}}}}};xhr.open(method,url,true);xhr.timeout=Gitana.HTTP_TIMEOUT;xhr.ontimeout=function(){failure({timeout:true},xhr)};xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");for(var header in headers){xhr.setRequestHeader(header,headers[header])}try{xhr.send(data)}catch(e){console.log(e)}}},request:function(options){return this.invoke(options)}});Gitana.Http.toQueryString=function(params){var queryString="";if(params){for(var k in params){if(queryString.length>0){queryString+="&"}var val=null;if(params[k]){val=params[k];val=Gitana.Http.URLEncode(val)}if(val){queryString+=k+"="+val}}}return queryString};Gitana.Http.Request=function(){var XHR;if(typeof global.Titanium!=="undefined"&&typeof global.Titanium.Network.createHTTPClient!="undefined"){XHR=global.Titanium.Network.createHTTPClient()}else{if(typeof require!=="undefined"){try{var XMLHttpRequest=require("xmlhttprequest").XMLHttpRequest;XHR=new XMLHttpRequest()}catch(e){XHR=new global.XMLHttpRequest()}}else{XHR=new global.XMLHttpRequest()}}return XHR};var Hash=function(){};Hash.prototype={join:function(string){string=string||"";return this.values().join(string)},keys:function(){var i,arr=[],self=this;for(i in self){if(self.hasOwnProperty(i)){arr.push(i)}}return arr},values:function(){var i,arr=[],self=this;for(i in self){if(self.hasOwnProperty(i)){arr.push(self[i])}}return arr},shift:function(){throw"not implemented"},unshift:function(){throw"not implemented"},push:function(){throw"not implemented"},pop:function(){throw"not implemented"},sort:function(){throw"not implemented"},ksort:function(func){var self=this,keys=self.keys(),i,value,key;if(func==undefined){keys.sort()}else{keys.sort(func)}for(i=0;i0){ret=q_arr.join("&")}return ret};Gitana.Http.QueryString.prototype.setQueryParams=function(query){var args=arguments,args_length=args.length,i,query_array,query_array_length,querystring=this,key_value;if(args_length==1){if(typeof query==="object"){for(i in query){if(query.hasOwnProperty(i)){querystring[i]=query[i]}}}else{if(typeof query==="string"){query_array=query.split("&");for(i=0,query_array_length=query_array.length;i{}|`^\\\u0080-\uffff]/,str_len=string.length,i,string_arr=string.split(""),c;for(i=0;i>6))+hex(128+(c&63))}else{if(c<65536){string_arr[i]=hex(224+(c>>12))+hex(128+((c>>6)&63))+hex(128+(c&63))}else{if(c<2097152){string_arr[i]=hex(240+(c>>18))+hex(128+((c>>12)&63))+hex(128+((c>>6)&63))+hex(128+(c&63))}}}}}}return string_arr.join("")};Gitana.Http.URLDecode=function(string){if(!string){return""}return string.replace(/%[a-fA-F0-9]{2}/ig,function(match){return String.fromCharCode(parseInt(match.replace("%",""),16))})}}(this));(function(global){Gitana.OAuth2Http=Gitana.Http.extend({constructor:function(options,storage){var self=this;if(storage===null||typeof(storage)==="string"){storage=new Gitana.OAuth2Http.Storage(storage)}this.cookieMode=null;this.ticketMode=null;this.error=null;this.errorDescription=null;this.errorUri=null;var tokenURL="/oauth/token";if(options.tokenURL){tokenURL=options.tokenURL}var baseURL=null;if(options.baseURL){baseURL=options.baseURL}var clientKey=options.clientKey;var clientSecret=options.clientSecret;this.authorizationFlow=options.authorizationFlow||Gitana.OAuth2Http.AUTHORIZATION_CODE;if(options.requestedScope){this.requestedScope=options.requestedScope}if(this.authorizationFlow==Gitana.OAuth2Http.AUTHORIZATION_CODE){this.code=options.code;this.redirectUri=options.redirectUri}if(this.authorizationFlow==Gitana.OAuth2Http.PASSWORD){this.username=options.username;if(options.password){this.password=options.password}else{this.password=""}}if(this.authorizationFlow==Gitana.OAuth2Http.COOKIE){this.cookieMode=true}if(this.authorizationFlow==Gitana.OAuth2Http.TICKET){this.ticketMode=options.ticket}this.ticketMaxAge=options.ticketMaxAge;this.clearStorage=function(){storage.clear()};this.accessToken=function(value){return storage.poke("accessToken",value)};this.refreshToken=function(value){return storage.poke("refreshToken",value)};this.grantedScope=function(value){return storage.poke("grantedScope",value)};this.expiresIn=function(value){return storage.poke("expiresIn",value)};this.grantTime=function(value){return storage.poke("grantTime",value)};this.getClientAuthorizationHeader=function(){var basicString=clientKey+":";if(clientSecret){basicString+=clientSecret}return"Basic "+Gitana.btoa(basicString)};this.getBearerAuthorizationHeader=function(){return"Bearer "+self.accessToken()};this.getPrefixedTokenURL=function(){return this.getPrefixedURL(tokenURL)};this.getPrefixedURL=function(url){var rebasedURL=url;if(baseURL&&Gitana.startsWith(url,"/")){rebasedURL=baseURL+url}return rebasedURL};if(this.authorizationFlow==Gitana.OAuth2Http.TOKEN){var existingAccessToken=this.accessToken();if(existingAccessToken!==options.accessToken){storage.clear()}this.accessToken(existingAccessToken)}this.base()},request:function(options){var self=this;var doGetAccessToken=function(success,failure){var onSuccess=function(response){var object=JSON.parse(response.text);if(response.error){self.error=object.error;self.errorDescription=object.error_description;self.errorUri=object.error_uri}else{var _accessToken=object.access_token;var _refreshToken=object.refresh_token;var _expiresIn=object.expires_in;var _grantedScope=object.scope;var _grantTime=new Date().getTime();self.clearStorage();self.accessToken(_accessToken);self.refreshToken(_refreshToken);self.expiresIn(_expiresIn);self.grantedScope(_grantedScope);self.grantTime(_grantTime)}success()};var onFailure=function(http,xhr){failure(http,xhr)};var o={success:onSuccess,failure:onFailure,headers:{Authorization:self.getClientAuthorizationHeader()},url:self.getPrefixedTokenURL(),method:Gitana.OAuth2Http.TOKEN_METHOD};var qs={};qs.grant_type=self.authorizationFlow;if(self.requestedScope){qs.scope=self.requestedScope}if(self.authorizationFlow===Gitana.OAuth2Http.AUTHORIZATION_CODE){qs.code=self.code;if(self.redirectUri){qs.redirect_uri=self.redirectUri}}else{if(self.authorizationFlow===Gitana.OAuth2Http.PASSWORD){qs.username=self.username;qs.password=self.password}}if(self.ticketMaxAge){qs.ticketMaxAge=self.ticketMaxAge}if("post"===Gitana.OAuth2Http.TOKEN_METHOD.toLowerCase()){o.headers["Content-Type"]="application/x-www-form-urlencoded"}var queryString=Gitana.Http.toQueryString(qs);if(queryString){if(o.url.indexOf("?")>-1){o.url=o.url+"&"+queryString}else{o.url=o.url+"?"+queryString}}self.invoke(o)};if(typeof(Gitana.REFRESH_TOKEN_LOCKS)==="undefined"){Gitana.REFRESH_TOKEN_LOCKS={}}if(typeof(Gitana.REFRESH_TOKEN_LOCK_REATTEMPT_MS)==="undefined"){Gitana.REFRESH_TOKEN_LOCK_REATTEMPT_MS=75}var waitForPendingRefresh=function(key,oldAccessToken){setTimeout(function(){if(Gitana.REFRESH_TOKEN_LOCKS[key]){return waitForPendingRefresh()}var newAccessToken=self.accessToken();var autoAttemptRefresh=(newAccessToken===oldAccessToken);doCall(autoAttemptRefresh)},Gitana.REFRESH_TOKEN_LOCK_REATTEMPT_MS)};var doRefreshAccessToken=function(success,failure){var key=self.refreshToken();var oldAccessToken=self.accessToken();if(Gitana.REFRESH_TOKEN_LOCKS[key]){return waitForPendingRefresh(key,oldAccessToken)}Gitana.REFRESH_TOKEN_LOCKS[key]=true;_doRefreshAccessToken(function(response){delete Gitana.REFRESH_TOKEN_LOCKS[key];success(response)},function(http,xhr){delete Gitana.REFRESH_TOKEN_LOCKS[key];failure(http,xhr)})};var _doRefreshAccessToken=function(success,failure){var onSuccess=function(response){var object=JSON.parse(response.text);if(response.error){self.error=object.error;self.errorDescription=object.error_description;self.errorUri=object.error_uri}else{var _accessToken=object.access_token;var _refreshToken=object.refresh_token;var _expiresIn=object.expires_in;var _grantTime=new Date().getTime();var _grantedScope=self.grantedScope();self.clearStorage();self.accessToken(_accessToken);self.refreshToken(_refreshToken);self.expiresIn(_expiresIn);self.grantedScope(_grantedScope);self.grantTime(_grantTime)}success(response)};var onFailure=function(http,xhr){Gitana.REFRESH_TOKEN_FAILURE_FN(self,http,xhr);failure(http,xhr)};var o={success:onSuccess,failure:onFailure,headers:{Authorization:self.getClientAuthorizationHeader()},url:self.getPrefixedTokenURL(),method:Gitana.OAuth2Http.TOKEN_METHOD};var qs={};qs.grant_type="refresh_token";qs.refresh_token=self.refreshToken();if(self.requestedScope){qs.scope=self.requestedScope}if(self.ticketMaxAge){qs.ticketMaxAge=self.ticketMaxAge}if("post"===Gitana.OAuth2Http.TOKEN_METHOD.toLowerCase()){o.headers["Content-Type"]="application/x-www-form-urlencoded"}var queryString=Gitana.Http.toQueryString(qs);if(queryString){if(o.url.indexOf("?")>-1){o.url=o.url+"&"+queryString}else{o.url=o.url+"?"+queryString}}self.invoke(o)};var doCall=function(autoAttemptRefresh){var successHandler=function(response){options.success(response)};var failureHandler=function(http,xhr){if(autoAttemptRefresh){var notJson=false;var isInvalidToken=false;if(http.text){var responseData={};try{responseData=JSON.parse(http.text)}catch(e){console.log("Error response is not json");console.log(e);console.log(http.text);notJson=true}if(responseData.error){if(responseData.error=="invalid_token"){isInvalidToken=true}}}var is401=(http.code==401);var is400=(http.code==400);var is403=(http.code==403);if(is401||is400||is403||isInvalidToken||notJson){if(self.refreshToken()){doRefreshAccessToken(function(){doCall(false)},function(){options.failure(http,xhr)})}else{options.failure(http,xhr)}}else{options.failure(http,xhr)}}else{options.failure(http,xhr)}};var o={};Gitana.copyInto(o,options);o.success=successHandler;o.failure=failureHandler;if(!o.headers){o.headers={}}if(!self.cookieMode&&!self.ticketMode){o.headers.Authorization=self.getBearerAuthorizationHeader()}if(self.ticketMode){o.headers.GITANA_TICKET=encodeURIComponent(self.ticketMode)}o.url=self.getPrefixedURL(o.url);self.invoke(o)};var forceRefresh=false;if(self.accessToken()){var grantTime=self.grantTime();if(grantTime){var expiresIn=self.expiresIn();if(expiresIn){var expirationTimeMs=self.grantTime()+(self.expiresIn()*1000);var nowTimeMs=new Date().getTime();var timeRemainingMs=expirationTimeMs-nowTimeMs;if(timeRemainingMs<=0){}else{}if(timeRemainingMs<=20000){forceRefresh=true}}}}if((!self.accessToken()||forceRefresh)&&!this.cookieMode&&!this.ticketMode){if(!self.refreshToken()){doGetAccessToken(function(){doCall(true)},function(http,xhr){options.failure(http,xhr)})}else{doRefreshAccessToken(function(){doCall(true)},function(http,xhr){options.failure(http,xhr)})}}else{doCall(true)}},refresh:function(callback){var self=this;var onSuccess=function(response){var object=JSON.parse(response.text);if(response.error){self.error=object.error;self.errorDescription=object.error_description;self.errorUri=object.error_uri;callback({error:self.error,message:self.errorDescription})}else{var _accessToken=object.access_token;var _refreshToken=object.refresh_token;var _expiresIn=object.expires_in;var _grantTime=new Date().getTime();var _grantedScope=self.grantedScope();self.clearStorage();self.accessToken(_accessToken);self.refreshToken(_refreshToken);self.expiresIn(_expiresIn);self.grantedScope(_grantedScope);self.grantTime(_grantTime);callback()}};var onFailure=function(http,xhr){Gitana.REFRESH_TOKEN_FAILURE_FN(self,http,xhr);callback({message:"Unable to refresh access token"})};var o={success:onSuccess,failure:onFailure,headers:{Authorization:self.getClientAuthorizationHeader()},url:self.getPrefixedTokenURL(),method:Gitana.OAuth2Http.TOKEN_METHOD};var qs={};qs.grant_type="refresh_token";qs.refresh_token=self.refreshToken();if(self.requestedScope){qs.scope=self.requestedScope}if(self.ticketMaxAge){qs.ticketMaxAge=self.ticketMaxAge}if("post"===Gitana.OAuth2Http.TOKEN_METHOD.toLowerCase()){o.headers["Content-Type"]="application/x-www-form-urlencoded"}var queryString=Gitana.Http.toQueryString(qs);if(queryString){if(o.url.indexOf("?")>-1){o.url=o.url+"&"+queryString}else{o.url=o.url+"?"+queryString}}self.invoke(o)}});Gitana.OAuth2Http.Storage=function(scope){var memoryStorage=function(){var memory={};var m={};m.removeItem=function(key){delete memory[key]};m.getItem=function(key){return memory[key]};m.setItem=function(key,value){memory[key]=value};return m}();var supportsLocalStorage=function(){try{return"localStorage" in window&&window.localStorage!==null}catch(e){return false}};var supportsSessionStorage=function(){try{return"sessionStorage" in window&&window.sessionStorage!==null}catch(e){return false}};var acquireStorage=function(){var storage=null;if(scope=="session"&&supportsSessionStorage()){storage=sessionStorage}else{if(scope=="local"&&supportsLocalStorage()){storage=localStorage}else{storage=memoryStorage}}return storage};var r={};r.clear=function(){acquireStorage().removeItem("gitanaAuthState")};r.poke=function(key,value){var state={};var stateString=acquireStorage().getItem("gitanaAuthState");if(stateString){state=JSON.parse(stateString)}var touch=false;if(typeof(value)!=="undefined"&&value!==null){state[key]=value;touch=true}else{if(value===null){delete state[key];touch=true}}if(touch){acquireStorage().setItem("gitanaAuthState",JSON.stringify(state))}return state[key]};return r}}(this));Gitana.OAuth2Http.PASSWORD="password";Gitana.OAuth2Http.AUTHORIZATION_CODE="authorization_code";Gitana.OAuth2Http.TOKEN="token";Gitana.OAuth2Http.COOKIE="cookie";Gitana.OAuth2Http.TICKET="ticket";Gitana.OAuth2Http.TOKEN_METHOD="POST";(function(window){Chain=function(object,skipAutoTrap){if(!object){object={}}var proxiedObject=Chain.proxy(object);proxiedObject.__queue=(function(){var queue=[];return function(x){if(x){if(x=="empty"){queue=[]}else{queue.push(x)}}return queue}})();proxiedObject.__response=(function(){var response=null;return function(x){if(!Gitana.isUndefined(x)){if(x){response=x}else{response=null}}return response}})();proxiedObject.__waiting=(function(){var waiting=false;return function(x){if(!Gitana.isUndefined(x)){waiting=x}return waiting}})();proxiedObject.__parent=(function(){var parent=null;return function(x){if(!Gitana.isUndefined(x)){if(x){parent=x}else{parent=null}}return parent}})();proxiedObject.__id=(function(){var id=Chain.idCount;Chain.idCount++;return function(){return id}})();proxiedObject.__helper=(function(){var helper=null;return function(x){if(x){helper=x}return helper}})();proxiedObject.__transparent=(function(){var transparent=false;return function(x){if(!Gitana.isUndefined(x)){transparent=x}return transparent}})();if(!proxiedObject.__copyState){proxiedObject.__copyState=function(other){Gitana.copyInto(this,other)}}proxiedObject.then=function(element,functionName){var self=this;var autorun=false;if(Gitana.isArray(element)){var array=element;var parallelInvoker=function(){var count=0;var total=array.length;var onComplete=function(){count++;if(count==total){self.next()}};for(var i=0;i "+element.toString());var returned=callback.call(self,response,previousResponse);if(returned!==false){self.next(returned)}},0)}else{var subchain=element;subchain.__response(this.__response());if(subchain.__transparent()){subchain.__copyState(this)}if(subchain.beforeChainRun){subchain.beforeChainRun.call(subchain)}subchain.run()}return this};proxiedObject.subchain=function(object,noAutoAdd){var transparent=false;if(!object){transparent=true}if(!object){object=this}var subchain=Chain(object,true);subchain.__parent(this);if(subchain.beforeChainRun){subchain.beforeChainRun.call(subchain)}if(!noAutoAdd){this.then(subchain)}subchain.__transparent(transparent);return subchain};proxiedObject.next=function(response){if(typeof response!=="undefined"){this.__response(response)}this.__waiting(false);if(this.__queue().length==0){if(this.__parent()){var r=this.__response();this.__parent().__response(r);this.__response(null);if(this.__transparent()){Gitana.deleteProperties(this.__parent());this.__parent().__copyState(this)}this.__parent().next()}this.__parent(null);this.__queue("empty")}else{this.run()}};proxiedObject.wait=function(ms){return this.then(function(){var wake=function(chain){return function(){chain.next()}}(this);window.setTimeout(wake,ms);return false})};proxiedObject.trap=function(errorHandler){this.errorHandler=errorHandler;return this};proxiedObject.error=function(err){var errorHandler=null;var ancestor=this;while(ancestor&&!errorHandler){errorHandler=ancestor.errorHandler;if(!errorHandler){ancestor=ancestor.__parent()}}this.__queue("empty");this.__response(null);if(this.__parent()){this.__parent().__queue("empty");this.__parent().__waiting(false)}if(errorHandler){var code=errorHandler.call(this,err);if(code!==false){this.next()}}};proxiedObject.done=function(){return this.__parent()};proxiedObject.chain=function(){return Chain(this,true).then(function(){})};if(!proxiedObject.clone){proxiedObject.clone=function(){return Chain.clone(this)}}if(!skipAutoTrap&&autoTrap()){proxiedObject.trap(autoTrap())}return proxiedObject};Chain.proxy=function(o){if(o.__original&&o.__original()){delete o.__original}var proxy=null;if(o.clone){proxy=o.clone()}else{proxy=Chain.clone(o)}proxy.__original=function(){return o};return proxy};Chain.unproxy=function(proxy){var o=null;if(proxy.__original&&proxy.__original()){o=proxy.__original()}return o};Chain.debug=false;Chain.log=function(chain,text){if(Chain.debug&&!Gitana.isUndefined(console)){var f=function(){var identifier=this.__id();if(this.__transparent()){identifier+="[t]"}if(!this.__parent()){return identifier}return f.call(this.__parent())+" > "+identifier};var identifier=f.call(chain);console.log("Chain["+identifier+"] "+text)}};Chain.clone=function(object){function F(){}F.prototype=object;var clone=new F();Gitana.copyInto(clone,object);return clone};var autoTrapValue=null;var autoTrap=Chain.autoTrap=function(_autoTrap){if(_autoTrap){autoTrapValue=_autoTrap}return autoTrapValue};Chain.idCount=0})(window);(function(window){var Gitana=window.Gitana;Gitana.Chainable=Base.extend({constructor:function(driver){var self=this;this.base();this.__copyState=function(other){Gitana.copyInto(this,other);this.chainCopyState(other)};this.getDriver=function(){return driver};this.getFactory=function(){return new Gitana.ObjectFactory()};this.httpError=function(httpError){var err=new Gitana.Error();err.name="Http Error";err.message=httpError.message;err.status=httpError.status;err.statusText=httpError.statusText;if(httpError.errorType){err.errorType=httpError.errorType}if(httpError.stacktrace){err.stacktrace=httpError.stacktrace}this.error(err);return false};this.missingNodeError=function(id){var err=new Gitana.Error();err.name="Missing Node error";err.message="The node: "+id+" could not be found";this.error(err);return false};this.chainGet=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaGet(uri,params,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)});return false})};this.chainCreate=function(chainable,object,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaPost(uri,params,object,function(status){driver.gitanaGet(uri+"/"+status.getId(),null,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)});return false},"chainCreate")};this.chainCreateEx=function(chainable,object,createUri,readUri){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(createUri)){createUri=createUri.call(self)}driver.gitanaPost(createUri,null,object,function(status){if(Gitana.isFunction(readUri)){readUri=readUri.call(self,status)}driver.gitanaGet(readUri,null,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)});return false})};this.chainPost=function(chainable,uri,params,payload){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaPost(uri,params,payload,function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)});return false})};this.chainPostEmpty=function(chainable,uri,params,payload,contentType){var self=this;if(!payload){payload={}}return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaPost(uri,params,payload,function(response){chain.next()},function(http){self.httpError(http)});return false})};this.chainUpload=function(chainable,uri,params,contentType,payload){var self=this;if(!payload){payload={}}return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaUpload(uri,params,contentType,payload,function(response){chain.next()},function(http){self.httpError(http)});return false})};this.chainGetResponse=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaGet(uri,params,{},function(response){chain.next(response)},function(http){self.httpError(http)});return false})};this.chainGetResponseText=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaRequest("GET",uri,params,"text/plain",null,{},function(response){chain.next(response)},function(http){self.httpError(http)});return false})};this.chainGetResponseRows=function(chainable,uri,params){return this.chainGetResponse(chainable,uri,params).then(function(response){return response.rows})};this.chainHasResponseRow=function(chainable,uri,value){return this.chainGetResponse(chainable,uri).then(function(response){var authorized=false;for(var i=0;i-1){identifiers.domain=principal.substring(0,x);identifiers.principal=principal.substring(x+1)}else{identifiers.domain=defaultDomainId;identifiers.principal=principal}}else{if(principal.objectType&&principal.objectType()=="Gitana.DomainPrincipal"){identifiers.domain=principal.getDomainId();identifiers.principal=principal.getId()}else{if(principal.objectType&&principal.objectType()=="Gitana.TeamMember"){identifiers.domain=principal.domainId;identifiers.principal=principal._doc}else{if(principal._doc){identifiers.domain=defaultDomainId;identifiers.principal=principal._doc}else{if(principal.name){identifiers.domain=defaultDomainId;identifiers.principal=principal.name}}}}}return identifiers}},chainCopyState:function(otherObject){}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Response=Base.extend({constructor:function(object){Gitana.copyInto(this,object)},getId:function(){return this["_doc"]},isStatusDocument:function(){return(this["ok"]||this["error"])},isListDocument:function(){return this["total_rows"]&&this["rows"]&&this["offset"]},isDataDocument:function(){return(!this.isStatusDocument()&&!this.isListDocument())},isOk:function(){var ok=true;if(this.isStatusDocument()){if(this["ok"]!=null){ok=this["ok"]}}if(this["error"]){ok=false}return ok},isError:function(){return !this.isOk()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AuthInfo=Base.extend({constructor:function(object){Gitana.copyInto(this,object)},getPrincipalId:function(){return this["principalId"]},getPrincipalDomainId:function(){return this["principalDomainId"]},getPrincipalName:function(){return this["principalName"]},getTenantId:function(){return this["tenantId"]},getTenantTitle:function(){return this["tenantTitle"]},getTenantDescription:function(){return this["tenantDescription"]},getClientId:function(){return this["clientId"]},getTicket:function(){return this["ticket"]}})})(window);(function(window){var Gitana=window.Gitana;Gitana.SystemMetadata=Base.extend({constructor:function(){this.base()},updateFrom:function(json){Gitana.deleteProperties(this,false);Gitana.copyInto(this,json)},get:function(key){return this[key]},getChangesetId:function(){return this.get("changeset")},getCreatedBy:function(){return this.get("created_by")},getCreatedByPrincipalId:function(){return this.get("created_by_principal_id")},getCreatedByPrincipalDomainId:function(){return this.get("created_by_principal_domain_id")},getModifiedBy:function(){return this.get("modified_by")},getModifiedByPrincipalId:function(){return this.get("modified_by_principal_id")},getModifiedByPrincipalDomainId:function(){return this.get("modified_by_principal_domain_id")},getCreatedOn:function(){if(!this.createdOn){this.createdOn=new Gitana.Timestamp(this.get("created_on"))}return this.createdOn},getModifiedOn:function(){if(!this.modifiedOn){this.modifiedOn=new Gitana.Timestamp(this.get("modified_on"))}return this.modifiedOn}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Timestamp=Base.extend({constructor:function(object){this.base(object)},getYear:function(){return this["year"]},getMonth:function(){return this["month"]},getDay:function(){return this["day_of_month"]},getHour:function(){return this["hour"]},getMinute:function(){return this["minute"]},getSecond:function(){return this["second"]},getMillisecond:function(){return this["millisecond"]},getTime:function(){return this["ms"]},getTimestamp:function(){return this["timestamp"]}})})(window);(function(window){Gitana.uniqueIdCounter=0;Gitana.makeArray=function(args){return Array.prototype.slice.call(args)};Gitana.stringify=function(object,pretty){var val=null;if(object){if(pretty){val=JSON.stringify(object,null," ")}else{val=JSON.stringify(object)}}return val};Gitana.isString=function(arg){return(typeof arg=="string")};Gitana.isNumber=function(arg){return(typeof arg=="number")};Gitana.isBoolean=function(arg){return(typeof arg=="boolean")};Gitana.isFunction=function(arg){return Object.prototype.toString.call(arg)==="[object Function]"};Gitana.startsWith=function(text,prefix){return text.substr(0,prefix.length)===prefix};Gitana.copyInto=function(target,source){for(var i in source){if(source.hasOwnProperty(i)&&!this.isFunction(source[i])){target[i]=source[i]}}};Gitana.deleteProperties=function(object,deleteFunctions){var keys=[];for(var k in object){keys.push(k)}for(var i=0;i0){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expirationString=";expires="+date.toGMTString()}}}var domainString="";if(host){domainString=";domain="+host}document.cookie=name+"="+value+expirationString+pathString+domainString+";"};createCookie(name,value,path,days,domain)}};Gitana.deleteCookie=function(name,path){var existsCookie=function(name,path){return Gitana.readCookie(name)};if(typeof(document)!="undefined"){if(existsCookie(name)){Gitana.writeCookie(name,"",path,0)}if(existsCookie(name)){if(window){var domain=window.location.host;if(domain){var i=domain.indexOf(":");if(i>-1){domain=domain.substring(0,i)}}Gitana.writeCookie(name,"",path,0,domain)}}}};Gitana.readCookie=function(name){function _readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i>2,((ascii[0]&3)<<4)|ascii[1]>>4,((ascii[1]&15)<<2)|ascii[2]>>6,ascii[2]&63];if(isNaN(ascii[1])){index[2]=64}if(isNaN(ascii[2])){index[3]=64}output+=b64.charAt(index[0])+b64.charAt(index[1])+b64.charAt(index[2])+b64.charAt(index[3])}return output};Gitana.copyKeepers=function(target,source){if(!source){return}for(var i in source){if(source.hasOwnProperty(i)&&!this.isFunction(source[i])){if(!Gitana.isUndefined(target[i])){target[i]=source[i]}}}}})(window);(function(window){var Gitana=window.Gitana;var STATUS_UNRESOLVED="unresolved";var STATUS_RESOLVED="resolved";var STATUS_REJECTED="rejected";var triggerAll=function(val,cbs){for(var i=0;i0){var cbs=chunks.shift();var ps=[];for(var i=cbs.length-1;i>=0;i--){var cb=cbs[i];var p=cb();ps.push(p)}loop(Gitana.Defer.all(ps))}else{def.resolve(results)}},def.reject)})(Gitana.Promise.resolved([]));return def.promise};Gitana.Queue=Queue})(window);(function(window){Gitana.Methods={};Gitana.Methods.listAttachments=function(mapClass){if(!mapClass){mapClass=Gitana.BinaryAttachmentMap}return function(local){var self=this;var result=this.subchain(new mapClass(this));if(!local){result.then(function(){var chain=this;self.getDriver().gitanaGet(self.getUri()+"/attachments",null,{},function(response){chain.handleResponse(response);chain.next()});return false})}else{var existingMap=self.getSystemMetadata()["attachments"];if(existingMap){for(var key in existingMap){var value=result[key];value.attachmentId=key}}}return result}};Gitana.Methods.attach=function(attachmentClass,paramsFunction){if(!attachmentClass){attachmentClass=Gitana.BinaryAttachment}return function(attachmentId,contentType,data){var self=this;if(!attachmentId){attachmentId="default"}var result=this.subchain(new attachmentClass(this));result.then(function(){var params={};if(paramsFunction){paramsFunction(params)}var uploadUri=self.getUri()+"/attachments/"+attachmentId;this.chainUpload(this,uploadUri,params,contentType,data).then(function(){this.subchain(self).listAttachments().then(function(){this.select(attachmentId).then(function(){result.handleResponse(this)})})})});return result}};Gitana.Methods.unattach=function(){return function(attachmentId){return this.then(function(){this.chainDelete(this,this.getUri()+"/attachments/"+attachmentId).then(function(){})})}};Gitana.Methods.getPreviewUri=function(prefix){if(!prefix){prefix="preview"}return function(name,config){var url=this.getDriver().baseURL+this.getUri()+"/"+prefix+"/"+name;if(config){var first=true;for(var key in config){if(first){url+="?"}else{url+="&"}var value=config[key];if(value){url+=key+"="+value}first=false}}return url}};Gitana.Methods.listInteractionObjects=function(factoryMapMethod,uriPath){return function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory()[factoryMapMethod](this);return this.chainGet(chainable,this.getUri()+"/"+uriPath,params)}};Gitana.Methods.readInteractionObject=function(factoryObjectMethod,uriPath){return function(interactionObjectId){var chainable=this.getFactory()[factoryObjectMethod](this);return this.chainGet(chainable,this.getUri()+"/"+uriPath+"/"+interactionObjectId)}};Gitana.Methods.queryInteractionObjects=function(factoryMapMethod,uriPath){return function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/"+uriPath+"/query"};var chainable=this.getFactory()[factoryMapMethod](this);return this.chainPost(chainable,uriFunction,params,query)}}})(window);(function(window){(function(){if(typeof window.location!="undefined"){if(typeof(Gitana.autoConfigUri)==="undefined"){var uri=window.location.href;var z1=uri.indexOf(window.location.pathname);z1=uri.indexOf("/",z1+2);if(z1>-1){uri=uri.substring(0,z1)}if(uri.indexOf("cloudcms.net")>-1){Gitana.autoConfigUri=uri}}}}())})(window);(function(window){var Gitana=window.Gitana;Gitana.ObjectFactory=Base.extend({constructor:function(){this.create=function(klass,existing,object){var created=new klass(existing,object);return created}},platformDataStoreMap:function(platform,object){return this.create(Gitana.PlatformDataStoreMap,platform,object)},platformDataStore:function(platform,object){var type=object.datastoreTypeId;return this[type](platform,object)},platform:function(cluster,object){return this.create(Gitana.Platform,cluster,object)},job:function(cluster,object){var type=null;if(object){if(Gitana.isString(object)){type=object}else{type=object.type}}var job=null;if("copy"==type){job=this.create(Gitana.CopyJob,cluster,object)}else{if("export"==type){job=this.create(Gitana.TransferExportJob,cluster,object)}else{if("import"==type){job=this.create(Gitana.TransferImportJob,cluster,object)}else{job=this.create(Gitana.Job,cluster,object)}}}return job},jobMap:function(cluster,object){return this.create(Gitana.JobMap,cluster,object)},logEntry:function(cluster,object){return this.create(Gitana.LogEntry,cluster,object)},logEntryMap:function(cluster,object){return this.create(Gitana.LogEntryMap,cluster,object)},auditRecord:function(repository,object){return this.create(Gitana.AuditRecord,repository,object)},auditRecordMap:function(repository,object){return this.create(Gitana.AuditRecordMap,repository,object)},stack:function(platform,object){return this.create(Gitana.Stack,platform,object)},stackMap:function(platform,object){return this.create(Gitana.StackMap,platform,object)},project:function(platform,object){return this.create(Gitana.Project,platform,object)},projectMap:function(platform,object){return this.create(Gitana.ProjectMap,platform,object)},uiConfig:function(platform,object){return this.create(Gitana.UIConfig,platform,object)},uiConfigMap:function(platform,object){return this.create(Gitana.UIConfigMap,platform,object)},scheduledWork:function(platform,object){return this.create(Gitana.ScheduledWork,platform,object)},scheduledWorkMap:function(platform,object){return this.create(Gitana.ScheduledWorkMap,platform,object)},report:function(platform,object){return this.create(Gitana.Report,platform,object)},reportMap:function(platform,object){return this.create(Gitana.ReportMap,platform,object)},repository:function(platform,object){return this.create(Gitana.Repository,platform,object)},repositoryMap:function(platform,object){return this.create(Gitana.RepositoryMap,platform,object)},domain:function(platform,object){return this.create(Gitana.Domain,platform,object)},domainMap:function(platform,object){return this.create(Gitana.DomainMap,platform,object)},vault:function(platform,object){return this.create(Gitana.Vault,platform,object)},vaultMap:function(platform,object){return this.create(Gitana.VaultMap,platform,object)},registrar:function(platform,object){return this.create(Gitana.Registrar,platform,object)},registrarMap:function(platform,object){return this.create(Gitana.RegistrarMap,platform,object)},directory:function(platform,object){return this.create(Gitana.Directory,platform,object)},directoryMap:function(platform,object){return this.create(Gitana.DirectoryMap,platform,object)},application:function(platform,object){return this.create(Gitana.Application,platform,object)},applicationMap:function(platform,object){return this.create(Gitana.ApplicationMap,platform,object)},warehouse:function(platform,object){return this.create(Gitana.Warehouse,platform,object)},warehouseMap:function(platform,object){return this.create(Gitana.WarehouseMap,platform,object)},webhost:function(platform,object){return this.create(Gitana.WebHost,platform,object)},webhostMap:function(platform,object){return this.create(Gitana.WebHostMap,platform,object)},autoClientMapping:function(webhost,object){return this.create(Gitana.AutoClientMapping,webhost,object)},autoClientMappingMap:function(webhost,object){return this.create(Gitana.AutoClientMappingMap,webhost,object)},trustedDomainMapping:function(webhost,object){return this.create(Gitana.TrustedDomainMapping,webhost,object)},trustedDomainMappingMap:function(webhost,object){return this.create(Gitana.TrustedDomainMappingMap,webhost,object)},deployedApplication:function(webhost,object){return this.create(Gitana.DeployedApplication,webhost,object)},deployedApplicationMap:function(webhost,object){return this.create(Gitana.DeployedApplicationMap,webhost,object)},descriptor:function(platform,object){return this.create(Gitana.Descriptor,platform,object)},descriptorMap:function(platform,object){return this.create(Gitana.DescriptorMap,platform,object)},client:function(platform,object){var client=this.create(Gitana.Client,platform,object);Gitana.stampInto(client,Gitana.ClientMethods);return client},clientMap:function(platform,object){return this.create(Gitana.ClientMap,platform,object)},authenticationGrant:function(platform,object){return this.create(Gitana.AuthenticationGrant,platform,object)},authenticationGrantMap:function(platform,object){return this.create(Gitana.AuthenticationGrantMap,platform,object)},billingProviderConfiguration:function(platform,object){return this.create(Gitana.BillingProviderConfiguration,platform,object)},billingProviderConfigurationMap:function(platform,object){return this.create(Gitana.BillingProviderConfigurationMap,platform,object)},workflowModel:function(platform,object){return this.create(Gitana.WorkflowModel,platform,object)},workflowModelMap:function(platform,object){return this.create(Gitana.WorkflowModelMap,platform,object)},workflowInstance:function(platform,object){return this.create(Gitana.WorkflowInstance,platform,object)},workflowInstanceMap:function(platform,object){return this.create(Gitana.WorkflowInstanceMap,platform,object)},workflowTask:function(platform,object){return this.create(Gitana.WorkflowTask,platform,object)},workflowTaskMap:function(platform,object){return this.create(Gitana.WorkflowTaskMap,platform,object)},workflowComment:function(platform,object){return this.create(Gitana.WorkflowComment,platform,object)},workflowCommentMap:function(platform,object){return this.create(Gitana.WorkflowCommentMap,platform,object)},changeset:function(repository,object){return this.create(Gitana.Changeset,repository,object)},branch:function(repository,object){return this.create(Gitana.Branch,repository,object)},node:function(branch,object){var objectClass=null;if(object){if(Gitana.isString(object)){object={_type:object}}var type=object._type;if(type){if(Gitana.ObjectFactory.registry[type]){objectClass=Gitana.ObjectFactory.registry[type]}}if(!objectClass){if(type&&Gitana.startsWith(type,"a:")){objectClass=Gitana.Association}}if(!objectClass){if(object.__is_association&&object.__is_association()){objectClass=Gitana.Association}}}if(!objectClass){objectClass=Gitana.Node}return this.create(objectClass,branch,object)},association:function(branch,object){return this.create(Gitana.Association,branch,object)},release:function(repository,object){return this.create(Gitana.Release,repository,object)},mergeConflict:function(repository,object){return this.create(Gitana.MergeConflict,repository,object)},branchMap:function(repository,object){return this.create(Gitana.BranchMap,repository,object)},changesetMap:function(repository,object){return this.create(Gitana.ChangesetMap,repository,object)},releaseMap:function(repository,object){return this.create(Gitana.ReleaseMap,repository,object)},mergeConflictMap:function(repository,object){return this.create(Gitana.MergeConflictMap,repository,object)},nodeMap:function(branch,object){return this.create(Gitana.NodeMap,branch,object)},definition:function(branch,object){return this.create(Gitana.Definition,branch,object)},form:function(branch,object){return this.create(Gitana.Form,branch,object)},traversalResults:function(branch,object){return this.create(Gitana.TraversalResults,branch,object)},domainPrincipal:function(domain,object){var principal=this.create(Gitana.DomainPrincipal,domain,object);if(object){this.extendPrincipal(principal)}return principal},domainPrincipalMap:function(domain,object){return this.create(Gitana.PrincipalMap,domain,object)},extendPrincipal:function(principal){if(principal.getType()&&principal.objectType()=="Gitana.DomainPrincipal"){if(principal.getType()=="USER"){Gitana.stampInto(principal,Gitana.DomainUser)}else{if(principal.getType()=="GROUP"){Gitana.stampInto(principal,Gitana.DomainGroup)}}}},archive:function(vault,object){return this.create(Gitana.Archive,vault,object)},archiveMap:function(vault,object){return this.create(Gitana.ArchiveMap,vault,object)},team:function(cluster,teamable,object){return new Gitana.Team(cluster,teamable,object)},teamMap:function(cluster,teamable,object){return new Gitana.TeamMap(cluster,teamable,object)},activity:function(datastore,object){return new Gitana.Activity(datastore,object)},activityMap:function(datastore,object){return new Gitana.ActivityMap(datastore,object)},role:function(cluster,roleContainer,object){return new Gitana.Role(cluster,roleContainer,object)},roleMap:function(cluster,roleContainer,object){return new Gitana.RoleMap(cluster,roleContainer,object)},tenant:function(registrar,object){return this.create(Gitana.Tenant,registrar,object)},tenantMap:function(registrar,object){return this.create(Gitana.TenantMap,registrar,object)},plan:function(registrar,object){return this.create(Gitana.Plan,registrar,object)},planMap:function(registrar,object){return this.create(Gitana.PlanMap,registrar,object)},meter:function(registrar,object){return this.create(Gitana.Meter,registrar,object)},meterMap:function(registrar,object){return this.create(Gitana.MeterMap,registrar,object)},identity:function(directory,object){return this.create(Gitana.Identity,directory,object)},identityMap:function(directory,object){return this.create(Gitana.IdentityMap,directory,object)},connection:function(directory,object){return this.create(Gitana.Connection,directory,object)},connectionMap:function(directory,object){return this.create(Gitana.ConnectionMap,directory,object)},interactionApplication:function(warehouse,object){return this.create(Gitana.InteractionApplication,warehouse,object)},interactionApplicationMap:function(warehouse,object){return this.create(Gitana.InteractionApplicationMap,warehouse,object)},interactionSession:function(warehouse,object){return this.create(Gitana.InteractionSession,warehouse,object)},interactionSessionMap:function(warehouse,object){return this.create(Gitana.InteractionSessionMap,warehouse,object)},interactionPage:function(warehouse,object){return this.create(Gitana.InteractionPage,warehouse,object)},interactionPageMap:function(warehouse,object){return this.create(Gitana.InteractionPageMap,warehouse,object)},interactionNode:function(warehouse,object){return this.create(Gitana.InteractionNode,warehouse,object)},interactionNodeMap:function(warehouse,object){return this.create(Gitana.InteractionNodeMap,warehouse,object)},interactionUser:function(warehouse,object){return this.create(Gitana.InteractionUser,warehouse,object)},interactionUserMap:function(warehouse,object){return this.create(Gitana.InteractionUserMap,warehouse,object)},interactionContinent:function(warehouse,object){return this.create(Gitana.InteractionContinent,warehouse,object)},interactionContinentMap:function(warehouse,object){return this.create(Gitana.InteractionContinentMap,warehouse,object)},interactionCountry:function(warehouse,object){return this.create(Gitana.InteractionCountry,warehouse,object)},interactionCountryMap:function(warehouse,object){return this.create(Gitana.InteractionCountryMap,warehouse,object)},interactionCity:function(warehouse,object){return this.create(Gitana.InteractionCity,warehouse,object)},interactionCityMap:function(warehouse,object){return this.create(Gitana.InteractionCityMap,warehouse,object)},interactionRegion:function(warehouse,object){return this.create(Gitana.InteractionRegion,warehouse,object)},interactionRegionMap:function(warehouse,object){return this.create(Gitana.InteractionRegionMap,warehouse,object)},interactionPostalCode:function(warehouse,object){return this.create(Gitana.InteractionPostalCode,warehouse,object)},interactionPostalCodeMap:function(warehouse,object){return this.create(Gitana.InteractionPostalCodeMap,warehouse,object)},interactionUserAgent:function(warehouse,object){return this.create(Gitana.InteractionUserAgent,warehouse,object)},interactionUserAgentMap:function(warehouse,object){return this.create(Gitana.InteractionUserAgentMap,warehouse,object)},interactionOperatingSystem:function(warehouse,object){return this.create(Gitana.InteractionOperatingSystem,warehouse,object)},interactionOperatingSystemMap:function(warehouse,object){return this.create(Gitana.InteractionOperatingSystemMap,warehouse,object)},interactionDevice:function(warehouse,object){return this.create(Gitana.InteractionDevice,warehouse,object)},interactionDeviceMap:function(warehouse,object){return this.create(Gitana.InteractionDeviceMap,warehouse,object)},interactionReport:function(warehouse,object){return this.create(Gitana.InteractionReport,warehouse,object)},interactionReportMap:function(warehouse,object){return this.create(Gitana.InteractionReportMap,warehouse,object)},interactionReportEntry:function(warehouse,object){return this.create(Gitana.InteractionReportEntry,warehouse,object)},interactionReportEntryMap:function(warehouse,object){return this.create(Gitana.InteractionReportEntryMap,warehouse,object)},interaction:function(warehouse,object){return this.create(Gitana.Interaction,warehouse,object)},interactionMap:function(warehouse,object){return this.create(Gitana.InteractionMap,warehouse,object)},conversionTrigger:function(warehouse,object){return this.create(Gitana.ConversionTrigger,warehouse,object)},conversionTriggerMap:function(warehouse,object){return this.create(Gitana.ConversionTriggerMap,warehouse,object)},settings:function(application,object){return this.create(Gitana.Settings,application,object)},settingsMap:function(application,object){return this.create(Gitana.SettingsMap,application,object)},registration:function(application,object){return this.create(Gitana.Registration,application,object)},registrationMap:function(application,object){return this.create(Gitana.RegistrationMap,application,object)},pageRendition:function(application,object){return this.create(Gitana.PageRendition,application,object)},pageRenditionMap:function(application,object){return this.create(Gitana.PageRenditionMap,application,object)},email:function(application,object){return this.create(Gitana.Email,application,object)},emailMap:function(application,object){return this.create(Gitana.EmailMap,application,object)},emailProvider:function(application,object){return this.create(Gitana.EmailProvider,application,object)},emailProviderMap:function(application,object){return this.create(Gitana.EmailProviderMap,application,object)}});Gitana.ObjectFactory.registry={};Gitana.ObjectFactory.register=function(qname,objectClass){Gitana.ObjectFactory.registry[qname]=objectClass}})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractPersistable=Gitana.Chainable.extend({constructor:function(driver,object){this.base(driver);if(object){this.handleResponse.call(this,object)}},handleResponse:function(response){Gitana.deleteProperties(this,false);if(response._ref){delete response._ref}Gitana.copyInto(this,response);this.handleSystemProperties(response)},handleSystemProperties:function(response){this.chainCopyState(response)},json:function(){return JSON.parse(JSON.stringify(this))}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractMap=Gitana.AbstractPersistable.extend({constructor:function(driver,object){this.__keys=(function(){var list=[];return function(x){if(!Gitana.isUndefined(x)){if(x=="empty"){while(list.length>0){list.shift()}}else{if(!x&&x.length){for(var i=0;i=0){_offset=offset}return _offset}})();this.base(driver,object);if(object){this.chainCopyState(object)}},refs:function(){var references=[];for(var i=0;ithis.__keys().length){return}for(var i=0;i=size){keysToRemove.push(this.__keys()[i])}}while(this.__keys().length>size){this.__keys().pop()}for(var i=0;i=skip+limit){keysToRemove.push(this.__keys()[i])}}while(this.__keys().length>limit+skip){this.__keys().pop()}for(var i=0;i0){json=this[this.__keys()[0]]}var chainable=this.buildObject(json);return this.subchain(chainable).then(function(){var chain=this;this.subchain(self).then(function(){if(this.__keys().length>0){var obj=this[this.__keys()[0]];if(chain.loadFrom){chain.loadFrom(obj)}else{chain.handleResponse(obj)}}else{var err=new Gitana.Error();err.name="Empty Map";err.message="The map doesn't have any elements in it";if(emptyHandler){emptyHandler.call(self,err)}else{this.error(err)}return false}})})},select:function(key){var self=this;var json={};if(this[key]){json=this[key]}var result=this.subchain(this.buildObject(json));return result.then(function(){var chain=this;this.subchain(self).then(function(){var obj=this[key];if(!obj){var err=new Gitana.Error();err.name="No element with key: "+key;err.message=err.name;this.error(err);return false}if(result.loadFrom){chain.loadFrom(obj)}else{chain.handleResponse(obj)}})})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractObject=Gitana.AbstractPersistable.extend({constructor:function(driver,object){this.__system=(function(){var _system=new Gitana.SystemMetadata();return function(system){if(!Gitana.isUndefined(system)){_system.updateFrom(system)}return _system}})();this.chainDelete=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}chain.getDriver().gitanaDelete(uri,params,function(){chain.next()},function(http){self.httpError(http)});return false})};this.chainReload=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}chain.getDriver().gitanaGet(uri,params,{},function(obj){chain.handleResponse(obj);chain.next()},function(http){self.httpError(http)});return false})};this.chainUpdate=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}chain.getDriver().gitanaPut(uri,params,chain,function(){chain.getDriver().gitanaGet(uri,params,{},function(obj){chain.handleResponse(obj);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)});return false})};this.base(driver,object)},chainCopyState:function(otherObject){this.base(otherObject);if(otherObject.__system){this.__system(otherObject.__system())}},getUri:function(){return null},getType:function(){return null},ref:function(){return null},getProxiedUri:function(){return this.getDriver().baseURL+this.getUri()},get:function(key){return this[key]},set:function(key,value){this[key]=value},getId:function(){return this.get("_doc")},getSystemMetadata:function(){return this.__system()},getTitle:function(){return this.get("title")},getDescription:function(){return this.get("description")},replacePropertiesWith:function(object){var candidate={};Gitana.copyInto(candidate,object);var backups={};backups._doc=this["_doc"];delete candidate._doc;backups._type=this["_type"];delete candidate._type;backups._qname=this["_qname"];delete candidate._qname;Gitana.deleteProperties(this,false);this["_doc"]=backups._doc;this["_type"]=backups._type;this["_qname"]=backups._qname;Gitana.copyInto(this,candidate)},handleSystemProperties:function(response){this.base(response);if(this["_system"]){var json=this["_system"];delete this["_system"];this.__system().updateFrom(json)}},stringify:function(pretty){return Gitana.stringify(this,pretty)},loadFrom:function(anotherObject){this.handleResponse(anotherObject)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractSelfableObject=Gitana.AbstractObject.extend({constructor:function(driver,object){this.base(driver,object)},del:function(){var self=this;var uriFunction=function(){return self.getUri()};return this.chainDelete(this.getPlatform(),uriFunction)},reload:function(){var self=this;var uriFunction=function(){return self.getUri()};return this.chainReload(null,uriFunction)},update:function(){var self=this;var uriFunction=function(){return self.getUri()};return this.chainUpdate(null,uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractSelfableACLObject=Gitana.AbstractSelfableObject.extend({constructor:function(driver,object){this.base(driver,object)},loadACL:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/acl/list"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response)})},listAuthorities:function(principal,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/acl?id="+principalDomainQualifiedId};return this.chainGetResponseRows(this,uriFunction).then(function(response){callback.call(this,response)})},checkAuthority:function(principal,authorityId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/authorities/"+authorityId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},grantAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/authorities/"+authorityId+"/grant?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/authorities/"+authorityId+"/revoke?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAllAuthorities:function(principal){return this.revokeAuthority(principal,"all")},loadAuthorityGrants:function(principalIds,callback){if(!principalIds){principalIds=[]}var json={principals:principalIds};return this.chainPostResponse(this,this.getUri()+"/authorities",{},json).then(function(response){callback.call(this,response)})},checkPermission:function(principal,permissionId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return self.getUri()+"/permissions/"+permissionId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DataStore=Gitana.AbstractObject.extend({constructor:function(driver,object){this.base(driver,object)},getUri:function(){return null},getType:function(){return null},ref:function(){return this.getType()+"://"+this.getId()},loadACL:function(callback){var uriFunction=function(){return this.getUri()+"/acl/list"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response)})},listAuthorities:function(principal,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/acl?id="+principalDomainQualifiedId};return this.chainGetResponseRows(this,uriFunction).then(function(response){callback.call(this,response)})},checkAuthority:function(principal,authorityId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},grantAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/grant?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/revoke?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAllAuthorities:function(principal){return this.revokeAuthority(principal,"all")},loadAuthorityGrants:function(principalIds,callback){if(!principalIds){principalIds=[]}var json={principals:principalIds};return this.chainPostResponse(this,this.getUri()+"/authorities",{},json).then(function(response){callback.call(this,response)})},checkPermission:function(principal,permissionId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/permissions/"+permissionId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},readTeam:function(teamKey){var uriFunction=function(){return this.getUri()+"/teams/"+teamKey};var chainable=this.getFactory().team(this.getPlatform(),this);return this.chainGet(chainable,uriFunction)},listTeams:function(){var uriFunction=function(){return this.getUri()+"/teams"};var chainable=this.getFactory().teamMap(this.getCluster(),this);return this.chainGet(chainable,uriFunction)},createTeam:function(teamKey,object){if(!object){object={}}var uriFunction=function(){return this.getUri()+"/teams?key="+teamKey};var self=this;var chainable=this.getFactory().team(this.getPlatform(),this);return this.chainPostResponse(chainable,uriFunction,{},object).then(function(){var chain=this;Chain(self).readTeam(teamKey).then(function(){chain.handleResponse(this);chain.next()});return false})},readOwnersTeam:function(){return this.readTeam("owners")},listActivities:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().activityMap(this);return this.chainGet(chainable,"/activities",params)},readActivity:function(activityId){var chainable=this.getFactory().activity(this);return this.chainGet(chainable,"/activities/"+activityId)},queryActivities:function(query,pagination){var chainable=this.getFactory().activityMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/activities/query",params,query)},readRole:function(roleKeyOrId,inherited){var params={};if(inherited){params.inherited=true}var uriFunction=function(){return this.getUri()+"/roles/"+roleKeyOrId};var chainable=this.getFactory().role(this.getCluster(),this);return this.chainGet(chainable,uriFunction,params)},listRoles:function(inherited){var params={};if(inherited){params.inherited=true}var uriFunction=function(){return this.getUri()+"/roles"};var chainable=this.getFactory().roleMap(this.getCluster(),this);return this.chainGet(chainable,uriFunction,params)},createRole:function(roleKey,object){if(!object){object={}}object.roleKey=roleKey;var uriFunction=function(){return this.getUri()+"/roles"};var self=this;var chainable=this.getFactory().role(this.getPlatform(),this,roleKey);return this.chainPostResponse(chainable,uriFunction,{},object).then(function(){this.subchain(self).readRole(roleKey).then(function(){Gitana.copyInto(chainable,this)})})},getMaxSize:function(){return this.get("maxSize")},getSize:function(){return this.get("size")},getObjectCount:function(){return this.get("objectcount")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ContainedDataStore=Gitana.DataStore.extend({constructor:function(container,object){this.base(container.getDriver(),object);this.getContainer=function(){return container};this.getContainerId=function(){return container.getId()}},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.getContainer(),uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},exportArchive:function(settings){var self=this;var vaultId=settings.vault;if(!Gitana.isString(vaultId)){vaultId=vaultId.getId()}var groupId=settings.group;var artifactId=settings.artifact;var versionId=settings.version;var configuration=(settings.configuration?settings.configuration:{});var synchronous=(settings.async?false:true);var chainable=this.getFactory().job(this.getCluster(),"export");return this.subchain(chainable).then(function(){var chain=this;this.getDriver().gitanaPost(self.getUri()+"/export?vault="+vaultId+"&group="+groupId+"&artifact="+artifactId+"&version="+versionId+"&schedule=ASYNCHRONOUS",{},configuration,function(response){Gitana.handleJobCompletion(chain,self.getCluster(),response.getId(),synchronous)},function(http){self.httpError(http)});return false})},importArchive:function(settings,reportFn){var self=this;var vaultId=settings.vault;if(!Gitana.isString(vaultId)){vaultId=vaultId.getId()}var groupId=settings.group;var artifactId=settings.artifact;var versionId=settings.version;var configuration=(settings.configuration?settings.configuration:{});var synchronous=(settings.async?false:true);var chainable=this.getFactory().job(this.getCluster(),"import");return this.subchain(chainable).then(function(){var chain=this;this.getDriver().gitanaPost(self.getUri()+"/import?vault="+vaultId+"&group="+groupId+"&artifact="+artifactId+"&version="+versionId+"&schedule=ASYNCHRONOUS",{},configuration,function(response){Gitana.handleJobCompletion(chain,self.getCluster(),response.getId(),synchronous,reportFn)},function(http){self.httpError(http)});return false})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.BinaryAttachment=Gitana.AbstractPersistable.extend({constructor:function(persistable,attachment){this.base(persistable.getDriver(),attachment);this.objectType=function(){return"Gitana.BinaryAttachment"};this.persistable=function(){return persistable}},getId:function(){return this.attachmentId},getLength:function(){return this.length},getContentType:function(){return this.contentType},getFilename:function(){return this.filename},getUri:function(){return this.persistable().getUri()+"/attachments/"+this.getId()},getDownloadUri:function(){return this.getDriver().baseURL+this.getUri()},getPreviewUri:function(name,config){if(!config){config={}}config.attachment=this.attachmentId;return this.persistable().getPreviewUri(name,config)},del:function(){var self=this;var result=this.subchain(this.persistable());result.subchain(self).then(function(){var chain=this;this.getDriver().gitanaDelete(this.getUri(),null,function(){chain.next()},function(http){self.httpError(http)});return false});return result},download:function(callback){var self=this;return this.then(function(){var chain=this;this.getDriver().gitanaDownload(this.getUri(),null,function(data){callback.call(self,data);chain.next()},function(http){self.httpError(http)});return false})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.BinaryAttachmentMap=Gitana.AbstractMap.extend({constructor:function(persistable,object){this.objectType=function(){return"Gitana.BinaryAttachmentMap"};this.__persistable=(function(){var _persistable=persistable;return function(p){if(!Gitana.isUndefined(p)){_persistable=p}return _persistable}})();if(!object){object=this.__persistable().getSystemMetadata()["attachments"]}this.base(this.__persistable().getDriver(),object)},chainCopyState:function(otherObject){this.base(otherObject);if(otherObject.__persistable){this.__persistable(otherObject.__persistable())}},clone:function(){return new Gitana.BinaryAttachmentMap(this.__persistable(),this)},buildObject:function(attachment){return new Gitana.BinaryAttachment(this.__persistable(),attachment)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AuditRecord=Gitana.AbstractObject.extend({constructor:function(datastore,object){this.base(datastore.getCluster(),object);this.objectType=function(){return"Gitana.AuditRecord"};this.getDataStore=function(){return datastore};this.getDataStoreId=function(){return datastore.getId()}},getUri:function(){return this.datastore.getUri()+"/audit"},clone:function(){return this.getFactory().auditRecord(this.getDataStore(),this)},getScope:function(){return this.get("scope")},getAction:function(){return this.get("action")},getPrincipalId:function(){return this.get("principal")},getMethod:function(){return this.get("method")},getHandler:function(){return this.get("handler")},getArgs:function(){return this.get("args")},getReturn:function(){return this.get("return")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AuditRecordMap=Gitana.AbstractMap.extend({constructor:function(datastore,object){this.objectType=function(){return"Gitana.AuditRecordMap"};this.getDatastore=function(){return datastore};this.base(datastore.getDriver(),object)},clone:function(){return this.getFactory().auditRecordMap(this.getDatastore(),this)},buildObject:function(json){return this.getFactory().auditRecord(this.getDatastore(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Team=Gitana.AbstractObject.extend({constructor:function(cluster,teamable,object){this.__teamable=(function(){var _teamable=null;return function(teamable){if(!Gitana.isUndefined(teamable)){_teamable=teamable}return _teamable}})();this.__teamable(teamable);this.objectType=function(){return"Gitana.Team"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object)},clone:function(){return this.getFactory().team(this.getCluster(),this.__teamable(),this)},getUri:function(){return this.__teamable().getUri()+"/teams/"+this.getKey()},getType:function(){return"team"},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.__teamable(),uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},addMember:function(principal){var self=this;var uriFunction=function(){var principalDomainQualifiedId=self.extractPrincipalDomainQualifiedId(principal);return this.getUri()+"/members/add?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},removeMember:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/members/remove?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},listMembers:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return this.getUri()+"/members"};var chainable=new Gitana.TeamMemberMap(this);return this.chainGet(chainable,uriFunction,params)},grant:function(authorityId){var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/grant"};return this.chainPostEmpty(null,uriFunction)},revoke:function(authorityId){var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/revoke"};return this.chainPostEmpty(null,uriFunction)},loadAuthorities:function(callback){var uriFunction=function(){return this.getUri()+"/authorities"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response.authorities)})},getKey:function(){return this.get("key")},getGroupId:function(){return this.get("groupId")},getRoleKeys:function(){return this.get("roleKeys")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TeamMap=Gitana.AbstractMap.extend({constructor:function(cluster,teamable,object){this.__teamable=(function(){var _teamable=null;return function(teamable){if(!Gitana.isUndefined(teamable)){_teamable=teamable}return _teamable}})();this.__teamable(teamable);this.objectType=function(){return"Gitana.TeamMap"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object)},clone:function(){return this.getFactory().teamMap(this.getCluster(),this.__teamable(),this)},buildObject:function(json){return this.getFactory().team(this.getCluster(),this.__teamable(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TeamMember=Gitana.AbstractObject.extend({constructor:function(team,object){this.base(team.getDriver(),object);this.objectType=function(){return"Gitana.TeamMember"};this.getTeam=function(){return team};this.getCluster=function(){return team.getCluster()};this.getClusterId=function(){return team.getClusterId()}}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TeamMemberMap=Gitana.AbstractMap.extend({constructor:function(team,object){this.objectType=function(){return"Gitana.TeamMemberMap"};this.getTeam=function(){return team};this.base(team.getDriver(),object)},clone:function(){return new Gitana.TeamMemberMap(this.getTeam(),this)},buildObject:function(json){return new Gitana.TeamMember(this.getTeam(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Activity=Gitana.AbstractObject.extend({constructor:function(datastore,object){this.base(datastore.getDriver(),object);this.objectType=function(){return"Gitana.Activity"};this.getDataStore=function(){return datastore}},getUri:function(){return this.getDataStore().getUri()+"/activities/"+this.getId()},clone:function(){return new Gitana.Activity(this.getDataStore(),this)},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.getDataStore(),uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},getType:function(){return this.get("type")},getTimestamp:function(){return this.get("timestamp")},getUserDomainId:function(){return this.get("userDomainId")},getUserId:function(){return this.get("userId")},getUserTitle:function(){return this.get("userTitle")},getUserEmail:function(){return this.get("userEmail")},getUserName:function(){return this.get("userName")},getObjectDataStoreTypeId:function(){return this.get("objectDatastoreTypeId")},getObjectDataStoreId:function(){return this.get("objectDatastoreId")},getObjectDataStoreTitle:function(){return this.get("objectDatastoreTitle")},getObjectTypeId:function(){return this.get("objectTypeId")},getObjectId:function(){return this.get("objectId")},getObjectTitle:function(){return this.get("objectTitle")},getOtherDataStoreTypeId:function(){return this.get("otherDatastoreTypeId")},getOtherDataStoreId:function(){return this.get("otherDatastoreId")},getOtherDataStoreTitle:function(){return this.get("otherDatastoreTitle")},getOtherTypeId:function(){return this.get("otherTypeId")},getOtherId:function(){return this.get("otherId")},getOtherTitle:function(){return this.get("otherTitle")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ActivityMap=Gitana.AbstractMap.extend({constructor:function(datastore,object){this.objectType=function(){return"Gitana.ActivityMap"};this.getDataStore=function(){return datastore};this.base(datastore.getDriver(),object)},clone:function(){return this.getFactory().activityMap(this.getDataStore(),this)},buildObject:function(json){return this.getFactory().activity(this.getDataStore(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Role=Gitana.AbstractObject.extend({constructor:function(cluster,roleContainer,object){this.base(cluster.getDriver(),object);this.objectType=function(){return"Gitana.Role"};this.roleContainer=roleContainer;this.getCluster=function(){return cluster}},getUri:function(){return this.roleContainer.getUri()+"/roles/"+this.getId()},getType:function(){return"role"},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.roleContainer,uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},getRoleKey:function(){return this.roleKey},getPermissions:function(){return this.object.permissions}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RoleMap=Gitana.AbstractMap.extend({constructor:function(cluster,roleContainer,object){this.objectType=function(){return"Gitana.RoleMap"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object);this.roleContainer=roleContainer},clone:function(){return this.getFactory().roleMap(this.getCluster(),this.roleContainer,this)},buildObject:function(json){return this.getFactory().role(this.getCluster(),this.roleContainer,json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Cluster=Gitana.DataStore.extend({constructor:function(driver,object){this.objectType=function(){return"Gitana.Cluster"};this.base(driver,object)},getUri:function(){return""},getType:function(){return Gitana.TypedIDConstants.TYPE_CLUSTER},clone:function(){return new Gitana.Cluster(this.getDriver(),this)},loadContainedTypes:function(type,callback){var uriFunction=function(){return"/tools/types/contained/"+type};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.types)})},queryJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/query",params,query)},readJob:function(jobId){var chainable=this.getFactory().job(this);return this.chainGet(chainable,"/jobs/"+jobId)},killJob:function(jobId){return this.chainPostEmpty(null,"/jobs/"+jobId+"/kill")},queryUnstartedJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/unstarted/query",params,query)},queryRunningJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/running/query",params,query)},queryFailedJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/failed/query",params,query)},queryWaitingJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/waiting/query",params,query)},queryFinishedJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/finished/query",params,query)},waitForJobCompletion:function(jobId,callback){var chainable=this;var f=function(){window.setTimeout(function(){Chain(chainable).readJob(jobId).then(function(){if(this.state=="FINISHED"){callback(this);chainable.next()}else{if(this.state=="ERROR"){callback(this);chainable.next()}else{f()}}})},1000)};f()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractClusterObject=Gitana.AbstractObject.extend({constructor:function(cluster,object){this.base(cluster.getDriver(),object);this.objectType=function(){return"Gitana.Job"};this.getCluster=function(){return cluster}},ref:function(){return this.getType()+"://"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Job=Gitana.AbstractClusterObject.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.Job"}},clone:function(){return new Gitana.Job(this.getCluster(),this)},getType:function(){return this.get("type")},getRunAsPrincipalId:function(){return this.get("runAsPrincipal")},getRunAsPrincipalDomainId:function(){return this.get("runAsPrincipalDomain")},getState:function(){return this.get("state")},getPlatformId:function(){return this.get("platformId")},getPriority:function(){return this.get("priority")},getAttempts:function(){return this.get("attempts")},getScheduledStartTime:function(){return this.get("schedule_start_ms")},getLogEntries:function(){return this.get("log_entries")},getCurrentThread:function(){return this.get("current_thread")},getCurrentServer:function(){return this.get("current_server")},getCurrentServerTimeStamp:function(){return this.get("current_server_timestamp")},getSubmittedBy:function(){return this.get("submitted_by")},getSubmittedTimestamp:function(){return this.get("submitted_timestamp")},getStarted:function(){return this.get("started")},getStartedBy:function(){return this.get("started_by")},getStartedTimestamp:function(){return this.get("started_timestamp")},getStopped:function(){return this.get("stopped")},getStoppedTimestamp:function(){return this.get("stopped_timestamp")},getPaused:function(){return this.get("paused")},getPausedBy:function(){return this.get("paused_by")},getPausedTimestamp:function(){return this.get("paused_timestamp")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.JobMap=Gitana.AbstractMap.extend({constructor:function(cluster,object){this.objectType=function(){return"Gitana.JobMap"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object)},clone:function(){return this.getFactory().jobMap(this.getCluster(),this)},buildObject:function(json){return this.getFactory().job(this.getCluster(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.LogEntry=Gitana.AbstractObject.extend({constructor:function(platform,object){this.base(platform.getDriver(),object);this.objectType=function(){return"Gitana.LogEntry"};this.getPlatform=function(){return platform}},clone:function(){return new Gitana.LogEntry(this.getPlatform(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_LOG_ENTRY},getPrincipalId:function(){return this.get("principalId")},getRepositoryId:function(){return this.get("repositoryId")},getBranchId:function(){return this.get("branchId")},getLevel:function(){return this.get("level")},getThread:function(){return this.get("thread")},getTimestamp:function(){return this.get("timestamp")},getMessage:function(){return this.get("message")},getFilename:function(){return this.get("filename")},getMethod:function(){return this.get("method")},getLineNumber:function(){return this.get("line")},getClassDescriptor:function(){return this.get("class")},getThrowables:function(){return this.get("throwables")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.LogEntryMap=Gitana.AbstractMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.LogEntryMap"};this.getPlatform=function(){return platform};this.base(platform.getDriver(),object)},clone:function(){return this.getFactory().logEntryMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().logEntry(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.CopyJob=Gitana.Job.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.CopyJob"}},clone:function(){return new Gitana.CopyJob(this.getCluster(),this)},getImports:function(){var importObjects=[];var array=this.get("imports");for(var i=0;i0){targetId=importObjects[0].getTargetId()}return targetId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TransferImportJob=Gitana.Job.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.TransferImportJob"}},clone:function(){return new Gitana.TransferExportJob(this.getCluster(),this)},getImports:function(){var importObjects=[];var array=this.get("imports");for(var i=0;i0){targetId=importObjects[0].getTargetId()}return targetId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TransferExportJob=Gitana.Job.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.TransferExportJob"}},clone:function(){return new Gitana.TransferExportJob(this.getCluster(),this)},getImports:function(){var importObjects=[];var array=this.get("imports");for(var i=0;i0){targetId=importObjects[0].getTargetId()}return targetId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Platform=Gitana.ContainedDataStore.extend({constructor:function(cluster,object){this.objectType=function(){return"Gitana.Platform"};this.base(cluster,object);this.getCluster=function(){return cluster};this.getClusterId=function(){return cluster.getId()}},getPlatform:function(){return this},readCluster:function(){return this.subchain(this.getCluster())},getUri:function(){return""},getType:function(){return Gitana.TypedIDConstants.TYPE_PLATFORM},clone:function(){return this.getFactory().platform(this.getCluster(),this)},del:function(){return this},reload:function(){var uriFunction=function(){return this.getUri()+"/"};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()+"/"};return this.chainUpdate(null,uriFunction)},readPrimaryDomain:function(){var self=this;var uriFunction=function(){return self.getUri()+"/domains/primary"};var chainable=this.getFactory().domain(this);return this.chainGet(chainable,uriFunction)},loadInfo:function(callback){var uriFunction=function(){return"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},listRepositories:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().repositoryMap(this);return this.chainGet(chainable,"/repositories",params)},readRepository:function(repositoryId){var chainable=this.getFactory().repository(this);return this.chainGet(chainable,"/repositories/"+repositoryId)},createRepository:function(object){var chainable=this.getFactory().repository(this);return this.chainCreate(chainable,object,"/repositories")},queryRepositories:function(query,pagination){var chainable=this.getFactory().repositoryMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/repositories/query",params,query)},checkRepositoryPermissions:function(checks,callback){var uriFunction=function(){return"/repositories/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkRepositoryAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listDomains:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().domainMap(this);return this.chainGet(chainable,"/domains",params)},readDomain:function(domainId){var chainable=this.getFactory().domain(this);return this.chainGet(chainable,"/domains/"+domainId)},createDomain:function(object){var chainable=this.getFactory().domain(this);return this.chainCreate(chainable,object,"/domains")},queryDomains:function(query,pagination){var chainable=this.getFactory().domainMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/domains/query",params,query)},checkDomainPermissions:function(checks,callback){var uriFunction=function(){return"/domains/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkDomainAuthorities:function(checks,callback){var uriFunction=function(){return"/domains/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listVaults:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().vaultMap(this);return this.chainGet(chainable,"/vaults",params)},readVault:function(vaultId){var chainable=this.getFactory().vault(this);return this.chainGet(chainable,"/vaults/"+vaultId)},createVault:function(object){var chainable=this.getFactory().vault(this);return this.chainCreate(chainable,object,"/vaults")},queryVaults:function(query,pagination){var chainable=this.getFactory().vaultMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/vaults/query",params,query)},checkVaultPermissions:function(checks,callback){var uriFunction=function(){return"/vaults/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkVaultAuthorities:function(checks,callback){var uriFunction=function(){return"/vaults/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},authenticate:function(config,authFailureHandler){return this.getDriver().authenticate(config,authFailureHandler)},logout:function(expireAccessToken){var self=this;return this.subchain().then(function(){var platformCacheKey=this.getDriver().platformCacheKey;if(platformCacheKey){Gitana.disconnect(platformCacheKey,expireAccessToken)}this.getDriver().clearAuthentication();delete this.getDriver().platformCacheKey})},listStacks:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().stackMap(this);return this.chainGet(chainable,"/stacks",params)},readStack:function(stackId){var chainable=this.getFactory().stack(this);return this.chainGet(chainable,"/stacks/"+stackId)},createStack:function(object){if(!object){object={}}var chainable=this.getFactory().stack(this);return this.chainCreate(chainable,object,"/stacks")},queryStacks:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/stacks/query"};var chainable=this.getFactory().stackMap(this);return this.chainPost(chainable,uriFunction,params,query)},findStackForDataStore:function(datastoreType,datastoreId){var chainable=this.getFactory().stack(this);return this.chainGet(chainable,"/stacks/find/"+datastoreType+"/"+datastoreId)},checkStackPermissions:function(checks,callback){var uriFunction=function(){return"/stacks/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkStackAuthorities:function(checks,callback){var uriFunction=function(){return"/stacks/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listProjects:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().projectMap(this);return this.chainGet(chainable,"/projects",params)},readProject:function(projectId){var chainable=this.getFactory().project(this);return this.chainGet(chainable,"/projects/"+projectId)},createProject:function(object){if(!object){object={}}var chainable=this.getFactory().project(this);return this.chainCreate(chainable,object,"/projects")},startCreateProject:function(object,callback){var uriFunction=function(){return"/projects/start"};if(!object){object={}}return this.chainPostResponse(this,uriFunction,{},object).then(function(response){var jobId=response._doc;callback(jobId)})},queryProjects:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/projects/query"};var chainable=this.getFactory().projectMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkProjectPermissions:function(checks,callback){var uriFunction=function(){return"/projects/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkProjectAuthorities:function(checks,callback){var uriFunction=function(){return"/projects/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listProjectTypes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().projectMap(this);return this.chainGet(chainable,"/projecttypes",params)},queryLogEntries:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/logs/query"};if(!query){query={}}var chainable=this.getFactory().logEntryMap(this.getCluster());var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readLogEntry:function(logEntryId){var self=this;var uriFunction=function(){return self.getUri()+"/logs/"+logEntryId};var chainable=this.getFactory().logEntry(this.getCluster());return this.chainGet(chainable,uriFunction)},readLog:function(callback){var self=this;var uriFunction=function(){return"/logs/logfile"};return this.chainGetResponseText(this,uriFunction).then(function(text){callback.call(this,text)})},createLogEntry:function(message,level,obj){var self=this;var uriFunction=function(){return self.getUri()+"/logs"};if(!obj){obj={}}obj.message=message;obj.level=level;var chainable=this.getFactory().logEntry(this.getCluster());return this.chainCreate(chainable,obj,"/logs")},postLogEntry:function(message,level,obj){var self=this;var uriFunction=function(){return self.getUri()+"/logs"};if(!obj){obj={}}obj.message=message;obj.level=level;return this.chainPostEmpty(null,uriFunction,{},obj,"application/json")},listRegistrars:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().registrarMap(this);return this.chainGet(chainable,"/registrars",params)},readRegistrar:function(registrarId){var chainable=this.getFactory().registrar(this);return this.chainGet(chainable,"/registrars/"+registrarId)},createRegistrar:function(object){var chainable=this.getFactory().registrar(this);return this.chainCreate(chainable,object,"/registrars")},queryRegistrars:function(query,pagination){var chainable=this.getFactory().registrarMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/registrars/query",params,query)},checkRegistrarPermissions:function(checks,callback){var uriFunction=function(){return"/registrars/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkRegistrarAuthorities:function(checks,callback){var uriFunction=function(){return"/registrars/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listApplications:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().applicationMap(this);return this.chainGet(chainable,"/applications",params)},readApplication:function(applicationId){var uriFunction=function(){return"/applications/"+applicationId};var chainable=this.getFactory().application(this);return this.chainGet(chainable,uriFunction)},createApplication:function(object){var chainable=this.getFactory().application(this);return this.chainCreate(chainable,object,"/applications")},queryApplications:function(query,pagination){var chainable=this.getFactory().applicationMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/applications/query",params,query)},checkApplicationPermissions:function(checks,callback){var uriFunction=function(){return"/applications/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkApplicationAuthorities:function(checks,callback){var uriFunction=function(){return"/applications/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listApplicationTypes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().applicationMap(this);return this.chainGet(chainable,"/applicationtypes",params)},listClients:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().clientMap(this);return this.chainGet(chainable,"/clients",params)},readClient:function(clientId){var chainable=this.getFactory().client(this);return this.chainGet(chainable,"/clients/"+clientId)},createClient:function(object){if(!object){object={}}var chainable=this.getFactory().client(this);return this.chainCreate(chainable,object,"/clients")},queryClients:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/clients/query"};var chainable=this.getFactory().clientMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkClientPermissions:function(checks,callback){var uriFunction=function(){return"/clients/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkClientAuthorities:function(checks,callback){var uriFunction=function(){return"/clients/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},readAuthenticationGrant:function(authenticationGrantId){var chainable=this.getFactory().authenticationGrant(this);return this.chainGet(chainable,"/auth/grants/"+authenticationGrantId)},createAuthenticationGrant:function(object){if(!object){object={}}var chainable=this.getFactory().authenticationGrant(this);return this.chainCreate(chainable,object,"/auth/grants")},queryAuthenticationGrants:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/auth/grants/query"};var chainable=this.getFactory().authenticationGrantMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkAuthenticationGrantPermissions:function(checks,callback){var uriFunction=function(){return"/auth/grants/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkAuthenticationGrantAuthorities:function(checks,callback){var uriFunction=function(){return"/auth/grants/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listDirectories:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().directoryMap(this);return this.chainGet(chainable,"/directories",params)},readDirectory:function(directoryId){var chainable=this.getFactory().directory(this);return this.chainGet(chainable,"/directories/"+directoryId)},createDirectory:function(object){var chainable=this.getFactory().directory(this);return this.chainCreate(chainable,object,"/directories")},queryDirectories:function(query,pagination){var chainable=this.getFactory().directoryMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/directories/query",params,query)},checkDirectoryPermissions:function(checks,callback){var uriFunction=function(){return"/directories/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkDirectoryAuthorities:function(checks,callback){var uriFunction=function(){return"/directories/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listBillingProviderConfigurations:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().billingProviderConfigurationMap(this);return this.chainGet(chainable,"/billing/configurations",params)},readBillingProviderConfiguration:function(billingProviderConfigurationId){var chainable=this.getFactory().billingProviderConfiguration(this);return this.chainGet(chainable,"/billing/configurations/"+billingProviderConfigurationId)},createBillingProviderConfiguration:function(providerId,object){if(!object){object={}}object.providerId=providerId;var chainable=this.getFactory().billingProviderConfiguration(this);return this.chainCreate(chainable,object,"/billing/configurations")},queryBillingProviderConfigurations:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/billing/configurations/query"};var chainable=this.getFactory().billingProviderConfigurationMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkBillingProviderConfigurationPermissions:function(checks,callback){var uriFunction=function(){return"/billing/configurations/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkBillingProviderConfigurationAuthorities:function(checks,callback){var uriFunction=function(){return"/billing/configurations/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWebHosts:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().webhostMap(this);return this.chainGet(chainable,"/webhosts",params)},readWebHost:function(webhostId){var chainable=this.getFactory().webhost(this);return this.chainGet(chainable,"/webhosts/"+webhostId)},createWebHost:function(object){var chainable=this.getFactory().webhost(this);return this.chainCreate(chainable,object,"/webhosts")},queryWebHosts:function(query,pagination){var chainable=this.getFactory().webhostMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/webhosts/query",params,query)},checkWebHostPermissions:function(checks,callback){var uriFunction=function(){return"/webhosts/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWebHostAuthorities:function(checks,callback){var uriFunction=function(){return"/webhosts/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWarehouses:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().warehouseMap(this);return this.chainGet(chainable,"/warehouses",params)},readWarehouse:function(warehouseId){var chainable=this.getFactory().warehouse(this);return this.chainGet(chainable,"/warehouses/"+warehouseId)},createWarehouse:function(object){var chainable=this.getFactory().warehouse(this);return this.chainCreate(chainable,object,"/warehouses")},queryWarehouses:function(query,pagination){var chainable=this.getFactory().warehouseMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/warehouses/query",params,query)},checkWarehousePermissions:function(checks,callback){var uriFunction=function(){return"/warehouses/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWarehouseAuthorities:function(checks,callback){var uriFunction=function(){return"/warehouses/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listTenantAttachments:function(){var self=this;var pseudoTenant=this.clone();pseudoTenant.getUri=function(){return"/tenant"};var result=this.subchain(new Gitana.BinaryAttachmentMap(pseudoTenant));result.then(function(){var chain=this;self.getDriver().gitanaGet(self.getUri()+"/tenant/attachments",null,{},function(response){chain.handleResponse(response);chain.next()});return false});return result},tenantAttachment:function(attachmentId){return this.listTenantAttachments().select(attachmentId)},tenantAttach:function(attachmentId,contentType,data){var self=this;var tenant=this.clone();tenant.getUri=function(){return"/tenant"};var result=this.subchain(new Gitana.BinaryAttachment(tenant));result.subchain().then(function(){var uploadUri=self.getUri()+"/tenant/attachments/"+attachmentId;this.chainUpload(this,uploadUri,null,contentType,data).then(function(){this.subchain(self).listTenantAttachments().then(function(){this.select(attachmentId).then(function(){result.handleResponse(this)})})})});return result},tenantUnattach:function(attachmentId){return this.subchain().then(function(){this.chainDelete(this,this.getUri()+"/tenant/attachments/"+attachmentId).then(function(){})})},getTenantPreviewUri:Gitana.Methods.getPreviewUri("tenant/preview"),app:function(settings,callback){var self=this;if(Gitana.isFunction(settings)){callback=settings;settings=null}if(Gitana.isString(settings)){settings={application:settings}}var config={application:null,appCacheKey:null};Gitana.copyKeepers(config,Gitana.loadDefaultConfig());Gitana.copyKeepers(config,self.getDriver().getOriginalConfiguration());Gitana.copyKeepers(config,settings);var cacheKey=config.appCacheKey;if(cacheKey){if(Gitana.APPS&&Gitana.APPS[cacheKey]){callback.call(Chain(Gitana.APPS[cacheKey]));return}}if(!config.application){callback.call(self,new Error("No application configured"));return}var helper=new Gitana.AppHelper(self,config);if(!Gitana.APPS){Gitana.APPS={}}helper.init.call(helper,function(err){if(err){callback(err);return}if(cacheKey){Gitana.APPS[cacheKey]=helper}callback.call(Chain(helper))})},accessLookups:function(entries,callback){var uriFunction=function(){return"/access/lookup"};var object={entries:entries};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.entries)})},accessChecks:function(entries,callback){var uriFunction=function(){return"/access/check"};var object={entries:entries};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.entries)})},referenceReads:function(entries,callback){var uriFunction=function(){return"/ref/read"};var object={entries:entries};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.entries)})},referenceDiff:function(sourceRef,targetRef,callback){var uriFunction=function(){return"/ref/diff"};var params={source:sourceRef,target:targetRef};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response)})},referenceMerge:function(sourceRef,diffObject,callback){var uriFunction=function(){return"/ref/merge"};var params={source:sourceRef};return this.chainPostResponse(this,uriFunction,params,diffObject).then(function(response){callback.call(this,response)})},adminIndexDatastores:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/index";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminRepair:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/repair";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},listRuleActions:function(pagination,callback){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/rule/actions"};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},readRuleAction:function(actionId,callback){var uriFunction=function(){return"/rule/actions/"+actionId};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},listRuleConditions:function(pagination,callback){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/rule/conditions"};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},readRuleCondition:function(conditionId,callback){var uriFunction=function(){return"/rule/conditions/"+conditionId};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},listWorkflowModels:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowModelMap(this);return this.chainGet(chainable,"/workflow/models",params)},listAllWorkflowModels:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowModelMap(this);return this.chainGet(chainable,"/workflow/models?all=true",params)},readWorkflowModel:function(workflowModelId,workflowModelVersionId){var uriFunction=function(){var url="/workflow/models/"+workflowModelId;if(workflowModelVersionId){url+="/versions/"+workflowModelVersionId}return url};var chainable=this.getFactory().workflowModel(this);return this.chainGet(chainable,uriFunction)},createWorkflowModel:function(id,object){if(!object){object={}}object.id=id;var chainable=this.getFactory().workflowModel(this);return this.chainCreate(chainable,object,"/workflow/models")},queryWorkflowModels:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/models/query"};var chainable=this.getFactory().workflowModelMap(this);return this.chainPost(chainable,uriFunction,params,query)},queryAllWorkflowModels:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/models/query?all=true"};var chainable=this.getFactory().workflowModelMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowModelPermissions:function(checks,callback){var uriFunction=function(){return"/workflow/models/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowModelAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/models/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWorkflowModelVersions:function(id,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var self=this;return"/workflow/models/"+id+"/versions"};var chainable=this.getFactory().workflowModelMap(this);return this.chainGet(chainable,uriFunction,params)},queryWorkflowModelVersions:function(id,query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var self=this;return"/workflow/models/"+id+"/versions/query"};var chainable=this.getFactory().workflowModelMap(this);return this.chainPost(chainable,uriFunction,params,query)},listWorkflows:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowInstanceMap(this);return this.chainGet(chainable,"/workflow/instances",params)},readWorkflow:function(workflowId){var chainable=this.getFactory().workflowInstance(this);return this.chainGet(chainable,"/workflow/instances/"+workflowId)},createWorkflow:function(workflowModelId,object){if(!object){object={}}var params={modelId:workflowModelId};var chainable=this.getFactory().workflowInstance(this);return this.chainCreate(chainable,object,"/workflow/instances",params)},queryWorkflows:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/instances/query"};var chainable=this.getFactory().workflowInstanceMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowInstancePermissions:function(checks,callback){var uriFunction=function(){return"/workflow/instance/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowInstanceAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/instance/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWorkflowTasks:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowTaskMap(this);return this.chainGet(chainable,"/workflow/tasks",params)},readWorkflowTask:function(workflowTaskId){var chainable=this.getFactory().workflowTask(this);return this.chainGet(chainable,"/workflow/tasks/"+workflowTaskId)},queryWorkflowTasks:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/tasks/query"};var chainable=this.getFactory().workflowTaskMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowTaskPermissions:function(checks,callback){var uriFunction=function(){return"/workflow/task/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowTaskAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/task/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWorkflowComments:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowCommentMap(this);return this.chainGet(chainable,"/workflow/comments",params)},readWorkflowComment:function(workflowCommentId){var chainable=this.getFactory().workflowComment(this);return this.chainGet(chainable,"/workflow/comments/"+workflowCommentId)},createWorkflowComment:function(workflowId,workflowTaskId,object){var params={};var createUri=function(){var uri="/workflow/instances/"+workflowId+"/comments";if(workflowTaskId){uri+="?taskId="+workflowTaskId}return uri};var readUri=function(status){return"/workflow/comments/"+status._doc};var chainable=this.getFactory().workflowComment(this);return this.chainCreateEx(chainable,object,createUri,readUri)},queryWorkflowComments:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/comments/query"};var chainable=this.getFactory().workflowCommentMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowCommentPermissions:function(checks,callback){var uriFunction=function(){return"/workflow/comments/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowCommentAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/comments/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listTasksForCurrentUser:function(filter,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}var chainable=this.getFactory().workflowTaskMap(this);return this.chainGet(chainable,"/workflow/user/tasks",params)},queryTasksForCurrentUser:function(filter,query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}var chainable=this.getFactory().workflowTaskMap(this);return this.chainPost(chainable,"/workflow/user/tasks/query",params,query)},queryTasks:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowTaskMap(this);return this.chainPost(chainable,"/workflow/tasks/query",params,query)},loadWorkflowHistory:function(workflowId,pagination,callback){var uriFunction=function(){return"/workflow/instances/"+workflowId+"/history"};var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},listScheduledWorkItems:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().scheduledWorkMap(this);return this.chainGet(chainable,"/work/scheduled",params)},readScheduledWorkItem:function(scheduledWorkId){var chainable=this.getFactory().scheduledWork(this);return this.chainGet(chainable,"/work/scheduled/"+scheduledWorkId)},createScheduledWorkItem:function(object){if(!object){object={}}var chainable=this.getFactory().scheduledWork(this);return this.chainCreate(chainable,object,"/work/scheduled")},queryScheduledWorkItems:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/work/scheduled/query"};var chainable=this.getFactory().scheduledWorkMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkScheduledWorkPermissions:function(checks,callback){var uriFunction=function(){return"/work/scheduled/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkScheduledWorkAuthorities:function(checks,callback){var uriFunction=function(){return"/work/scheduled/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listReports:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().reportMap(this);return this.chainGet(chainable,"/reports",params)},readReport:function(reportId){var chainable=this.getFactory().report(this);return this.chainGet(chainable,"/reports/"+reportId)},createReport:function(object){if(!object){object={}}var chainable=this.getFactory().report(this);return this.chainCreate(chainable,object,"/reports")},queryReports:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/reports/query"};var chainable=this.getFactory().reportMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkReportPermissions:function(checks,callback){var uriFunction=function(){return"/reports/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkReportAuthorities:function(checks,callback){var uriFunction=function(){return"/reports/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},executeReport:function(reportId,config,callback){if(typeof(config)=="function"){callback=config;config={}}var uriFunction=function(){return"/reports/"+reportId+"/execute"};return this.chainPostResponse(this,uriFunction,null,config).then(function(response){callback.call(this,response)})},runExport:function(objects,configuration,callback){var self=this;var uriFunction=function(){return"/ref/exports/start"};if(!configuration){configuration={}}var references=[];if(objects.refs){references=objects.refs()}else{if(objects.length){for(var i=0;i0){var obj=settings[settings.__keys()[0]];chain.loadFrom(obj);chain.next()}else{object.settings={};driver.gitanaPost(createUri,null,object,function(status){driver.gitanaGet(createUri+"/"+status.getId(),null,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)})}},function(http){self.httpError(http)});return false})},readApplicationPrincipalSettings:function(){var args=Gitana.makeArray(arguments);if(args.length==1){var principal=args.shift();return this.readApplicationSettings("principal",principal.getDomainQualifiedId())}else{if(args.length==2){var domainId=args.shift();var principalId=args.shift();return this.readApplicationSettings("principal",domainId+"/"+principalId)}}},checkSettingPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/settings/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkSettingAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/settings/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createRegistration:function(object){var self=this;var chainable=this.getFactory().registration(this);var uriFunction=function(){return self.getUri()+"/registrations"};return this.chainCreate(chainable,object,uriFunction)},listRegistrations:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/registrations"};var chainable=this.getFactory().registrationMap(this);return this.chainGet(chainable,uriFunction,params)},readRegistration:function(registrationId){var self=this;var chainable=this.getFactory().registration(this);var uriFunction=function(){return self.getUri()+"/registrations/"+registrationId};return this.chainGet(chainable,uriFunction)},queryRegistrations:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/registrations/query"};var chainable=this.getFactory().registrationMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkRegistrationPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/registrations/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkRegistrationAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/registrations/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createPageRendition:function(deploymentKey,object){var self=this;var chainable=this.getFactory().pageRendition(this,deploymentKey);var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions"};return this.chainCreate(chainable,object,uriFunction)},listPageRenditions:function(deploymentKey,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions"};var chainable=this.getFactory().pageRenditionMap(this,deploymentKey);return this.chainGet(chainable,uriFunction,params)},readPageRendition:function(deploymentKey,pageRenditionIdOrKey){var self=this;var chainable=this.getFactory().pageRendition(this,deploymentKey);var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/"+pageRenditionIdOrKey};return this.chainGet(chainable,uriFunction)},queryPageRenditions:function(deploymentKey,query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/query"};var chainable=this.getFactory().pageRenditionMap(this,deploymentKey);return this.chainPost(chainable,uriFunction,params,query)},checkPageRenditionPermissions:function(deploymentKey,checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkPageRenditionAuthorities:function(deploymentKey,checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createEmailProvider:function(object){var self=this;var chainable=this.getFactory().emailProvider(this);var uriFunction=function(){return self.getUri()+"/emailproviders"};return this.chainCreate(chainable,object,uriFunction)},listEmailProviders:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emailproviders"};var chainable=this.getFactory().emailProviderMap(this);return this.chainGet(chainable,uriFunction,params)},readEmailProvider:function(emailProviderId){var self=this;var chainable=this.getFactory().emailProvider(this);var uriFunction=function(){return self.getUri()+"/emailproviders/"+emailProviderId};return this.chainGet(chainable,uriFunction)},queryEmailProviders:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emailproviders/query"};var chainable=this.getFactory().emailProviderMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkEmailProviderPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emailproviders/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkEmailProviderAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emailproviders/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createEmail:function(object){var self=this;var chainable=this.getFactory().email(this);var uriFunction=function(){return self.getUri()+"/emails"};return this.chainCreate(chainable,object,uriFunction)},listEmails:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emails"};var chainable=this.getFactory().emailMap(this);return this.chainGet(chainable,uriFunction,params)},readEmail:function(emailId){var self=this;var chainable=this.getFactory().email(this);var uriFunction=function(){return self.getUri()+"/emails/"+emailId};return this.chainGet(chainable,uriFunction)},queryEmails:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emails/query"};var chainable=this.getFactory().emailMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkEmailPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emails/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkEmailAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emails/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},deploy:function(deploymentKey){var self=this;var uriFunction=function(){return self.getUri()+"/deploy/"+deploymentKey};var webhost=new Gitana.WebHost(this.getPlatform());var chainable=this.getFactory().deployedApplication(webhost);return this.chainPost(chainable,uriFunction).then(function(){var webhostId=self.deployments[deploymentKey]["webhost"];this.subchain(this.getPlatform()).readWebHost(webhostId).then(function(){webhost.loadFrom(this)})})},undeploy:function(deploymentKey){var self=this;var uriFunction=function(){return self.getUri()+"/undeploy/"+deploymentKey};return this.chainPost(this,uriFunction)},findDeployedApplication:function(deploymentKey){var self=this;var uriFunction=function(){return self.getUri()+"/deployed/"+deploymentKey};var webhost=new Gitana.WebHost(this.getPlatform());var chainable=this.getFactory().deployedApplication(webhost);return this.chainGet(chainable,uriFunction).then(function(){var webhostId=self.deployments[deploymentKey]["webhost"];this.subchain(this.getPlatform()).readWebHost(webhostId).then(function(){webhost.loadFrom(this)})})},loadDeploymentInfo:function(deploymentKey,callback){var self=this;var uriFunction=function(){return self.getUri()+"/deployed/"+deploymentKey+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response.info)})},refreshDeploymentKeys:function(deploymentKey){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/deployments/"+deploymentKey+"/refreshkeys";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ApplicationMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.ApplicationMap"};this.base(platform,object)},clone:function(){return this.getFactory().applicationMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().application(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractApplicationObject=Gitana.AbstractPlatformObject.extend({constructor:function(application,object){this.base(application.getPlatform(),object);this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getApplicationId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Settings=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.Settings"}},clone:function(){return new Gitana.Settings(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_SETTINGS},getUri:function(){return"/applications/"+this.getApplicationId()+"/settings/"+this.getId()},getSettings:function(){return this["settings"]},getSetting:function(key){return(this.getSettings()?this.getSettings()[key]:null)},setSetting:function(key,val){if(!this.getSettings()){this["settings"]={}}this["settings"][key]=val},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri()})})(window);(function(window){var Gitana=window.Gitana;Gitana.SettingsMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.SettingsMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().settingsMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().settings(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Email=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.Email"}},clone:function(){return new Gitana.Email(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_EMAIL},getUri:function(){return"/applications/"+this.getApplicationId()+"/emails/"+this.getId()},send:function(emailProvider){return this.then(function(){this.subchain(emailProvider).send(this)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.EmailMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.EmailMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().emailMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().email(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.EmailProvider=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.EmailProvider"}},clone:function(){return new Gitana.EmailProvider(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_EMAIL_PROVIDER},getUri:function(){return"/applications/"+this.getApplicationId()+"/emailproviders/"+this.getId()},send:function(email,model){var self=this;if(!model){model={}}var emailId=null;if(Gitana.isString(email)){emailId=email}else{emailId=email.getId()}var uriFunction=function(){return self.getUri()+"/send?email="+emailId};return this.chainPostEmpty(null,uriFunction,{},model)},test:function(from,to){var self=this;var uriFunction=function(){return self.getUri()+"/test?from="+from+"&to="+to};return this.chainPostEmpty(null,uriFunction)},sendForExport:function(exportId,emailConfig,callback){var self=this;var uriFunction=function(){return"/ref/exports/"+exportId+"/email"};var params={};var payload={applicationId:this.getApplicationId(),emailProviderId:this.getId(),email:emailConfig};return this.chainPostResponse(this,uriFunction,params,payload).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.EmailProviderMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.EmailProviderMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().emailProviderMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().emailProvider(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Registration=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.Registration"}},clone:function(){return new Gitana.Registration(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_REGISTRATION},getUri:function(){return"/applications/"+this.getApplicationId()+"/registrations/"+this.getId()},sendConfirmationEmail:function(){var self=this;var uriFunction=function(){return self.getUri()+"/send/confirmation"};return this.chainPostEmpty(this,uriFunction,{},this)},sendWelcomeEmail:function(){var self=this;var uriFunction=function(){return self.getUri()+"/send/welcome"};return this.chainPostEmpty(this,uriFunction,{},this)},confirm:function(newUserPassword,paymentMethodObject){if(!paymentMethodObject){paymentMethodObject={}}var params={password:newUserPassword};var self=this;var uriFunction=function(){return self.getUri()+"/confirm"};return this.chainPostEmpty(this,uriFunction,params,paymentMethodObject)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RegistrationMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.RegistrationMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().registrationMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().registration(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PageRendition=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.PageRendition"}},clone:function(){return new Gitana.PageRendition(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_PAGE_RENDITION},getUri:function(){return"/applications/"+this.getApplicationId()+"/deployments/"+this.deploymentKey+"/pagerenditions/"+this.key},invalidate:function(){var self=this;var uriFunction=function(){return self.getUri()+"/invalidate"};return this.chainPostEmpty(this.getPlatform(),uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PageRenditionMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.PageRenditionMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().pageRenditionMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().pageRendition(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Warehouse=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.Warehouse"};this.base(platform,object)},getUri:function(){return"/warehouses/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_WAREHOUSE},clone:function(){return this.getFactory().warehouse(this.getPlatform(),this)},listInteractions:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionMap(this);return this.chainGet(chainable,this.getUri()+"/interactions",params)},readInteraction:function(interactionId){var chainable=this.getFactory().interaction(this);return this.chainGet(chainable,this.getUri()+"/interactions/"+interactionId)},queryInteractions:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/interactions/query"};var chainable=this.getFactory().interactionMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionApplications:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionApplicationMap(this);return this.chainGet(chainable,this.getUri()+"/applications",params)},readInteractionApplication:function(interactionApplicationId){var chainable=this.getFactory().interactionApplication(this);return this.chainGet(chainable,this.getUri()+"/applications/"+interactionApplicationId)},queryInteractionApplications:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/applications/query"};var chainable=this.getFactory().interactionApplicationMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionSessions:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionSessionMap(this);return this.chainGet(chainable,this.getUri()+"/sessions",params)},readInteractionSession:function(interactionSessionId){var chainable=this.getFactory().interactionSession(this);return this.chainGet(chainable,this.getUri()+"/sessions/"+interactionSessionId)},queryInteractionSessions:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/sessions/query"};var chainable=this.getFactory().interactionSessionMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionPages:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionPageMap(this);return this.chainGet(chainable,this.getUri()+"/pages",params)},readInteractionPage:function(interactionPageId){var chainable=this.getFactory().interactionPage(this);return this.chainGet(chainable,this.getUri()+"/pages/"+interactionPageId)},queryInteractionPages:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/pages/query"};var chainable=this.getFactory().interactionPageMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionNodes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionNodeMap(this);return this.chainGet(chainable,this.getUri()+"/nodes",params)},readInteractionNode:function(interactionNodeId){var chainable=this.getFactory().interactionNode(this);return this.chainGet(chainable,this.getUri()+"/nodes/"+interactionNodeId)},queryInteractionNodes:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes/query"};var chainable=this.getFactory().interactionNodeMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionUsers:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionUserMap(this);return this.chainGet(chainable,this.getUri()+"/users",params)},readInteractionUser:function(interactionUserId){var chainable=this.getFactory().interactionUser(this);return this.chainGet(chainable,this.getUri()+"/users/"+interactionUserId)},queryInteractionUsers:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/users/query"};var chainable=this.getFactory().interactionUserMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionContinents:Gitana.Methods.listInteractionObjects("interactionContinentMap","continents"),readInteractionContinent:Gitana.Methods.readInteractionObject("interactionContinent","continents"),queryInteractionContinents:Gitana.Methods.queryInteractionObjects("interactionContinentMap","continents"),listInteractionCountries:Gitana.Methods.listInteractionObjects("interactionCountryMap","countries"),readInteractionCountry:Gitana.Methods.readInteractionObject("interactionCountry","countries"),queryInteractionCountries:Gitana.Methods.queryInteractionObjects("interactionCountryMap","countries"),listInteractionCities:Gitana.Methods.listInteractionObjects("interactionCityMap","cities"),readInteractionCity:Gitana.Methods.readInteractionObject("interactionCity","cities"),queryInteractionCities:Gitana.Methods.queryInteractionObjects("interactionCityMap","cities"),listInteractionRegions:Gitana.Methods.listInteractionObjects("interactionRegionMap","regions"),readInteractionRegion:Gitana.Methods.readInteractionObject("interactionRegion","regions"),queryInteractionRegions:Gitana.Methods.queryInteractionObjects("interactionRegionMap","regions"),listInteractionPostalCodes:Gitana.Methods.listInteractionObjects("interactionPostalCodeMap","postalcodes"),readInteractionPostalCode:Gitana.Methods.readInteractionObject("interactionPostalCode","postalcodes"),queryInteractionPostalCodes:Gitana.Methods.queryInteractionObjects("interactionPostalCodeMap","postalcodes"),listInteractionUserAgents:Gitana.Methods.listInteractionObjects("interactionUserAgentMap","useragents"),readInteractionUserAgent:Gitana.Methods.readInteractionObject("interactionUserAgent","useragents"),queryInteractionUserAgents:Gitana.Methods.queryInteractionObjects("interactionUserAgentMap","useragents"),listInteractionOperatingSystems:Gitana.Methods.listInteractionObjects("interactionOperatingSystemMap","operatingsystems"),readInteractionOperatingSystems:Gitana.Methods.readInteractionObject("interactionOperatingSystem","operatingsystems"),queryInteractionOperatingSystems:Gitana.Methods.queryInteractionObjects("interactionOperatingSystemMap","operatingsystems"),listInteractionDevices:Gitana.Methods.listInteractionObjects("interactionDeviceMap","devices"),readInteractionDevice:Gitana.Methods.readInteractionObject("interactionDevice","devices"),queryInteractionDevices:Gitana.Methods.queryInteractionObjects("interactionDeviceMap","devices"),listInteractionReports:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionReportMap(this);return this.chainGet(chainable,this.getUri()+"/reports",params)},readInteractionReport:function(interactionReportId){var chainable=this.getFactory().interactionReport(this);return this.chainGet(chainable,this.getUri()+"/reports/"+interactionReportId)},queryInteractionReports:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/reports/query"};var chainable=this.getFactory().interactionReportMap(this);return this.chainPost(chainable,uriFunction,params,query)},loadInfo:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},reset:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/reset";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},listConversionTriggers:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/triggers/"};var chainable=this.getFactory().conversionTriggerMap(this);return this.chainGet(chainable,uriFunction,params)},readConversionTrigger:function(triggerId){var self=this;var uriFunction=function(){return self.getUri()+"/triggers/"+triggerId};var chainable=this.getFactory().conversionTrigger(this);return this.chainGet(chainable,uriFunction)},createConversionTrigger:function(object){var self=this;if(!object){object={}}var uriFunction=function(){return self.getUri()+"/triggers"};var chainable=this.getFactory().conversionTrigger(this);return this.chainCreate(chainable,object,uriFunction)},queryConversionTriggers:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/triggers/query"};var chainable=this.getFactory().conversionTriggerMap(this);return this.chainPost(chainable,uriFunction,params,query)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.WarehouseMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.WarehouseMap"};this.base(platform,object)},clone:function(){return this.getFactory().warehouseMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().warehouse(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractWarehouseObject=Gitana.AbstractPlatformObject.extend({constructor:function(warehouse,object){this.base(warehouse.getPlatform(),object);this.getWarehouse=function(){return warehouse};this.getWarehouseId=function(){return warehouse.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getWarehouseId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractWarehouseObjectMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(warehouse,object){this.getWarehouse=function(){return warehouse};this.getWarehouseId=function(){return warehouse.getId()};this.base(warehouse.getPlatform(),object)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractReportableWarehouseObject=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.interactionObjectTypeId=null},listReports:function(pagination){return this.queryReports({},pagination)},readReport:function(interactionReportKey){return this.queryReports({key:interactionReportKey}).keepOne()},queryReports:function(query,pagination){if(!query){query={}}query.objectTypeId=this.interactionObjectTypeId;query.objectId=this.getId();return this.subchain(this.getWarehouse()).queryInteractionReports(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Interaction=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.Interaction"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/interactions/"+this.getId()},clone:function(){return this.getFactory().interaction(this.getWarehouse(),this)},getInteractionApplicationId:function(){return this.get("interactionApplicationId")},getInteractionSessionId:function(){return this.get("interactionSessionId")},getInteractionPageId:function(){return this.get("interactionPageId")},getInteractionUserId:function(){return this.get("interactionUserId")},getInteractionNodeId:function(){return this.get("interactionNodeId")},getSourceUserAgent:function(){return this["source"]["user-agent"]},getSourceHost:function(){return this["source"]["host"]},getSourceIP:function(){return this["source"]["ip"]},getEventType:function(){return this["event"]["type"]},getEventX:function(){return this["event"]["x"]},getEventY:function(){return this["event"]["y"]},getEventOffsetX:function(){return this["event"]["offsetX"]},getEventOffsetY:function(){return this["event"]["offsetY"]},getApplicationHost:function(){return this["application"]["host"]},getApplicationUrl:function(){return this["application"]["url"]},getApplicationUri:function(){return this["application"]["uri"]},getElementId:function(){return this["element"]["id"]},getElementType:function(){return this["element"]["type"]},getElementPath:function(){return this["element"]["path"]},getNodeRepositoryId:function(){return this["node"]["repositoryId"]},getNodeBranchId:function(){return this["node"]["branchId"]},getNodeId:function(){return this["node"]["id"]},getTimestampStart:function(){return this["timestamp"]["start"]},getTimestampEnd:function(){return this["timestamp"]["end"]},getTimestampMs:function(){return this["timestamp"]["ms"]},getPrincipalDomainId:function(){return this["principal"]["domainId"]},getPrincipalId:function(){return this["principal"]["id"]}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interaction(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionApplication=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionApplication"};this.interactionObjectTypeId="application"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_APPLICATION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/applications/"+this.getId()},clone:function(){return this.getFactory().interactionApplication(this.getWarehouse(),this)},getTimestampStart:function(){return this.get("timestamp")["start"]},getTimestampEnd:function(){return this.get("timestamp")["end"]},listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionApplicationId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)},listSessions:function(pagination){return this.querySessions(null,pagination)},querySessions:function(query,pagination){if(!query){query={}}query.interactionApplicationId=this.getId();return this.subchain(this.getWarehouse()).queryInteractionSessions(query,pagination)},listPages:function(pagination){return this.queryPages(null,pagination)},queryPages:function(query,pagination){if(!query){query={}}query.interactionApplicationId=this.getId();return this.subchain(this.getWarehouse()).queryInteractionPages(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionApplicationMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionApplicationMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionApplicationMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionApplication(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionSession=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionSession"};this.interactionObjectTypeId="session"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_SESSION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/sessions/"+this.getId()},clone:function(){return this.getFactory().interactionSession(this.getWarehouse(),this)},getInteractionApplicationId:function(){return this.get("interactionApplicationId")},getTimestampStart:function(){return this.get("timestamp")["start"]},getTimestampEnd:function(){return this.get("timestamp")["end"]},listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionSessionId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionSessionMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionSessionMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionSessionMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionSession(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPage=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionPage"};this.interactionObjectTypeId="page"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_PAGE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/pages/"+this.getId()},clone:function(){return this.getFactory().interactionPage(this.getWarehouse(),this)},getInteractionApplicationId:function(){return this.get("interactionApplicationId")},getPageUri:function(){return this.get("uri")},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri(),listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionPageId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)},capture:function(){var self=this;var uriFunction=function(){return self.getUri()+"/capture"};return this.chainPostEmpty(null,uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPageMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionPageMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionPageMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionPage(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionNode=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionNode"};this.interactionObjectTypeId="node"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_NODE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/nodes/"+this.getId()},clone:function(){return this.getFactory().interactionNode(this.getWarehouse(),this)},getRepositoryId:function(){return this.get("repositoryId")},getBranchId:function(){return this.get("branchId")},getNodeId:function(){return this.get("nodeId")},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri(),listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionNodeId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)},capture:function(){var self=this;var uriFunction=function(){return self.getUri()+"/capture"};return this.chainPostEmpty(null,uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionNodeMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionNodeMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionNodeMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionNode(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUser=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionUser"};this.interactionObjectTypeId="user"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_SESSION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/users/"+this.getId()},clone:function(){return this.getFactory().interactionUser(this.getWarehouse(),this)},getKey:function(){return this.get("key")},listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionUserId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUserMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionUserMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionUserMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionUser(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionContinent=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionContinent"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_CONTINENT},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/continents/"+this.getId()},clone:function(){return this.getFactory().interactionContinent(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionContinentMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionContinentMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionContinentMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionContinent(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCountry=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionCountry"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_COUNTRY},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/countries/"+this.getId()},clone:function(){return this.getFactory().interactionCountry(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCountryMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionCountryMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionCountryMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionCountry(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCity=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionCity"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_CITY},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/cities/"+this.getId()},clone:function(){return this.getFactory().interactionCity(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCityMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionCityMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionCityMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionCity(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionRegion=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionRegion"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_REGION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/regions/"+this.getId()},clone:function(){return this.getFactory().interactionRegion(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionRegionMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionRegionMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionRegionMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionRegion(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPostalCode=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionPostalCode"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_POSTALCODE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/postalcodes/"+this.getId()},clone:function(){return this.getFactory().interactionPostalCode(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPostalCodeMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionPostalCodeMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionPostalCodeMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionPostalCode(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUserAgent=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionUserAgent"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_USERAGENT},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/useragents/"+this.getId()},clone:function(){return this.getFactory().interactionUserAgent(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUserAgentMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionUserAgentMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionUserAgentMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionUserAgent(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionOperatingSystem=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionOperatingSystem"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_OPERATINGSYSTEM},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/operatingsystems/"+this.getId()},clone:function(){return this.getFactory().interactionOperatingSystem(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionOperatingSystemMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionOperatingSystemMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionOperatingSystemMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionOperatingSystem(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionDevice=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionDevice"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_DEVICE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/devices/"+this.getId()},clone:function(){return this.getFactory().interactionDevice(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionDeviceMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionDeviceMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionDeviceMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionDevice(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReport=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionReport"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/reports/"+this.getId()},clone:function(){return this.getFactory().interactionReport(this.getWarehouse(),this)},getObjectTypeId:function(){return this.get("objectTypeId")},getObjectId:function(){return this.get("objectId")},getKey:function(){return this.get("key")},listEntries:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionReportEntryMap(self.getWarehouse());return this.chainGet(chainable,this.getUri()+"/entries",params)},readEntry:function(interactionReportEntryId){var self=this;var chainable=this.getFactory().interactionReportEntry(self.getWarehouse());return this.chainGet(chainable,this.getUri()+"/entries/"+interactionReportEntryId)},queryEntries:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/entries/query"};var chainable=this.getFactory().interactionReportEntryMap(self.getWarehouse());return this.chainPost(chainable,uriFunction,params,query)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReportMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionReportMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionReportMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionReport(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReportEntry=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionReportEntry"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT_ENTRY},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/reports/"+this.getReportId()+"/entries/"+this.getId()},clone:function(){return this.getFactory().interactionReportEntry(this.getWarehouse(),this)},getReportId:function(){return this.get("reportId")},getKey:function(){return this.get("key")},getApplicationId:function(){return this.get("applicationId")},getApplicationTitle:function(){return this.get("applicationTitle")},getApplicationDescription:function(){return this.get("applicationDescription")},getSessionId:function(){return this.get("sessionId")},getSessionTitle:function(){return this.get("sessionTitle")},getSessionDescription:function(){return this.get("sessionDescription")},getPageId:function(){return this.get("pageId")},getPageUri:function(){return this.get("pageUri")},getPageTitle:function(){return this.get("pageTitle")},getPageDescription:function(){return this.get("pageDescription")},getNodeId:function(){return this.get("nodeId")},getNodeTargetRepositoryId:function(){return this.get("nodeTargetRepositoryId")},getNodeTargetBranchId:function(){return this.get("nodeTargetBranchId")},getNodeTargetId:function(){return this.get("nodeTargetId")},getNodeTitle:function(){return this.get("nodeTitle")},getNodeDescription:function(){return this.get("nodeDescription")},getUserId:function(){return this.get("userId")},getUserTitle:function(){return this.get("userTitle")},getUserDescription:function(){return this.get("userDescription")},getUserFirstName:function(){return this.get("userFirstName")},getUserLastName:function(){return this.get("userLastName")},getUserEmail:function(){return this.get("userEmail")},getUserName:function(){return this.get("userName")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReportEntryMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionReportEntryMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionReportEntryMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionReportEntry(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ConversionTrigger=Gitana.AbstractWarehouseObject.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.ConversionTrigger"}},getType:function(){return Gitana.TypedIDConstants.TYPE_CONVERSION_TRIGGER},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/triggers/"+this.getId()},clone:function(){return this.getFactory().conversionTrigger(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ConversionTriggerMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.ConversionTriggerMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().conversionTriggerMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().conversionTrigger(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Directory=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.Directory"};this.base(platform,object)},getUri:function(){return"/directories/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_DIRECTORY},clone:function(){return this.getFactory().directory(this.getPlatform(),this)},readIdentity:function(identityId){var self=this;var uriFunction=function(){return self.getUri()+"/identities/"+identityId};var chainable=this.getFactory().identity(this);return this.chainGet(chainable,uriFunction)},listIdentities:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/identities"};var chainable=this.getFactory().identityMap(this);return this.chainGet(chainable,uriFunction,params)},queryIdentities:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/identities/query"};var chainable=this.getFactory().identityMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkIdentityPermissions:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/identities/permissions/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkIdentityAuthorities:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/identities/authorities/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},readConnection:function(connectionId){var self=this;var uriFunction=function(){return self.getUri()+"/connections/"+connectionId};var chainable=this.getFactory().connection(this);return this.chainGet(chainable,uriFunction)},createConnection:function(object){var self=this;if(!object){object={}}var uriFunction=function(){return self.getUri()+"/connections"};var chainable=this.getFactory().connection(this,object);return this.chainCreate(chainable,object,uriFunction)},listConnections:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/connections"};var chainable=this.getFactory().connectionMap(this);return this.chainGet(chainable,uriFunction,params)},queryConnections:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/connections/query"};var chainable=this.getFactory().connectionMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkConnectionPermissions:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/connections/permissions/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkConnectionAuthorities:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/connections/authorities/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DirectoryMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.DirectoryMap"};this.base(platform,object)},clone:function(){return this.getFactory().directoryMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().directory(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractDirectoryObject=Gitana.AbstractPlatformObject.extend({constructor:function(directory,object){this.base(directory.getPlatform(),object);this.objectType=function(){return"Gitana.Connection"};this.getDirectory=function(){return directory};this.getDirectoryId=function(){return directory.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getDirectoryId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Identity=Gitana.AbstractDirectoryObject.extend({constructor:function(directory,object){this.base(directory,object);this.objectType=function(){return"Gitana.Identity"}},getType:function(){return Gitana.TypedIDConstants.TYPE_IDENTITY},getUri:function(){return"/directories/"+this.getDirectoryId()+"/identities/"+this.getId()},clone:function(){return this.getFactory().identity(this.getDirectory(),this)},changePassword:function(password,verifyPassword){var object={password:password,verifyPassword:verifyPassword};return this.chainPostEmpty(null,this.getUri()+"/changepassword",{},object)},findPolicyUsers:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/users"};var domain=new Gitana.Domain(this.getPlatform());var chainable=this.getFactory().domainPrincipalMap(domain);var params={};if(tenantId){params.tenantId=tenantId}return this.chainGet(chainable,uriFunction,params)},findPolicyUserForTenant:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/user"};var chainable=this.getFactory().domainPrincipal(this);var params={};params.tenantId=tenantId;return this.chainGet(chainable,uriFunction,params)},findPolicyUsersForTenant:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/users"};var chainable=this.getFactory().domainPrincipalMap(this);var params={};params.tenantId=tenantId;return this.chainGet(chainable,uriFunction,params)},findPolicyTenants:function(registrarId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/tenants"};var chainable=this.getFactory().tenantMap(this);var params={};if(registrarId){params.registrarId=registrarId}return this.chainGet(chainable,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.IdentityMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(directory,object){this.objectType=function(){return"Gitana.IdentityMap"};this.getDirectory=function(){return directory};this.getDirectoryId=function(){return directory.getId()};this.base(directory.getPlatform(),object)},clone:function(){return this.getFactory().identityMap(this.getDirectory(),this)},buildObject:function(json){return this.getFactory().identity(this.getDirectory(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Connection=Gitana.AbstractDirectoryObject.extend({constructor:function(directory,object){this.base(directory,object);this.objectType=function(){return"Gitana.Connection"}},getType:function(){return Gitana.TypedIDConstants.TYPE_CONNECTION},getUri:function(){return"/directories/"+this.getDirectoryId()+"/connections/"+this.getId()},clone:function(){return this.getFactory().connection(this.getDirectory(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ConnectionMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(directory,object){this.objectType=function(){return"Gitana.ConnectionMap"};this.getDirectory=function(){return directory};this.getDirectoryId=function(){return directory.getId()};this.base(directory.getPlatform(),object)},clone:function(){return this.getFactory().connectionMap(this.getDirectory(),this)},buildObject:function(json){return this.getFactory().connection(this.getDirectory(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Domain=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.Domain"}},getUri:function(){return"/domains/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_DOMAIN},clone:function(){return this.getFactory().domain(this.getPlatform(),this)},listPrincipals:function(pagination,options){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(options){Gitana.copyInto(params,options)}var uriFunction=function(){return self.getUri()+"/principals"};var chainable=this.getFactory().domainPrincipalMap(this);return this.chainGet(chainable,uriFunction,params)},readPrincipal:function(principalId,options){var self=this;var params={};if(options){Gitana.copyInto(params,options)}var uriFunction=function(){return self.getUri()+"/principals/"+principalId};var chainable=this.getFactory().domainPrincipal(this);return this.chainGet(chainable,uriFunction,params)},createPrincipal:function(object){var self=this;if(!object){object={}}if(!object.name){console.log("missing name");return}if(!object.type){console.log("missing type");return}var uriFunction=function(){return self.getUri()+"/principals"};var chainable=this.getFactory().domainPrincipal(this,object);return this.chainCreate(chainable,object,uriFunction)},queryPrincipals:function(query,pagination,options){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(options){Gitana.copyInto(params,options)}var uriFunction=function(){return self.getUri()+"/principals/query"};var chainable=this.getFactory().domainPrincipalMap(this);return this.chainPost(chainable,uriFunction,params,query)},listGroups:function(pagination){var query={type:"GROUP"};return this.queryPrincipals(query,pagination)},createGroup:function(object){if(!object){object={}}object.type="GROUP";return this.createPrincipal(object)},queryGroups:function(query,pagination){if(!query){query={}}query.type="GROUP";return this.queryPrincipals(query,pagination)},listUsers:function(pagination){var query={type:"USER"};return this.queryPrincipals(query,pagination)},createUser:function(object){if(!object){object={}}object.type="USER";return this.createPrincipal(object)},queryUsers:function(query,pagination){if(!query){query={}}query.type="USER";return this.queryPrincipals(query,pagination)},addMember:function(group,principal){var self=this;var groupId=this.extractPrincipalIdentifiers(group,this.getId())["principal"];var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return self.getUri()+"/principals/"+groupId+"/members/add?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},removeMember:function(group,principal){var self=this;var groupId=this.extractPrincipalIdentifiers(group,this.getId())["principal"];var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return self.getUri()+"/principals/"+groupId+"/members/remove?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},listMembers:function(group,filter,pagination,indirect){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}if(indirect){params.indirect=true}var groupId=this.extractPrincipalIdentifiers(group,this.getId())["principal"];var uriFunction=function(){return self.getUri()+"/principals/"+groupId+"/members"};var chainable=this.getFactory().domainPrincipalMap(this);return this.chainGet(chainable,uriFunction,params)},checkPrincipalPermissions:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/principals/permissions/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkPrincipalAuthorities:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/principals/authorities/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkGroupMemberships:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/principals/membership/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.DomainMap"};this.base(platform,object)},clone:function(){return this.getFactory().domainMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().domain(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractDomainObject=Gitana.AbstractPlatformObject.extend({constructor:function(domain,object){this.base(domain.getPlatform(),object);this.objectType=function(){return"Gitana.DomainPrincipal"};this.getDomain=function(){return domain};this.getDomainId=function(){return domain.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getDomainId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainPrincipal=Gitana.AbstractDomainObject.extend({constructor:function(domain,object){this.base(domain,object);this.objectType=function(){return"Gitana.DomainPrincipal"}},getUri:function(){return"/domains/"+this.getDomainId()+"/principals/"+this.getId()},clone:function(){return this.getFactory().domainPrincipal(this.getDomain(),this)},beforeChainRun:function(){this.getFactory().extendPrincipal(this)},getName:function(){return this.get("name")},getType:function(){return this.get("type")},getDomainQualifiedName:function(){return this.getDomainId()+"/"+this.getName()},getDomainQualifiedId:function(){return this.getDomainId()+"/"+this.getId()},listMemberships:function(indirect,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var uri=this.getUri()+"/memberships";if(indirect){uri=uri+"?indirect=true"}return uri};var chainable=this.getFactory().domainPrincipalMap(this.getDomain());return this.chainGet(chainable,uriFunction,params)},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri(),listAuthenticationGrants:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}params.domainId=this.getDomainId();params.principalId=this.getId();var chainable=this.getFactory().authenticationGrantMap(this.getPlatform());return this.chainGet(chainable,"/auth/grants",params)},listTeamMemberships:function(teamable,pagination){var params={teamableType:teamable.getType(),teamableId:teamable.getId()};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return this.getUri()+"/teams"};var chainable=this.getFactory().teamMap(this.getCluster(),this);return this.chainGet(chainable,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PrincipalMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(domain,object){this.objectType=function(){return"Gitana.PrincipalMap"};this.getDomain=function(){return domain};this.base(domain.getPlatform(),object)},clone:function(){return this.getFactory().domainPrincipalMap(this.getDomain(),this)},buildObject:function(json){return this.getFactory().domainPrincipal(this.getDomain(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainGroup={TYPE:"GROUP",readGroupNode:function(branch,createIfNotFound){var result=this.subchain(this.getFactory().node(branch,"n:group"));result.subchain(branch).readGroupNode(this.getId(),createIfNotFound).then(function(){result.handleResponse(this)});return result},listMembers:function(filter,indirect,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}if(indirect){params.indirect=true}var uriFunction=function(){return self.getUri()+"/members"};var chainable=this.getFactory().domainPrincipalMap(this.getDomain());return this.chainGet(chainable,uriFunction,params)},listUsers:function(){var inherit=false;var pagination=null;var args=Gitana.makeArray(arguments);var a1=args.shift();if(Gitana.isBoolean(a1)){inherit=a1;pagination=args.shift()}else{pagination=args.shift()}return this.listMembers("user",inherit,pagination)},listGroups:function(){var inherit=false;var pagination=null;var args=Gitana.makeArray(arguments);var a1=args.shift();if(Gitana.isBoolean(a1)){inherit=a1;pagination=args.shift()}else{pagination=a1}return this.listMembers("group",inherit,pagination)},addMember:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);return this.chainPostEmpty(null,this.getUri()+"/members/add?id="+principalDomainQualifiedId)},removeMember:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);return this.chainPostEmpty(null,this.getUri()+"/members/remove?id="+principalDomainQualifiedId)}}})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainUser={TYPE:"USER",readPersonNode:function(branch,createIfNotFound){var result=this.subchain(this.getFactory().node(branch,"n:person"));result.subchain(branch).readPersonNode(this.getDomainQualifiedId(),createIfNotFound).then(function(){result.handleResponse(this)});return result},hasIdentity:function(){return(this.getDirectoryId()&&this.getIdentityId())},getDirectoryId:function(){return this.get("directoryId")},getIdentityId:function(){return this.get("identityId")},readDirectory:function(){var directory=this.getFactory().directory(this.getPlatform(),{_doc:this.getDirectoryId()});var result=this.subchain(directory);result.subchain(this.getPlatform()).readDirectory(this.getDirectoryId()).then(function(){result.handleResponse(this)});return result},readIdentity:function(){var self=this;var directory=this.getFactory().directory(this.getPlatform(),{_doc:this.getDirectoryId()});var identity=this.getFactory().identity(directory,{_doc:this.getIdentityId()});var result=this.subchain(identity);result.subchain(this.getPlatform()).readDirectory(self.getDirectoryId()).then(function(){directory.handleResponse(this);this.readIdentity(self.getIdentityId()).then(function(){identity.handleResponse(this)})});return result},getFirstName:function(){return this.get("firstName")},setFirstName:function(firstName){this.set("firstName",firstName)},getLastName:function(){return this.get("lastName")},setLastName:function(lastName){this.set("lastName",lastName)},getCompanyName:function(){return this.get("companyName")},setCompanyName:function(companyName){this.set("companyName",companyName)},getEmail:function(){return this.get("email")},setEmail:function(email){this.set("email",email)},getJobTitle:function(){return this.get("jobTitle")},setJobTitle:function(jobTitle){this.set("jobTitle",jobTitle)},getAddress:function(){return this.get("address")},setAddress:function(address){this.set("address",address)},getCity:function(){return this.get("city")},setCity:function(city){this.set("city",city)},getState:function(){return this.get("state")},setState:function(state){this.set("state",state)},getZipcode:function(){return this.get("zipcode")},setZipcode:function(zipcode){this.set("zipcode",zipcode)},getPhoneNumber:function(){return this.get("phoneNumber")},setPhoneNumber:function(phoneNumber){this.set("phoneNumber",phoneNumber)}}})(window);(function(window){var Gitana=window.Gitana;Gitana.Registrar=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.Registrar"};this.base(platform,object)},getUri:function(){return"/registrars/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_REGISTRAR},clone:function(){return this.getFactory().registrar(this.getPlatform(),this)},listTenants:function(pagination){var self=this;var uriFunction=function(){return self.getUri()+"/tenants"};var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().tenantMap(this);return this.chainGet(chainable,uriFunction,params)},queryTenants:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/query"};var chainable=this.getFactory().tenantMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readTenant:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/"+tenantId};var chainable=this.getFactory().tenant(this);return this.chainGet(chainable,uriFunction)},lookupTenantForPrincipal:function(principal){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/lookup?id="+principal.getDomainQualifiedId()};var chainable=this.getFactory().tenant(this);return this.chainGet(chainable,uriFunction)},createTenant:function(principal,planKey,paymentMethod){var self=this;var uriFunction=function(){return self.getUri()+"/tenants"};var object={};object.principalId=principal.getId();object.domainId=principal.getDomainId();object.planKey=planKey;if(paymentMethod){object.paymentMethod=paymentMethod}var chainable=this.getFactory().tenant(this);return this.chainCreate(chainable,object,uriFunction)},checkTenantPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkTenantAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listPlans:function(pagination){var self=this;var uriFunction=function(){return self.getUri()+"/plans"};var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().planMap(this);return this.chainGet(chainable,uriFunction,params)},queryPlans:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/plans/query"};var chainable=this.getFactory().planMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readPlan:function(planId){var self=this;var uriFunction=function(){return self.getUri()+"/plans/"+planId};var chainable=this.getFactory().plan(this);return this.chainGet(chainable,uriFunction)},createPlan:function(object){var self=this;var uriFunction=function(){return self.getUri()+"/plans"};var chainable=this.getFactory().plan(this);return this.chainCreate(chainable,object,uriFunction)},checkPlanPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/plans/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkPlanAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/plans/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listMeters:function(pagination){var self=this;var uriFunction=function(){return self.getUri()+"/meters"};var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().meterMap(this);return this.chainGet(chainable,uriFunction,params)},queryMeters:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/meters/query"};var chainable=this.getFactory().meterMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readMeter:function(meterId){var self=this;var uriFunction=function(){return self.getUri()+"/meters/"+meterId};var chainable=this.getFactory().meter(this);return this.chainGet(chainable,uriFunction)},createMeter:function(object){var self=this;var uriFunction=function(){return self.getUri()+"/meters"};var chainable=this.getFactory().meter(this);return this.chainCreate(chainable,object,uriFunction)},checkMeterPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/meters/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkMeterAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/meters/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RegistrarMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.RegistrarMap"};this.base(platform,object)},clone:function(){return this.getFactory().registrarMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().registrar(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractRegistrarObject=Gitana.AbstractPlatformObject.extend({constructor:function(registrar,object){this.base(registrar.getPlatform(),object);this.objectType=function(){return"Gitana.Meter"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getRegistrarId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Meter=Gitana.AbstractRegistrarObject.extend({constructor:function(registrar,object){this.base(registrar,object);this.objectType=function(){return"Gitana.Meter"}},getType:function(){return Gitana.TypedIDConstants.TYPE_PLAN},getUri:function(){return"/registrars/"+this.getRegistrarId()+"/meters/"+this.getId()},clone:function(){return this.getFactory().meter(this.getRegistrar(),this)}});Gitana.Meter.FIELD_TENANT_ID="tenantId";Gitana.Meter.FIELD_METER_TYPE="meterType";Gitana.Meter.FIELD_METER_START="meterStart";Gitana.Meter.FIELD_METER_END="meterEnd";Gitana.Meter.FIELD_MAX_BYTE_COUNT="maxByteCount";Gitana.Meter.FIELD_RAW_BYTE_COUNT="rawByteCount";Gitana.Meter.FIELD_RAW_BYTE_COUNT_PERCENTAGE="rawByteCountPercentage";Gitana.Meter.FIELD_UNPROCESSED_BYTE_COUNT="unprocessedByteCount";Gitana.Meter.FIELD_BILLABLE_BYTE_COUNT="billableByteCount";Gitana.Meter.FIELD_BILLABLE_BYTE_COUNT_PERCENTAGE="billableByteCountPercentage";Gitana.Meter.FIELD_MAX_OBJECT_COUNT="maxObjectCount";Gitana.Meter.FIELD_RAW_OBJECT_COUNT="rawObjectCount";Gitana.Meter.FIELD_RAW_OBJECT_COUNT_PERCENTAGE="rawObjectCountPercentage";Gitana.Meter.FIELD_UNPROCESSED_OBJECT_COUNT="unprocessedObjectCount";Gitana.Meter.FIELD_BILLABLE_OBJECT_COUNT="billableObjectCount";Gitana.Meter.FIELD_BILLABLE_OBJECT_COUNT_PERCENTAGE="billableObjectCountPercentage"})(window);(function(window){var Gitana=window.Gitana;Gitana.MeterMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(registrar,object){this.objectType=function(){return"Gitana.MeterMap"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()};this.base(registrar.getPlatform(),object)},clone:function(){return this.getFactory().planMap(this.getRegistrar(),this)},buildObject:function(json){return this.getFactory().plan(this.getRegistrar(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Plan=Gitana.AbstractRegistrarObject.extend({constructor:function(registrar,object){this.base(registrar,object);this.objectType=function(){return"Gitana.Plan"}},getType:function(){return Gitana.TypedIDConstants.TYPE_PLAN},getUri:function(){return"/registrars/"+this.getRegistrarId()+"/plans/"+this.getId()},clone:function(){return this.getFactory().plan(this.getRegistrar(),this)},getPlanKey:function(){return this.get("planKey")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PlanMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(registrar,object){this.objectType=function(){return"Gitana.PlanMap"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()};this.base(registrar.getPlatform(),object)},clone:function(){return this.getFactory().planMap(this.getRegistrar(),this)},buildObject:function(json){return this.getFactory().plan(this.getRegistrar(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Tenant=Gitana.AbstractRegistrarObject.extend({constructor:function(registrar,object){this.base(registrar,object);this.objectType=function(){return"Gitana.Tenant"}},getType:function(){return Gitana.TypedIDConstants.TYPE_TENANT},getUri:function(){return"/registrars/"+this.getRegistrarId()+"/tenants/"+this.getId()},clone:function(){return this.getFactory().tenant(this.getRegistrar(),this)},getDnsSlug:function(){return this.get("dnsSlug")},getPlanKey:function(){return this.get("planKey")},getPrincipalId:function(){return this.get("principalId")},getPrincipalDomainId:function(){return this.get("domainId")},getPlatformId:function(){return this.get("platformId")},readTenantPlan:function(){var self=this;var uriFunction=function(){return self.getPlatform().getUri()+"/registrars/"+self.getRegistrarId()+"/plans/"+self.getPlanKey()};var chainable=this.getFactory().plan(this.getRegistrar());return this.chainGet(chainable,uriFunction)},readTenantPrincipal:function(){var self=this;var uriFunction=function(){return self.getPlatform().getUri()+"/domains/"+self.getPrincipalDomainId()+"/principals/"+self.getPrincipalId()};var domain=this.getFactory().domain(this.getPlatform(),{_doc:this.getPrincipalDomainId()});var chainable=this.getFactory().domainPrincipal(domain);return this.chainGet(chainable,uriFunction)},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),listAllocatedObjects:function(callback,objectType,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/objects"};var params={};if(pagination){Gitana.copyInto(params,pagination)}if(objectType){params.type=objectType}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response.rows)})},listAllocatedRepositoryObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"repository",pagination)},listAllocatedDomainObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"domain",pagination)},listAllocatedVaultObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"vault",pagination)},listAllocatedClientObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"client",pagination)},listAllocatedRegistrarObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"registrar",pagination)},listAllocatedStackObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"stack",pagination)},listAllocatedDirectoryObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"directory",pagination)},listAllocatedApplicationObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"application",pagination)},readDefaultAllocatedClientObject:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/defaultclient"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){var client={};Gitana.copyInto(client,response);Gitana.stampInto(client,Gitana.ClientMethods);client.get=function(key){return this[key]};callback.call(this,client)})},listAutoClientMappingObjects:function(callback,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings"};var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response.rows)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TenantMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(registrar,object){this.objectType=function(){return"Gitana.TenantMap"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()};this.base(registrar.getPlatform(),object)},clone:function(){return this.getFactory().tenantMap(this.getRegistrar(),this)},buildObject:function(json){return this.getFactory().tenant(this.getRegistrar(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Repository=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.Repository"}},getType:function(){return Gitana.TypedIDConstants.TYPE_REPOSITORY},getUri:function(){return"/repositories/"+this.getId()},clone:function(){return this.getFactory().repository(this.getPlatform(),this)},listBranches:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/branches"};var chainable=this.getFactory().branchMap(this);return this.chainGet(chainable,uriFunction,params)},readBranch:function(branchId){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/"+branchId};var chainable=this.getFactory().branch(this);return this.chainGet(chainable,uriFunction)},createBranch:function(branchId,changesetId,object){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches"};var createParams={branch:branchId,changeset:changesetId};var chainable=this.getFactory().branch(this);return this.chainCreate(chainable,object,uriFunction,createParams)},queryBranches:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/query"};var chainable=this.getFactory().branchMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkBranchPermissions:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkBranchAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listChangesets:function(){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets"};var chainable=this.getFactory().changesetMap(this);return this.chainGet(chainable,uriFunction)},readChangeset:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/"+changesetId};var chainable=this.getFactory().changeset(this);return this.chainGet(chainable,uriFunction)},listChangesetParents:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/"+changesetId+"/parents"};var chainable=this.getFactory().changesetMap(this);return this.chainGet(chainable,uriFunction)},listChangesetChildren:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/"+changesetId+"/children"};var chainable=this.getFactory().changesetMap(this);return this.chainGet(chainable,uriFunction)},queryChangesets:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/query"};var chainable=this.getFactory().changesetMap(this);return this.chainPost(chainable,uriFunction,params,query)},listReleases:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/releases"};var chainable=this.getFactory().releaseMap(this);return this.chainGet(chainable,uriFunction,params)},readRelease:function(releaseId){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/"+releaseId};var chainable=this.getFactory().release(this);return this.chainGet(chainable,uriFunction)},createRelease:function(object,sourceId){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases"};var params={};if(sourceId){params.sourceId=sourceId}var chainable=this.getFactory().release(this);return this.chainCreate(chainable,object,uriFunction,params)},startCreateRelease:function(object,sourceId,callback){var self=this;if(typeof(object)==="function"){callback=object;sourceId=null;object=null}if(typeof(sourceId)==="function"){callback=sourceId;sourceId=null}var uriFunction=function(){return self.getUri()+"/releases/create/start"};if(!object){object={}}var params={};if(sourceId){params.sourceId=sourceId}return this.chainPostResponse(this,uriFunction,params,object).then(function(response){var jobId=response._doc;callback(jobId)})},queryReleases:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/query"};var chainable=this.getFactory().releaseMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkReleasePermissions:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkReleaseAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listConflicts:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts"};var chainable=this.getFactory().mergeConflictMap(this);return this.chainGet(chainable,uriFunction,params)},readConflict:function(conflictId){var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/"+conflictId};var chainable=this.getFactory().mergeConflict(this);return this.chainGet(chainable,uriFunction)},queryConflicts:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/query"};var chainable=this.getFactory().mergeConflictMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkConflictPermissions:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkConflictAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},getMaxSize:function(){return this.get("maxSize")},getSize:function(){return this.get("size")},getObjectCount:function(){return this.get("objectcount")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RepositoryMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.RepositoryMap"};this.base(platform,object)},clone:function(){return this.getFactory().repositoryMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().repository(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractRepositoryObject=Gitana.AbstractPlatformObject.extend({constructor:function(repository,object){this.base(repository.getPlatform(),object);this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getRepositoryId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractNode=Gitana.AbstractRepositoryObject.extend({constructor:function(branch,object){this.__qname=(function(){var _qname=null;return function(qname){if(!Gitana.isUndefined(qname)){_qname=qname}return _qname}})();this.__type=(function(){var _type=null;return function(type){if(!Gitana.isUndefined(type)){_type=type}return _type}})();this.__features=(function(){var _features={};return function(features){if(!Gitana.isUndefined(features)){_features=features}return _features}})();this.__stats=(function(){var _stats={};return function(stats){if(!Gitana.isUndefined(stats)){_stats=stats}return _stats}})();this.__is_association=(function(){var _is_association=false;return function(is_association){if(!Gitana.isUndefined(is_association)){_is_association=is_association}return _is_association}})();this.base(branch.getRepository(),object);this.getBranch=function(){return branch};this.getBranchId=function(){return branch.getId()}},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()},ref:function(){return"node://"+this.getPlatformId()+"/"+this.getRepositoryId()+"/"+this.getBranchId()+"/"+this.getId()},clone:function(){return this.getFactory().node(this.getBranch(),this)},handleSystemProperties:function(response){this.base(response);if(this["_qname"]){var _qname=this["_qname"];delete this["_qname"];this.__qname(_qname)}if(this["_type"]){var _type=this["_type"];delete this["_type"];this.__type(_type)}if(this["_features"]){var _features=this["_features"];delete this["_features"];this.__features(_features)}if(this["_statistics"]&&typeof(this["_statistics"])=="object"){var stats=this["_statistics"];delete this["_statistics"];this.__stats(stats)}if(!Gitana.isUndefined(this["_is_association"])){var _is_association=this["_is_association"];delete this["_is_association"];this.__is_association(_is_association)}},chainCopyState:function(otherObject){this.base(otherObject);if(otherObject.__qname){this.__qname(otherObject.__qname())}if(otherObject.__type){this.__type(otherObject.__type())}if(otherObject.__features){this.__features(otherObject.__features())}if(otherObject.__stats){this.__stats(otherObject.__stats())}if(otherObject.__is_association){this.__is_association(otherObject.__is_association())}},stats:function(){return this.__stats()},getFeatureIds:function(callback){var self=this;var f=function(){var featureIds=[];for(var featureId in this.__features()){featureIds[featureIds.length]=featureId}return featureIds};if(callback){return this.then(function(){callback.call(this,f.call(self))})}return f.call(self)},getFeature:function(featureId,callback){var self=this;if(callback){return this.then(function(){callback.call(this,self.__features()[featureId])})}return self.__features()[featureId]},removeFeature:function(featureId){var self=this;var uriFunction=function(){return self.getUri()+"/features/"+featureId};return this.chainDelete(this,uriFunction).reload().then(function(){self.loadFrom(this)})},addFeature:function(featureId,featureConfig){var self=this;var uriFunction=function(){return self.getUri()+"/features/"+featureId};if(!featureConfig){featureConfig={}}return this.chainPostEmpty(null,uriFunction,{},featureConfig).reload().then(function(){self.loadFrom(this)})},hasFeature:function(featureId,callback){if(callback){return this.then(function(){var hasFeature=!Gitana.isEmpty(this.__features()[featureId]);callback.call(this,hasFeature)})}return !Gitana.isEmpty(this.__features()[featureId])},isAssociation:function(){return this.__is_association()},isContainer:function(){return this.hasFeature("f:container")},touch:function(){var self=this;var uriFunction=function(){return self.getUri()+"/touch"};return this.chainPost(null,uriFunction)},getTypeQName:function(){return this.__type()},changeTypeQName:function(typeQName){var self=this;var uriFunction=function(){return self.getUri()+"/change_type?type="+typeQName};return this.chainPostEmpty(null,uriFunction).reload().then(function(){self.loadFrom(this)})},getQName:function(){return this.__qname()},changeQName:function(qname){var self=this;var uriFunction=function(){return self.getUri()+"/change_qname?qname="+qname};return this.chainPostEmpty(null,uriFunction).reload().then(function(){self.loadFrom(this)})},listAttachments:Gitana.Methods.listAttachments(Gitana.NodeAttachmentMap),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attachmentDownloadUri:function(attachmentId){return this.getDriver().baseURL+this.getUri()+"/attachments/"+attachmentId},attach:function(attachmentId,contentType,data,filename){var paramsFunction=function(params){if(filename){params.filename=filename}};var delegate=Gitana.Methods.attach.call(this,Gitana.NodeAttachment,paramsFunction);return delegate.call(this,attachmentId,contentType,data)},getPreviewUri:Gitana.Methods.getPreviewUri(),unattach:Gitana.Methods.unattach()})})(window);(function(window){var Gitana=window.Gitana;Gitana.NodeAttachment=Gitana.BinaryAttachment.extend({constructor:function(persistable,attachment){this.base(persistable,attachment)},getFilename:function(){return this.filename}})})(window);(function(window){var Gitana=window.Gitana;Gitana.NodeAttachmentMap=Gitana.BinaryAttachmentMap.extend({constructor:function(persistable,object){this.base(persistable,object);this.objectType=function(){return"Gitana.NodeAttachmentMap"}},clone:function(){return new Gitana.NodeAttachmentMap(this.__persistable(),this)},buildObject:function(attachment){return new Gitana.NodeAttachment(this.__persistable(),attachment)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Association=Gitana.AbstractNode.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Association"}},getType:function(){return Gitana.TypedIDConstants.TYPE_ASSOCIATION},isAssociation:function(){return true},getDirectionality:function(){return this.get("directionality")},getSourceNodeId:function(){return this.get("source")},getSourceNodeChangesetId:function(){return this.get("source_changeset")},getSourceNodeType:function(){return this.get("source_type")},getTargetNodeId:function(){return this.get("target")},getTargetNodeChangesetId:function(){return this.get("target_changeset")},getTargetNodeType:function(){return this.get("target_type")},readSourceNode:function(){var self=this;var result=this.subchain(this.getFactory().node(this.getBranch()));return result.then(function(){var chain=this;this.subchain(self.getBranch()).readNode(self.getSourceNodeId()).then(function(){chain.loadFrom(this)})})},readTargetNode:function(){var self=this;var result=this.subchain(this.getFactory().node(this.getBranch()));return result.then(function(){var chain=this;this.subchain(self.getBranch()).readNode(self.getTargetNodeId()).then(function(){chain.loadFrom(this)})})},readOtherNode:function(node){var self=this;var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}var result=this.subchain(this.getFactory().node(this.getBranch()));result.then(function(){var chain=this;this.subchain(self).then(function(){if(nodeId==this.getSourceNodeId()){this.readTargetNode().then(function(){chain.loadFrom(this)})}else{if(nodeId==this.getTargetNodeId()){this.readSourceNode().then(function(){chain.loadFrom(this)})}else{var err=new Gitana.Error();err.name="No node on association";err.message="The node: "+nodeId+" was not found on this association";this.error(err);return false}}})});return result},getDirection:function(node){var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}var direction=null;if(this.getDirectionality()=="UNDIRECTED"){direction="MUTUAL"}else{if(this.getSourceNodeId()==nodeId){direction="OUTGOING"}else{if(this.getTargetNodeId()==nodeId){direction="INCOMING"}}}return direction},getOtherNodeId:function(node){var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}var otherNodeId=null;if(this.getSourceNodeId()==nodeId){otherNodeId=this.getTargetNodeId()}else{if(this.getTargetNodeId()==nodeId){otherNodeId=this.getSourceNodeId()}}return otherNodeId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Branch=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.Branch"}},getType:function(){return Gitana.TypedIDConstants.TYPE_BRANCH},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getId()},clone:function(){return this.getFactory().branch(this.getRepository(),this)},isMaster:function(){return(this.getBranchType().toLowerCase()=="master")},getBranchType:function(){return this.get("type")},getTip:function(){return this.get("tip")},listMounts:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes"};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,params)},readNode:function(nodeId,path){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/"+nodeId};var params={};if(path){params.path=path}var chainable=this.getFactory().node(this);return this.chainGet(chainable,uriFunction,params)},rootNode:function(){return this.readNode("root")},createNode:function(object,options){var self=this;var uriFunction=function(){return self.getUri()+"/nodes"};var params={};if(options){var rootNodeId="root";var associationType="a:child";var filePath=null;var parentFolderPath=null;var fileName=null;if(typeof(options)==="string"){var rootPrefixedFilePath=options;if(Gitana.startsWith(rootPrefixedFilePath,"/")){rootPrefixedFilePath=rootPrefixedFilePath.substring(1)}if(rootPrefixedFilePath==""){filePath="/"}else{var i=rootPrefixedFilePath.indexOf("/");rootNodeId=rootPrefixedFilePath.substring(0,i);filePath=rootPrefixedFilePath.substring(i+1)}}else{if(typeof(options)==="object"){if(options.rootNodeId){rootNodeId=options.rootNodeId}if(options.associationType){associationType=options.associationType}if(options.fileName){fileName=options.fileName}else{if(options.filename){fileName=options.filename}}if(options.parentFolderPath){parentFolderPath=options.parentFolderPath}else{if(options.folderPath){parentFolderPath=options.folderPath}else{if(options.folderpath){parentFolderPath=options.folderpath}}}if(options.filePath){filePath=options.filePath}else{if(options.filepath){filePath=options.filepath}}}}if(rootNodeId){params.rootNodeId=rootNodeId}if(associationType){params.associationType=associationType}if(fileName){params.fileName=fileName}if(filePath){params.filePath=filePath}if(parentFolderPath){params.parentFolderPath=parentFolderPath}if(options.params){for(var param in options.params){params[param]=options.params[param]}}}var chainable=this.getFactory().node(this);return this.chainCreate(chainable,object,uriFunction,params)},searchNodes:function(search,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(Gitana.isString(search)){search={search:search}}var uriFunction=function(){return self.getUri()+"/nodes/search"};var chainable=this.getFactory().nodeMap(this);return this.chainPost(chainable,uriFunction,params,search)},queryNodes:function(query,pagination){var self=this;if(!query){query={}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes/query"};var chainable=this.getFactory().nodeMap(this);if(!Gitana.PREFER_GET_OVER_POST){return this.chainPost(chainable,uriFunction,params,query)}else{Gitana.copyInto(params,{query:JSON.stringify(query)});return this.chainGet(chainable,uriFunction,params)}},queryOne:function(query,errHandler){return this.queryNodes(query).keepOne(function(err){if(errHandler){errHandler(err);return false}})},deleteNodes:function(nodeIds){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/delete"};return this.chainPost(this,uriFunction,{},{_docs:nodeIds})},checkNodePermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkNodeAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},readPersonNode:function(user,createIfNotFound){var self=this;var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(user);var uriFunction=function(){var uri=self.getUri()+"/person/acquire?id="+principalDomainQualifiedId;if(createIfNotFound){uri+="&createIfNotFound="+createIfNotFound}return uri};var chainable=this.getFactory().node(this,"n:person");return this.chainGet(chainable,uriFunction)},readGroupNode:function(group,createIfNotFound){var self=this;var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(group);var uriFunction=function(){var uri=self.getUri()+"/group/acquire?id="+principalDomainQualifiedId;if(createIfNotFound){uri+="&createIfNotFound="+createIfNotFound}return uri};var chainable=this.getFactory().node(this,"n:group");return this.chainGet(chainable,uriFunction)},listDefinitions:function(filter,pagination){if(filter&&typeof(filter)==="object"){pagination=filter;filter=null}var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var uri=self.getUri()+"/definitions";params.capabilities="true";if(filter){params.filter=filter}return uri};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,params)},readDefinition:function(qname){var self=this;var uriFunction=function(){return self.getUri()+"/definitions/"+qname};var chainable=this.getFactory().definition(this);return this.chainGet(chainable,uriFunction)},loadSchemas:function(filter,callback){if(typeof(filter)=="function"){callback=filter;filter=null}var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/schemas";if(filter){uri+="?filter="+filter}self.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response);chain.next()});return false})},loadSchema:function(qname,callback){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/schemas/"+qname;self.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response);chain.next()});return false})},generateQName:function(object,callback){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/qnames/generate";self.getDriver().gitanaPost(uri,null,object,function(response){var qname=response._qname;callback.call(chain,qname);chain.next()});return false})},associate:function(sourceNode,targetNode,object){var sourceNodeId=null;if(Gitana.isString(sourceNode)){sourceNodeId=sourceNode}else{sourceNodeId=sourceNode.getId()}var targetNodeId=null;if(Gitana.isString(targetNode)){targetNodeId=targetNode}else{targetNodeId=targetNode.getId()}var result=this.subchain(this);result.subchain(this).then(function(){this.readNode(sourceNodeId).associate(targetNodeId,object)});return result},traverse:function(node,config){var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}return this.readNode(nodeId).traverse(config)},createContainer:function(object){if(!object){object={}}if(!object._features){object._features={}}object._features["f:container"]={active:"true"};return this.createNode(object)},find:function(config,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes/find"};var chainable=this.getFactory().nodeMap(this);return this.chainPost(chainable,uriFunction,params,config)},findNodes:function(config,pagination){return this.find(config,pagination)},listItems:function(listKey,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/lists/"+listKey+"/items"};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,pagination)},queryItems:function(listKey,query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/lists/"+listKey+"/items/query"};var chainable=this.getFactory().nodeMap(this);return this.chainPost(chainable,uriFunction,params,query)},loadForms:function(filter,callback){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/forms";if(filter){uri+="?filter="+filter}self.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response);chain.next()});return false})},adminRebuildPathIndexes:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/paths/index";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminRebuildSearchIndexes:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/search/index";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminContentMaintenance:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/content";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminUpgradeSchema:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/upgradeschema";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},createForExport:function(exportId,config,callback){var self=this;if(!config){config={}}if(!config.repositoryId){config.repositoryId=self.getRepositoryId()}if(!config.branchId){config.branchId=self.getId()}if(!config.properties){config.properties={}}if(!config.parentFolderPath){config.parentFolderPath={}}var uriFunction=function(){return"/ref/exports/"+exportId+"/generate"};var params={};return this.chainPostResponse(this,uriFunction,params,config).then(function(response){callback(response)})},loadInfo:function(callback){var uriFunction=function(){return this.getUri()+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},createCustomIndex:function(name,index){var self=this;var payload=null;if(typeof(index)==="undefined"){payload=name}else{payload={name:name,index:index}}var uriFunction=function(){return self.getUri()+"/indexes"};return this.chainPost(this,uriFunction,{},payload)},dropCustomIndex:function(name){var self=this;var uriFunction=function(){return self.getUri()+"/indexes/"+name};return this.chainDelete(this,uriFunction)},loadCustomIndexes:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/indexes"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},loadHistoryChangesets:function(config,pagination,callback){var self=this;if(typeof(pagination)==="function"){callback=pagination;pagination=null}if(typeof(config)==="function"){callback=config;config={};pagination=null}if(!config){config={}}var uriFunction=function(){return self.getUri()+"/history/changesets"};var params={};if(pagination){Gitana.copyInto(params,pagination)}if(config.root){params.root=config.root}if(config.tip){params.tip=config.tip}if(config.include_root){params.include_root=config.include_root}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},loadHistoryNodeDiffs:function(config,pagination,callback){var self=this;if(typeof(pagination)==="function"){callback=pagination;pagination=null}if(typeof(config)==="function"){callback=config;config={};pagination=null}if(!config){config={}}var uriFunction=function(){return self.getUri()+"/history/nodediffs"};var params={};if(pagination){Gitana.copyInto(params,pagination)}if(config.root){params.root=config.root}if(config.tip){params.tip=config.tip}if(config.include_root){params.include_root=config.include_root}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Changeset=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.Changeset"}},getType:function(){return Gitana.TypedIDConstants.TYPE_CHANGESET},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/changesets/"+this.getId()},clone:function(){return this.getFactory().changeset(this.getRepository(),this)},listNodes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/changesets/"+this.getId()+"/nodes"};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Node=Gitana.AbstractNode.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Node"}},getType:function(){return Gitana.TypedIDConstants.TYPE_NODE},listChildren:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/children"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},listRelatives:function(config,pagination){var type=null;var direction=null;if(config){type=config.type;if(config.direction){direction=config.direction.toUpperCase()}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/relatives";if(type){url=url+"?type="+type}if(direction){if(type){url=url+"&direction="+direction}else{url=url+"?direction="+direction}}return url};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},queryRelatives:function(query,config,pagination){var type=null;var direction=null;if(config){type=config.type;if(config.direction){direction=config.direction.toUpperCase()}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/relatives/query";if(type){url=url+"?type="+type}if(direction){if(type){url=url+"&direction="+direction}else{url=url+"?direction="+direction}}return url};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainPost(chainable,uriFunction,params,query)},associations:function(config,pagination){var type=null;var direction=null;if(config){type=config.type;if(config.direction){direction=config.direction.toUpperCase()}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/associations?a=1";if(type){url=url+"&type="+type}if(direction){url=url+"&direction="+direction}return url};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},incomingAssociations:function(type,pagination){var config={direction:"INCOMING"};if(type){config.type=type}return this.associations(config,pagination)},outgoingAssociations:function(type,pagination){var config={direction:"OUTGOING"};if(type){config.type=type}return this.associations(config,pagination)},associate:function(targetNodeId,object,undirected){if(!Gitana.isString(targetNodeId)){targetNodeId=targetNodeId.getId()}if(object){if(Gitana.isString(object)){object={_type:object}}}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/associate?node="+targetNodeId;if(undirected){url+="&directionality=UNDIRECTED"}return url};return this.chainPostEmpty(null,uriFunction,null,object)},associateOf:function(sourceNode,object,undirected){var self=this;var result=this.subchain(this);result.subchain(sourceNode).then(function(){this.associate(self,object,undirected)});return result},unassociate:function(targetNodeId,type,undirected){if(!Gitana.isString(targetNodeId)){targetNodeId=targetNodeId.getId()}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/unassociate?node="+targetNodeId;if(type){url=url+"&type="+type}if(undirected){url+="&directionality=UNDIRECTED"}return url};return this.chainPostEmpty(null,uriFunction)},traverse:function(config){var payload={traverse:config};var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/traverse"};var chainable=this.getFactory().traversalResults(this.getBranch());var params={};return this.chainPost(chainable,uriFunction,params,payload)},mount:function(mountKey){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/mount/"+mountKey};return this.chainPostEmpty(null,uriFunction,null,object)},unmount:function(){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/unmount"};return this.chainPostEmpty(null,uriFunction,null,object)},lock:function(){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/lock"};return this.chainPostEmpty(null,uriFunction)},unlock:function(){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/unlock"};return this.chainPostEmpty(null,uriFunction)},checkLocked:function(callback){return this.subchain(this).then(function(){var chain=this;var uri="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/lock";this.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response.locked);chain.next()});return false})},loadACL:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/acl/list"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response)})},listAuthorities:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/acl?id="+principalDomainQualifiedId};return this.chainGetResponseRows(this,uriFunction)},checkAuthority:function(principal,authorityId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities/"+authorityId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},grantAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities/"+authorityId+"/grant?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities/"+authorityId+"/revoke?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAllAuthorities:function(principal){return this.revokeAuthority(principal,"all")},loadAuthorityGrants:function(principalIds,callback){if(!principalIds){principalIds=[]}var json={principals:principalIds};return this.chainPostResponse(this,"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities",{},json).then(function(response){callback.call(this,response)})},checkPermission:function(principal,permissionId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/permissions/"+permissionId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},listAuditRecords:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/auditrecords"};var chainable=this.getFactory().auditRecordMap(this.getRepository());return this.chainGet(chainable,uriFunction,params)},createTranslation:function(edition,locale,object){var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n?locale="+locale;if(edition){url+="&edition="+edition}return url};var chainable=this.getFactory().node(this.getBranch());return this.chainCreateEx(chainable,object,uriFunction,uriFunction)},editions:function(callback){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n/editions"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response.editions)})},locales:function(edition,callback){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n/locales?edition="+edition};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response.locales)})},listTranslations:function(edition,pagination){var params={};if(edition){params.edition=edition}if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n/translations"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},readTranslation:function(){var edition;var locale;var args=Gitana.makeArray(arguments);if(args.length==1){locale=args.shift()}else{if(args.length>1){edition=args.shift();locale=args.shift()}}var uriFunction=function(){var uri="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n?locale="+locale;if(edition){uri+="&edition="+edition}return uri};var chainable=this.getFactory().node(this.getBranch());return this.chainGet(chainable,uriFunction)},createChild:function(object){var self=this;var branch=new Gitana.Branch(this.getRepository());var chainable=this.getFactory().node(branch);return this.subchain(chainable).then(function(){var chain=this;this.subchain(self).then(function(){branch.loadFrom(this.getBranch());this.subchain(branch).createNode(object).then(function(){chain.loadFrom(this);this.childOf(self)})})})},childOf:function(sourceNode){return this.associateOf(sourceNode,"a:child")},find:function(config,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/find"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainPost(chainable,uriFunction,params,config)},loadTree:function(config,callback){var self=this;if(typeof(config)==="function"){callback=config;config=null}if(!config){config={}}var uriFunction=function(){return self.getUri()+"/tree"};var params={};if(config.leafPath){params.leaf=config.leafPath}if(config.basePath){params.base=config.basePath}if(config.containers){params.containers=true}if(config.properties){params.properties=true}params.depth=1;if(config.depth){params.depth=config.depth}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response)})},resolvePath:function(rootNodeId,callback){var self=this;var uriFunction=function(){return self.getUri()+"/path"};var params={rootNodeId:rootNodeId};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response.path)})},listVersions:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return this.getUri()+"/versions"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},restoreVersion:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/versions/"+changesetId+"/restore"};var chainable=this.getFactory().node(this.getBranch());return this.chainPost(chainable,uriFunction,{},{})},moveToFolder:function(targetFolder){var self=this;var params={};params.targetNodeId=targetFolder.getId?targetFolder.getId():targetFolder;var uriFunction=function(){return self.getUri()+"/move"};return this.chainPostEmpty(this,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Release=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.Release"}},getType:function(){return Gitana.TypedIDConstants.TYPE_RELEASE},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/releases/"+this.getId()},clone:function(){return this.getFactory().release(this.getRepository(),this)},finalize:function(object,callback){if(typeof(object)==="function"){callback=object;object=null}if(!object){object={}}var self=this;var uriFunction=function(){return self.getUri()+"/finalize"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback(response)})},unfinalize:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/unfinalize"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})},loadInfo:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},startFinalize:function(object,callback){var self=this;if(typeof(object)==="function"){callback=object;object=null}var uriFunction=function(){return self.getUri()+"/finalize/start"};if(!object){object={}}return this.chainPostResponse(this,uriFunction,{},object).then(function(response){var jobId=response._doc;callback(jobId)})},archive:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/archive"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})},unarchive:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/unarchive"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})},releaseImmediately:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/releaseimmediately"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.MergeConflict=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.MergeConflict"}},getType:function(){return Gitana.TypedIDConstants.TYPE_RELEASE},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/conflicts/"+this.getId()},clone:function(){return this.getFactory().mergeConflict(this.getRepository(),this)},resolve:function(resolution,callback){var self=this;var uriFunction=function(){return self.getUri()+"/resolve"};var params={resolution:resolution};return this.chainPostResponse(this,uriFunction,params).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.BranchMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.BranchMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().branchMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().branch(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ChangesetMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.ChangesetMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().changesetMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().changeset(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.NodeMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(branch,object){this.objectType=function(){return"Gitana.NodeMap"};this.getRepository=function(){return branch.getRepository()};this.getRepositoryId=function(){return branch.getRepository().getId()};this.getBranch=function(){return branch};this.getBranchId=function(){return branch.getId()};this.base(branch.getPlatform(),object)},clone:function(){return this.getFactory().nodeMap(this.getBranch(),this)},buildObject:function(json){return this.getFactory().node(this.getBranch(),json)},del:function(){var self=this;var uriFunction=function(){return self.getBranch().getUri()+"/nodes/delete"};return this.subchain().then(function(){var nodeIds=this.__keys();return this.chainPost(this,uriFunction,{},{_docs:nodeIds})})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ReleaseMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.ReleaseMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().releaseMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().release(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.MergeConflictMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.MergeConflictMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().mergeConflictMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().mergeConflict(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TraversalResults=Gitana.AbstractPersistable.extend({constructor:function(branch,object){if(!this._nodes){this._nodes={}}if(!this._associations){this._associations={}}if(!this._config){this._config={}}this.base(branch.getDriver(),object);this.getRepository=function(){return branch.getRepository()};this.getRepositoryId=function(){return branch.getRepository().getId()};this.getBranch=function(){return branch};this.getBranchId=function(){return branch.getId()}},clear:function(){Gitana.deleteProperties(this._nodes,true);Gitana.deleteProperties(this._associations,true);Gitana.deleteProperties(this._config,true)},handleResponse:function(response){this.clear();this.handleSystemProperties(response);Gitana.copyInto(this._nodes,response.nodes);Gitana.copyInto(this._associations,response.associations);Gitana.copyInto(this._config,response.config);this._config.center=response.node},center:function(){var chainable=this.getFactory().node(this.getBranch());var result=this.subchain(chainable);result.subchain(this.getBranch()).readNode(this._config.center).then(function(){result.handleResponse(this)});return result},nodeCount:function(callback){return this.then(function(){callback.call(this,Gitana.getNumberOfKeys(this._nodes))})},associationCount:function(callback){return this.then(function(){callback.call(this,Gitana.getNumberOfKeys(this._associations))})},nodes:function(){var self=this;var result=this.subchain(this.getFactory().nodeMap(this.getBranch()));return result.then(function(){var chain=this;var response={rows:self._nodes};chain.handleResponse(response)})},node:function(id){var self=this;var result=this.subchain(this.getFactory().node(this.getBranch()));return result.then(function(){var nodeObject=self._nodes[id];if(!nodeObject){return self.missingNodeError(id)}this.handleResponse(nodeObject)})},associations:function(){var self=this;var result=this.subchain(this.getFactory().nodeMap(this.getBranch()));return result.then(function(){var chain=this;var response={rows:self._associations};chain.handleResponse(response)})},association:function(id){var self=this;var result=this.subchain(this.getFactory().association(this.getBranch()));return result.then(function(){var associationObject=self._associations[id];if(!associationObject){return self.missingNodeError(id)}this.handleResponse(associationObject)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Definition=Gitana.Node.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Definition"}},clone:function(){return this.getFactory().definition(this.getBranch(),this)},listFormAssociations:function(){var self=this;var uriFunction=function(){return self.getUri()+"/forms"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction)},readForm:function(formKey){var self=this;var uriFunction=function(){return self.getUri()+"/forms/"+formKey};var chainable=this.getFactory().form(this.getBranch());return this.chainGet(chainable,uriFunction)},createForm:function(formKey,formObject,formPath){var self=this;if(typeof(formObject)==="string"){formPath=formObject;formObject=null}if(!formObject){formObject={}}formObject._type="n:form";var chainable=this.getFactory().form(this.getBranch());var result=this.subchain(chainable);result.subchain(this.getBranch()).createNode(formObject,formPath).then(function(){var formNode=this;this.subchain(self).then(function(){var associationObject={_type:"a:has_form","form-key":formKey};this.associate(formNode,associationObject).then(function(){var association=this;var uri="/repositories/"+formNode.getRepositoryId()+"/branches/"+formNode.getBranchId()+"/nodes/"+formNode.getId();this.getDriver().gitanaGet(uri,null,{},function(response){result.handleResponse(response);association.next()});return false})})});return result},removeFormAssociation:function(formKey){return this.subchain(this).then(function(){var association=null;this.listFormAssociations().each(function(){if(this.getFormKey()==formKey){association=this}}).then(function(){if(association){this.subchain(association).del()}})})}});Gitana.ObjectFactory.register("d:type",Gitana.Definition);Gitana.ObjectFactory.register("d:feature",Gitana.Definition);Gitana.ObjectFactory.register("d:association",Gitana.Definition)})(window);(function(window){var Gitana=window.Gitana;Gitana.Form=Gitana.Node.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Form"}},clone:function(){return this.getFactory().form(this.getBranch(),this)},getEngineId:function(){return this.get("engineId")},setEngineId:function(engineId){this.set("engineId",engineId)}});Gitana.ObjectFactory.register("n:form",Gitana.Form)})(window);(function(window){var Gitana=window.Gitana;Gitana.HasFormAssociation=Gitana.Association.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.HasFormAssociation"}},clone:function(){return new Gitana.HasFormAssociation(this.getBranch(),this)},getFormKey:function(){return this.get("form-key")},setFormKey:function(formKey){this.set("form-key",formKey)}});Gitana.ObjectFactory.register("a:has_form",Gitana.HasFormAssociation)})(window);(function(window){var Gitana=window.Gitana;Gitana.HasTranslationAssociation=Gitana.Association.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.HasTranslationAssociation"}},clone:function(){return new Gitana.HasTranslationAssociation(this.getBranch(),this)},getLocale:function(){return this.get("locale")},setLocale:function(locale){this.set("locale",locale)},getEdition:function(){return this.get("edition")},setEdition:function(edition){this.set("edition",edition)}});Gitana.ObjectFactory.register("a:has_translation",Gitana.HasTranslationAssociation)})(window);(function(window){var Gitana=window.Gitana;Gitana.Person=Gitana.Node.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Person"}},clone:function(){return new Gitana.Person(this.getBranch(),this)},getPrincipalName:function(){return this.get("principal-name")},getPrincipalType:function(){return this.get("principal-type")},getPrincipalId:function(){return this.get("principal-id")},getPrincipalDomainId:function(){return this.get("principal-domain")},readPrincipal:function(){return this.subchain(this.getPlatform()).readDomain(this.getPrincipalDomainId()).readPrincipal(this.getPrincipalId())},getFirstName:function(){return this.get("firstName")},setFirstName:function(firstName){this.set("firstName",firstName)},getLastName:function(){return this.get("lastName")},setLastName:function(lastName){this.set("lastName",lastName)},getCompanyName:function(){return this.get("companyName")},setCompanyName:function(companyName){this.set("companyName",companyName)},getEmail:function(){return this.get("email")},setEmail:function(email){this.set("email",email)},getJobTitle:function(){return this.get("jobTitle")},setJobTitle:function(jobTitle){this.set("jobTitle",jobTitle)},getAddress:function(){return this.get("address")},setAddress:function(address){this.set("address",address)},getCity:function(){return this.get("city")},setCity:function(city){this.set("city",city)},getState:function(){return this.get("state")},setState:function(state){this.set("state",state)},getZipcode:function(){return this.get("zipcode")},setZipcode:function(zipcode){this.set("zipcode",zipcode)},getPhoneNumber:function(){return this.get("phoneNumber")},setPhoneNumber:function(phoneNumber){this.set("phoneNumber",phoneNumber)}});Gitana.ObjectFactory.register("n:person",Gitana.Person)})(window);(function(window){var Gitana=window.Gitana;Gitana.Vault=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.Vault"}},getType:function(){return Gitana.TypedIDConstants.TYPE_VAULT},getUri:function(){return"/vaults/"+this.getId()},clone:function(){return this.getFactory().vault(this.getPlatform(),this)},listArchives:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().archiveMap(this);return this.chainGet(chainable,this.getUri()+"/archives",params)},readArchive:function(archiveId){var chainable=this.getFactory().archive(this);return this.chainGet(chainable,this.getUri()+"/archives/"+archiveId)},lookupArchive:function(groupId,artifactId,versionId){var chainable=this.getFactory().archive(this);return this.chainGet(chainable,this.getUri()+"/archives/lookup?group="+groupId+"&artifact="+artifactId+"&version="+versionId)},queryArchives:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/archives/query"};var chainable=this.getFactory().archiveMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkArchivePermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/archives/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkArchiveAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/archives/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.VaultMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.VaultMap"};this.base(platform,object)},clone:function(){return this.getFactory().vaultMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().vault(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractVaultObject=Gitana.AbstractPlatformObject.extend({constructor:function(vault,object){this.base(vault.getPlatform(),object);this.objectType=function(){return"Gitana.Archive"};this.getVault=function(){return vault};this.getVaultId=function(){return vault.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getVaultId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Archive=Gitana.AbstractVaultObject.extend({constructor:function(vault,object){this.base(vault,object);this.objectType=function(){return"Gitana.Archive"}},getType:function(){return Gitana.TypedIDConstants.TYPE_ARCHIVE},getUri:function(){return"/vaults/"+this.getVaultId()+"/archives/"+this.getId()},clone:function(){return this.getFactory().archive(this.getVault(),this)},getDownloadUri:function(){return this.getProxiedUri()+"/download"},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri()})})(window);(function(window){var Gitana=window.Gitana;Gitana.ArchiveMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(vault,object){this.objectType=function(){return"Gitana.ArchiveMap"};this.getVault=function(){return vault};this.getVaultId=function(){return vault.getId()};this.base(vault.getPlatform(),object)},clone:function(){return this.getFactory().archiveMap(this.getVault(),this)},buildObject:function(json){return this.getFactory().archive(this.getVault(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.WebHost=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.WebHost"};this.base(platform,object)},getUri:function(){return"/webhosts/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_WEB_HOST},clone:function(){return this.getFactory().webhost(this.getPlatform(),this)},getUrlPatterns:function(){return this.get("urlPatterns")},createAutoClientMapping:function(uri,applicationId,clientKey,authGrantKey,object){if(!object){object={}}if(!Gitana.isString(applicationId)){applicationId=applicationId.getId()}if(!Gitana.isString(clientKey)){clientKey=clientKey.getKey()}if(!Gitana.isString(authGrantKey)){authGrantKey=authGrantKey.getKey()}object.uri=uri;object.applicationId=applicationId;object.clientKey=clientKey;object.authGrantKey=authGrantKey;var uriFunction=function(){return"/webhosts/"+this.getId()+"/autoclientmappings"};var chainable=this.getFactory().autoClientMapping(this);return this.chainCreate(chainable,object,uriFunction)},listAutoClientMappings:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/webhosts/"+this.getId()+"/autoclientmappings"};var chainable=this.getFactory().autoClientMappingMap(this);return this.chainGet(chainable,uriFunction,params)},readAutoClientMapping:function(autoClientMappingId){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings/"+autoClientMappingId};var chainable=this.getFactory().autoClientMapping(this);return this.chainGet(chainable,uriFunction)},queryAutoClientMappings:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/autoclientmappings/query"};var chainable=this.getFactory().autoClientMappingMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkAutoClientMappingsPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkAutoClientMappingsAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createTrustedDomainMapping:function(host,scope,platformId,object){if(!object){object={}}if(!Gitana.isString(platformId)){platformId=platformId.getId()}object.host=host;object.scope=scope;object.platformId=platformId;var uriFunction=function(){return"/webhosts/"+this.getId()+"/trusteddomainmappings"};var chainable=this.getFactory().trustedDomainMapping(this);return this.chainCreate(chainable,object,uriFunction)},listTrustedDomainMappings:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/webhosts/"+this.getId()+"/trusteddomainmappings"};var chainable=this.getFactory().trustedDomainMappingMap(this);return this.chainGet(chainable,uriFunction,params)},readTrustedDomainMapping:function(trustedDomainMappingId){var self=this;var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/"+trustedDomainMappingId};var chainable=this.getFactory().trustedDomainMapping(this);return this.chainGet(chainable,uriFunction)},queryTrustedDomainMappings:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/query"};var chainable=this.getFactory().trustedDomainMappingMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkTrustedDomainMappingsPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkTrustedDomainMappingsAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listDeployedApplications:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/webhosts/"+this.getId()+"/applications"};var chainable=this.getFactory().deployedApplicationMap(this);return this.chainGet(chainable,uriFunction,params)},readDeployedApplication:function(deployedApplicationId){var uriFunction=function(){return"/webhosts/"+this.getId()+"/applications/"+deployedApplicationId};var chainable=this.getFactory().deployedApplication(this);return this.chainGet(chainable,uriFunction)},queryDeployedApplications:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/applications/query"};var chainable=this.getFactory().deployedApplicationMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkDeployedApplicationsPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/applications/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkDeployedApplicationsAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/applications/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.WebHostMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.WebHostMap"};this.base(platform,object)},clone:function(){return this.getFactory().webhostMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().webhost(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractWebHostObject=Gitana.AbstractPlatformObject.extend({constructor:function(webhost,object){this.base(webhost.getPlatform(),object);this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getWebHostId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AutoClientMapping=Gitana.AbstractWebHostObject.extend({constructor:function(webhost,object){this.base(webhost,object);this.objectType=function(){return"Gitana.AutoClientMapping"}},clone:function(){return this.getFactory().autoClientMapping(this.getWebHost(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_AUTO_CLIENT_MAPPING},getUri:function(){return"/webhosts/"+this.getWebHostId()+"/autoclientmappings/"+this.getId()},getSourceUri:function(){return this.get("uri")},getTargetApplicationId:function(){return this.get("applicationId")},getTargetClientKey:function(){return this.get("clientKey")},getTargetTenantId:function(){return this.get("tenantId")},getAutoManage:function(){return this.get("automanage")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TrustedDomainMappingMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(webhost,object){this.objectType=function(){return"Gitana.TrustedDomainMappingMap"};this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()};this.base(webhost.getPlatform(),object)},clone:function(){return this.getFactory().trustedDomainMappingMap(this.getWebHost(),this)},buildObject:function(json){return this.getFactory().trustedDomainMapping(this.getWebHost(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TrustedDomainMapping=Gitana.AbstractWebHostObject.extend({constructor:function(webhost,object){this.base(webhost,object);this.objectType=function(){return"Gitana.TrustedDomainMapping"}},clone:function(){return this.getFactory().trustedDomainMapping(this.getWebHost(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_TRUSTED_DOMAIN_MAPPING},getUri:function(){return"/webhosts/"+this.getWebHostId()+"/trusteddomainmappings/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AutoClientMappingMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(webhost,object){this.objectType=function(){return"Gitana.AutoClientMappingMap"};this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()};this.base(webhost.getPlatform(),object)},clone:function(){return this.getFactory().autoClientMappingMap(this.getWebHost(),this)},buildObject:function(json){return this.getFactory().autoClientMapping(this.getWebHost(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DeployedApplication=Gitana.AbstractWebHostObject.extend({constructor:function(webhost,object){this.base(webhost,object);this.objectType=function(){return"Gitana.DeployedApplication"}},clone:function(){return this.getFactory().deployedApplication(this.getWebHost(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_DEPLOYED_APPLICATION},getUri:function(){return"/webhosts/"+this.getWebHostId()+"/applications/"+this.getId()},undeploy:function(){var uriFunction=function(){return this.getUri()+"/undeploy"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},redeploy:function(){var uriFunction=function(){return this.getUri()+"/redeploy"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},start:function(){var uriFunction=function(){return this.getUri()+"/start"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},stop:function(){var uriFunction=function(){return this.getUri()+"/stop"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},restart:function(){var uriFunction=function(){return this.getUri()+"/restart"};return this.chainPostEmpty(this.getWebHost(),uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DeployedApplicationMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(webhost,object){this.objectType=function(){return"Gitana.DeployedApplicationMap"};this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()};this.base(webhost.getPlatform(),object)},clone:function(){return this.getFactory().deployedApplicationMap(this.getWebHost(),this)},buildObject:function(json){return this.getFactory().deployedApplication(this.getWebHost(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Context=Gitana.Chainable.extend({constructor:function(configs){this.base(new Gitana(configs.driver?configs.driver:{}));if(!this.cache){this.cache={}}this.cache.repository=null;this.cache.branch=null;this.cache.platform=null;this.getConfigs=function(){return configs};this.getRepositoryConfigs=function(){var repositoryConfigs=configs.repository;if(typeof repositoryConfigs=="string"){repositoryConfigs={repository:repositoryConfigs}}return repositoryConfigs};this.getBranchConfigs=function(){var branchConfigs=configs.branch?configs.branch:"master";if(typeof branchConfigs=="string"){if(branchConfigs=="master"){branchConfigs={type:"MASTER"}}else{branchConfigs={_doc:branchConfigs}}}return branchConfigs};this.getUserConfigs=function(){return configs.user};this.getDriverConfigs=function(){return configs.driver}},platform:function(platform){if(platform||platform===null){this.cache.platform=platform}return this.cache.platform?Chain(this.cache.platform):null},repository:function(repository){if(repository||repository===null){this.cache.repository=repository}return this.cache.repository?Chain(this.cache.repository):null},branch:function(branch){if(branch||branch===null){this.cache.branch=branch}return this.cache.branch?Chain(this.cache.branch):null},init:function(){var self=this;var loadPlatform=function(successCallback,errorCallback){if(!self.platform()){var authentication=self.getConfigs()["authentication"];self.getDriver().authenticate(authentication,function(http){if(errorCallback){errorCallback({message:"Failed to login Gitana.",reason:"INVALID_LOGIN",error:http})}}).then(function(){self.platform(this);loadRepository(successCallback,errorCallback)})}else{loadRepository(successCallback,errorCallback)}};var loadRepository=function(successCallback,errorCallback){if(!self.repository()){self.platform().trap(function(error){if(errorCallback){errorCallback({message:"Failed to get repository",error:error})}}).queryRepositories(self.getRepositoryConfigs()).count(function(count){if(errorCallback){if(count==0){errorCallback({message:"Cannot find any repository"})}if(count>1){errorCallback({message:"Found more than one repository"})}}}).keepOne().then(function(){self.repository(this);loadBranch(successCallback,errorCallback)})}else{loadBranch(successCallback,errorCallback)}};var loadBranch=function(successCallback,errorCallback){if(!self.branch()){self.repository().trap(function(error){if(errorCallback){errorCallback({message:"Failed to get branch",error:error})}}).queryBranches(self.getBranchConfigs()).count(function(count){if(errorCallback){if(count==0){errorCallback({message:"Cannot find any branch"})}if(count>1){errorCallback({message:"Found more than one branch"})}}}).keepOne().then(function(){self.branch(this);successCallback.call()})}else{successCallback.call()}};var result=Chain(this);return result.subchain().then(function(){var chain=this;loadPlatform(function(){chain.next()},function(err){var errorCallback=self.getConfigs()["error"];if(errorCallback){errorCallback.call(self,err)}});return false})}});Gitana.Context.create=function(config){var context=new Gitana.Context(config);return context.init()}})(window);(function(window){var Gitana=window.Gitana;Gitana.AppHelper=Gitana.AbstractObject.extend({constructor:function(platform,config){this.objectType=function(){return"Gitana.AppHelper"};this.base(platform.getDriver());this.getPlatform=function(){return platform};this.getPlatformId=function(){return platform.getId()};this.getApplicationId=function(){return config.application};this.cache=Gitana.MemoryCache();this.chainedCacheItem=function(key){var chained=null;if(this.cache(key)){chained=Chain(this.cache(key))}return chained}},init:function(callback){var self=this;var p=function(application){var projectId=application.projectId;if(projectId){Chain(self.getPlatform()).trap(function(err){callback()}).readProject(projectId).then(function(){self.cache("project",this);callback()})}else{callback()}};Chain(self.getPlatform()).trap(function(err){callback(err)}).readApplication(self.getApplicationId()).then(function(){self.cache("application",this);var application=this;this.subchain(self.getPlatform()).trap(function(err){p(application)}).findStackForDataStore(Gitana.TypedIDConstants.TYPE_APPLICATION,self.getApplicationId()).then(function(){self.cache("stack",this);this.listDataStores().each(function(key){this["_doc"]=this["datastoreId"];delete this["datastoreTypeId"];self.cache("stack.datastore."+key,this)});this.then(function(){p(application)})})})},platform:function(){return Chain(this.getPlatform())},application:function(){return this.chainedCacheItem("application")},stack:function(){return this.chainedCacheItem("stack")},datastore:function(key){return this.chainedCacheItem("stack.datastore."+key)},project:function(){return this.chainedCacheItem("project")}})})(window);(function(window){var Gitana=window.Gitana;var STATUS_UNRESOLVED="unresolved";var STATUS_RESOLVED="resolved";var STATUS_REJECTED="rejected";var triggerAll=function(val,cbs){for(var i=0;i1){var ancestor=this[source];if(ancestor&&(typeof value==="function")&&(!ancestor.valueOf||ancestor.valueOf()!==value.valueOf())&&/\bbase\b/.test(value)){var method=value.valueOf();value=function(){var previous=this.base||Base.prototype.base;this.base=ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue};value.valueOf=function(type){return(type==="object")?value:method};value.toString=Base.toString}this[source]=value}else{if(source){var extend=Base.prototype.extend;if(!Base._prototyping&&typeof this!=="function"){extend=this.extend||extend}var proto={toSource:null};var hidden=["constructor","toString","valueOf"];for(var i=Base._prototyping?0:1;i-1){var qs=url.substring(x1+1);url=url.substring(0,x1);var parts=qs.split("&");for(var x2=0;x2-1){url=url+"&"+paramKey+"="+paramValue}else{url=url+"?"+paramKey+"="+paramValue}}return this.ajax(method,url,contentType,data,headers,onSuccess,onFailure)},gitanaGet:function(url,params,headers,successCallback,failureCallback){return this.gitanaRequest("GET",url,params,"application/json",null,headers,successCallback,failureCallback)},gitanaDownload:function(url,params,successCallback,failureCallback){return this.gitanaRequest("GET",url,params,null,null,{},successCallback,failureCallback)},gitanaPost:function(url,params,jsonData,successCallback,failureCallback){return this.gitanaRequest("POST",url,params,"application/json",jsonData,{},successCallback,failureCallback)},gitanaUpload:function(url,params,contentType,data,successCallback,failureCallback){return this.gitanaRequest("POST",url,params,contentType,data,{},successCallback,failureCallback)},gitanaPut:function(url,params,jsonData,successCallback,failureCallback){return this.gitanaRequest("PUT",url,params,"application/json",jsonData,{},successCallback,failureCallback)},gitanaDelete:function(url,params,successCallback,failureCallback){return this.gitanaRequest("DELETE",url,params,"application/json",null,{},successCallback,failureCallback)},getFactory:function(){return new Gitana.ObjectFactory()},authenticate:function(settings,authFailureHandler){var driver=this;var config={code:null,redirectUri:null,username:null,password:null,accessToken:null,ticket:null,cookie:null,ticketMaxAge:null};Gitana.copyKeepers(config,Gitana.loadDefaultConfig());Gitana.copyKeepers(config,settings);var platformConfig={key:null,ticket:null,username:null,clientKey:null};Gitana.copyKeepers(platformConfig,this.getOriginalConfiguration());Gitana.copyKeepers(platformConfig,settings);var platformCacheKey=platformConfig.key;if(!platformCacheKey){platformCacheKey=Gitana.determinePlatformCacheKey(platformConfig,true)}if(platformCacheKey){this.platformCacheKey=platformCacheKey}var cluster=new Gitana.Cluster(this,{});var applyPlatformCache=function(driver,platform){var platformCacheKey=driver.platformCacheKey;if(platformCacheKey){Gitana.PLATFORM_CACHE(platformCacheKey,platform)}var ticket=driver.getAuthInfo().getTicket();if(ticket){Gitana.PLATFORM_CACHE(ticket,platform)}};var doAuthenticate=function(){var platform=this;if(!config.code&&!config.username&&!config.accessToken&&!config.cookie&&!config.ticket){config.username="guest";config.password="guest"}if(config.code){config.authorizationFlow=Gitana.OAuth2Http.AUTHORIZATION_CODE;driver.resetHttp(config);Gitana.deleteCookie("GITANA_TICKET","/");driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.username){config.authorizationFlow=Gitana.OAuth2Http.PASSWORD;driver.resetHttp(config);Gitana.deleteCookie("GITANA_TICKET","/");driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.accessToken){config.authorizationFlow=Gitana.OAuth2Http.TOKEN;driver.resetHttp(config);Gitana.deleteCookie("GITANA_TICKET","/");driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.cookie){config.authorizationFlow=Gitana.OAuth2Http.COOKIE;driver.resetHttp(config);driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);if(authInfo.accessToken){driver.http.accessToken(authInfo.accessToken)}Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{if(config.ticket){config.authorizationFlow=Gitana.OAuth2Http.TICKET;driver.resetHttp(config);var headers={GITANA_TICKET:config.ticket};driver.gitanaGet("/auth/info",{},headers,function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);Gitana.deleteCookie("JSESSIONID","/");applyPlatformCache(driver,platform);platform.reload();platform.next()},function(http){if(authFailureHandler){authFailureHandler.call(platform,http)}})}else{var message="Unsupported authentication flow - you must provide either a username, authorization code, access token or select cookie-based authentication";if(authFailureHandler){authFailureHandler.call(platform,{message:message})}else{throw new Error(message)}}}}}}};var result=this.getFactory().platform(cluster);return Chain(result).then(function(){doAuthenticate.call(this);return false})},reloadAuthInfo:function(callback){var driver=this;driver.gitanaGet("/auth/info",{},{},function(response){var authInfo=new Gitana.AuthInfo(response);driver.setAuthInfo(authInfo);callback()},function(http){callback(null,http)})},clearAuthentication:function(){if(this.http.clearStorage){this.http.clearStorage()}this.resetHttp();Gitana.deleteCookie("GITANA_TICKET","/")},refreshAuthentication:function(callback){this.http.refresh(function(err){callback(err)})},destroy:function(){this.clearAuthentication()}});Gitana.EVERYONE={name:"everyone",type:"GROUP"};Gitana.toCopyDependencyChain=function(typedID){var array=[];if(typedID.getType()==="node"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getBranch()));array=array.concat({typeId:"changeset",id:typedID.getSystemMetadata().getChangesetId()})}else{if(typedID.getType()==="association"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getBranch()));array=array.concat({typeId:"changeset",id:typedID.getSystemMetadata().getChangesetId()})}else{if(typedID.getType()==="branch"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getRepository()))}else{if(typedID.getType()==="platform"){}else{if(typedID.getType()==="stack"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getPlatform()))}else{if(typedID.getType()==="project"){array=array.concat(Gitana.toCopyDependencyChain(typedID.getPlatform()))}else{array=array.concat(Gitana.toCopyDependencyChain(typedID.getPlatform()))}}}}}}array.push(Gitana.toDependencyObject(typedID));return array};Gitana.toDependencyObject=function(typedID){return{typeId:typedID.getType(),id:typedID.getId()}};Gitana.TypedIDConstants={};Gitana.TypedIDConstants.TYPE_APPLICATION="application";Gitana.TypedIDConstants.TYPE_EMAIL="email";Gitana.TypedIDConstants.TYPE_EMAIL_PROVIDER="emailprovider";Gitana.TypedIDConstants.TYPE_REGISTRATION="registration";Gitana.TypedIDConstants.TYPE_PAGE_RENDITION="pageRendition";Gitana.TypedIDConstants.TYPE_SETTINGS="settings";Gitana.TypedIDConstants.TYPE_CLUSTER="cluster";Gitana.TypedIDConstants.TYPE_JOB="job";Gitana.TypedIDConstants.TYPE_LOG_ENTRY="logEntry";Gitana.TypedIDConstants.TYPE_DIRECTORY="directory";Gitana.TypedIDConstants.TYPE_IDENTITY="identity";Gitana.TypedIDConstants.TYPE_CONNECTION="connection";Gitana.TypedIDConstants.TYPE_DOMAIN="domain";Gitana.TypedIDConstants.TYPE_DOMAIN_GROUP="group";Gitana.TypedIDConstants.TYPE_DOMAIN_USER="user";Gitana.TypedIDConstants.TYPE_PLATFORM="platform";Gitana.TypedIDConstants.TYPE_AUTHENTICATION_GRANT="authenticationGrant";Gitana.TypedIDConstants.TYPE_BILLING_PROVIDERS_CONFIGURATION="billingProviderConfiguration";Gitana.TypedIDConstants.TYPE_CLIENT="client";Gitana.TypedIDConstants.TYPE_DESCRIPTOR="externalServiceDescriptor";Gitana.TypedIDConstants.TYPE_STACK="stack";Gitana.TypedIDConstants.TYPE_PROJECT="project";Gitana.TypedIDConstants.TYPE_SCHEDULED_WORK="scheduled-work";Gitana.TypedIDConstants.TYPE_REPORT="report";Gitana.TypedIDConstants.TYPE_WORKFLOW_INSTANCE="workflowInstance";Gitana.TypedIDConstants.TYPE_WORKFLOW_MODEL="workflowModel";Gitana.TypedIDConstants.TYPE_WORKFLOW_TASK="workflowTask";Gitana.TypedIDConstants.TYPE_WORKFLOW_COMMENT="workflowComment";Gitana.TypedIDConstants.TYPE_UICONFIG="uiconfig";Gitana.TypedIDConstants.TYPE_REGISTRAR="registrar";Gitana.TypedIDConstants.TYPE_METER="meter";Gitana.TypedIDConstants.TYPE_PLAN="plan";Gitana.TypedIDConstants.TYPE_TENANT="tenant";Gitana.TypedIDConstants.TYPE_REPOSITORY="repository";Gitana.TypedIDConstants.TYPE_ASSOCIATION="association";Gitana.TypedIDConstants.TYPE_BRANCH="branch";Gitana.TypedIDConstants.TYPE_CHANGESET="changeset";Gitana.TypedIDConstants.TYPE_NODE="node";Gitana.TypedIDConstants.TYPE_RELEASE="release";Gitana.TypedIDConstants.TYPE_MERGE_CONFLICT="mergeConflict";Gitana.TypedIDConstants.TYPE_VAULT="vault";Gitana.TypedIDConstants.TYPE_ARCHIVE="archive";Gitana.TypedIDConstants.TYPE_WAREHOUSE="warehouse";Gitana.TypedIDConstants.TYPE_INTERACTION="interaction";Gitana.TypedIDConstants.TYPE_INTERACTION_APPLICATION="interactionApplication";Gitana.TypedIDConstants.TYPE_INTERACTION_NODE="interactionNode";Gitana.TypedIDConstants.TYPE_INTERACTION_PAGE="interactionPage";Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT="interactionReport";Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT_ENTRY="interactionReportEntry";Gitana.TypedIDConstants.TYPE_INTERACTION_SESSION="interactionSession";Gitana.TypedIDConstants.TYPE_INTERACTION_USER="interactionUser";Gitana.TypedIDConstants.TYPE_INTERACTION_CONTINENT="interactionContinent";Gitana.TypedIDConstants.TYPE_INTERACTION_COUNTRY="interactionCountry";Gitana.TypedIDConstants.TYPE_INTERACTION_CITY="interactionCity";Gitana.TypedIDConstants.TYPE_INTERACTION_REGION="interactionRegion";Gitana.TypedIDConstants.TYPE_INTERACTION_POSTALCODE="interactionPostalCode";Gitana.TypedIDConstants.TYPE_INTERACTION_USERAGENT="interactionUserAgent";Gitana.TypedIDConstants.TYPE_INTERACTION_OPERATINGSYSTEM="interactionOperatingSystem";Gitana.TypedIDConstants.TYPE_INTERACTION_DEVICE="interactionDevice";Gitana.TypedIDConstants.TYPE_CONVERSION_TRIGGER="conversionTrigger";Gitana.TypedIDConstants.TYPE_WEB_HOST="webhost";Gitana.TypedIDConstants.TYPE_AUTO_CLIENT_MAPPING="autoClientMapping";Gitana.TypedIDConstants.TYPE_TRUSTED_DOMAIN_MAPPING="trustedDomainMapping";Gitana.TypedIDConstants.TYPE_DEPLOYED_APPLICATION="deployedApplication";Gitana.handleJobCompletion=function(chain,cluster,jobId,synchronous,reportFn){var jobFinalizer=function(){return Chain(cluster).readJob(jobId).then(function(){if(reportFn){reportFn(this)}if(!synchronous||(synchronous&&(this.getState()=="FINISHED"||this.getState()=="ERROR"))){chain.loadFrom(this);chain.next()}else{window.setTimeout(jobFinalizer,1000)}})};window.setTimeout(jobFinalizer,1000)};Gitana.loadDefaultConfig=function(){};Gitana.MemoryCache=function(){var cache={};return function(k,v){if(!Gitana.isUndefined(v)){if(v){cache[k]=v}else{delete cache[k]}}if(k=="clear"){var za=[];for(var z in cache){za.push(z)}for(var i=0;i=200&&xhr.status<=226)||xhr.status==304){if(typeof(Gitana.XHR_CACHE_FN)!=="undefined"&&Gitana.XHR_CACHE_FN!==null){Gitana.XHR_CACHE_FN({method:method,url:url,headers:headers},responseObject)}success(responseObject,xhr)}else{if(xhr.status>=400&&xhr.status!==0){failure(responseObject,xhr)}else{if(xhr.status>=300&&xhr.status<=303){failure(responseObject,xhr)}}}}};xhr.open(method,url,true);xhr.timeout=Gitana.HTTP_TIMEOUT;xhr.ontimeout=function(){failure({timeout:true},xhr)};xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");for(var header in headers){xhr.setRequestHeader(header,headers[header])}try{xhr.send(data)}catch(e){console.log(e)}}},request:function(options){return this.invoke(options)}});Gitana.Http.toQueryString=function(params){var queryString="";if(params){for(var k in params){if(queryString.length>0){queryString+="&"}var val=null;if(params[k]){val=params[k];val=Gitana.Http.URLEncode(val)}if(val){queryString+=k+"="+val}}}return queryString};Gitana.Http.Request=function(){var XHR;if(typeof global.Titanium!=="undefined"&&typeof global.Titanium.Network.createHTTPClient!="undefined"){XHR=global.Titanium.Network.createHTTPClient()}else{if(typeof require!=="undefined"){try{var XMLHttpRequest=require("xmlhttprequest").XMLHttpRequest;XHR=new XMLHttpRequest()}catch(e){XHR=new global.XMLHttpRequest()}}else{XHR=new global.XMLHttpRequest()}}return XHR};var Hash=function(){};Hash.prototype={join:function(string){string=string||"";return this.values().join(string)},keys:function(){var i,arr=[],self=this;for(i in self){if(self.hasOwnProperty(i)){arr.push(i)}}return arr},values:function(){var i,arr=[],self=this;for(i in self){if(self.hasOwnProperty(i)){arr.push(self[i])}}return arr},shift:function(){throw"not implemented"},unshift:function(){throw"not implemented"},push:function(){throw"not implemented"},pop:function(){throw"not implemented"},sort:function(){throw"not implemented"},ksort:function(func){var self=this,keys=self.keys(),i,value,key;if(func==undefined){keys.sort()}else{keys.sort(func)}for(i=0;i0){ret=q_arr.join("&")}return ret};Gitana.Http.QueryString.prototype.setQueryParams=function(query){var args=arguments,args_length=args.length,i,query_array,query_array_length,querystring=this,key_value;if(args_length==1){if(typeof query==="object"){for(i in query){if(query.hasOwnProperty(i)){querystring[i]=query[i]}}}else{if(typeof query==="string"){query_array=query.split("&");for(i=0,query_array_length=query_array.length;i{}|`^\\\u0080-\uffff]/,str_len=string.length,i,string_arr=string.split(""),c;for(i=0;i>6))+hex(128+(c&63))}else{if(c<65536){string_arr[i]=hex(224+(c>>12))+hex(128+((c>>6)&63))+hex(128+(c&63))}else{if(c<2097152){string_arr[i]=hex(240+(c>>18))+hex(128+((c>>12)&63))+hex(128+((c>>6)&63))+hex(128+(c&63))}}}}}}return string_arr.join("")};Gitana.Http.URLDecode=function(string){if(!string){return""}return string.replace(/%[a-fA-F0-9]{2}/ig,function(match){return String.fromCharCode(parseInt(match.replace("%",""),16))})}}(this));(function(global){Gitana.OAuth2Http=Gitana.Http.extend({constructor:function(options,storage){var self=this;if(storage===null||typeof(storage)==="string"){storage=new Gitana.OAuth2Http.Storage(storage)}this.cookieMode=null;this.ticketMode=null;this.error=null;this.errorDescription=null;this.errorUri=null;var tokenURL="/oauth/token";if(options.tokenURL){tokenURL=options.tokenURL}var baseURL=null;if(options.baseURL){baseURL=options.baseURL}var clientKey=options.clientKey;var clientSecret=options.clientSecret;this.authorizationFlow=options.authorizationFlow||Gitana.OAuth2Http.AUTHORIZATION_CODE;if(options.requestedScope){this.requestedScope=options.requestedScope}if(this.authorizationFlow==Gitana.OAuth2Http.AUTHORIZATION_CODE){this.code=options.code;this.redirectUri=options.redirectUri}if(this.authorizationFlow==Gitana.OAuth2Http.PASSWORD){this.username=options.username;if(options.password){this.password=options.password}else{this.password=""}}if(this.authorizationFlow==Gitana.OAuth2Http.COOKIE){this.cookieMode=true}if(this.authorizationFlow==Gitana.OAuth2Http.TICKET){this.ticketMode=options.ticket}this.ticketMaxAge=options.ticketMaxAge;this.clearStorage=function(){storage.clear()};this.accessToken=function(value){return storage.poke("accessToken",value)};this.refreshToken=function(value){return storage.poke("refreshToken",value)};this.grantedScope=function(value){return storage.poke("grantedScope",value)};this.expiresIn=function(value){return storage.poke("expiresIn",value)};this.grantTime=function(value){return storage.poke("grantTime",value)};this.getClientAuthorizationHeader=function(){var basicString=clientKey+":";if(clientSecret){basicString+=clientSecret}return"Basic "+Gitana.btoa(basicString)};this.getBearerAuthorizationHeader=function(){return"Bearer "+self.accessToken()};this.getPrefixedTokenURL=function(){return this.getPrefixedURL(tokenURL)};this.getPrefixedURL=function(url){var rebasedURL=url;if(baseURL&&Gitana.startsWith(url,"/")){rebasedURL=baseURL+url}return rebasedURL};if(this.authorizationFlow==Gitana.OAuth2Http.TOKEN){var existingAccessToken=this.accessToken();if(existingAccessToken!==options.accessToken){storage.clear()}this.accessToken(existingAccessToken)}this.base()},request:function(options){var self=this;var doGetAccessToken=function(success,failure){var onSuccess=function(response){var object=JSON.parse(response.text);if(response.error){self.error=object.error;self.errorDescription=object.error_description;self.errorUri=object.error_uri}else{var _accessToken=object.access_token;var _refreshToken=object.refresh_token;var _expiresIn=object.expires_in;var _grantedScope=object.scope;var _grantTime=new Date().getTime();self.clearStorage();self.accessToken(_accessToken);self.refreshToken(_refreshToken);self.expiresIn(_expiresIn);self.grantedScope(_grantedScope);self.grantTime(_grantTime)}success()};var onFailure=function(http,xhr){failure(http,xhr)};var o={success:onSuccess,failure:onFailure,headers:{Authorization:self.getClientAuthorizationHeader()},url:self.getPrefixedTokenURL(),method:Gitana.OAuth2Http.TOKEN_METHOD};var qs={};qs.grant_type=self.authorizationFlow;if(self.requestedScope){qs.scope=self.requestedScope}if(self.authorizationFlow===Gitana.OAuth2Http.AUTHORIZATION_CODE){qs.code=self.code;if(self.redirectUri){qs.redirect_uri=self.redirectUri}}else{if(self.authorizationFlow===Gitana.OAuth2Http.PASSWORD){qs.username=self.username;qs.password=self.password}}if(self.ticketMaxAge){qs.ticketMaxAge=self.ticketMaxAge}if("post"===Gitana.OAuth2Http.TOKEN_METHOD.toLowerCase()){o.headers["Content-Type"]="application/x-www-form-urlencoded"}var queryString=Gitana.Http.toQueryString(qs);if(queryString){if(o.url.indexOf("?")>-1){o.url=o.url+"&"+queryString}else{o.url=o.url+"?"+queryString}}self.invoke(o)};if(typeof(Gitana.REFRESH_TOKEN_LOCKS)==="undefined"){Gitana.REFRESH_TOKEN_LOCKS={}}if(typeof(Gitana.REFRESH_TOKEN_LOCK_REATTEMPT_MS)==="undefined"){Gitana.REFRESH_TOKEN_LOCK_REATTEMPT_MS=75}var waitForPendingRefresh=function(key,oldAccessToken){setTimeout(function(){if(Gitana.REFRESH_TOKEN_LOCKS[key]){return waitForPendingRefresh()}var newAccessToken=self.accessToken();var autoAttemptRefresh=(newAccessToken===oldAccessToken);doCall(autoAttemptRefresh)},Gitana.REFRESH_TOKEN_LOCK_REATTEMPT_MS)};var doRefreshAccessToken=function(success,failure){var key=self.refreshToken();var oldAccessToken=self.accessToken();if(Gitana.REFRESH_TOKEN_LOCKS[key]){return waitForPendingRefresh(key,oldAccessToken)}Gitana.REFRESH_TOKEN_LOCKS[key]=true;_doRefreshAccessToken(function(response){delete Gitana.REFRESH_TOKEN_LOCKS[key];success(response)},function(http,xhr){delete Gitana.REFRESH_TOKEN_LOCKS[key];failure(http,xhr)})};var _doRefreshAccessToken=function(success,failure){var onSuccess=function(response){var object=JSON.parse(response.text);if(response.error){self.error=object.error;self.errorDescription=object.error_description;self.errorUri=object.error_uri}else{var _accessToken=object.access_token;var _refreshToken=object.refresh_token;var _expiresIn=object.expires_in;var _grantTime=new Date().getTime();var _grantedScope=self.grantedScope();self.clearStorage();self.accessToken(_accessToken);self.refreshToken(_refreshToken);self.expiresIn(_expiresIn);self.grantedScope(_grantedScope);self.grantTime(_grantTime)}success(response)};var onFailure=function(http,xhr){Gitana.REFRESH_TOKEN_FAILURE_FN(self,http,xhr);failure(http,xhr)};var o={success:onSuccess,failure:onFailure,headers:{Authorization:self.getClientAuthorizationHeader()},url:self.getPrefixedTokenURL(),method:Gitana.OAuth2Http.TOKEN_METHOD};var qs={};qs.grant_type="refresh_token";qs.refresh_token=self.refreshToken();if(self.requestedScope){qs.scope=self.requestedScope}if(self.ticketMaxAge){qs.ticketMaxAge=self.ticketMaxAge}if("post"===Gitana.OAuth2Http.TOKEN_METHOD.toLowerCase()){o.headers["Content-Type"]="application/x-www-form-urlencoded"}var queryString=Gitana.Http.toQueryString(qs);if(queryString){if(o.url.indexOf("?")>-1){o.url=o.url+"&"+queryString}else{o.url=o.url+"?"+queryString}}self.invoke(o)};var doCall=function(autoAttemptRefresh){var successHandler=function(response){options.success(response)};var failureHandler=function(http,xhr){if(autoAttemptRefresh){var notJson=false;var isInvalidToken=false;if(http.text){var responseData={};try{responseData=JSON.parse(http.text)}catch(e){console.log("Error response is not json");console.log(e);console.log(http.text);notJson=true}if(responseData.error){if(responseData.error=="invalid_token"){isInvalidToken=true}}}var is401=(http.code==401);var is400=(http.code==400);var is403=(http.code==403);if(is401||is400||is403||isInvalidToken||notJson){if(self.refreshToken()){doRefreshAccessToken(function(){doCall(false)},function(){options.failure(http,xhr)})}else{options.failure(http,xhr)}}else{options.failure(http,xhr)}}else{options.failure(http,xhr)}};var o={};Gitana.copyInto(o,options);o.success=successHandler;o.failure=failureHandler;if(!o.headers){o.headers={}}if(!self.cookieMode&&!self.ticketMode){o.headers.Authorization=self.getBearerAuthorizationHeader()}if(self.ticketMode){o.headers.GITANA_TICKET=encodeURIComponent(self.ticketMode)}o.url=self.getPrefixedURL(o.url);self.invoke(o)};var forceRefresh=false;if(self.accessToken()){var grantTime=self.grantTime();if(grantTime){var expiresIn=self.expiresIn();if(expiresIn){var expirationTimeMs=self.grantTime()+(self.expiresIn()*1000);var nowTimeMs=new Date().getTime();var timeRemainingMs=expirationTimeMs-nowTimeMs;if(timeRemainingMs<=0){}else{}if(timeRemainingMs<=20000){forceRefresh=true}}}}if((!self.accessToken()||forceRefresh)&&!this.cookieMode&&!this.ticketMode){if(!self.refreshToken()){doGetAccessToken(function(){doCall(true)},function(http,xhr){options.failure(http,xhr)})}else{doRefreshAccessToken(function(){doCall(true)},function(http,xhr){options.failure(http,xhr)})}}else{doCall(true)}},refresh:function(callback){var self=this;var onSuccess=function(response){var object=JSON.parse(response.text);if(response.error){self.error=object.error;self.errorDescription=object.error_description;self.errorUri=object.error_uri;callback({error:self.error,message:self.errorDescription})}else{var _accessToken=object.access_token;var _refreshToken=object.refresh_token;var _expiresIn=object.expires_in;var _grantTime=new Date().getTime();var _grantedScope=self.grantedScope();self.clearStorage();self.accessToken(_accessToken);self.refreshToken(_refreshToken);self.expiresIn(_expiresIn);self.grantedScope(_grantedScope);self.grantTime(_grantTime);callback()}};var onFailure=function(http,xhr){Gitana.REFRESH_TOKEN_FAILURE_FN(self,http,xhr);callback({message:"Unable to refresh access token"})};var o={success:onSuccess,failure:onFailure,headers:{Authorization:self.getClientAuthorizationHeader()},url:self.getPrefixedTokenURL(),method:Gitana.OAuth2Http.TOKEN_METHOD};var qs={};qs.grant_type="refresh_token";qs.refresh_token=self.refreshToken();if(self.requestedScope){qs.scope=self.requestedScope}if(self.ticketMaxAge){qs.ticketMaxAge=self.ticketMaxAge}if("post"===Gitana.OAuth2Http.TOKEN_METHOD.toLowerCase()){o.headers["Content-Type"]="application/x-www-form-urlencoded"}var queryString=Gitana.Http.toQueryString(qs);if(queryString){if(o.url.indexOf("?")>-1){o.url=o.url+"&"+queryString}else{o.url=o.url+"?"+queryString}}self.invoke(o)}});Gitana.OAuth2Http.Storage=function(scope){var memoryStorage=function(){var memory={};var m={};m.removeItem=function(key){delete memory[key]};m.getItem=function(key){return memory[key]};m.setItem=function(key,value){memory[key]=value};return m}();var supportsLocalStorage=function(){try{return"localStorage" in window&&window.localStorage!==null}catch(e){return false}};var supportsSessionStorage=function(){try{return"sessionStorage" in window&&window.sessionStorage!==null}catch(e){return false}};var acquireStorage=function(){var storage=null;if(scope=="session"&&supportsSessionStorage()){storage=sessionStorage}else{if(scope=="local"&&supportsLocalStorage()){storage=localStorage}else{storage=memoryStorage}}return storage};var r={};r.clear=function(){acquireStorage().removeItem("gitanaAuthState")};r.poke=function(key,value){var state={};var stateString=acquireStorage().getItem("gitanaAuthState");if(stateString){state=JSON.parse(stateString)}var touch=false;if(typeof(value)!=="undefined"&&value!==null){state[key]=value;touch=true}else{if(value===null){delete state[key];touch=true}}if(touch){acquireStorage().setItem("gitanaAuthState",JSON.stringify(state))}return state[key]};return r}}(this));Gitana.OAuth2Http.PASSWORD="password";Gitana.OAuth2Http.AUTHORIZATION_CODE="authorization_code";Gitana.OAuth2Http.TOKEN="token";Gitana.OAuth2Http.COOKIE="cookie";Gitana.OAuth2Http.TICKET="ticket";Gitana.OAuth2Http.TOKEN_METHOD="POST";(function(window){Chain=function(object,skipAutoTrap){if(!object){object={}}var proxiedObject=Chain.proxy(object);proxiedObject.__queue=(function(){var queue=[];return function(x){if(x){if(x=="empty"){queue=[]}else{queue.push(x)}}return queue}})();proxiedObject.__response=(function(){var response=null;return function(x){if(!Gitana.isUndefined(x)){if(x){response=x}else{response=null}}return response}})();proxiedObject.__waiting=(function(){var waiting=false;return function(x){if(!Gitana.isUndefined(x)){waiting=x}return waiting}})();proxiedObject.__parent=(function(){var parent=null;return function(x){if(!Gitana.isUndefined(x)){if(x){parent=x}else{parent=null}}return parent}})();proxiedObject.__id=(function(){var id=Chain.idCount;Chain.idCount++;return function(){return id}})();proxiedObject.__helper=(function(){var helper=null;return function(x){if(x){helper=x}return helper}})();proxiedObject.__transparent=(function(){var transparent=false;return function(x){if(!Gitana.isUndefined(x)){transparent=x}return transparent}})();if(!proxiedObject.__copyState){proxiedObject.__copyState=function(other){Gitana.copyInto(this,other)}}proxiedObject.then=function(element,functionName){var self=this;var autorun=false;if(Gitana.isArray(element)){var array=element;var parallelInvoker=function(){var count=0;var total=array.length;var onComplete=function(){count++;if(count==total){self.next()}};for(var i=0;i "+element.toString());var returned=callback.call(self,response,previousResponse);if(returned!==false){self.next(returned)}},0)}else{var subchain=element;subchain.__response(this.__response());if(subchain.__transparent()){subchain.__copyState(this)}if(subchain.beforeChainRun){subchain.beforeChainRun.call(subchain)}subchain.run()}return this};proxiedObject.subchain=function(object,noAutoAdd){var transparent=false;if(!object){transparent=true}if(!object){object=this}var subchain=Chain(object,true);subchain.__parent(this);if(subchain.beforeChainRun){subchain.beforeChainRun.call(subchain)}if(!noAutoAdd){this.then(subchain)}subchain.__transparent(transparent);return subchain};proxiedObject.next=function(response){if(typeof response!=="undefined"){this.__response(response)}this.__waiting(false);if(this.__queue().length==0){if(this.__parent()){var r=this.__response();this.__parent().__response(r);this.__response(null);if(this.__transparent()){Gitana.deleteProperties(this.__parent());this.__parent().__copyState(this)}this.__parent().next()}this.__parent(null);this.__queue("empty")}else{this.run()}};proxiedObject.wait=function(ms){return this.then(function(){var wake=function(chain){return function(){chain.next()}}(this);window.setTimeout(wake,ms);return false})};proxiedObject.trap=function(errorHandler){this.errorHandler=errorHandler;return this};proxiedObject.error=function(err){var errorHandler=null;var ancestor=this;while(ancestor&&!errorHandler){errorHandler=ancestor.errorHandler;if(!errorHandler){ancestor=ancestor.__parent()}}this.__queue("empty");this.__response(null);if(this.__parent()){this.__parent().__queue("empty");this.__parent().__waiting(false)}if(errorHandler){var code=errorHandler.call(this,err);if(code!==false){this.next()}}};proxiedObject.done=function(){return this.__parent()};proxiedObject.chain=function(){return Chain(this,true).then(function(){})};if(!proxiedObject.clone){proxiedObject.clone=function(){return Chain.clone(this)}}if(!skipAutoTrap&&autoTrap()){proxiedObject.trap(autoTrap())}return proxiedObject};Chain.proxy=function(o){if(o.__original&&o.__original()){delete o.__original}var proxy=null;if(o.clone){proxy=o.clone()}else{proxy=Chain.clone(o)}proxy.__original=function(){return o};return proxy};Chain.unproxy=function(proxy){var o=null;if(proxy.__original&&proxy.__original()){o=proxy.__original()}return o};Chain.debug=false;Chain.log=function(chain,text){if(Chain.debug&&!Gitana.isUndefined(console)){var f=function(){var identifier=this.__id();if(this.__transparent()){identifier+="[t]"}if(!this.__parent()){return identifier}return f.call(this.__parent())+" > "+identifier};var identifier=f.call(chain);console.log("Chain["+identifier+"] "+text)}};Chain.clone=function(object){function F(){}F.prototype=object;var clone=new F();Gitana.copyInto(clone,object);return clone};var autoTrapValue=null;var autoTrap=Chain.autoTrap=function(_autoTrap){if(_autoTrap){autoTrapValue=_autoTrap}return autoTrapValue};Chain.idCount=0})(window);(function(window){var Gitana=window.Gitana;Gitana.Chainable=Base.extend({constructor:function(driver){var self=this;this.base();this.__copyState=function(other){Gitana.copyInto(this,other);this.chainCopyState(other)};this.getDriver=function(){return driver};this.getFactory=function(){return new Gitana.ObjectFactory()};this.httpError=function(httpError){var err=new Gitana.Error();err.name="Http Error";err.message=httpError.message;err.status=httpError.status;err.statusText=httpError.statusText;if(httpError.errorType){err.errorType=httpError.errorType}if(httpError.stacktrace){err.stacktrace=httpError.stacktrace}this.error(err);return false};this.missingNodeError=function(id){var err=new Gitana.Error();err.name="Missing Node error";err.message="The node: "+id+" could not be found";this.error(err);return false};this.chainGet=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaGet(uri,params,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)});return false})};this.chainCreate=function(chainable,object,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaPost(uri,params,object,function(status){driver.gitanaGet(uri+"/"+status.getId(),null,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)});return false},"chainCreate")};this.chainCreateEx=function(chainable,object,createUri,readUri){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(createUri)){createUri=createUri.call(self)}driver.gitanaPost(createUri,null,object,function(status){if(Gitana.isFunction(readUri)){readUri=readUri.call(self,status)}driver.gitanaGet(readUri,null,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)});return false})};this.chainPost=function(chainable,uri,params,payload){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaPost(uri,params,payload,function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)});return false})};this.chainPostEmpty=function(chainable,uri,params,payload,contentType){var self=this;if(!payload){payload={}}return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaPost(uri,params,payload,function(response){chain.next()},function(http){self.httpError(http)});return false})};this.chainUpload=function(chainable,uri,params,contentType,payload){var self=this;if(!payload){payload={}}return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaUpload(uri,params,contentType,payload,function(response){chain.next()},function(http){self.httpError(http)});return false})};this.chainGetResponse=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaGet(uri,params,{},function(response){chain.next(response)},function(http){self.httpError(http)});return false})};this.chainGetResponseText=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}driver.gitanaRequest("GET",uri,params,"text/plain",null,{},function(response){chain.next(response)},function(http){self.httpError(http)});return false})};this.chainGetResponseRows=function(chainable,uri,params){return this.chainGetResponse(chainable,uri,params).then(function(response){return response.rows})};this.chainHasResponseRow=function(chainable,uri,value){return this.chainGetResponse(chainable,uri).then(function(response){var authorized=false;for(var i=0;i-1){identifiers.domain=principal.substring(0,x);identifiers.principal=principal.substring(x+1)}else{identifiers.domain=defaultDomainId;identifiers.principal=principal}}else{if(principal.objectType&&principal.objectType()=="Gitana.DomainPrincipal"){identifiers.domain=principal.getDomainId();identifiers.principal=principal.getId()}else{if(principal.objectType&&principal.objectType()=="Gitana.TeamMember"){identifiers.domain=principal.domainId;identifiers.principal=principal._doc}else{if(principal._doc){identifiers.domain=defaultDomainId;identifiers.principal=principal._doc}else{if(principal.name){identifiers.domain=defaultDomainId;identifiers.principal=principal.name}}}}}return identifiers}},chainCopyState:function(otherObject){}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Response=Base.extend({constructor:function(object){Gitana.copyInto(this,object)},getId:function(){return this["_doc"]},isStatusDocument:function(){return(this["ok"]||this["error"])},isListDocument:function(){return this["total_rows"]&&this["rows"]&&this["offset"]},isDataDocument:function(){return(!this.isStatusDocument()&&!this.isListDocument())},isOk:function(){var ok=true;if(this.isStatusDocument()){if(this["ok"]!=null){ok=this["ok"]}}if(this["error"]){ok=false}return ok},isError:function(){return !this.isOk()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AuthInfo=Base.extend({constructor:function(object){Gitana.copyInto(this,object)},getPrincipalId:function(){return this["principalId"]},getPrincipalDomainId:function(){return this["principalDomainId"]},getPrincipalName:function(){return this["principalName"]},getTenantId:function(){return this["tenantId"]},getTenantTitle:function(){return this["tenantTitle"]},getTenantDescription:function(){return this["tenantDescription"]},getClientId:function(){return this["clientId"]},getTicket:function(){return this["ticket"]}})})(window);(function(window){var Gitana=window.Gitana;Gitana.SystemMetadata=Base.extend({constructor:function(){this.base()},updateFrom:function(json){Gitana.deleteProperties(this,false);Gitana.copyInto(this,json)},get:function(key){return this[key]},getChangesetId:function(){return this.get("changeset")},getCreatedBy:function(){return this.get("created_by")},getCreatedByPrincipalId:function(){return this.get("created_by_principal_id")},getCreatedByPrincipalDomainId:function(){return this.get("created_by_principal_domain_id")},getModifiedBy:function(){return this.get("modified_by")},getModifiedByPrincipalId:function(){return this.get("modified_by_principal_id")},getModifiedByPrincipalDomainId:function(){return this.get("modified_by_principal_domain_id")},getCreatedOn:function(){if(!this.createdOn){this.createdOn=new Gitana.Timestamp(this.get("created_on"))}return this.createdOn},getModifiedOn:function(){if(!this.modifiedOn){this.modifiedOn=new Gitana.Timestamp(this.get("modified_on"))}return this.modifiedOn}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Timestamp=Base.extend({constructor:function(object){this.base(object)},getYear:function(){return this["year"]},getMonth:function(){return this["month"]},getDay:function(){return this["day_of_month"]},getHour:function(){return this["hour"]},getMinute:function(){return this["minute"]},getSecond:function(){return this["second"]},getMillisecond:function(){return this["millisecond"]},getTime:function(){return this["ms"]},getTimestamp:function(){return this["timestamp"]}})})(window);(function(window){Gitana.uniqueIdCounter=0;Gitana.makeArray=function(args){return Array.prototype.slice.call(args)};Gitana.stringify=function(object,pretty){var val=null;if(object){if(pretty){val=JSON.stringify(object,null," ")}else{val=JSON.stringify(object)}}return val};Gitana.isString=function(arg){return(typeof arg=="string")};Gitana.isNumber=function(arg){return(typeof arg=="number")};Gitana.isBoolean=function(arg){return(typeof arg=="boolean")};Gitana.isFunction=function(arg){return Object.prototype.toString.call(arg)==="[object Function]"};Gitana.startsWith=function(text,prefix){return text.substr(0,prefix.length)===prefix};Gitana.copyInto=function(target,source){for(var i in source){if(source.hasOwnProperty(i)&&!this.isFunction(source[i])){target[i]=source[i]}}};Gitana.deleteProperties=function(object,deleteFunctions){var keys=[];for(var k in object){keys.push(k)}for(var i=0;i0){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expirationString=";expires="+date.toGMTString()}}}var domainString="";if(host){domainString=";domain="+host}document.cookie=name+"="+value+expirationString+pathString+domainString+";"};createCookie(name,value,path,days,domain)}};Gitana.deleteCookie=function(name,path){var existsCookie=function(name,path){return Gitana.readCookie(name)};if(typeof(document)!="undefined"){if(existsCookie(name)){Gitana.writeCookie(name,"",path,0)}if(existsCookie(name)){if(window){var domain=window.location.host;if(domain){var i=domain.indexOf(":");if(i>-1){domain=domain.substring(0,i)}}Gitana.writeCookie(name,"",path,0,domain)}}}};Gitana.readCookie=function(name){function _readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i>2,((ascii[0]&3)<<4)|ascii[1]>>4,((ascii[1]&15)<<2)|ascii[2]>>6,ascii[2]&63];if(isNaN(ascii[1])){index[2]=64}if(isNaN(ascii[2])){index[3]=64}output+=b64.charAt(index[0])+b64.charAt(index[1])+b64.charAt(index[2])+b64.charAt(index[3])}return output};Gitana.copyKeepers=function(target,source){if(!source){return}for(var i in source){if(source.hasOwnProperty(i)&&!this.isFunction(source[i])){if(!Gitana.isUndefined(target[i])){target[i]=source[i]}}}}})(window);(function(window){var Gitana=window.Gitana;var STATUS_UNRESOLVED="unresolved";var STATUS_RESOLVED="resolved";var STATUS_REJECTED="rejected";var triggerAll=function(val,cbs){for(var i=0;i0){var cbs=chunks.shift();var ps=[];for(var i=cbs.length-1;i>=0;i--){var cb=cbs[i];var p=cb();ps.push(p)}loop(Gitana.Defer.all(ps))}else{def.resolve(results)}},def.reject)})(Gitana.Promise.resolved([]));return def.promise};Gitana.Queue=Queue})(window);(function(window){Gitana.Methods={};Gitana.Methods.listAttachments=function(mapClass){if(!mapClass){mapClass=Gitana.BinaryAttachmentMap}return function(local){var self=this;var result=this.subchain(new mapClass(this));if(!local){result.then(function(){var chain=this;self.getDriver().gitanaGet(self.getUri()+"/attachments",null,{},function(response){chain.handleResponse(response);chain.next()});return false})}else{var existingMap=self.getSystemMetadata()["attachments"];if(existingMap){for(var key in existingMap){var value=result[key];value.attachmentId=key}}}return result}};Gitana.Methods.attach=function(attachmentClass,paramsFunction){if(!attachmentClass){attachmentClass=Gitana.BinaryAttachment}return function(attachmentId,contentType,data){var self=this;if(!attachmentId){attachmentId="default"}var result=this.subchain(new attachmentClass(this));result.then(function(){var params={};if(paramsFunction){paramsFunction(params)}var uploadUri=self.getUri()+"/attachments/"+attachmentId;this.chainUpload(this,uploadUri,params,contentType,data).then(function(){this.subchain(self).listAttachments().then(function(){this.select(attachmentId).then(function(){result.handleResponse(this)})})})});return result}};Gitana.Methods.unattach=function(){return function(attachmentId){return this.then(function(){this.chainDelete(this,this.getUri()+"/attachments/"+attachmentId).then(function(){})})}};Gitana.Methods.getPreviewUri=function(prefix){if(!prefix){prefix="preview"}return function(name,config){var url=this.getDriver().baseURL+this.getUri()+"/"+prefix+"/"+name;if(config){var first=true;for(var key in config){if(first){url+="?"}else{url+="&"}var value=config[key];if(value){url+=key+"="+value}first=false}}return url}};Gitana.Methods.listInteractionObjects=function(factoryMapMethod,uriPath){return function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory()[factoryMapMethod](this);return this.chainGet(chainable,this.getUri()+"/"+uriPath,params)}};Gitana.Methods.readInteractionObject=function(factoryObjectMethod,uriPath){return function(interactionObjectId){var chainable=this.getFactory()[factoryObjectMethod](this);return this.chainGet(chainable,this.getUri()+"/"+uriPath+"/"+interactionObjectId)}};Gitana.Methods.queryInteractionObjects=function(factoryMapMethod,uriPath){return function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/"+uriPath+"/query"};var chainable=this.getFactory()[factoryMapMethod](this);return this.chainPost(chainable,uriFunction,params,query)}}})(window);(function(window){(function(){if(typeof window.location!="undefined"){if(typeof(Gitana.autoConfigUri)==="undefined"){var uri=window.location.href;var z1=uri.indexOf(window.location.pathname);z1=uri.indexOf("/",z1+2);if(z1>-1){uri=uri.substring(0,z1)}if(uri.indexOf("cloudcms.net")>-1){Gitana.autoConfigUri=uri}}}}())})(window);(function(window){var Gitana=window.Gitana;Gitana.ObjectFactory=Base.extend({constructor:function(){this.create=function(klass,existing,object){var created=new klass(existing,object);return created}},platformDataStoreMap:function(platform,object){return this.create(Gitana.PlatformDataStoreMap,platform,object)},platformDataStore:function(platform,object){var type=object.datastoreTypeId;return this[type](platform,object)},platform:function(cluster,object){return this.create(Gitana.Platform,cluster,object)},job:function(cluster,object){var type=null;if(object){if(Gitana.isString(object)){type=object}else{type=object.type}}var job=null;if("copy"==type){job=this.create(Gitana.CopyJob,cluster,object)}else{if("export"==type){job=this.create(Gitana.TransferExportJob,cluster,object)}else{if("import"==type){job=this.create(Gitana.TransferImportJob,cluster,object)}else{job=this.create(Gitana.Job,cluster,object)}}}return job},jobMap:function(cluster,object){return this.create(Gitana.JobMap,cluster,object)},logEntry:function(cluster,object){return this.create(Gitana.LogEntry,cluster,object)},logEntryMap:function(cluster,object){return this.create(Gitana.LogEntryMap,cluster,object)},auditRecord:function(repository,object){return this.create(Gitana.AuditRecord,repository,object)},auditRecordMap:function(repository,object){return this.create(Gitana.AuditRecordMap,repository,object)},stack:function(platform,object){return this.create(Gitana.Stack,platform,object)},stackMap:function(platform,object){return this.create(Gitana.StackMap,platform,object)},project:function(platform,object){return this.create(Gitana.Project,platform,object)},projectMap:function(platform,object){return this.create(Gitana.ProjectMap,platform,object)},uiConfig:function(platform,object){return this.create(Gitana.UIConfig,platform,object)},uiConfigMap:function(platform,object){return this.create(Gitana.UIConfigMap,platform,object)},scheduledWork:function(platform,object){return this.create(Gitana.ScheduledWork,platform,object)},scheduledWorkMap:function(platform,object){return this.create(Gitana.ScheduledWorkMap,platform,object)},report:function(platform,object){return this.create(Gitana.Report,platform,object)},reportMap:function(platform,object){return this.create(Gitana.ReportMap,platform,object)},repository:function(platform,object){return this.create(Gitana.Repository,platform,object)},repositoryMap:function(platform,object){return this.create(Gitana.RepositoryMap,platform,object)},domain:function(platform,object){return this.create(Gitana.Domain,platform,object)},domainMap:function(platform,object){return this.create(Gitana.DomainMap,platform,object)},vault:function(platform,object){return this.create(Gitana.Vault,platform,object)},vaultMap:function(platform,object){return this.create(Gitana.VaultMap,platform,object)},registrar:function(platform,object){return this.create(Gitana.Registrar,platform,object)},registrarMap:function(platform,object){return this.create(Gitana.RegistrarMap,platform,object)},directory:function(platform,object){return this.create(Gitana.Directory,platform,object)},directoryMap:function(platform,object){return this.create(Gitana.DirectoryMap,platform,object)},application:function(platform,object){return this.create(Gitana.Application,platform,object)},applicationMap:function(platform,object){return this.create(Gitana.ApplicationMap,platform,object)},warehouse:function(platform,object){return this.create(Gitana.Warehouse,platform,object)},warehouseMap:function(platform,object){return this.create(Gitana.WarehouseMap,platform,object)},webhost:function(platform,object){return this.create(Gitana.WebHost,platform,object)},webhostMap:function(platform,object){return this.create(Gitana.WebHostMap,platform,object)},autoClientMapping:function(webhost,object){return this.create(Gitana.AutoClientMapping,webhost,object)},autoClientMappingMap:function(webhost,object){return this.create(Gitana.AutoClientMappingMap,webhost,object)},trustedDomainMapping:function(webhost,object){return this.create(Gitana.TrustedDomainMapping,webhost,object)},trustedDomainMappingMap:function(webhost,object){return this.create(Gitana.TrustedDomainMappingMap,webhost,object)},deployedApplication:function(webhost,object){return this.create(Gitana.DeployedApplication,webhost,object)},deployedApplicationMap:function(webhost,object){return this.create(Gitana.DeployedApplicationMap,webhost,object)},descriptor:function(platform,object){return this.create(Gitana.Descriptor,platform,object)},descriptorMap:function(platform,object){return this.create(Gitana.DescriptorMap,platform,object)},client:function(platform,object){var client=this.create(Gitana.Client,platform,object);Gitana.stampInto(client,Gitana.ClientMethods);return client},clientMap:function(platform,object){return this.create(Gitana.ClientMap,platform,object)},authenticationGrant:function(platform,object){return this.create(Gitana.AuthenticationGrant,platform,object)},authenticationGrantMap:function(platform,object){return this.create(Gitana.AuthenticationGrantMap,platform,object)},billingProviderConfiguration:function(platform,object){return this.create(Gitana.BillingProviderConfiguration,platform,object)},billingProviderConfigurationMap:function(platform,object){return this.create(Gitana.BillingProviderConfigurationMap,platform,object)},workflowModel:function(platform,object){return this.create(Gitana.WorkflowModel,platform,object)},workflowModelMap:function(platform,object){return this.create(Gitana.WorkflowModelMap,platform,object)},workflowInstance:function(platform,object){return this.create(Gitana.WorkflowInstance,platform,object)},workflowInstanceMap:function(platform,object){return this.create(Gitana.WorkflowInstanceMap,platform,object)},workflowTask:function(platform,object){return this.create(Gitana.WorkflowTask,platform,object)},workflowTaskMap:function(platform,object){return this.create(Gitana.WorkflowTaskMap,platform,object)},workflowComment:function(platform,object){return this.create(Gitana.WorkflowComment,platform,object)},workflowCommentMap:function(platform,object){return this.create(Gitana.WorkflowCommentMap,platform,object)},changeset:function(repository,object){return this.create(Gitana.Changeset,repository,object)},branch:function(repository,object){return this.create(Gitana.Branch,repository,object)},node:function(branch,object){var objectClass=null;if(object){if(Gitana.isString(object)){object={_type:object}}var type=object._type;if(type){if(Gitana.ObjectFactory.registry[type]){objectClass=Gitana.ObjectFactory.registry[type]}}if(!objectClass){if(type&&Gitana.startsWith(type,"a:")){objectClass=Gitana.Association}}if(!objectClass){if(object.__is_association&&object.__is_association()){objectClass=Gitana.Association}}}if(!objectClass){objectClass=Gitana.Node}return this.create(objectClass,branch,object)},association:function(branch,object){return this.create(Gitana.Association,branch,object)},release:function(repository,object){return this.create(Gitana.Release,repository,object)},mergeConflict:function(repository,object){return this.create(Gitana.MergeConflict,repository,object)},branchMap:function(repository,object){return this.create(Gitana.BranchMap,repository,object)},changesetMap:function(repository,object){return this.create(Gitana.ChangesetMap,repository,object)},releaseMap:function(repository,object){return this.create(Gitana.ReleaseMap,repository,object)},mergeConflictMap:function(repository,object){return this.create(Gitana.MergeConflictMap,repository,object)},nodeMap:function(branch,object){return this.create(Gitana.NodeMap,branch,object)},definition:function(branch,object){return this.create(Gitana.Definition,branch,object)},form:function(branch,object){return this.create(Gitana.Form,branch,object)},traversalResults:function(branch,object){return this.create(Gitana.TraversalResults,branch,object)},domainPrincipal:function(domain,object){var principal=this.create(Gitana.DomainPrincipal,domain,object);if(object){this.extendPrincipal(principal)}return principal},domainPrincipalMap:function(domain,object){return this.create(Gitana.PrincipalMap,domain,object)},extendPrincipal:function(principal){if(principal.getType()&&principal.objectType()=="Gitana.DomainPrincipal"){if(principal.getType()=="USER"){Gitana.stampInto(principal,Gitana.DomainUser)}else{if(principal.getType()=="GROUP"){Gitana.stampInto(principal,Gitana.DomainGroup)}}}},archive:function(vault,object){return this.create(Gitana.Archive,vault,object)},archiveMap:function(vault,object){return this.create(Gitana.ArchiveMap,vault,object)},team:function(cluster,teamable,object){return new Gitana.Team(cluster,teamable,object)},teamMap:function(cluster,teamable,object){return new Gitana.TeamMap(cluster,teamable,object)},activity:function(datastore,object){return new Gitana.Activity(datastore,object)},activityMap:function(datastore,object){return new Gitana.ActivityMap(datastore,object)},role:function(cluster,roleContainer,object){return new Gitana.Role(cluster,roleContainer,object)},roleMap:function(cluster,roleContainer,object){return new Gitana.RoleMap(cluster,roleContainer,object)},tenant:function(registrar,object){return this.create(Gitana.Tenant,registrar,object)},tenantMap:function(registrar,object){return this.create(Gitana.TenantMap,registrar,object)},plan:function(registrar,object){return this.create(Gitana.Plan,registrar,object)},planMap:function(registrar,object){return this.create(Gitana.PlanMap,registrar,object)},meter:function(registrar,object){return this.create(Gitana.Meter,registrar,object)},meterMap:function(registrar,object){return this.create(Gitana.MeterMap,registrar,object)},identity:function(directory,object){return this.create(Gitana.Identity,directory,object)},identityMap:function(directory,object){return this.create(Gitana.IdentityMap,directory,object)},connection:function(directory,object){return this.create(Gitana.Connection,directory,object)},connectionMap:function(directory,object){return this.create(Gitana.ConnectionMap,directory,object)},interactionApplication:function(warehouse,object){return this.create(Gitana.InteractionApplication,warehouse,object)},interactionApplicationMap:function(warehouse,object){return this.create(Gitana.InteractionApplicationMap,warehouse,object)},interactionSession:function(warehouse,object){return this.create(Gitana.InteractionSession,warehouse,object)},interactionSessionMap:function(warehouse,object){return this.create(Gitana.InteractionSessionMap,warehouse,object)},interactionPage:function(warehouse,object){return this.create(Gitana.InteractionPage,warehouse,object)},interactionPageMap:function(warehouse,object){return this.create(Gitana.InteractionPageMap,warehouse,object)},interactionNode:function(warehouse,object){return this.create(Gitana.InteractionNode,warehouse,object)},interactionNodeMap:function(warehouse,object){return this.create(Gitana.InteractionNodeMap,warehouse,object)},interactionUser:function(warehouse,object){return this.create(Gitana.InteractionUser,warehouse,object)},interactionUserMap:function(warehouse,object){return this.create(Gitana.InteractionUserMap,warehouse,object)},interactionContinent:function(warehouse,object){return this.create(Gitana.InteractionContinent,warehouse,object)},interactionContinentMap:function(warehouse,object){return this.create(Gitana.InteractionContinentMap,warehouse,object)},interactionCountry:function(warehouse,object){return this.create(Gitana.InteractionCountry,warehouse,object)},interactionCountryMap:function(warehouse,object){return this.create(Gitana.InteractionCountryMap,warehouse,object)},interactionCity:function(warehouse,object){return this.create(Gitana.InteractionCity,warehouse,object)},interactionCityMap:function(warehouse,object){return this.create(Gitana.InteractionCityMap,warehouse,object)},interactionRegion:function(warehouse,object){return this.create(Gitana.InteractionRegion,warehouse,object)},interactionRegionMap:function(warehouse,object){return this.create(Gitana.InteractionRegionMap,warehouse,object)},interactionPostalCode:function(warehouse,object){return this.create(Gitana.InteractionPostalCode,warehouse,object)},interactionPostalCodeMap:function(warehouse,object){return this.create(Gitana.InteractionPostalCodeMap,warehouse,object)},interactionUserAgent:function(warehouse,object){return this.create(Gitana.InteractionUserAgent,warehouse,object)},interactionUserAgentMap:function(warehouse,object){return this.create(Gitana.InteractionUserAgentMap,warehouse,object)},interactionOperatingSystem:function(warehouse,object){return this.create(Gitana.InteractionOperatingSystem,warehouse,object)},interactionOperatingSystemMap:function(warehouse,object){return this.create(Gitana.InteractionOperatingSystemMap,warehouse,object)},interactionDevice:function(warehouse,object){return this.create(Gitana.InteractionDevice,warehouse,object)},interactionDeviceMap:function(warehouse,object){return this.create(Gitana.InteractionDeviceMap,warehouse,object)},interactionReport:function(warehouse,object){return this.create(Gitana.InteractionReport,warehouse,object)},interactionReportMap:function(warehouse,object){return this.create(Gitana.InteractionReportMap,warehouse,object)},interactionReportEntry:function(warehouse,object){return this.create(Gitana.InteractionReportEntry,warehouse,object)},interactionReportEntryMap:function(warehouse,object){return this.create(Gitana.InteractionReportEntryMap,warehouse,object)},interaction:function(warehouse,object){return this.create(Gitana.Interaction,warehouse,object)},interactionMap:function(warehouse,object){return this.create(Gitana.InteractionMap,warehouse,object)},conversionTrigger:function(warehouse,object){return this.create(Gitana.ConversionTrigger,warehouse,object)},conversionTriggerMap:function(warehouse,object){return this.create(Gitana.ConversionTriggerMap,warehouse,object)},settings:function(application,object){return this.create(Gitana.Settings,application,object)},settingsMap:function(application,object){return this.create(Gitana.SettingsMap,application,object)},registration:function(application,object){return this.create(Gitana.Registration,application,object)},registrationMap:function(application,object){return this.create(Gitana.RegistrationMap,application,object)},pageRendition:function(application,object){return this.create(Gitana.PageRendition,application,object)},pageRenditionMap:function(application,object){return this.create(Gitana.PageRenditionMap,application,object)},email:function(application,object){return this.create(Gitana.Email,application,object)},emailMap:function(application,object){return this.create(Gitana.EmailMap,application,object)},emailProvider:function(application,object){return this.create(Gitana.EmailProvider,application,object)},emailProviderMap:function(application,object){return this.create(Gitana.EmailProviderMap,application,object)}});Gitana.ObjectFactory.registry={};Gitana.ObjectFactory.register=function(qname,objectClass){Gitana.ObjectFactory.registry[qname]=objectClass}})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractPersistable=Gitana.Chainable.extend({constructor:function(driver,object){this.base(driver);if(object){this.handleResponse.call(this,object)}},handleResponse:function(response){Gitana.deleteProperties(this,false);if(response._ref){delete response._ref}Gitana.copyInto(this,response);this.handleSystemProperties(response)},handleSystemProperties:function(response){this.chainCopyState(response)},json:function(){return JSON.parse(JSON.stringify(this))}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractMap=Gitana.AbstractPersistable.extend({constructor:function(driver,object){this.__keys=(function(){var list=[];return function(x){if(!Gitana.isUndefined(x)){if(x=="empty"){while(list.length>0){list.shift()}}else{if(!x&&x.length){for(var i=0;i=0){_offset=offset}return _offset}})();this.base(driver,object);if(object){this.chainCopyState(object)}},refs:function(){var references=[];for(var i=0;ithis.__keys().length){return}for(var i=0;i=size){keysToRemove.push(this.__keys()[i])}}while(this.__keys().length>size){this.__keys().pop()}for(var i=0;i=skip+limit){keysToRemove.push(this.__keys()[i])}}while(this.__keys().length>limit+skip){this.__keys().pop()}for(var i=0;i0){json=this[this.__keys()[0]]}var chainable=this.buildObject(json);return this.subchain(chainable).then(function(){var chain=this;this.subchain(self).then(function(){if(this.__keys().length>0){var obj=this[this.__keys()[0]];if(chain.loadFrom){chain.loadFrom(obj)}else{chain.handleResponse(obj)}}else{var err=new Gitana.Error();err.name="Empty Map";err.message="The map doesn't have any elements in it";if(emptyHandler){emptyHandler.call(self,err)}else{this.error(err)}return false}})})},select:function(key){var self=this;var json={};if(this[key]){json=this[key]}var result=this.subchain(this.buildObject(json));return result.then(function(){var chain=this;this.subchain(self).then(function(){var obj=this[key];if(!obj){var err=new Gitana.Error();err.name="No element with key: "+key;err.message=err.name;this.error(err);return false}if(result.loadFrom){chain.loadFrom(obj)}else{chain.handleResponse(obj)}})})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractObject=Gitana.AbstractPersistable.extend({constructor:function(driver,object){this.__system=(function(){var _system=new Gitana.SystemMetadata();return function(system){if(!Gitana.isUndefined(system)){_system.updateFrom(system)}return _system}})();this.chainDelete=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}chain.getDriver().gitanaDelete(uri,params,function(){chain.next()},function(http){self.httpError(http)});return false})};this.chainReload=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}chain.getDriver().gitanaGet(uri,params,{},function(obj){chain.handleResponse(obj);chain.next()},function(http){self.httpError(http)});return false})};this.chainUpdate=function(chainable,uri,params){var self=this;return this.subchain(chainable).then(function(){var chain=this;if(Gitana.isFunction(uri)){uri=uri.call(self)}chain.getDriver().gitanaPut(uri,params,chain,function(){chain.getDriver().gitanaGet(uri,params,{},function(obj){chain.handleResponse(obj);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)});return false})};this.base(driver,object)},chainCopyState:function(otherObject){this.base(otherObject);if(otherObject.__system){this.__system(otherObject.__system())}},getUri:function(){return null},getType:function(){return null},ref:function(){return null},getProxiedUri:function(){return this.getDriver().baseURL+this.getUri()},get:function(key){return this[key]},set:function(key,value){this[key]=value},getId:function(){return this.get("_doc")},getSystemMetadata:function(){return this.__system()},getTitle:function(){return this.get("title")},getDescription:function(){return this.get("description")},replacePropertiesWith:function(object){var candidate={};Gitana.copyInto(candidate,object);var backups={};backups._doc=this["_doc"];delete candidate._doc;backups._type=this["_type"];delete candidate._type;backups._qname=this["_qname"];delete candidate._qname;Gitana.deleteProperties(this,false);this["_doc"]=backups._doc;this["_type"]=backups._type;this["_qname"]=backups._qname;Gitana.copyInto(this,candidate)},handleSystemProperties:function(response){this.base(response);if(this["_system"]){var json=this["_system"];delete this["_system"];this.__system().updateFrom(json)}},stringify:function(pretty){return Gitana.stringify(this,pretty)},loadFrom:function(anotherObject){this.handleResponse(anotherObject)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractSelfableObject=Gitana.AbstractObject.extend({constructor:function(driver,object){this.base(driver,object)},del:function(){var self=this;var uriFunction=function(){return self.getUri()};return this.chainDelete(this.getPlatform(),uriFunction)},reload:function(){var self=this;var uriFunction=function(){return self.getUri()};return this.chainReload(null,uriFunction)},update:function(){var self=this;var uriFunction=function(){return self.getUri()};return this.chainUpdate(null,uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractSelfableACLObject=Gitana.AbstractSelfableObject.extend({constructor:function(driver,object){this.base(driver,object)},loadACL:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/acl/list"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response)})},listAuthorities:function(principal,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/acl?id="+principalDomainQualifiedId};return this.chainGetResponseRows(this,uriFunction).then(function(response){callback.call(this,response)})},checkAuthority:function(principal,authorityId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/authorities/"+authorityId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},grantAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/authorities/"+authorityId+"/grant?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var self=this;var uriFunction=function(){return self.getUri()+"/authorities/"+authorityId+"/revoke?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAllAuthorities:function(principal){return this.revokeAuthority(principal,"all")},loadAuthorityGrants:function(principalIds,callback){if(!principalIds){principalIds=[]}var json={principals:principalIds};return this.chainPostResponse(this,this.getUri()+"/authorities",{},json).then(function(response){callback.call(this,response)})},checkPermission:function(principal,permissionId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return self.getUri()+"/permissions/"+permissionId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DataStore=Gitana.AbstractObject.extend({constructor:function(driver,object){this.base(driver,object)},getUri:function(){return null},getType:function(){return null},ref:function(){return this.getType()+"://"+this.getId()},loadACL:function(callback){var uriFunction=function(){return this.getUri()+"/acl/list"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response)})},listAuthorities:function(principal,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/acl?id="+principalDomainQualifiedId};return this.chainGetResponseRows(this,uriFunction).then(function(response){callback.call(this,response)})},checkAuthority:function(principal,authorityId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},grantAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/grant?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/revoke?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAllAuthorities:function(principal){return this.revokeAuthority(principal,"all")},loadAuthorityGrants:function(principalIds,callback){if(!principalIds){principalIds=[]}var json={principals:principalIds};return this.chainPostResponse(this,this.getUri()+"/authorities",{},json).then(function(response){callback.call(this,response)})},checkPermission:function(principal,permissionId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/permissions/"+permissionId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},readTeam:function(teamKey){var uriFunction=function(){return this.getUri()+"/teams/"+teamKey};var chainable=this.getFactory().team(this.getPlatform(),this);return this.chainGet(chainable,uriFunction)},listTeams:function(){var uriFunction=function(){return this.getUri()+"/teams"};var chainable=this.getFactory().teamMap(this.getCluster(),this);return this.chainGet(chainable,uriFunction)},createTeam:function(teamKey,object){if(!object){object={}}var uriFunction=function(){return this.getUri()+"/teams?key="+teamKey};var self=this;var chainable=this.getFactory().team(this.getPlatform(),this);return this.chainPostResponse(chainable,uriFunction,{},object).then(function(){var chain=this;Chain(self).readTeam(teamKey).then(function(){chain.handleResponse(this);chain.next()});return false})},readOwnersTeam:function(){return this.readTeam("owners")},listActivities:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().activityMap(this);return this.chainGet(chainable,"/activities",params)},readActivity:function(activityId){var chainable=this.getFactory().activity(this);return this.chainGet(chainable,"/activities/"+activityId)},queryActivities:function(query,pagination){var chainable=this.getFactory().activityMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/activities/query",params,query)},readRole:function(roleKeyOrId,inherited){var params={};if(inherited){params.inherited=true}var uriFunction=function(){return this.getUri()+"/roles/"+roleKeyOrId};var chainable=this.getFactory().role(this.getCluster(),this);return this.chainGet(chainable,uriFunction,params)},listRoles:function(inherited){var params={};if(inherited){params.inherited=true}var uriFunction=function(){return this.getUri()+"/roles"};var chainable=this.getFactory().roleMap(this.getCluster(),this);return this.chainGet(chainable,uriFunction,params)},createRole:function(roleKey,object){if(!object){object={}}object.roleKey=roleKey;var uriFunction=function(){return this.getUri()+"/roles"};var self=this;var chainable=this.getFactory().role(this.getPlatform(),this,roleKey);return this.chainPostResponse(chainable,uriFunction,{},object).then(function(){this.subchain(self).readRole(roleKey).then(function(){Gitana.copyInto(chainable,this)})})},getMaxSize:function(){return this.get("maxSize")},getSize:function(){return this.get("size")},getObjectCount:function(){return this.get("objectcount")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ContainedDataStore=Gitana.DataStore.extend({constructor:function(container,object){this.base(container.getDriver(),object);this.getContainer=function(){return container};this.getContainerId=function(){return container.getId()}},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.getContainer(),uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},exportArchive:function(settings){var self=this;var vaultId=settings.vault;if(!Gitana.isString(vaultId)){vaultId=vaultId.getId()}var groupId=settings.group;var artifactId=settings.artifact;var versionId=settings.version;var configuration=(settings.configuration?settings.configuration:{});var synchronous=(settings.async?false:true);var chainable=this.getFactory().job(this.getCluster(),"export");return this.subchain(chainable).then(function(){var chain=this;this.getDriver().gitanaPost(self.getUri()+"/export?vault="+vaultId+"&group="+groupId+"&artifact="+artifactId+"&version="+versionId+"&schedule=ASYNCHRONOUS",{},configuration,function(response){Gitana.handleJobCompletion(chain,self.getCluster(),response.getId(),synchronous)},function(http){self.httpError(http)});return false})},importArchive:function(settings,reportFn){var self=this;var vaultId=settings.vault;if(!Gitana.isString(vaultId)){vaultId=vaultId.getId()}var groupId=settings.group;var artifactId=settings.artifact;var versionId=settings.version;var configuration=(settings.configuration?settings.configuration:{});var synchronous=(settings.async?false:true);var chainable=this.getFactory().job(this.getCluster(),"import");return this.subchain(chainable).then(function(){var chain=this;this.getDriver().gitanaPost(self.getUri()+"/import?vault="+vaultId+"&group="+groupId+"&artifact="+artifactId+"&version="+versionId+"&schedule=ASYNCHRONOUS",{},configuration,function(response){Gitana.handleJobCompletion(chain,self.getCluster(),response.getId(),synchronous,reportFn)},function(http){self.httpError(http)});return false})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.BinaryAttachment=Gitana.AbstractPersistable.extend({constructor:function(persistable,attachment){this.base(persistable.getDriver(),attachment);this.objectType=function(){return"Gitana.BinaryAttachment"};this.persistable=function(){return persistable}},getId:function(){return this.attachmentId},getLength:function(){return this.length},getContentType:function(){return this.contentType},getFilename:function(){return this.filename},getUri:function(){return this.persistable().getUri()+"/attachments/"+this.getId()},getDownloadUri:function(){return this.getDriver().baseURL+this.getUri()},getPreviewUri:function(name,config){if(!config){config={}}config.attachment=this.attachmentId;return this.persistable().getPreviewUri(name,config)},del:function(){var self=this;var result=this.subchain(this.persistable());result.subchain(self).then(function(){var chain=this;this.getDriver().gitanaDelete(this.getUri(),null,function(){chain.next()},function(http){self.httpError(http)});return false});return result},download:function(callback){var self=this;return this.then(function(){var chain=this;this.getDriver().gitanaDownload(this.getUri(),null,function(data){callback.call(self,data);chain.next()},function(http){self.httpError(http)});return false})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.BinaryAttachmentMap=Gitana.AbstractMap.extend({constructor:function(persistable,object){this.objectType=function(){return"Gitana.BinaryAttachmentMap"};this.__persistable=(function(){var _persistable=persistable;return function(p){if(!Gitana.isUndefined(p)){_persistable=p}return _persistable}})();if(!object){object=this.__persistable().getSystemMetadata()["attachments"]}this.base(this.__persistable().getDriver(),object)},chainCopyState:function(otherObject){this.base(otherObject);if(otherObject.__persistable){this.__persistable(otherObject.__persistable())}},clone:function(){return new Gitana.BinaryAttachmentMap(this.__persistable(),this)},buildObject:function(attachment){return new Gitana.BinaryAttachment(this.__persistable(),attachment)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AuditRecord=Gitana.AbstractObject.extend({constructor:function(datastore,object){this.base(datastore.getCluster(),object);this.objectType=function(){return"Gitana.AuditRecord"};this.getDataStore=function(){return datastore};this.getDataStoreId=function(){return datastore.getId()}},getUri:function(){return this.datastore.getUri()+"/audit"},clone:function(){return this.getFactory().auditRecord(this.getDataStore(),this)},getScope:function(){return this.get("scope")},getAction:function(){return this.get("action")},getPrincipalId:function(){return this.get("principal")},getMethod:function(){return this.get("method")},getHandler:function(){return this.get("handler")},getArgs:function(){return this.get("args")},getReturn:function(){return this.get("return")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AuditRecordMap=Gitana.AbstractMap.extend({constructor:function(datastore,object){this.objectType=function(){return"Gitana.AuditRecordMap"};this.getDatastore=function(){return datastore};this.base(datastore.getDriver(),object)},clone:function(){return this.getFactory().auditRecordMap(this.getDatastore(),this)},buildObject:function(json){return this.getFactory().auditRecord(this.getDatastore(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Team=Gitana.AbstractObject.extend({constructor:function(cluster,teamable,object){this.__teamable=(function(){var _teamable=null;return function(teamable){if(!Gitana.isUndefined(teamable)){_teamable=teamable}return _teamable}})();this.__teamable(teamable);this.objectType=function(){return"Gitana.Team"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object)},clone:function(){return this.getFactory().team(this.getCluster(),this.__teamable(),this)},getUri:function(){return this.__teamable().getUri()+"/teams/"+this.getKey()},getType:function(){return"team"},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.__teamable(),uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},addMember:function(principal){var self=this;var uriFunction=function(){var principalDomainQualifiedId=self.extractPrincipalDomainQualifiedId(principal);return this.getUri()+"/members/add?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},removeMember:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return this.getUri()+"/members/remove?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},listMembers:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return this.getUri()+"/members"};var chainable=new Gitana.TeamMemberMap(this);return this.chainGet(chainable,uriFunction,params)},grant:function(authorityId){var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/grant"};return this.chainPostEmpty(null,uriFunction)},revoke:function(authorityId){var uriFunction=function(){return this.getUri()+"/authorities/"+authorityId+"/revoke"};return this.chainPostEmpty(null,uriFunction)},loadAuthorities:function(callback){var uriFunction=function(){return this.getUri()+"/authorities"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response.authorities)})},getKey:function(){return this.get("key")},getGroupId:function(){return this.get("groupId")},getRoleKeys:function(){return this.get("roleKeys")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TeamMap=Gitana.AbstractMap.extend({constructor:function(cluster,teamable,object){this.__teamable=(function(){var _teamable=null;return function(teamable){if(!Gitana.isUndefined(teamable)){_teamable=teamable}return _teamable}})();this.__teamable(teamable);this.objectType=function(){return"Gitana.TeamMap"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object)},clone:function(){return this.getFactory().teamMap(this.getCluster(),this.__teamable(),this)},buildObject:function(json){return this.getFactory().team(this.getCluster(),this.__teamable(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TeamMember=Gitana.AbstractObject.extend({constructor:function(team,object){this.base(team.getDriver(),object);this.objectType=function(){return"Gitana.TeamMember"};this.getTeam=function(){return team};this.getCluster=function(){return team.getCluster()};this.getClusterId=function(){return team.getClusterId()}}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TeamMemberMap=Gitana.AbstractMap.extend({constructor:function(team,object){this.objectType=function(){return"Gitana.TeamMemberMap"};this.getTeam=function(){return team};this.base(team.getDriver(),object)},clone:function(){return new Gitana.TeamMemberMap(this.getTeam(),this)},buildObject:function(json){return new Gitana.TeamMember(this.getTeam(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Activity=Gitana.AbstractObject.extend({constructor:function(datastore,object){this.base(datastore.getDriver(),object);this.objectType=function(){return"Gitana.Activity"};this.getDataStore=function(){return datastore}},getUri:function(){return this.getDataStore().getUri()+"/activities/"+this.getId()},clone:function(){return new Gitana.Activity(this.getDataStore(),this)},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.getDataStore(),uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},getType:function(){return this.get("type")},getTimestamp:function(){return this.get("timestamp")},getUserDomainId:function(){return this.get("userDomainId")},getUserId:function(){return this.get("userId")},getUserTitle:function(){return this.get("userTitle")},getUserEmail:function(){return this.get("userEmail")},getUserName:function(){return this.get("userName")},getObjectDataStoreTypeId:function(){return this.get("objectDatastoreTypeId")},getObjectDataStoreId:function(){return this.get("objectDatastoreId")},getObjectDataStoreTitle:function(){return this.get("objectDatastoreTitle")},getObjectTypeId:function(){return this.get("objectTypeId")},getObjectId:function(){return this.get("objectId")},getObjectTitle:function(){return this.get("objectTitle")},getOtherDataStoreTypeId:function(){return this.get("otherDatastoreTypeId")},getOtherDataStoreId:function(){return this.get("otherDatastoreId")},getOtherDataStoreTitle:function(){return this.get("otherDatastoreTitle")},getOtherTypeId:function(){return this.get("otherTypeId")},getOtherId:function(){return this.get("otherId")},getOtherTitle:function(){return this.get("otherTitle")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ActivityMap=Gitana.AbstractMap.extend({constructor:function(datastore,object){this.objectType=function(){return"Gitana.ActivityMap"};this.getDataStore=function(){return datastore};this.base(datastore.getDriver(),object)},clone:function(){return this.getFactory().activityMap(this.getDataStore(),this)},buildObject:function(json){return this.getFactory().activity(this.getDataStore(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Role=Gitana.AbstractObject.extend({constructor:function(cluster,roleContainer,object){this.base(cluster.getDriver(),object);this.objectType=function(){return"Gitana.Role"};this.roleContainer=roleContainer;this.getCluster=function(){return cluster}},getUri:function(){return this.roleContainer.getUri()+"/roles/"+this.getId()},getType:function(){return"role"},del:function(){var uriFunction=function(){return this.getUri()};return this.chainDelete(this.roleContainer,uriFunction)},reload:function(){var uriFunction=function(){return this.getUri()};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()};return this.chainUpdate(null,uriFunction)},getRoleKey:function(){return this.roleKey},getPermissions:function(){return this.object.permissions}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RoleMap=Gitana.AbstractMap.extend({constructor:function(cluster,roleContainer,object){this.objectType=function(){return"Gitana.RoleMap"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object);this.roleContainer=roleContainer},clone:function(){return this.getFactory().roleMap(this.getCluster(),this.roleContainer,this)},buildObject:function(json){return this.getFactory().role(this.getCluster(),this.roleContainer,json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Cluster=Gitana.DataStore.extend({constructor:function(driver,object){this.objectType=function(){return"Gitana.Cluster"};this.base(driver,object)},getUri:function(){return""},getType:function(){return Gitana.TypedIDConstants.TYPE_CLUSTER},clone:function(){return new Gitana.Cluster(this.getDriver(),this)},loadContainedTypes:function(type,callback){var uriFunction=function(){return"/tools/types/contained/"+type};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.types)})},queryJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/query",params,query)},readJob:function(jobId){var chainable=this.getFactory().job(this);return this.chainGet(chainable,"/jobs/"+jobId)},killJob:function(jobId){return this.chainPostEmpty(null,"/jobs/"+jobId+"/kill")},queryUnstartedJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/unstarted/query",params,query)},queryRunningJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/running/query",params,query)},queryFailedJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/failed/query",params,query)},queryWaitingJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/waiting/query",params,query)},queryFinishedJobs:function(query,pagination){var chainable=this.getFactory().jobMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/jobs/finished/query",params,query)},waitForJobCompletion:function(jobId,callback){var chainable=this;var f=function(){window.setTimeout(function(){Chain(chainable).readJob(jobId).then(function(){if(this.state=="FINISHED"){callback(this);chainable.next()}else{if(this.state=="ERROR"){callback(this);chainable.next()}else{f()}}})},1000)};f()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractClusterObject=Gitana.AbstractObject.extend({constructor:function(cluster,object){this.base(cluster.getDriver(),object);this.objectType=function(){return"Gitana.Job"};this.getCluster=function(){return cluster}},ref:function(){return this.getType()+"://"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Job=Gitana.AbstractClusterObject.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.Job"}},clone:function(){return new Gitana.Job(this.getCluster(),this)},getType:function(){return this.get("type")},getRunAsPrincipalId:function(){return this.get("runAsPrincipal")},getRunAsPrincipalDomainId:function(){return this.get("runAsPrincipalDomain")},getState:function(){return this.get("state")},getPlatformId:function(){return this.get("platformId")},getPriority:function(){return this.get("priority")},getAttempts:function(){return this.get("attempts")},getScheduledStartTime:function(){return this.get("schedule_start_ms")},getLogEntries:function(){return this.get("log_entries")},getCurrentThread:function(){return this.get("current_thread")},getCurrentServer:function(){return this.get("current_server")},getCurrentServerTimeStamp:function(){return this.get("current_server_timestamp")},getSubmittedBy:function(){return this.get("submitted_by")},getSubmittedTimestamp:function(){return this.get("submitted_timestamp")},getStarted:function(){return this.get("started")},getStartedBy:function(){return this.get("started_by")},getStartedTimestamp:function(){return this.get("started_timestamp")},getStopped:function(){return this.get("stopped")},getStoppedTimestamp:function(){return this.get("stopped_timestamp")},getPaused:function(){return this.get("paused")},getPausedBy:function(){return this.get("paused_by")},getPausedTimestamp:function(){return this.get("paused_timestamp")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.JobMap=Gitana.AbstractMap.extend({constructor:function(cluster,object){this.objectType=function(){return"Gitana.JobMap"};this.getCluster=function(){return cluster};this.base(cluster.getDriver(),object)},clone:function(){return this.getFactory().jobMap(this.getCluster(),this)},buildObject:function(json){return this.getFactory().job(this.getCluster(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.LogEntry=Gitana.AbstractObject.extend({constructor:function(platform,object){this.base(platform.getDriver(),object);this.objectType=function(){return"Gitana.LogEntry"};this.getPlatform=function(){return platform}},clone:function(){return new Gitana.LogEntry(this.getPlatform(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_LOG_ENTRY},getPrincipalId:function(){return this.get("principalId")},getRepositoryId:function(){return this.get("repositoryId")},getBranchId:function(){return this.get("branchId")},getLevel:function(){return this.get("level")},getThread:function(){return this.get("thread")},getTimestamp:function(){return this.get("timestamp")},getMessage:function(){return this.get("message")},getFilename:function(){return this.get("filename")},getMethod:function(){return this.get("method")},getLineNumber:function(){return this.get("line")},getClassDescriptor:function(){return this.get("class")},getThrowables:function(){return this.get("throwables")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.LogEntryMap=Gitana.AbstractMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.LogEntryMap"};this.getPlatform=function(){return platform};this.base(platform.getDriver(),object)},clone:function(){return this.getFactory().logEntryMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().logEntry(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.CopyJob=Gitana.Job.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.CopyJob"}},clone:function(){return new Gitana.CopyJob(this.getCluster(),this)},getImports:function(){var importObjects=[];var array=this.get("imports");for(var i=0;i0){targetId=importObjects[0].getTargetId()}return targetId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TransferImportJob=Gitana.Job.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.TransferImportJob"}},clone:function(){return new Gitana.TransferExportJob(this.getCluster(),this)},getImports:function(){var importObjects=[];var array=this.get("imports");for(var i=0;i0){targetId=importObjects[0].getTargetId()}return targetId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TransferExportJob=Gitana.Job.extend({constructor:function(cluster,object){this.base(cluster,object);this.objectType=function(){return"Gitana.TransferExportJob"}},clone:function(){return new Gitana.TransferExportJob(this.getCluster(),this)},getImports:function(){var importObjects=[];var array=this.get("imports");for(var i=0;i0){targetId=importObjects[0].getTargetId()}return targetId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Platform=Gitana.ContainedDataStore.extend({constructor:function(cluster,object){this.objectType=function(){return"Gitana.Platform"};this.base(cluster,object);this.getCluster=function(){return cluster};this.getClusterId=function(){return cluster.getId()}},getPlatform:function(){return this},readCluster:function(){return this.subchain(this.getCluster())},getUri:function(){return""},getType:function(){return Gitana.TypedIDConstants.TYPE_PLATFORM},clone:function(){return this.getFactory().platform(this.getCluster(),this)},del:function(){return this},reload:function(){var uriFunction=function(){return this.getUri()+"/"};return this.chainReload(null,uriFunction)},update:function(){var uriFunction=function(){return this.getUri()+"/"};return this.chainUpdate(null,uriFunction)},readPrimaryDomain:function(){var self=this;var uriFunction=function(){return self.getUri()+"/domains/primary"};var chainable=this.getFactory().domain(this);return this.chainGet(chainable,uriFunction)},loadInfo:function(callback){var uriFunction=function(){return"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},listRepositories:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().repositoryMap(this);return this.chainGet(chainable,"/repositories",params)},readRepository:function(repositoryId){var chainable=this.getFactory().repository(this);return this.chainGet(chainable,"/repositories/"+repositoryId)},createRepository:function(object){var chainable=this.getFactory().repository(this);return this.chainCreate(chainable,object,"/repositories")},queryRepositories:function(query,pagination){var chainable=this.getFactory().repositoryMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/repositories/query",params,query)},checkRepositoryPermissions:function(checks,callback){var uriFunction=function(){return"/repositories/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkRepositoryAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listDomains:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().domainMap(this);return this.chainGet(chainable,"/domains",params)},readDomain:function(domainId){var chainable=this.getFactory().domain(this);return this.chainGet(chainable,"/domains/"+domainId)},createDomain:function(object){var chainable=this.getFactory().domain(this);return this.chainCreate(chainable,object,"/domains")},queryDomains:function(query,pagination){var chainable=this.getFactory().domainMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/domains/query",params,query)},checkDomainPermissions:function(checks,callback){var uriFunction=function(){return"/domains/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkDomainAuthorities:function(checks,callback){var uriFunction=function(){return"/domains/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listVaults:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().vaultMap(this);return this.chainGet(chainable,"/vaults",params)},readVault:function(vaultId){var chainable=this.getFactory().vault(this);return this.chainGet(chainable,"/vaults/"+vaultId)},createVault:function(object){var chainable=this.getFactory().vault(this);return this.chainCreate(chainable,object,"/vaults")},queryVaults:function(query,pagination){var chainable=this.getFactory().vaultMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/vaults/query",params,query)},checkVaultPermissions:function(checks,callback){var uriFunction=function(){return"/vaults/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkVaultAuthorities:function(checks,callback){var uriFunction=function(){return"/vaults/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},authenticate:function(config,authFailureHandler){return this.getDriver().authenticate(config,authFailureHandler)},logout:function(expireAccessToken){var self=this;return this.subchain().then(function(){var platformCacheKey=this.getDriver().platformCacheKey;if(platformCacheKey){Gitana.disconnect(platformCacheKey,expireAccessToken)}this.getDriver().clearAuthentication();delete this.getDriver().platformCacheKey})},listStacks:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().stackMap(this);return this.chainGet(chainable,"/stacks",params)},readStack:function(stackId){var chainable=this.getFactory().stack(this);return this.chainGet(chainable,"/stacks/"+stackId)},createStack:function(object){if(!object){object={}}var chainable=this.getFactory().stack(this);return this.chainCreate(chainable,object,"/stacks")},queryStacks:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/stacks/query"};var chainable=this.getFactory().stackMap(this);return this.chainPost(chainable,uriFunction,params,query)},findStackForDataStore:function(datastoreType,datastoreId){var chainable=this.getFactory().stack(this);return this.chainGet(chainable,"/stacks/find/"+datastoreType+"/"+datastoreId)},checkStackPermissions:function(checks,callback){var uriFunction=function(){return"/stacks/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkStackAuthorities:function(checks,callback){var uriFunction=function(){return"/stacks/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listProjects:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().projectMap(this);return this.chainGet(chainable,"/projects",params)},readProject:function(projectId){var chainable=this.getFactory().project(this);return this.chainGet(chainable,"/projects/"+projectId)},createProject:function(object){if(!object){object={}}var chainable=this.getFactory().project(this);return this.chainCreate(chainable,object,"/projects")},startCreateProject:function(object,callback){var uriFunction=function(){return"/projects/start"};if(!object){object={}}return this.chainPostResponse(this,uriFunction,{},object).then(function(response){var jobId=response._doc;callback(jobId)})},queryProjects:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/projects/query"};var chainable=this.getFactory().projectMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkProjectPermissions:function(checks,callback){var uriFunction=function(){return"/projects/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkProjectAuthorities:function(checks,callback){var uriFunction=function(){return"/projects/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listProjectTypes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().projectMap(this);return this.chainGet(chainable,"/projecttypes",params)},queryLogEntries:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/logs/query"};if(!query){query={}}var chainable=this.getFactory().logEntryMap(this.getCluster());var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readLogEntry:function(logEntryId){var self=this;var uriFunction=function(){return self.getUri()+"/logs/"+logEntryId};var chainable=this.getFactory().logEntry(this.getCluster());return this.chainGet(chainable,uriFunction)},readLog:function(callback){var self=this;var uriFunction=function(){return"/logs/logfile"};return this.chainGetResponseText(this,uriFunction).then(function(text){callback.call(this,text)})},createLogEntry:function(message,level,obj){var self=this;var uriFunction=function(){return self.getUri()+"/logs"};if(!obj){obj={}}obj.message=message;obj.level=level;var chainable=this.getFactory().logEntry(this.getCluster());return this.chainCreate(chainable,obj,"/logs")},postLogEntry:function(message,level,obj){var self=this;var uriFunction=function(){return self.getUri()+"/logs"};if(!obj){obj={}}obj.message=message;obj.level=level;return this.chainPostEmpty(null,uriFunction,{},obj,"application/json")},listRegistrars:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().registrarMap(this);return this.chainGet(chainable,"/registrars",params)},readRegistrar:function(registrarId){var chainable=this.getFactory().registrar(this);return this.chainGet(chainable,"/registrars/"+registrarId)},createRegistrar:function(object){var chainable=this.getFactory().registrar(this);return this.chainCreate(chainable,object,"/registrars")},queryRegistrars:function(query,pagination){var chainable=this.getFactory().registrarMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/registrars/query",params,query)},checkRegistrarPermissions:function(checks,callback){var uriFunction=function(){return"/registrars/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkRegistrarAuthorities:function(checks,callback){var uriFunction=function(){return"/registrars/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listApplications:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().applicationMap(this);return this.chainGet(chainable,"/applications",params)},readApplication:function(applicationId){var uriFunction=function(){return"/applications/"+applicationId};var chainable=this.getFactory().application(this);return this.chainGet(chainable,uriFunction)},createApplication:function(object){var chainable=this.getFactory().application(this);return this.chainCreate(chainable,object,"/applications")},queryApplications:function(query,pagination){var chainable=this.getFactory().applicationMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/applications/query",params,query)},checkApplicationPermissions:function(checks,callback){var uriFunction=function(){return"/applications/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkApplicationAuthorities:function(checks,callback){var uriFunction=function(){return"/applications/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listApplicationTypes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().applicationMap(this);return this.chainGet(chainable,"/applicationtypes",params)},listClients:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().clientMap(this);return this.chainGet(chainable,"/clients",params)},readClient:function(clientId){var chainable=this.getFactory().client(this);return this.chainGet(chainable,"/clients/"+clientId)},createClient:function(object){if(!object){object={}}var chainable=this.getFactory().client(this);return this.chainCreate(chainable,object,"/clients")},queryClients:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/clients/query"};var chainable=this.getFactory().clientMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkClientPermissions:function(checks,callback){var uriFunction=function(){return"/clients/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkClientAuthorities:function(checks,callback){var uriFunction=function(){return"/clients/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},readAuthenticationGrant:function(authenticationGrantId){var chainable=this.getFactory().authenticationGrant(this);return this.chainGet(chainable,"/auth/grants/"+authenticationGrantId)},createAuthenticationGrant:function(object){if(!object){object={}}var chainable=this.getFactory().authenticationGrant(this);return this.chainCreate(chainable,object,"/auth/grants")},queryAuthenticationGrants:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/auth/grants/query"};var chainable=this.getFactory().authenticationGrantMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkAuthenticationGrantPermissions:function(checks,callback){var uriFunction=function(){return"/auth/grants/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkAuthenticationGrantAuthorities:function(checks,callback){var uriFunction=function(){return"/auth/grants/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listDirectories:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().directoryMap(this);return this.chainGet(chainable,"/directories",params)},readDirectory:function(directoryId){var chainable=this.getFactory().directory(this);return this.chainGet(chainable,"/directories/"+directoryId)},createDirectory:function(object){var chainable=this.getFactory().directory(this);return this.chainCreate(chainable,object,"/directories")},queryDirectories:function(query,pagination){var chainable=this.getFactory().directoryMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/directories/query",params,query)},checkDirectoryPermissions:function(checks,callback){var uriFunction=function(){return"/directories/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkDirectoryAuthorities:function(checks,callback){var uriFunction=function(){return"/directories/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listBillingProviderConfigurations:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().billingProviderConfigurationMap(this);return this.chainGet(chainable,"/billing/configurations",params)},readBillingProviderConfiguration:function(billingProviderConfigurationId){var chainable=this.getFactory().billingProviderConfiguration(this);return this.chainGet(chainable,"/billing/configurations/"+billingProviderConfigurationId)},createBillingProviderConfiguration:function(providerId,object){if(!object){object={}}object.providerId=providerId;var chainable=this.getFactory().billingProviderConfiguration(this);return this.chainCreate(chainable,object,"/billing/configurations")},queryBillingProviderConfigurations:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/billing/configurations/query"};var chainable=this.getFactory().billingProviderConfigurationMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkBillingProviderConfigurationPermissions:function(checks,callback){var uriFunction=function(){return"/billing/configurations/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkBillingProviderConfigurationAuthorities:function(checks,callback){var uriFunction=function(){return"/billing/configurations/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWebHosts:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().webhostMap(this);return this.chainGet(chainable,"/webhosts",params)},readWebHost:function(webhostId){var chainable=this.getFactory().webhost(this);return this.chainGet(chainable,"/webhosts/"+webhostId)},createWebHost:function(object){var chainable=this.getFactory().webhost(this);return this.chainCreate(chainable,object,"/webhosts")},queryWebHosts:function(query,pagination){var chainable=this.getFactory().webhostMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/webhosts/query",params,query)},checkWebHostPermissions:function(checks,callback){var uriFunction=function(){return"/webhosts/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWebHostAuthorities:function(checks,callback){var uriFunction=function(){return"/webhosts/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWarehouses:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().warehouseMap(this);return this.chainGet(chainable,"/warehouses",params)},readWarehouse:function(warehouseId){var chainable=this.getFactory().warehouse(this);return this.chainGet(chainable,"/warehouses/"+warehouseId)},createWarehouse:function(object){var chainable=this.getFactory().warehouse(this);return this.chainCreate(chainable,object,"/warehouses")},queryWarehouses:function(query,pagination){var chainable=this.getFactory().warehouseMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,"/warehouses/query",params,query)},checkWarehousePermissions:function(checks,callback){var uriFunction=function(){return"/warehouses/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWarehouseAuthorities:function(checks,callback){var uriFunction=function(){return"/warehouses/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listTenantAttachments:function(){var self=this;var pseudoTenant=this.clone();pseudoTenant.getUri=function(){return"/tenant"};var result=this.subchain(new Gitana.BinaryAttachmentMap(pseudoTenant));result.then(function(){var chain=this;self.getDriver().gitanaGet(self.getUri()+"/tenant/attachments",null,{},function(response){chain.handleResponse(response);chain.next()});return false});return result},tenantAttachment:function(attachmentId){return this.listTenantAttachments().select(attachmentId)},tenantAttach:function(attachmentId,contentType,data){var self=this;var tenant=this.clone();tenant.getUri=function(){return"/tenant"};var result=this.subchain(new Gitana.BinaryAttachment(tenant));result.subchain().then(function(){var uploadUri=self.getUri()+"/tenant/attachments/"+attachmentId;this.chainUpload(this,uploadUri,null,contentType,data).then(function(){this.subchain(self).listTenantAttachments().then(function(){this.select(attachmentId).then(function(){result.handleResponse(this)})})})});return result},tenantUnattach:function(attachmentId){return this.subchain().then(function(){this.chainDelete(this,this.getUri()+"/tenant/attachments/"+attachmentId).then(function(){})})},getTenantPreviewUri:Gitana.Methods.getPreviewUri("tenant/preview"),app:function(settings,callback){var self=this;if(Gitana.isFunction(settings)){callback=settings;settings=null}if(Gitana.isString(settings)){settings={application:settings}}var config={application:null,appCacheKey:null};Gitana.copyKeepers(config,Gitana.loadDefaultConfig());Gitana.copyKeepers(config,self.getDriver().getOriginalConfiguration());Gitana.copyKeepers(config,settings);var cacheKey=config.appCacheKey;if(cacheKey){if(Gitana.APPS&&Gitana.APPS[cacheKey]){callback.call(Chain(Gitana.APPS[cacheKey]));return}}if(!config.application){callback.call(self,new Error("No application configured"));return}var helper=new Gitana.AppHelper(self,config);if(!Gitana.APPS){Gitana.APPS={}}helper.init.call(helper,function(err){if(err){callback(err);return}if(cacheKey){Gitana.APPS[cacheKey]=helper}callback.call(Chain(helper))})},accessLookups:function(entries,callback){var uriFunction=function(){return"/access/lookup"};var object={entries:entries};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.entries)})},accessChecks:function(entries,callback){var uriFunction=function(){return"/access/check"};var object={entries:entries};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.entries)})},referenceReads:function(entries,callback){var uriFunction=function(){return"/ref/read"};var object={entries:entries};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.entries)})},referenceDiff:function(sourceRef,targetRef,callback){var uriFunction=function(){return"/ref/diff"};var params={source:sourceRef,target:targetRef};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response)})},referenceMerge:function(sourceRef,diffObject,callback){var uriFunction=function(){return"/ref/merge"};var params={source:sourceRef};return this.chainPostResponse(this,uriFunction,params,diffObject).then(function(response){callback.call(this,response)})},adminIndexDatastores:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/index";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminRepair:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/repair";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},listRuleActions:function(pagination,callback){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/rule/actions"};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},readRuleAction:function(actionId,callback){var uriFunction=function(){return"/rule/actions/"+actionId};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},listRuleConditions:function(pagination,callback){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/rule/conditions"};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},readRuleCondition:function(conditionId,callback){var uriFunction=function(){return"/rule/conditions/"+conditionId};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},listWorkflowModels:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowModelMap(this);return this.chainGet(chainable,"/workflow/models",params)},listAllWorkflowModels:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowModelMap(this);return this.chainGet(chainable,"/workflow/models?all=true",params)},readWorkflowModel:function(workflowModelId,workflowModelVersionId){var uriFunction=function(){var url="/workflow/models/"+workflowModelId;if(workflowModelVersionId){url+="/versions/"+workflowModelVersionId}return url};var chainable=this.getFactory().workflowModel(this);return this.chainGet(chainable,uriFunction)},createWorkflowModel:function(id,object){if(!object){object={}}object.id=id;var chainable=this.getFactory().workflowModel(this);return this.chainCreate(chainable,object,"/workflow/models")},queryWorkflowModels:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/models/query"};var chainable=this.getFactory().workflowModelMap(this);return this.chainPost(chainable,uriFunction,params,query)},queryAllWorkflowModels:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/models/query?all=true"};var chainable=this.getFactory().workflowModelMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowModelPermissions:function(checks,callback){var uriFunction=function(){return"/workflow/models/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowModelAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/models/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWorkflowModelVersions:function(id,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var self=this;return"/workflow/models/"+id+"/versions"};var chainable=this.getFactory().workflowModelMap(this);return this.chainGet(chainable,uriFunction,params)},queryWorkflowModelVersions:function(id,query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var self=this;return"/workflow/models/"+id+"/versions/query"};var chainable=this.getFactory().workflowModelMap(this);return this.chainPost(chainable,uriFunction,params,query)},listWorkflows:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowInstanceMap(this);return this.chainGet(chainable,"/workflow/instances",params)},readWorkflow:function(workflowId){var chainable=this.getFactory().workflowInstance(this);return this.chainGet(chainable,"/workflow/instances/"+workflowId)},createWorkflow:function(workflowModelId,object){if(!object){object={}}var params={modelId:workflowModelId};var chainable=this.getFactory().workflowInstance(this);return this.chainCreate(chainable,object,"/workflow/instances",params)},queryWorkflows:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/instances/query"};var chainable=this.getFactory().workflowInstanceMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowInstancePermissions:function(checks,callback){var uriFunction=function(){return"/workflow/instance/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowInstanceAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/instance/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWorkflowTasks:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowTaskMap(this);return this.chainGet(chainable,"/workflow/tasks",params)},readWorkflowTask:function(workflowTaskId){var chainable=this.getFactory().workflowTask(this);return this.chainGet(chainable,"/workflow/tasks/"+workflowTaskId)},queryWorkflowTasks:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/tasks/query"};var chainable=this.getFactory().workflowTaskMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowTaskPermissions:function(checks,callback){var uriFunction=function(){return"/workflow/task/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowTaskAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/task/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listWorkflowComments:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowCommentMap(this);return this.chainGet(chainable,"/workflow/comments",params)},readWorkflowComment:function(workflowCommentId){var chainable=this.getFactory().workflowComment(this);return this.chainGet(chainable,"/workflow/comments/"+workflowCommentId)},createWorkflowComment:function(workflowId,workflowTaskId,object){var params={};var createUri=function(){var uri="/workflow/instances/"+workflowId+"/comments";if(workflowTaskId){uri+="?taskId="+workflowTaskId}return uri};var readUri=function(status){return"/workflow/comments/"+status._doc};var chainable=this.getFactory().workflowComment(this);return this.chainCreateEx(chainable,object,createUri,readUri)},queryWorkflowComments:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/workflow/comments/query"};var chainable=this.getFactory().workflowCommentMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkWorkflowCommentPermissions:function(checks,callback){var uriFunction=function(){return"/workflow/comments/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkWorkflowCommentAuthorities:function(checks,callback){var uriFunction=function(){return"/workflow/comments/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listTasksForCurrentUser:function(filter,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}var chainable=this.getFactory().workflowTaskMap(this);return this.chainGet(chainable,"/workflow/user/tasks",params)},queryTasksForCurrentUser:function(filter,query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}var chainable=this.getFactory().workflowTaskMap(this);return this.chainPost(chainable,"/workflow/user/tasks/query",params,query)},queryTasks:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().workflowTaskMap(this);return this.chainPost(chainable,"/workflow/tasks/query",params,query)},loadWorkflowHistory:function(workflowId,pagination,callback){var uriFunction=function(){return"/workflow/instances/"+workflowId+"/history"};var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},listScheduledWorkItems:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().scheduledWorkMap(this);return this.chainGet(chainable,"/work/scheduled",params)},readScheduledWorkItem:function(scheduledWorkId){var chainable=this.getFactory().scheduledWork(this);return this.chainGet(chainable,"/work/scheduled/"+scheduledWorkId)},createScheduledWorkItem:function(object){if(!object){object={}}var chainable=this.getFactory().scheduledWork(this);return this.chainCreate(chainable,object,"/work/scheduled")},queryScheduledWorkItems:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/work/scheduled/query"};var chainable=this.getFactory().scheduledWorkMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkScheduledWorkPermissions:function(checks,callback){var uriFunction=function(){return"/work/scheduled/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkScheduledWorkAuthorities:function(checks,callback){var uriFunction=function(){return"/work/scheduled/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listReports:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().reportMap(this);return this.chainGet(chainable,"/reports",params)},readReport:function(reportId){var chainable=this.getFactory().report(this);return this.chainGet(chainable,"/reports/"+reportId)},createReport:function(object){if(!object){object={}}var chainable=this.getFactory().report(this);return this.chainCreate(chainable,object,"/reports")},queryReports:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/reports/query"};var chainable=this.getFactory().reportMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkReportPermissions:function(checks,callback){var uriFunction=function(){return"/reports/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkReportAuthorities:function(checks,callback){var uriFunction=function(){return"/reports/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},executeReport:function(reportId,config,callback){if(typeof(config)=="function"){callback=config;config={}}var uriFunction=function(){return"/reports/"+reportId+"/execute"};return this.chainPostResponse(this,uriFunction,null,config).then(function(response){callback.call(this,response)})},runExport:function(objects,configuration,callback){var self=this;var uriFunction=function(){return"/ref/exports/start"};if(!configuration){configuration={}}var references=[];if(objects.refs){references=objects.refs()}else{if(objects.length){for(var i=0;i0){var obj=settings[settings.__keys()[0]];chain.loadFrom(obj);chain.next()}else{object.settings={};driver.gitanaPost(createUri,null,object,function(status){driver.gitanaGet(createUri+"/"+status.getId(),null,{},function(response){chain.handleResponse(response);chain.next()},function(http){self.httpError(http)})},function(http){self.httpError(http)})}},function(http){self.httpError(http)});return false})},readApplicationPrincipalSettings:function(){var args=Gitana.makeArray(arguments);if(args.length==1){var principal=args.shift();return this.readApplicationSettings("principal",principal.getDomainQualifiedId())}else{if(args.length==2){var domainId=args.shift();var principalId=args.shift();return this.readApplicationSettings("principal",domainId+"/"+principalId)}}},checkSettingPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/settings/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkSettingAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/settings/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createRegistration:function(object){var self=this;var chainable=this.getFactory().registration(this);var uriFunction=function(){return self.getUri()+"/registrations"};return this.chainCreate(chainable,object,uriFunction)},listRegistrations:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/registrations"};var chainable=this.getFactory().registrationMap(this);return this.chainGet(chainable,uriFunction,params)},readRegistration:function(registrationId){var self=this;var chainable=this.getFactory().registration(this);var uriFunction=function(){return self.getUri()+"/registrations/"+registrationId};return this.chainGet(chainable,uriFunction)},queryRegistrations:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/registrations/query"};var chainable=this.getFactory().registrationMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkRegistrationPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/registrations/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkRegistrationAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/registrations/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createPageRendition:function(deploymentKey,object){var self=this;var chainable=this.getFactory().pageRendition(this,deploymentKey);var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions"};return this.chainCreate(chainable,object,uriFunction)},listPageRenditions:function(deploymentKey,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions"};var chainable=this.getFactory().pageRenditionMap(this,deploymentKey);return this.chainGet(chainable,uriFunction,params)},readPageRendition:function(deploymentKey,pageRenditionIdOrKey){var self=this;var chainable=this.getFactory().pageRendition(this,deploymentKey);var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/"+pageRenditionIdOrKey};return this.chainGet(chainable,uriFunction)},queryPageRenditions:function(deploymentKey,query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/query"};var chainable=this.getFactory().pageRenditionMap(this,deploymentKey);return this.chainPost(chainable,uriFunction,params,query)},checkPageRenditionPermissions:function(deploymentKey,checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkPageRenditionAuthorities:function(deploymentKey,checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/deployments/"+deploymentKey+"/pagerenditions/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createEmailProvider:function(object){var self=this;var chainable=this.getFactory().emailProvider(this);var uriFunction=function(){return self.getUri()+"/emailproviders"};return this.chainCreate(chainable,object,uriFunction)},listEmailProviders:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emailproviders"};var chainable=this.getFactory().emailProviderMap(this);return this.chainGet(chainable,uriFunction,params)},readEmailProvider:function(emailProviderId){var self=this;var chainable=this.getFactory().emailProvider(this);var uriFunction=function(){return self.getUri()+"/emailproviders/"+emailProviderId};return this.chainGet(chainable,uriFunction)},queryEmailProviders:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emailproviders/query"};var chainable=this.getFactory().emailProviderMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkEmailProviderPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emailproviders/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkEmailProviderAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emailproviders/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createEmail:function(object){var self=this;var chainable=this.getFactory().email(this);var uriFunction=function(){return self.getUri()+"/emails"};return this.chainCreate(chainable,object,uriFunction)},listEmails:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emails"};var chainable=this.getFactory().emailMap(this);return this.chainGet(chainable,uriFunction,params)},readEmail:function(emailId){var self=this;var chainable=this.getFactory().email(this);var uriFunction=function(){return self.getUri()+"/emails/"+emailId};return this.chainGet(chainable,uriFunction)},queryEmails:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/emails/query"};var chainable=this.getFactory().emailMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkEmailPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emails/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkEmailAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/emails/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},deploy:function(deploymentKey){var self=this;var uriFunction=function(){return self.getUri()+"/deploy/"+deploymentKey};var webhost=new Gitana.WebHost(this.getPlatform());var chainable=this.getFactory().deployedApplication(webhost);return this.chainPost(chainable,uriFunction).then(function(){var webhostId=self.deployments[deploymentKey]["webhost"];this.subchain(this.getPlatform()).readWebHost(webhostId).then(function(){webhost.loadFrom(this)})})},undeploy:function(deploymentKey){var self=this;var uriFunction=function(){return self.getUri()+"/undeploy/"+deploymentKey};return this.chainPost(this,uriFunction)},findDeployedApplication:function(deploymentKey){var self=this;var uriFunction=function(){return self.getUri()+"/deployed/"+deploymentKey};var webhost=new Gitana.WebHost(this.getPlatform());var chainable=this.getFactory().deployedApplication(webhost);return this.chainGet(chainable,uriFunction).then(function(){var webhostId=self.deployments[deploymentKey]["webhost"];this.subchain(this.getPlatform()).readWebHost(webhostId).then(function(){webhost.loadFrom(this)})})},loadDeploymentInfo:function(deploymentKey,callback){var self=this;var uriFunction=function(){return self.getUri()+"/deployed/"+deploymentKey+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response.info)})},refreshDeploymentKeys:function(deploymentKey){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/deployments/"+deploymentKey+"/refreshkeys";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ApplicationMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.ApplicationMap"};this.base(platform,object)},clone:function(){return this.getFactory().applicationMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().application(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractApplicationObject=Gitana.AbstractPlatformObject.extend({constructor:function(application,object){this.base(application.getPlatform(),object);this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getApplicationId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Settings=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.Settings"}},clone:function(){return new Gitana.Settings(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_SETTINGS},getUri:function(){return"/applications/"+this.getApplicationId()+"/settings/"+this.getId()},getSettings:function(){return this["settings"]},getSetting:function(key){return(this.getSettings()?this.getSettings()[key]:null)},setSetting:function(key,val){if(!this.getSettings()){this["settings"]={}}this["settings"][key]=val},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri()})})(window);(function(window){var Gitana=window.Gitana;Gitana.SettingsMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.SettingsMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().settingsMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().settings(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Email=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.Email"}},clone:function(){return new Gitana.Email(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_EMAIL},getUri:function(){return"/applications/"+this.getApplicationId()+"/emails/"+this.getId()},send:function(emailProvider){return this.then(function(){this.subchain(emailProvider).send(this)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.EmailMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.EmailMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().emailMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().email(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.EmailProvider=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.EmailProvider"}},clone:function(){return new Gitana.EmailProvider(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_EMAIL_PROVIDER},getUri:function(){return"/applications/"+this.getApplicationId()+"/emailproviders/"+this.getId()},send:function(email,model){var self=this;if(!model){model={}}var emailId=null;if(Gitana.isString(email)){emailId=email}else{emailId=email.getId()}var uriFunction=function(){return self.getUri()+"/send?email="+emailId};return this.chainPostEmpty(null,uriFunction,{},model)},test:function(from,to){var self=this;var uriFunction=function(){return self.getUri()+"/test?from="+from+"&to="+to};return this.chainPostEmpty(null,uriFunction)},sendForExport:function(exportId,emailConfig,callback){var self=this;var uriFunction=function(){return"/ref/exports/"+exportId+"/email"};var params={};var payload={applicationId:this.getApplicationId(),emailProviderId:this.getId(),email:emailConfig};return this.chainPostResponse(this,uriFunction,params,payload).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.EmailProviderMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.EmailProviderMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().emailProviderMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().emailProvider(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Registration=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.Registration"}},clone:function(){return new Gitana.Registration(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_REGISTRATION},getUri:function(){return"/applications/"+this.getApplicationId()+"/registrations/"+this.getId()},sendConfirmationEmail:function(){var self=this;var uriFunction=function(){return self.getUri()+"/send/confirmation"};return this.chainPostEmpty(this,uriFunction,{},this)},sendWelcomeEmail:function(){var self=this;var uriFunction=function(){return self.getUri()+"/send/welcome"};return this.chainPostEmpty(this,uriFunction,{},this)},confirm:function(newUserPassword,paymentMethodObject){if(!paymentMethodObject){paymentMethodObject={}}var params={password:newUserPassword};var self=this;var uriFunction=function(){return self.getUri()+"/confirm"};return this.chainPostEmpty(this,uriFunction,params,paymentMethodObject)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RegistrationMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.RegistrationMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().registrationMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().registration(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PageRendition=Gitana.AbstractApplicationObject.extend({constructor:function(application,object){this.base(application,object);this.objectType=function(){return"Gitana.PageRendition"}},clone:function(){return new Gitana.PageRendition(this.getApplication(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_PAGE_RENDITION},getUri:function(){return"/applications/"+this.getApplicationId()+"/deployments/"+this.deploymentKey+"/pagerenditions/"+this.key},invalidate:function(){var self=this;var uriFunction=function(){return self.getUri()+"/invalidate"};return this.chainPostEmpty(this.getPlatform(),uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PageRenditionMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(application,object){this.objectType=function(){return"Gitana.PageRenditionMap"};this.getApplication=function(){return application};this.getApplicationId=function(){return application.getId()};this.base(application.getPlatform(),object)},clone:function(){return this.getFactory().pageRenditionMap(this.getApplication(),this)},buildObject:function(json){return this.getFactory().pageRendition(this.getApplication(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Warehouse=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.Warehouse"};this.base(platform,object)},getUri:function(){return"/warehouses/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_WAREHOUSE},clone:function(){return this.getFactory().warehouse(this.getPlatform(),this)},listInteractions:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionMap(this);return this.chainGet(chainable,this.getUri()+"/interactions",params)},readInteraction:function(interactionId){var chainable=this.getFactory().interaction(this);return this.chainGet(chainable,this.getUri()+"/interactions/"+interactionId)},queryInteractions:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/interactions/query"};var chainable=this.getFactory().interactionMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionApplications:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionApplicationMap(this);return this.chainGet(chainable,this.getUri()+"/applications",params)},readInteractionApplication:function(interactionApplicationId){var chainable=this.getFactory().interactionApplication(this);return this.chainGet(chainable,this.getUri()+"/applications/"+interactionApplicationId)},queryInteractionApplications:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/applications/query"};var chainable=this.getFactory().interactionApplicationMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionSessions:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionSessionMap(this);return this.chainGet(chainable,this.getUri()+"/sessions",params)},readInteractionSession:function(interactionSessionId){var chainable=this.getFactory().interactionSession(this);return this.chainGet(chainable,this.getUri()+"/sessions/"+interactionSessionId)},queryInteractionSessions:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/sessions/query"};var chainable=this.getFactory().interactionSessionMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionPages:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionPageMap(this);return this.chainGet(chainable,this.getUri()+"/pages",params)},readInteractionPage:function(interactionPageId){var chainable=this.getFactory().interactionPage(this);return this.chainGet(chainable,this.getUri()+"/pages/"+interactionPageId)},queryInteractionPages:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/pages/query"};var chainable=this.getFactory().interactionPageMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionNodes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionNodeMap(this);return this.chainGet(chainable,this.getUri()+"/nodes",params)},readInteractionNode:function(interactionNodeId){var chainable=this.getFactory().interactionNode(this);return this.chainGet(chainable,this.getUri()+"/nodes/"+interactionNodeId)},queryInteractionNodes:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes/query"};var chainable=this.getFactory().interactionNodeMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionUsers:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionUserMap(this);return this.chainGet(chainable,this.getUri()+"/users",params)},readInteractionUser:function(interactionUserId){var chainable=this.getFactory().interactionUser(this);return this.chainGet(chainable,this.getUri()+"/users/"+interactionUserId)},queryInteractionUsers:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/users/query"};var chainable=this.getFactory().interactionUserMap(this);return this.chainPost(chainable,uriFunction,params,query)},listInteractionContinents:Gitana.Methods.listInteractionObjects("interactionContinentMap","continents"),readInteractionContinent:Gitana.Methods.readInteractionObject("interactionContinent","continents"),queryInteractionContinents:Gitana.Methods.queryInteractionObjects("interactionContinentMap","continents"),listInteractionCountries:Gitana.Methods.listInteractionObjects("interactionCountryMap","countries"),readInteractionCountry:Gitana.Methods.readInteractionObject("interactionCountry","countries"),queryInteractionCountries:Gitana.Methods.queryInteractionObjects("interactionCountryMap","countries"),listInteractionCities:Gitana.Methods.listInteractionObjects("interactionCityMap","cities"),readInteractionCity:Gitana.Methods.readInteractionObject("interactionCity","cities"),queryInteractionCities:Gitana.Methods.queryInteractionObjects("interactionCityMap","cities"),listInteractionRegions:Gitana.Methods.listInteractionObjects("interactionRegionMap","regions"),readInteractionRegion:Gitana.Methods.readInteractionObject("interactionRegion","regions"),queryInteractionRegions:Gitana.Methods.queryInteractionObjects("interactionRegionMap","regions"),listInteractionPostalCodes:Gitana.Methods.listInteractionObjects("interactionPostalCodeMap","postalcodes"),readInteractionPostalCode:Gitana.Methods.readInteractionObject("interactionPostalCode","postalcodes"),queryInteractionPostalCodes:Gitana.Methods.queryInteractionObjects("interactionPostalCodeMap","postalcodes"),listInteractionUserAgents:Gitana.Methods.listInteractionObjects("interactionUserAgentMap","useragents"),readInteractionUserAgent:Gitana.Methods.readInteractionObject("interactionUserAgent","useragents"),queryInteractionUserAgents:Gitana.Methods.queryInteractionObjects("interactionUserAgentMap","useragents"),listInteractionOperatingSystems:Gitana.Methods.listInteractionObjects("interactionOperatingSystemMap","operatingsystems"),readInteractionOperatingSystems:Gitana.Methods.readInteractionObject("interactionOperatingSystem","operatingsystems"),queryInteractionOperatingSystems:Gitana.Methods.queryInteractionObjects("interactionOperatingSystemMap","operatingsystems"),listInteractionDevices:Gitana.Methods.listInteractionObjects("interactionDeviceMap","devices"),readInteractionDevice:Gitana.Methods.readInteractionObject("interactionDevice","devices"),queryInteractionDevices:Gitana.Methods.queryInteractionObjects("interactionDeviceMap","devices"),listInteractionReports:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionReportMap(this);return this.chainGet(chainable,this.getUri()+"/reports",params)},readInteractionReport:function(interactionReportId){var chainable=this.getFactory().interactionReport(this);return this.chainGet(chainable,this.getUri()+"/reports/"+interactionReportId)},queryInteractionReports:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/reports/query"};var chainable=this.getFactory().interactionReportMap(this);return this.chainPost(chainable,uriFunction,params,query)},loadInfo:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},reset:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/reset";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},listConversionTriggers:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/triggers/"};var chainable=this.getFactory().conversionTriggerMap(this);return this.chainGet(chainable,uriFunction,params)},readConversionTrigger:function(triggerId){var self=this;var uriFunction=function(){return self.getUri()+"/triggers/"+triggerId};var chainable=this.getFactory().conversionTrigger(this);return this.chainGet(chainable,uriFunction)},createConversionTrigger:function(object){var self=this;if(!object){object={}}var uriFunction=function(){return self.getUri()+"/triggers"};var chainable=this.getFactory().conversionTrigger(this);return this.chainCreate(chainable,object,uriFunction)},queryConversionTriggers:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/triggers/query"};var chainable=this.getFactory().conversionTriggerMap(this);return this.chainPost(chainable,uriFunction,params,query)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.WarehouseMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.WarehouseMap"};this.base(platform,object)},clone:function(){return this.getFactory().warehouseMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().warehouse(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractWarehouseObject=Gitana.AbstractPlatformObject.extend({constructor:function(warehouse,object){this.base(warehouse.getPlatform(),object);this.getWarehouse=function(){return warehouse};this.getWarehouseId=function(){return warehouse.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getWarehouseId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractWarehouseObjectMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(warehouse,object){this.getWarehouse=function(){return warehouse};this.getWarehouseId=function(){return warehouse.getId()};this.base(warehouse.getPlatform(),object)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractReportableWarehouseObject=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.interactionObjectTypeId=null},listReports:function(pagination){return this.queryReports({},pagination)},readReport:function(interactionReportKey){return this.queryReports({key:interactionReportKey}).keepOne()},queryReports:function(query,pagination){if(!query){query={}}query.objectTypeId=this.interactionObjectTypeId;query.objectId=this.getId();return this.subchain(this.getWarehouse()).queryInteractionReports(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Interaction=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.Interaction"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/interactions/"+this.getId()},clone:function(){return this.getFactory().interaction(this.getWarehouse(),this)},getInteractionApplicationId:function(){return this.get("interactionApplicationId")},getInteractionSessionId:function(){return this.get("interactionSessionId")},getInteractionPageId:function(){return this.get("interactionPageId")},getInteractionUserId:function(){return this.get("interactionUserId")},getInteractionNodeId:function(){return this.get("interactionNodeId")},getSourceUserAgent:function(){return this["source"]["user-agent"]},getSourceHost:function(){return this["source"]["host"]},getSourceIP:function(){return this["source"]["ip"]},getEventType:function(){return this["event"]["type"]},getEventX:function(){return this["event"]["x"]},getEventY:function(){return this["event"]["y"]},getEventOffsetX:function(){return this["event"]["offsetX"]},getEventOffsetY:function(){return this["event"]["offsetY"]},getApplicationHost:function(){return this["application"]["host"]},getApplicationUrl:function(){return this["application"]["url"]},getApplicationUri:function(){return this["application"]["uri"]},getElementId:function(){return this["element"]["id"]},getElementType:function(){return this["element"]["type"]},getElementPath:function(){return this["element"]["path"]},getNodeRepositoryId:function(){return this["node"]["repositoryId"]},getNodeBranchId:function(){return this["node"]["branchId"]},getNodeId:function(){return this["node"]["id"]},getTimestampStart:function(){return this["timestamp"]["start"]},getTimestampEnd:function(){return this["timestamp"]["end"]},getTimestampMs:function(){return this["timestamp"]["ms"]},getPrincipalDomainId:function(){return this["principal"]["domainId"]},getPrincipalId:function(){return this["principal"]["id"]}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interaction(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionApplication=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionApplication"};this.interactionObjectTypeId="application"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_APPLICATION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/applications/"+this.getId()},clone:function(){return this.getFactory().interactionApplication(this.getWarehouse(),this)},getTimestampStart:function(){return this.get("timestamp")["start"]},getTimestampEnd:function(){return this.get("timestamp")["end"]},listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionApplicationId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)},listSessions:function(pagination){return this.querySessions(null,pagination)},querySessions:function(query,pagination){if(!query){query={}}query.interactionApplicationId=this.getId();return this.subchain(this.getWarehouse()).queryInteractionSessions(query,pagination)},listPages:function(pagination){return this.queryPages(null,pagination)},queryPages:function(query,pagination){if(!query){query={}}query.interactionApplicationId=this.getId();return this.subchain(this.getWarehouse()).queryInteractionPages(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionApplicationMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionApplicationMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionApplicationMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionApplication(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionSession=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionSession"};this.interactionObjectTypeId="session"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_SESSION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/sessions/"+this.getId()},clone:function(){return this.getFactory().interactionSession(this.getWarehouse(),this)},getInteractionApplicationId:function(){return this.get("interactionApplicationId")},getTimestampStart:function(){return this.get("timestamp")["start"]},getTimestampEnd:function(){return this.get("timestamp")["end"]},listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionSessionId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionSessionMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionSessionMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionSessionMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionSession(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPage=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionPage"};this.interactionObjectTypeId="page"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_PAGE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/pages/"+this.getId()},clone:function(){return this.getFactory().interactionPage(this.getWarehouse(),this)},getInteractionApplicationId:function(){return this.get("interactionApplicationId")},getPageUri:function(){return this.get("uri")},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri(),listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionPageId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)},capture:function(){var self=this;var uriFunction=function(){return self.getUri()+"/capture"};return this.chainPostEmpty(null,uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPageMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionPageMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionPageMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionPage(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionNode=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionNode"};this.interactionObjectTypeId="node"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_NODE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/nodes/"+this.getId()},clone:function(){return this.getFactory().interactionNode(this.getWarehouse(),this)},getRepositoryId:function(){return this.get("repositoryId")},getBranchId:function(){return this.get("branchId")},getNodeId:function(){return this.get("nodeId")},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri(),listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionNodeId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)},capture:function(){var self=this;var uriFunction=function(){return self.getUri()+"/capture"};return this.chainPostEmpty(null,uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionNodeMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionNodeMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionNodeMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionNode(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUser=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionUser"};this.interactionObjectTypeId="user"},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_SESSION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/users/"+this.getId()},clone:function(){return this.getFactory().interactionUser(this.getWarehouse(),this)},getKey:function(){return this.get("key")},listInteractions:function(pagination){return this.queryInteractions(null,pagination)},queryInteractions:function(query,pagination){if(!query){query={}}query.interactionUserId=this.getId();return this.subchain(this.getWarehouse()).queryInteractions(query,pagination)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUserMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionUserMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionUserMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionUser(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionContinent=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionContinent"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_CONTINENT},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/continents/"+this.getId()},clone:function(){return this.getFactory().interactionContinent(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionContinentMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionContinentMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionContinentMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionContinent(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCountry=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionCountry"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_COUNTRY},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/countries/"+this.getId()},clone:function(){return this.getFactory().interactionCountry(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCountryMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionCountryMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionCountryMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionCountry(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCity=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionCity"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_CITY},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/cities/"+this.getId()},clone:function(){return this.getFactory().interactionCity(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionCityMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionCityMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionCityMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionCity(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionRegion=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionRegion"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_REGION},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/regions/"+this.getId()},clone:function(){return this.getFactory().interactionRegion(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionRegionMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionRegionMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionRegionMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionRegion(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPostalCode=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionPostalCode"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_POSTALCODE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/postalcodes/"+this.getId()},clone:function(){return this.getFactory().interactionPostalCode(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionPostalCodeMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionPostalCodeMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionPostalCodeMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionPostalCode(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUserAgent=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionUserAgent"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_USERAGENT},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/useragents/"+this.getId()},clone:function(){return this.getFactory().interactionUserAgent(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionUserAgentMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionUserAgentMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionUserAgentMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionUserAgent(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionOperatingSystem=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionOperatingSystem"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_OPERATINGSYSTEM},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/operatingsystems/"+this.getId()},clone:function(){return this.getFactory().interactionOperatingSystem(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionOperatingSystemMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionOperatingSystemMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionOperatingSystemMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionOperatingSystem(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionDevice=Gitana.AbstractReportableWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionDevice"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_DEVICE},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/devices/"+this.getId()},clone:function(){return this.getFactory().interactionDevice(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionDeviceMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionDeviceMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionDeviceMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionDevice(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReport=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionReport"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/reports/"+this.getId()},clone:function(){return this.getFactory().interactionReport(this.getWarehouse(),this)},getObjectTypeId:function(){return this.get("objectTypeId")},getObjectId:function(){return this.get("objectId")},getKey:function(){return this.get("key")},listEntries:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().interactionReportEntryMap(self.getWarehouse());return this.chainGet(chainable,this.getUri()+"/entries",params)},readEntry:function(interactionReportEntryId){var self=this;var chainable=this.getFactory().interactionReportEntry(self.getWarehouse());return this.chainGet(chainable,this.getUri()+"/entries/"+interactionReportEntryId)},queryEntries:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/entries/query"};var chainable=this.getFactory().interactionReportEntryMap(self.getWarehouse());return this.chainPost(chainable,uriFunction,params,query)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReportMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionReportMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionReportMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionReport(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReportEntry=Gitana.AbstractWarehouseObject.extend({constructor:function(warehouse,object){this.base(warehouse,object);this.objectType=function(){return"Gitana.InteractionReportEntry"}},getType:function(){return Gitana.TypedIDConstants.TYPE_INTERACTION_REPORT_ENTRY},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/reports/"+this.getReportId()+"/entries/"+this.getId()},clone:function(){return this.getFactory().interactionReportEntry(this.getWarehouse(),this)},getReportId:function(){return this.get("reportId")},getKey:function(){return this.get("key")},getApplicationId:function(){return this.get("applicationId")},getApplicationTitle:function(){return this.get("applicationTitle")},getApplicationDescription:function(){return this.get("applicationDescription")},getSessionId:function(){return this.get("sessionId")},getSessionTitle:function(){return this.get("sessionTitle")},getSessionDescription:function(){return this.get("sessionDescription")},getPageId:function(){return this.get("pageId")},getPageUri:function(){return this.get("pageUri")},getPageTitle:function(){return this.get("pageTitle")},getPageDescription:function(){return this.get("pageDescription")},getNodeId:function(){return this.get("nodeId")},getNodeTargetRepositoryId:function(){return this.get("nodeTargetRepositoryId")},getNodeTargetBranchId:function(){return this.get("nodeTargetBranchId")},getNodeTargetId:function(){return this.get("nodeTargetId")},getNodeTitle:function(){return this.get("nodeTitle")},getNodeDescription:function(){return this.get("nodeDescription")},getUserId:function(){return this.get("userId")},getUserTitle:function(){return this.get("userTitle")},getUserDescription:function(){return this.get("userDescription")},getUserFirstName:function(){return this.get("userFirstName")},getUserLastName:function(){return this.get("userLastName")},getUserEmail:function(){return this.get("userEmail")},getUserName:function(){return this.get("userName")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.InteractionReportEntryMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.InteractionReportEntryMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().interactionReportEntryMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().interactionReportEntry(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ConversionTrigger=Gitana.AbstractWarehouseObject.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.ConversionTrigger"}},getType:function(){return Gitana.TypedIDConstants.TYPE_CONVERSION_TRIGGER},getUri:function(){return"/warehouses/"+this.getWarehouseId()+"/triggers/"+this.getId()},clone:function(){return this.getFactory().conversionTrigger(this.getWarehouse(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ConversionTriggerMap=Gitana.AbstractWarehouseObjectMap.extend({constructor:function(warehouse,object){this.objectType=function(){return"Gitana.ConversionTriggerMap"};this.base(warehouse,object)},clone:function(){return this.getFactory().conversionTriggerMap(this.getWarehouse(),this)},buildObject:function(json){return this.getFactory().conversionTrigger(this.getWarehouse(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Directory=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.Directory"};this.base(platform,object)},getUri:function(){return"/directories/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_DIRECTORY},clone:function(){return this.getFactory().directory(this.getPlatform(),this)},readIdentity:function(identityId){var self=this;var uriFunction=function(){return self.getUri()+"/identities/"+identityId};var chainable=this.getFactory().identity(this);return this.chainGet(chainable,uriFunction)},listIdentities:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/identities"};var chainable=this.getFactory().identityMap(this);return this.chainGet(chainable,uriFunction,params)},queryIdentities:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/identities/query"};var chainable=this.getFactory().identityMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkIdentityPermissions:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/identities/permissions/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkIdentityAuthorities:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/identities/authorities/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},readConnection:function(connectionId){var self=this;var uriFunction=function(){return self.getUri()+"/connections/"+connectionId};var chainable=this.getFactory().connection(this);return this.chainGet(chainable,uriFunction)},createConnection:function(object){var self=this;if(!object){object={}}var uriFunction=function(){return self.getUri()+"/connections"};var chainable=this.getFactory().connection(this,object);return this.chainCreate(chainable,object,uriFunction)},listConnections:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/connections"};var chainable=this.getFactory().connectionMap(this);return this.chainGet(chainable,uriFunction,params)},queryConnections:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/connections/query"};var chainable=this.getFactory().connectionMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkConnectionPermissions:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/connections/permissions/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkConnectionAuthorities:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/connections/authorities/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DirectoryMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.DirectoryMap"};this.base(platform,object)},clone:function(){return this.getFactory().directoryMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().directory(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractDirectoryObject=Gitana.AbstractPlatformObject.extend({constructor:function(directory,object){this.base(directory.getPlatform(),object);this.objectType=function(){return"Gitana.Connection"};this.getDirectory=function(){return directory};this.getDirectoryId=function(){return directory.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getDirectoryId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Identity=Gitana.AbstractDirectoryObject.extend({constructor:function(directory,object){this.base(directory,object);this.objectType=function(){return"Gitana.Identity"}},getType:function(){return Gitana.TypedIDConstants.TYPE_IDENTITY},getUri:function(){return"/directories/"+this.getDirectoryId()+"/identities/"+this.getId()},clone:function(){return this.getFactory().identity(this.getDirectory(),this)},changePassword:function(password,verifyPassword){var object={password:password,verifyPassword:verifyPassword};return this.chainPostEmpty(null,this.getUri()+"/changepassword",{},object)},findPolicyUsers:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/users"};var domain=new Gitana.Domain(this.getPlatform());var chainable=this.getFactory().domainPrincipalMap(domain);var params={};if(tenantId){params.tenantId=tenantId}return this.chainGet(chainable,uriFunction,params)},findPolicyUserForTenant:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/user"};var chainable=this.getFactory().domainPrincipal(this);var params={};params.tenantId=tenantId;return this.chainGet(chainable,uriFunction,params)},findPolicyUsersForTenant:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/users"};var chainable=this.getFactory().domainPrincipalMap(this);var params={};params.tenantId=tenantId;return this.chainGet(chainable,uriFunction,params)},findPolicyTenants:function(registrarId){var self=this;var uriFunction=function(){return self.getUri()+"/policy/tenants"};var chainable=this.getFactory().tenantMap(this);var params={};if(registrarId){params.registrarId=registrarId}return this.chainGet(chainable,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.IdentityMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(directory,object){this.objectType=function(){return"Gitana.IdentityMap"};this.getDirectory=function(){return directory};this.getDirectoryId=function(){return directory.getId()};this.base(directory.getPlatform(),object)},clone:function(){return this.getFactory().identityMap(this.getDirectory(),this)},buildObject:function(json){return this.getFactory().identity(this.getDirectory(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Connection=Gitana.AbstractDirectoryObject.extend({constructor:function(directory,object){this.base(directory,object);this.objectType=function(){return"Gitana.Connection"}},getType:function(){return Gitana.TypedIDConstants.TYPE_CONNECTION},getUri:function(){return"/directories/"+this.getDirectoryId()+"/connections/"+this.getId()},clone:function(){return this.getFactory().connection(this.getDirectory(),this)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ConnectionMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(directory,object){this.objectType=function(){return"Gitana.ConnectionMap"};this.getDirectory=function(){return directory};this.getDirectoryId=function(){return directory.getId()};this.base(directory.getPlatform(),object)},clone:function(){return this.getFactory().connectionMap(this.getDirectory(),this)},buildObject:function(json){return this.getFactory().connection(this.getDirectory(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Domain=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.Domain"}},getUri:function(){return"/domains/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_DOMAIN},clone:function(){return this.getFactory().domain(this.getPlatform(),this)},listPrincipals:function(pagination,options){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(options){Gitana.copyInto(params,options)}var uriFunction=function(){return self.getUri()+"/principals"};var chainable=this.getFactory().domainPrincipalMap(this);return this.chainGet(chainable,uriFunction,params)},readPrincipal:function(principalId,options){var self=this;var params={};if(options){Gitana.copyInto(params,options)}var uriFunction=function(){return self.getUri()+"/principals/"+principalId};var chainable=this.getFactory().domainPrincipal(this);return this.chainGet(chainable,uriFunction,params)},createPrincipal:function(object){var self=this;if(!object){object={}}if(!object.name){console.log("missing name");return}if(!object.type){console.log("missing type");return}var uriFunction=function(){return self.getUri()+"/principals"};var chainable=this.getFactory().domainPrincipal(this,object);return this.chainCreate(chainable,object,uriFunction)},queryPrincipals:function(query,pagination,options){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(options){Gitana.copyInto(params,options)}var uriFunction=function(){return self.getUri()+"/principals/query"};var chainable=this.getFactory().domainPrincipalMap(this);return this.chainPost(chainable,uriFunction,params,query)},listGroups:function(pagination){var query={type:"GROUP"};return this.queryPrincipals(query,pagination)},createGroup:function(object){if(!object){object={}}object.type="GROUP";return this.createPrincipal(object)},queryGroups:function(query,pagination){if(!query){query={}}query.type="GROUP";return this.queryPrincipals(query,pagination)},listUsers:function(pagination){var query={type:"USER"};return this.queryPrincipals(query,pagination)},createUser:function(object){if(!object){object={}}object.type="USER";return this.createPrincipal(object)},queryUsers:function(query,pagination){if(!query){query={}}query.type="USER";return this.queryPrincipals(query,pagination)},addMember:function(group,principal){var self=this;var groupId=this.extractPrincipalIdentifiers(group,this.getId())["principal"];var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return self.getUri()+"/principals/"+groupId+"/members/add?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},removeMember:function(group,principal){var self=this;var groupId=this.extractPrincipalIdentifiers(group,this.getId())["principal"];var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return self.getUri()+"/principals/"+groupId+"/members/remove?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},listMembers:function(group,filter,pagination,indirect){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}if(indirect){params.indirect=true}var groupId=this.extractPrincipalIdentifiers(group,this.getId())["principal"];var uriFunction=function(){return self.getUri()+"/principals/"+groupId+"/members"};var chainable=this.getFactory().domainPrincipalMap(this);return this.chainGet(chainable,uriFunction,params)},checkPrincipalPermissions:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/principals/permissions/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkPrincipalAuthorities:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/principals/authorities/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkGroupMemberships:function(checks,callback){var self=this;var object={checks:checks};var uriFunction=function(){return self.getUri()+"/principals/membership/check"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.DomainMap"};this.base(platform,object)},clone:function(){return this.getFactory().domainMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().domain(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractDomainObject=Gitana.AbstractPlatformObject.extend({constructor:function(domain,object){this.base(domain.getPlatform(),object);this.objectType=function(){return"Gitana.DomainPrincipal"};this.getDomain=function(){return domain};this.getDomainId=function(){return domain.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getDomainId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainPrincipal=Gitana.AbstractDomainObject.extend({constructor:function(domain,object){this.base(domain,object);this.objectType=function(){return"Gitana.DomainPrincipal"}},getUri:function(){return"/domains/"+this.getDomainId()+"/principals/"+this.getId()},clone:function(){return this.getFactory().domainPrincipal(this.getDomain(),this)},beforeChainRun:function(){this.getFactory().extendPrincipal(this)},getName:function(){return this.get("name")},getType:function(){return this.get("type")},getDomainQualifiedName:function(){return this.getDomainId()+"/"+this.getName()},getDomainQualifiedId:function(){return this.getDomainId()+"/"+this.getId()},listMemberships:function(indirect,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var uri=this.getUri()+"/memberships";if(indirect){uri=uri+"?indirect=true"}return uri};var chainable=this.getFactory().domainPrincipalMap(this.getDomain());return this.chainGet(chainable,uriFunction,params)},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri(),listAuthenticationGrants:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}params.domainId=this.getDomainId();params.principalId=this.getId();var chainable=this.getFactory().authenticationGrantMap(this.getPlatform());return this.chainGet(chainable,"/auth/grants",params)},listTeamMemberships:function(teamable,pagination){var params={teamableType:teamable.getType(),teamableId:teamable.getId()};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return this.getUri()+"/teams"};var chainable=this.getFactory().teamMap(this.getCluster(),this);return this.chainGet(chainable,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PrincipalMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(domain,object){this.objectType=function(){return"Gitana.PrincipalMap"};this.getDomain=function(){return domain};this.base(domain.getPlatform(),object)},clone:function(){return this.getFactory().domainPrincipalMap(this.getDomain(),this)},buildObject:function(json){return this.getFactory().domainPrincipal(this.getDomain(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainGroup={TYPE:"GROUP",readGroupNode:function(branch,createIfNotFound){var result=this.subchain(this.getFactory().node(branch,"n:group"));result.subchain(branch).readGroupNode(this.getId(),createIfNotFound).then(function(){result.handleResponse(this)});return result},listMembers:function(filter,indirect,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(filter){params.filter=filter}if(indirect){params.indirect=true}var uriFunction=function(){return self.getUri()+"/members"};var chainable=this.getFactory().domainPrincipalMap(this.getDomain());return this.chainGet(chainable,uriFunction,params)},listUsers:function(){var inherit=false;var pagination=null;var args=Gitana.makeArray(arguments);var a1=args.shift();if(Gitana.isBoolean(a1)){inherit=a1;pagination=args.shift()}else{pagination=args.shift()}return this.listMembers("user",inherit,pagination)},listGroups:function(){var inherit=false;var pagination=null;var args=Gitana.makeArray(arguments);var a1=args.shift();if(Gitana.isBoolean(a1)){inherit=a1;pagination=args.shift()}else{pagination=a1}return this.listMembers("group",inherit,pagination)},addMember:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);return this.chainPostEmpty(null,this.getUri()+"/members/add?id="+principalDomainQualifiedId)},removeMember:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);return this.chainPostEmpty(null,this.getUri()+"/members/remove?id="+principalDomainQualifiedId)}}})(window);(function(window){var Gitana=window.Gitana;Gitana.DomainUser={TYPE:"USER",readPersonNode:function(branch,createIfNotFound){var result=this.subchain(this.getFactory().node(branch,"n:person"));result.subchain(branch).readPersonNode(this.getDomainQualifiedId(),createIfNotFound).then(function(){result.handleResponse(this)});return result},hasIdentity:function(){return(this.getDirectoryId()&&this.getIdentityId())},getDirectoryId:function(){return this.get("directoryId")},getIdentityId:function(){return this.get("identityId")},readDirectory:function(){var directory=this.getFactory().directory(this.getPlatform(),{_doc:this.getDirectoryId()});var result=this.subchain(directory);result.subchain(this.getPlatform()).readDirectory(this.getDirectoryId()).then(function(){result.handleResponse(this)});return result},readIdentity:function(){var self=this;var directory=this.getFactory().directory(this.getPlatform(),{_doc:this.getDirectoryId()});var identity=this.getFactory().identity(directory,{_doc:this.getIdentityId()});var result=this.subchain(identity);result.subchain(this.getPlatform()).readDirectory(self.getDirectoryId()).then(function(){directory.handleResponse(this);this.readIdentity(self.getIdentityId()).then(function(){identity.handleResponse(this)})});return result},getFirstName:function(){return this.get("firstName")},setFirstName:function(firstName){this.set("firstName",firstName)},getLastName:function(){return this.get("lastName")},setLastName:function(lastName){this.set("lastName",lastName)},getCompanyName:function(){return this.get("companyName")},setCompanyName:function(companyName){this.set("companyName",companyName)},getEmail:function(){return this.get("email")},setEmail:function(email){this.set("email",email)},getJobTitle:function(){return this.get("jobTitle")},setJobTitle:function(jobTitle){this.set("jobTitle",jobTitle)},getAddress:function(){return this.get("address")},setAddress:function(address){this.set("address",address)},getCity:function(){return this.get("city")},setCity:function(city){this.set("city",city)},getState:function(){return this.get("state")},setState:function(state){this.set("state",state)},getZipcode:function(){return this.get("zipcode")},setZipcode:function(zipcode){this.set("zipcode",zipcode)},getPhoneNumber:function(){return this.get("phoneNumber")},setPhoneNumber:function(phoneNumber){this.set("phoneNumber",phoneNumber)}}})(window);(function(window){var Gitana=window.Gitana;Gitana.Registrar=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.Registrar"};this.base(platform,object)},getUri:function(){return"/registrars/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_REGISTRAR},clone:function(){return this.getFactory().registrar(this.getPlatform(),this)},listTenants:function(pagination){var self=this;var uriFunction=function(){return self.getUri()+"/tenants"};var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().tenantMap(this);return this.chainGet(chainable,uriFunction,params)},queryTenants:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/query"};var chainable=this.getFactory().tenantMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readTenant:function(tenantId){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/"+tenantId};var chainable=this.getFactory().tenant(this);return this.chainGet(chainable,uriFunction)},lookupTenantForPrincipal:function(principal){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/lookup?id="+principal.getDomainQualifiedId()};var chainable=this.getFactory().tenant(this);return this.chainGet(chainable,uriFunction)},createTenant:function(principal,planKey,paymentMethod){var self=this;var uriFunction=function(){return self.getUri()+"/tenants"};var object={};object.principalId=principal.getId();object.domainId=principal.getDomainId();object.planKey=planKey;if(paymentMethod){object.paymentMethod=paymentMethod}var chainable=this.getFactory().tenant(this);return this.chainCreate(chainable,object,uriFunction)},checkTenantPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkTenantAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/tenants/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listPlans:function(pagination){var self=this;var uriFunction=function(){return self.getUri()+"/plans"};var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().planMap(this);return this.chainGet(chainable,uriFunction,params)},queryPlans:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/plans/query"};var chainable=this.getFactory().planMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readPlan:function(planId){var self=this;var uriFunction=function(){return self.getUri()+"/plans/"+planId};var chainable=this.getFactory().plan(this);return this.chainGet(chainable,uriFunction)},createPlan:function(object){var self=this;var uriFunction=function(){return self.getUri()+"/plans"};var chainable=this.getFactory().plan(this);return this.chainCreate(chainable,object,uriFunction)},checkPlanPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/plans/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkPlanAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/plans/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listMeters:function(pagination){var self=this;var uriFunction=function(){return self.getUri()+"/meters"};var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().meterMap(this);return this.chainGet(chainable,uriFunction,params)},queryMeters:function(query,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/meters/query"};var chainable=this.getFactory().meterMap(this);var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainPost(chainable,uriFunction,params,query)},readMeter:function(meterId){var self=this;var uriFunction=function(){return self.getUri()+"/meters/"+meterId};var chainable=this.getFactory().meter(this);return this.chainGet(chainable,uriFunction)},createMeter:function(object){var self=this;var uriFunction=function(){return self.getUri()+"/meters"};var chainable=this.getFactory().meter(this);return this.chainCreate(chainable,object,uriFunction)},checkMeterPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/meters/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkMeterAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/meters/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RegistrarMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.RegistrarMap"};this.base(platform,object)},clone:function(){return this.getFactory().registrarMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().registrar(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractRegistrarObject=Gitana.AbstractPlatformObject.extend({constructor:function(registrar,object){this.base(registrar.getPlatform(),object);this.objectType=function(){return"Gitana.Meter"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getRegistrarId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Meter=Gitana.AbstractRegistrarObject.extend({constructor:function(registrar,object){this.base(registrar,object);this.objectType=function(){return"Gitana.Meter"}},getType:function(){return Gitana.TypedIDConstants.TYPE_PLAN},getUri:function(){return"/registrars/"+this.getRegistrarId()+"/meters/"+this.getId()},clone:function(){return this.getFactory().meter(this.getRegistrar(),this)}});Gitana.Meter.FIELD_TENANT_ID="tenantId";Gitana.Meter.FIELD_METER_TYPE="meterType";Gitana.Meter.FIELD_METER_START="meterStart";Gitana.Meter.FIELD_METER_END="meterEnd";Gitana.Meter.FIELD_MAX_BYTE_COUNT="maxByteCount";Gitana.Meter.FIELD_RAW_BYTE_COUNT="rawByteCount";Gitana.Meter.FIELD_RAW_BYTE_COUNT_PERCENTAGE="rawByteCountPercentage";Gitana.Meter.FIELD_UNPROCESSED_BYTE_COUNT="unprocessedByteCount";Gitana.Meter.FIELD_BILLABLE_BYTE_COUNT="billableByteCount";Gitana.Meter.FIELD_BILLABLE_BYTE_COUNT_PERCENTAGE="billableByteCountPercentage";Gitana.Meter.FIELD_MAX_OBJECT_COUNT="maxObjectCount";Gitana.Meter.FIELD_RAW_OBJECT_COUNT="rawObjectCount";Gitana.Meter.FIELD_RAW_OBJECT_COUNT_PERCENTAGE="rawObjectCountPercentage";Gitana.Meter.FIELD_UNPROCESSED_OBJECT_COUNT="unprocessedObjectCount";Gitana.Meter.FIELD_BILLABLE_OBJECT_COUNT="billableObjectCount";Gitana.Meter.FIELD_BILLABLE_OBJECT_COUNT_PERCENTAGE="billableObjectCountPercentage"})(window);(function(window){var Gitana=window.Gitana;Gitana.MeterMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(registrar,object){this.objectType=function(){return"Gitana.MeterMap"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()};this.base(registrar.getPlatform(),object)},clone:function(){return this.getFactory().planMap(this.getRegistrar(),this)},buildObject:function(json){return this.getFactory().plan(this.getRegistrar(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Plan=Gitana.AbstractRegistrarObject.extend({constructor:function(registrar,object){this.base(registrar,object);this.objectType=function(){return"Gitana.Plan"}},getType:function(){return Gitana.TypedIDConstants.TYPE_PLAN},getUri:function(){return"/registrars/"+this.getRegistrarId()+"/plans/"+this.getId()},clone:function(){return this.getFactory().plan(this.getRegistrar(),this)},getPlanKey:function(){return this.get("planKey")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.PlanMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(registrar,object){this.objectType=function(){return"Gitana.PlanMap"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()};this.base(registrar.getPlatform(),object)},clone:function(){return this.getFactory().planMap(this.getRegistrar(),this)},buildObject:function(json){return this.getFactory().plan(this.getRegistrar(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Tenant=Gitana.AbstractRegistrarObject.extend({constructor:function(registrar,object){this.base(registrar,object);this.objectType=function(){return"Gitana.Tenant"}},getType:function(){return Gitana.TypedIDConstants.TYPE_TENANT},getUri:function(){return"/registrars/"+this.getRegistrarId()+"/tenants/"+this.getId()},clone:function(){return this.getFactory().tenant(this.getRegistrar(),this)},getDnsSlug:function(){return this.get("dnsSlug")},getPlanKey:function(){return this.get("planKey")},getPrincipalId:function(){return this.get("principalId")},getPrincipalDomainId:function(){return this.get("domainId")},getPlatformId:function(){return this.get("platformId")},readTenantPlan:function(){var self=this;var uriFunction=function(){return self.getPlatform().getUri()+"/registrars/"+self.getRegistrarId()+"/plans/"+self.getPlanKey()};var chainable=this.getFactory().plan(this.getRegistrar());return this.chainGet(chainable,uriFunction)},readTenantPrincipal:function(){var self=this;var uriFunction=function(){return self.getPlatform().getUri()+"/domains/"+self.getPrincipalDomainId()+"/principals/"+self.getPrincipalId()};var domain=this.getFactory().domain(this.getPlatform(),{_doc:this.getPrincipalDomainId()});var chainable=this.getFactory().domainPrincipal(domain);return this.chainGet(chainable,uriFunction)},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),listAllocatedObjects:function(callback,objectType,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/objects"};var params={};if(pagination){Gitana.copyInto(params,pagination)}if(objectType){params.type=objectType}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response.rows)})},listAllocatedRepositoryObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"repository",pagination)},listAllocatedDomainObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"domain",pagination)},listAllocatedVaultObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"vault",pagination)},listAllocatedClientObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"client",pagination)},listAllocatedRegistrarObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"registrar",pagination)},listAllocatedStackObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"stack",pagination)},listAllocatedDirectoryObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"directory",pagination)},listAllocatedApplicationObjects:function(callback,pagination){return this.listAllocatedObjects(callback,"application",pagination)},readDefaultAllocatedClientObject:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/defaultclient"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){var client={};Gitana.copyInto(client,response);Gitana.stampInto(client,Gitana.ClientMethods);client.get=function(key){return this[key]};callback.call(this,client)})},listAutoClientMappingObjects:function(callback,pagination){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings"};var params={};if(pagination){Gitana.copyInto(params,pagination)}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response.rows)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TenantMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(registrar,object){this.objectType=function(){return"Gitana.TenantMap"};this.getRegistrar=function(){return registrar};this.getRegistrarId=function(){return registrar.getId()};this.base(registrar.getPlatform(),object)},clone:function(){return this.getFactory().tenantMap(this.getRegistrar(),this)},buildObject:function(json){return this.getFactory().tenant(this.getRegistrar(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Repository=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.Repository"}},getType:function(){return Gitana.TypedIDConstants.TYPE_REPOSITORY},getUri:function(){return"/repositories/"+this.getId()},clone:function(){return this.getFactory().repository(this.getPlatform(),this)},listBranches:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/branches"};var chainable=this.getFactory().branchMap(this);return this.chainGet(chainable,uriFunction,params)},readBranch:function(branchId){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/"+branchId};var chainable=this.getFactory().branch(this);return this.chainGet(chainable,uriFunction)},createBranch:function(branchId,changesetId,object){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches"};var createParams={branch:branchId,changeset:changesetId};var chainable=this.getFactory().branch(this);return this.chainCreate(chainable,object,uriFunction,createParams)},queryBranches:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/query"};var chainable=this.getFactory().branchMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkBranchPermissions:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkBranchAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/branches/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listChangesets:function(){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets"};var chainable=this.getFactory().changesetMap(this);return this.chainGet(chainable,uriFunction)},readChangeset:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/"+changesetId};var chainable=this.getFactory().changeset(this);return this.chainGet(chainable,uriFunction)},listChangesetParents:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/"+changesetId+"/parents"};var chainable=this.getFactory().changesetMap(this);return this.chainGet(chainable,uriFunction)},listChangesetChildren:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/"+changesetId+"/children"};var chainable=this.getFactory().changesetMap(this);return this.chainGet(chainable,uriFunction)},queryChangesets:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/changesets/query"};var chainable=this.getFactory().changesetMap(this);return this.chainPost(chainable,uriFunction,params,query)},listReleases:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/releases"};var chainable=this.getFactory().releaseMap(this);return this.chainGet(chainable,uriFunction,params)},readRelease:function(releaseId){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/"+releaseId};var chainable=this.getFactory().release(this);return this.chainGet(chainable,uriFunction)},createRelease:function(object,sourceId){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases"};var params={};if(sourceId){params.sourceId=sourceId}var chainable=this.getFactory().release(this);return this.chainCreate(chainable,object,uriFunction,params)},startCreateRelease:function(object,sourceId,callback){var self=this;if(typeof(object)==="function"){callback=object;sourceId=null;object=null}if(typeof(sourceId)==="function"){callback=sourceId;sourceId=null}var uriFunction=function(){return self.getUri()+"/releases/create/start"};if(!object){object={}}var params={};if(sourceId){params.sourceId=sourceId}return this.chainPostResponse(this,uriFunction,params,object).then(function(response){var jobId=response._doc;callback(jobId)})},queryReleases:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/query"};var chainable=this.getFactory().releaseMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkReleasePermissions:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkReleaseAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/releases/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listConflicts:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts"};var chainable=this.getFactory().mergeConflictMap(this);return this.chainGet(chainable,uriFunction,params)},readConflict:function(conflictId){var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/"+conflictId};var chainable=this.getFactory().mergeConflict(this);return this.chainGet(chainable,uriFunction)},queryConflicts:function(query,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/query"};var chainable=this.getFactory().mergeConflictMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkConflictPermissions:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkConflictAuthorities:function(checks,callback){var uriFunction=function(){return"/repositories/"+this.getId()+"/conflicts/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},getMaxSize:function(){return this.get("maxSize")},getSize:function(){return this.get("size")},getObjectCount:function(){return this.get("objectcount")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.RepositoryMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.RepositoryMap"};this.base(platform,object)},clone:function(){return this.getFactory().repositoryMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().repository(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractRepositoryObject=Gitana.AbstractPlatformObject.extend({constructor:function(repository,object){this.base(repository.getPlatform(),object);this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getRepositoryId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractNode=Gitana.AbstractRepositoryObject.extend({constructor:function(branch,object){this.__qname=(function(){var _qname=null;return function(qname){if(!Gitana.isUndefined(qname)){_qname=qname}return _qname}})();this.__type=(function(){var _type=null;return function(type){if(!Gitana.isUndefined(type)){_type=type}return _type}})();this.__features=(function(){var _features={};return function(features){if(!Gitana.isUndefined(features)){_features=features}return _features}})();this.__stats=(function(){var _stats={};return function(stats){if(!Gitana.isUndefined(stats)){_stats=stats}return _stats}})();this.__is_association=(function(){var _is_association=false;return function(is_association){if(!Gitana.isUndefined(is_association)){_is_association=is_association}return _is_association}})();this.base(branch.getRepository(),object);this.getBranch=function(){return branch};this.getBranchId=function(){return branch.getId()}},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()},ref:function(){return"node://"+this.getPlatformId()+"/"+this.getRepositoryId()+"/"+this.getBranchId()+"/"+this.getId()},clone:function(){return this.getFactory().node(this.getBranch(),this)},handleSystemProperties:function(response){this.base(response);if(this["_qname"]){var _qname=this["_qname"];delete this["_qname"];this.__qname(_qname)}if(this["_type"]){var _type=this["_type"];delete this["_type"];this.__type(_type)}if(this["_features"]){var _features=this["_features"];delete this["_features"];this.__features(_features)}if(this["_statistics"]&&typeof(this["_statistics"])=="object"){var stats=this["_statistics"];delete this["_statistics"];this.__stats(stats)}if(!Gitana.isUndefined(this["_is_association"])){var _is_association=this["_is_association"];delete this["_is_association"];this.__is_association(_is_association)}},chainCopyState:function(otherObject){this.base(otherObject);if(otherObject.__qname){this.__qname(otherObject.__qname())}if(otherObject.__type){this.__type(otherObject.__type())}if(otherObject.__features){this.__features(otherObject.__features())}if(otherObject.__stats){this.__stats(otherObject.__stats())}if(otherObject.__is_association){this.__is_association(otherObject.__is_association())}},stats:function(){return this.__stats()},getFeatureIds:function(callback){var self=this;var f=function(){var featureIds=[];for(var featureId in this.__features()){featureIds[featureIds.length]=featureId}return featureIds};if(callback){return this.then(function(){callback.call(this,f.call(self))})}return f.call(self)},getFeature:function(featureId,callback){var self=this;if(callback){return this.then(function(){callback.call(this,self.__features()[featureId])})}return self.__features()[featureId]},removeFeature:function(featureId){var self=this;var uriFunction=function(){return self.getUri()+"/features/"+featureId};return this.chainDelete(this,uriFunction).reload().then(function(){self.loadFrom(this)})},addFeature:function(featureId,featureConfig){var self=this;var uriFunction=function(){return self.getUri()+"/features/"+featureId};if(!featureConfig){featureConfig={}}return this.chainPostEmpty(null,uriFunction,{},featureConfig).reload().then(function(){self.loadFrom(this)})},hasFeature:function(featureId,callback){if(callback){return this.then(function(){var hasFeature=!Gitana.isEmpty(this.__features()[featureId]);callback.call(this,hasFeature)})}return !Gitana.isEmpty(this.__features()[featureId])},isAssociation:function(){return this.__is_association()},isContainer:function(){return this.hasFeature("f:container")},touch:function(){var self=this;var uriFunction=function(){return self.getUri()+"/touch"};return this.chainPost(null,uriFunction)},getTypeQName:function(){return this.__type()},changeTypeQName:function(typeQName){var self=this;var uriFunction=function(){return self.getUri()+"/change_type?type="+typeQName};return this.chainPostEmpty(null,uriFunction).reload().then(function(){self.loadFrom(this)})},getQName:function(){return this.__qname()},changeQName:function(qname){var self=this;var uriFunction=function(){return self.getUri()+"/change_qname?qname="+qname};return this.chainPostEmpty(null,uriFunction).reload().then(function(){self.loadFrom(this)})},listAttachments:Gitana.Methods.listAttachments(Gitana.NodeAttachmentMap),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attachmentDownloadUri:function(attachmentId){return this.getDriver().baseURL+this.getUri()+"/attachments/"+attachmentId},attach:function(attachmentId,contentType,data,filename){var paramsFunction=function(params){if(filename){params.filename=filename}};var delegate=Gitana.Methods.attach.call(this,Gitana.NodeAttachment,paramsFunction);return delegate.call(this,attachmentId,contentType,data)},getPreviewUri:Gitana.Methods.getPreviewUri(),unattach:Gitana.Methods.unattach()})})(window);(function(window){var Gitana=window.Gitana;Gitana.NodeAttachment=Gitana.BinaryAttachment.extend({constructor:function(persistable,attachment){this.base(persistable,attachment)},getFilename:function(){return this.filename}})})(window);(function(window){var Gitana=window.Gitana;Gitana.NodeAttachmentMap=Gitana.BinaryAttachmentMap.extend({constructor:function(persistable,object){this.base(persistable,object);this.objectType=function(){return"Gitana.NodeAttachmentMap"}},clone:function(){return new Gitana.NodeAttachmentMap(this.__persistable(),this)},buildObject:function(attachment){return new Gitana.NodeAttachment(this.__persistable(),attachment)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Association=Gitana.AbstractNode.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Association"}},getType:function(){return Gitana.TypedIDConstants.TYPE_ASSOCIATION},isAssociation:function(){return true},getDirectionality:function(){return this.get("directionality")},getSourceNodeId:function(){return this.get("source")},getSourceNodeChangesetId:function(){return this.get("source_changeset")},getSourceNodeType:function(){return this.get("source_type")},getTargetNodeId:function(){return this.get("target")},getTargetNodeChangesetId:function(){return this.get("target_changeset")},getTargetNodeType:function(){return this.get("target_type")},readSourceNode:function(){var self=this;var result=this.subchain(this.getFactory().node(this.getBranch()));return result.then(function(){var chain=this;this.subchain(self.getBranch()).readNode(self.getSourceNodeId()).then(function(){chain.loadFrom(this)})})},readTargetNode:function(){var self=this;var result=this.subchain(this.getFactory().node(this.getBranch()));return result.then(function(){var chain=this;this.subchain(self.getBranch()).readNode(self.getTargetNodeId()).then(function(){chain.loadFrom(this)})})},readOtherNode:function(node){var self=this;var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}var result=this.subchain(this.getFactory().node(this.getBranch()));result.then(function(){var chain=this;this.subchain(self).then(function(){if(nodeId==this.getSourceNodeId()){this.readTargetNode().then(function(){chain.loadFrom(this)})}else{if(nodeId==this.getTargetNodeId()){this.readSourceNode().then(function(){chain.loadFrom(this)})}else{var err=new Gitana.Error();err.name="No node on association";err.message="The node: "+nodeId+" was not found on this association";this.error(err);return false}}})});return result},getDirection:function(node){var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}var direction=null;if(this.getDirectionality()=="UNDIRECTED"){direction="MUTUAL"}else{if(this.getSourceNodeId()==nodeId){direction="OUTGOING"}else{if(this.getTargetNodeId()==nodeId){direction="INCOMING"}}}return direction},getOtherNodeId:function(node){var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}var otherNodeId=null;if(this.getSourceNodeId()==nodeId){otherNodeId=this.getTargetNodeId()}else{if(this.getTargetNodeId()==nodeId){otherNodeId=this.getSourceNodeId()}}return otherNodeId}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Branch=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.Branch"}},getType:function(){return Gitana.TypedIDConstants.TYPE_BRANCH},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getId()},clone:function(){return this.getFactory().branch(this.getRepository(),this)},isMaster:function(){return(this.getBranchType().toLowerCase()=="master")},getBranchType:function(){return this.get("type")},getTip:function(){return this.get("tip")},listMounts:function(pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes"};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,params)},readNode:function(nodeId,path){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/"+nodeId};var params={};if(path){params.path=path}var chainable=this.getFactory().node(this);return this.chainGet(chainable,uriFunction,params)},rootNode:function(){return this.readNode("root")},createNode:function(object,options){var self=this;var uriFunction=function(){return self.getUri()+"/nodes"};var params={};if(options){var rootNodeId="root";var associationType="a:child";var filePath=null;var parentFolderPath=null;var fileName=null;if(typeof(options)==="string"){var rootPrefixedFilePath=options;if(Gitana.startsWith(rootPrefixedFilePath,"/")){rootPrefixedFilePath=rootPrefixedFilePath.substring(1)}if(rootPrefixedFilePath==""){filePath="/"}else{var i=rootPrefixedFilePath.indexOf("/");rootNodeId=rootPrefixedFilePath.substring(0,i);filePath=rootPrefixedFilePath.substring(i+1)}}else{if(typeof(options)==="object"){if(options.rootNodeId){rootNodeId=options.rootNodeId}if(options.associationType){associationType=options.associationType}if(options.fileName){fileName=options.fileName}else{if(options.filename){fileName=options.filename}}if(options.parentFolderPath){parentFolderPath=options.parentFolderPath}else{if(options.folderPath){parentFolderPath=options.folderPath}else{if(options.folderpath){parentFolderPath=options.folderpath}}}if(options.filePath){filePath=options.filePath}else{if(options.filepath){filePath=options.filepath}}}}if(rootNodeId){params.rootNodeId=rootNodeId}if(associationType){params.associationType=associationType}if(fileName){params.fileName=fileName}if(filePath){params.filePath=filePath}if(parentFolderPath){params.parentFolderPath=parentFolderPath}if(options.params){for(var param in options.params){params[param]=options.params[param]}}}var chainable=this.getFactory().node(this);return this.chainCreate(chainable,object,uriFunction,params)},searchNodes:function(search,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}if(Gitana.isString(search)){search={search:search}}var uriFunction=function(){return self.getUri()+"/nodes/search"};var chainable=this.getFactory().nodeMap(this);return this.chainPost(chainable,uriFunction,params,search)},queryNodes:function(query,pagination){var self=this;if(!query){query={}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes/query"};var chainable=this.getFactory().nodeMap(this);if(!Gitana.PREFER_GET_OVER_POST){return this.chainPost(chainable,uriFunction,params,query)}else{Gitana.copyInto(params,{query:JSON.stringify(query)});return this.chainGet(chainable,uriFunction,params)}},queryOne:function(query,errHandler){return this.queryNodes(query).keepOne(function(err){if(errHandler){errHandler(err);return false}})},deleteNodes:function(nodeIds){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/delete"};return this.chainPost(this,uriFunction,{},{_docs:nodeIds})},checkNodePermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkNodeAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/nodes/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},readPersonNode:function(user,createIfNotFound){var self=this;var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(user);var uriFunction=function(){var uri=self.getUri()+"/person/acquire?id="+principalDomainQualifiedId;if(createIfNotFound){uri+="&createIfNotFound="+createIfNotFound}return uri};var chainable=this.getFactory().node(this,"n:person");return this.chainGet(chainable,uriFunction)},readGroupNode:function(group,createIfNotFound){var self=this;var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(group);var uriFunction=function(){var uri=self.getUri()+"/group/acquire?id="+principalDomainQualifiedId;if(createIfNotFound){uri+="&createIfNotFound="+createIfNotFound}return uri};var chainable=this.getFactory().node(this,"n:group");return this.chainGet(chainable,uriFunction)},listDefinitions:function(filter,pagination){if(filter&&typeof(filter)==="object"){pagination=filter;filter=null}var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var uri=self.getUri()+"/definitions";params.capabilities="true";if(filter){params.filter=filter}return uri};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,params)},readDefinition:function(qname){var self=this;var uriFunction=function(){return self.getUri()+"/definitions/"+qname};var chainable=this.getFactory().definition(this);return this.chainGet(chainable,uriFunction)},loadSchemas:function(filter,callback){if(typeof(filter)=="function"){callback=filter;filter=null}var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/schemas";if(filter){uri+="?filter="+filter}self.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response);chain.next()});return false})},loadSchema:function(qname,callback){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/schemas/"+qname;self.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response);chain.next()});return false})},generateQName:function(object,callback){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/qnames/generate";self.getDriver().gitanaPost(uri,null,object,function(response){var qname=response._qname;callback.call(chain,qname);chain.next()});return false})},associate:function(sourceNode,targetNode,object){var sourceNodeId=null;if(Gitana.isString(sourceNode)){sourceNodeId=sourceNode}else{sourceNodeId=sourceNode.getId()}var targetNodeId=null;if(Gitana.isString(targetNode)){targetNodeId=targetNode}else{targetNodeId=targetNode.getId()}var result=this.subchain(this);result.subchain(this).then(function(){this.readNode(sourceNodeId).associate(targetNodeId,object)});return result},traverse:function(node,config){var nodeId=null;if(Gitana.isString(node)){nodeId=node}else{nodeId=node.getId()}return this.readNode(nodeId).traverse(config)},createContainer:function(object){if(!object){object={}}if(!object._features){object._features={}}object._features["f:container"]={active:"true"};return this.createNode(object)},find:function(config,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/nodes/find"};var chainable=this.getFactory().nodeMap(this);return this.chainPost(chainable,uriFunction,params,config)},findNodes:function(config,pagination){return this.find(config,pagination)},listItems:function(listKey,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/lists/"+listKey+"/items"};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,pagination)},queryItems:function(listKey,query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/lists/"+listKey+"/items/query"};var chainable=this.getFactory().nodeMap(this);return this.chainPost(chainable,uriFunction,params,query)},loadForms:function(filter,callback){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/forms";if(filter){uri+="?filter="+filter}self.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response);chain.next()});return false})},adminRebuildPathIndexes:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/paths/index";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminRebuildSearchIndexes:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/search/index";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminContentMaintenance:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/content";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},adminUpgradeSchema:function(){var self=this;return this.then(function(){var chain=this;var uri=self.getUri()+"/admin/upgradeschema";self.getDriver().gitanaPost(uri,null,{},function(response){chain.next()});return false})},createForExport:function(exportId,config,callback){var self=this;if(!config){config={}}if(!config.repositoryId){config.repositoryId=self.getRepositoryId()}if(!config.branchId){config.branchId=self.getId()}if(!config.properties){config.properties={}}if(!config.parentFolderPath){config.parentFolderPath={}}var uriFunction=function(){return"/ref/exports/"+exportId+"/generate"};var params={};return this.chainPostResponse(this,uriFunction,params,config).then(function(response){callback(response)})},loadInfo:function(callback){var uriFunction=function(){return this.getUri()+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},createCustomIndex:function(name,index){var self=this;var payload=null;if(typeof(index)==="undefined"){payload=name}else{payload={name:name,index:index}}var uriFunction=function(){return self.getUri()+"/indexes"};return this.chainPost(this,uriFunction,{},payload)},dropCustomIndex:function(name){var self=this;var uriFunction=function(){return self.getUri()+"/indexes/"+name};return this.chainDelete(this,uriFunction)},loadCustomIndexes:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/indexes"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},loadHistoryChangesets:function(config,pagination,callback){var self=this;if(typeof(pagination)==="function"){callback=pagination;pagination=null}if(typeof(config)==="function"){callback=config;config={};pagination=null}if(!config){config={}}var uriFunction=function(){return self.getUri()+"/history/changesets"};var params={};if(pagination){Gitana.copyInto(params,pagination)}if(config.root){params.root=config.root}if(config.tip){params.tip=config.tip}if(config.include_root){params.include_root=config.include_root}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})},loadHistoryNodeDiffs:function(config,pagination,callback){var self=this;if(typeof(pagination)==="function"){callback=pagination;pagination=null}if(typeof(config)==="function"){callback=config;config={};pagination=null}if(!config){config={}}var uriFunction=function(){return self.getUri()+"/history/nodediffs"};var params={};if(pagination){Gitana.copyInto(params,pagination)}if(config.root){params.root=config.root}if(config.tip){params.tip=config.tip}if(config.include_root){params.include_root=config.include_root}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Changeset=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.Changeset"}},getType:function(){return Gitana.TypedIDConstants.TYPE_CHANGESET},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/changesets/"+this.getId()},clone:function(){return this.getFactory().changeset(this.getRepository(),this)},listNodes:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/changesets/"+this.getId()+"/nodes"};var chainable=this.getFactory().nodeMap(this);return this.chainGet(chainable,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Node=Gitana.AbstractNode.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Node"}},getType:function(){return Gitana.TypedIDConstants.TYPE_NODE},listChildren:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/children"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},listRelatives:function(config,pagination){var type=null;var direction=null;if(config){type=config.type;if(config.direction){direction=config.direction.toUpperCase()}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/relatives";if(type){url=url+"?type="+type}if(direction){if(type){url=url+"&direction="+direction}else{url=url+"?direction="+direction}}return url};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},queryRelatives:function(query,config,pagination){var type=null;var direction=null;if(config){type=config.type;if(config.direction){direction=config.direction.toUpperCase()}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/relatives/query";if(type){url=url+"?type="+type}if(direction){if(type){url=url+"&direction="+direction}else{url=url+"?direction="+direction}}return url};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainPost(chainable,uriFunction,params,query)},associations:function(config,pagination){var type=null;var direction=null;if(config){type=config.type;if(config.direction){direction=config.direction.toUpperCase()}}var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/associations?a=1";if(type){url=url+"&type="+type}if(direction){url=url+"&direction="+direction}return url};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},incomingAssociations:function(type,pagination){var config={direction:"INCOMING"};if(type){config.type=type}return this.associations(config,pagination)},outgoingAssociations:function(type,pagination){var config={direction:"OUTGOING"};if(type){config.type=type}return this.associations(config,pagination)},associate:function(targetNodeId,object,undirected){if(!Gitana.isString(targetNodeId)){targetNodeId=targetNodeId.getId()}if(object){if(Gitana.isString(object)){object={_type:object}}}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/associate?node="+targetNodeId;if(undirected){url+="&directionality=UNDIRECTED"}return url};return this.chainPostEmpty(null,uriFunction,null,object)},associateOf:function(sourceNode,object,undirected){var self=this;var result=this.subchain(this);result.subchain(sourceNode).then(function(){this.associate(self,object,undirected)});return result},unassociate:function(targetNodeId,type,undirected){if(!Gitana.isString(targetNodeId)){targetNodeId=targetNodeId.getId()}var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/unassociate?node="+targetNodeId;if(type){url=url+"&type="+type}if(undirected){url+="&directionality=UNDIRECTED"}return url};return this.chainPostEmpty(null,uriFunction)},traverse:function(config){var payload={traverse:config};var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/traverse"};var chainable=this.getFactory().traversalResults(this.getBranch());var params={};return this.chainPost(chainable,uriFunction,params,payload)},mount:function(mountKey){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/mount/"+mountKey};return this.chainPostEmpty(null,uriFunction,null,object)},unmount:function(){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/unmount"};return this.chainPostEmpty(null,uriFunction,null,object)},lock:function(){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/lock"};return this.chainPostEmpty(null,uriFunction)},unlock:function(){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/unlock"};return this.chainPostEmpty(null,uriFunction)},checkLocked:function(callback){return this.subchain(this).then(function(){var chain=this;var uri="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/lock";this.getDriver().gitanaGet(uri,null,{},function(response){callback.call(chain,response.locked);chain.next()});return false})},loadACL:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/acl/list"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response)})},listAuthorities:function(principal){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/acl?id="+principalDomainQualifiedId};return this.chainGetResponseRows(this,uriFunction)},checkAuthority:function(principal,authorityId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities/"+authorityId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},grantAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities/"+authorityId+"/grant?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAuthority:function(principal,authorityId){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities/"+authorityId+"/revoke?id="+principalDomainQualifiedId};return this.chainPostEmpty(null,uriFunction)},revokeAllAuthorities:function(principal){return this.revokeAuthority(principal,"all")},loadAuthorityGrants:function(principalIds,callback){if(!principalIds){principalIds=[]}var json={principals:principalIds};return this.chainPostResponse(this,"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/authorities",{},json).then(function(response){callback.call(this,response)})},checkPermission:function(principal,permissionId,callback){var principalDomainQualifiedId=this.extractPrincipalDomainQualifiedId(principal);var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/permissions/"+permissionId+"/check?id="+principalDomainQualifiedId};return this.chainPostResponse(this,uriFunction).then(function(response){callback.call(this,response.check)})},listAuditRecords:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/auditrecords"};var chainable=this.getFactory().auditRecordMap(this.getRepository());return this.chainGet(chainable,uriFunction,params)},createTranslation:function(edition,locale,object){var uriFunction=function(){var url="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n?locale="+locale;if(edition){url+="&edition="+edition}return url};var chainable=this.getFactory().node(this.getBranch());return this.chainCreateEx(chainable,object,uriFunction,uriFunction)},editions:function(callback){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n/editions"};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response.editions)})},locales:function(edition,callback){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n/locales?edition="+edition};return this.chainGetResponse(this,uriFunction).then(function(response){callback.call(this,response.locales)})},listTranslations:function(edition,pagination){var params={};if(edition){params.edition=edition}if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n/translations"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},readTranslation:function(){var edition;var locale;var args=Gitana.makeArray(arguments);if(args.length==1){locale=args.shift()}else{if(args.length>1){edition=args.shift();locale=args.shift()}}var uriFunction=function(){var uri="/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/i18n?locale="+locale;if(edition){uri+="&edition="+edition}return uri};var chainable=this.getFactory().node(this.getBranch());return this.chainGet(chainable,uriFunction)},createChild:function(object){var self=this;var branch=new Gitana.Branch(this.getRepository());var chainable=this.getFactory().node(branch);return this.subchain(chainable).then(function(){var chain=this;this.subchain(self).then(function(){branch.loadFrom(this.getBranch());this.subchain(branch).createNode(object).then(function(){chain.loadFrom(this);this.childOf(self)})})})},childOf:function(sourceNode){return this.associateOf(sourceNode,"a:child")},find:function(config,pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/find"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainPost(chainable,uriFunction,params,config)},loadTree:function(config,callback){var self=this;if(typeof(config)==="function"){callback=config;config=null}if(!config){config={}}var uriFunction=function(){return self.getUri()+"/tree"};var params={};if(config.leafPath){params.leaf=config.leafPath}if(config.basePath){params.base=config.basePath}if(config.containers){params.containers=true}if(config.properties){params.properties=true}params.depth=1;if(config.depth){params.depth=config.depth}return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response)})},resolvePath:function(rootNodeId,callback){var self=this;var uriFunction=function(){return self.getUri()+"/path"};var params={rootNodeId:rootNodeId};return this.chainGetResponse(this,uriFunction,params).then(function(response){callback.call(this,response.path)})},listVersions:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return this.getUri()+"/versions"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction,params)},restoreVersion:function(changesetId){var uriFunction=function(){return"/repositories/"+this.getRepositoryId()+"/branches/"+this.getBranchId()+"/nodes/"+this.getId()+"/versions/"+changesetId+"/restore"};var chainable=this.getFactory().node(this.getBranch());return this.chainPost(chainable,uriFunction,{},{})},moveToFolder:function(targetFolder){var self=this;var params={};params.targetNodeId=targetFolder.getId?targetFolder.getId():targetFolder;var uriFunction=function(){return self.getUri()+"/move"};return this.chainPostEmpty(this,uriFunction,params)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Release=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.Release"}},getType:function(){return Gitana.TypedIDConstants.TYPE_RELEASE},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/releases/"+this.getId()},clone:function(){return this.getFactory().release(this.getRepository(),this)},finalize:function(object,callback){if(typeof(object)==="function"){callback=object;object=null}if(!object){object={}}var self=this;var uriFunction=function(){return self.getUri()+"/finalize"};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback(response)})},unfinalize:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/unfinalize"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})},loadInfo:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/info"};return this.chainGetResponse(this,uriFunction,{}).then(function(response){callback(response)})},startFinalize:function(object,callback){var self=this;if(typeof(object)==="function"){callback=object;object=null}var uriFunction=function(){return self.getUri()+"/finalize/start"};if(!object){object={}}return this.chainPostResponse(this,uriFunction,{},object).then(function(response){var jobId=response._doc;callback(jobId)})},archive:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/archive"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})},unarchive:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/unarchive"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})},releaseImmediately:function(callback){var self=this;var uriFunction=function(){return self.getUri()+"/releaseimmediately"};return this.chainPostResponse(this,uriFunction).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.MergeConflict=Gitana.AbstractRepositoryObject.extend({constructor:function(repository,object){this.base(repository,object);this.objectType=function(){return"Gitana.MergeConflict"}},getType:function(){return Gitana.TypedIDConstants.TYPE_RELEASE},getUri:function(){return"/repositories/"+this.getRepositoryId()+"/conflicts/"+this.getId()},clone:function(){return this.getFactory().mergeConflict(this.getRepository(),this)},resolve:function(resolution,callback){var self=this;var uriFunction=function(){return self.getUri()+"/resolve"};var params={resolution:resolution};return this.chainPostResponse(this,uriFunction,params).then(function(response){callback(response)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.BranchMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.BranchMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().branchMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().branch(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ChangesetMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.ChangesetMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().changesetMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().changeset(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.NodeMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(branch,object){this.objectType=function(){return"Gitana.NodeMap"};this.getRepository=function(){return branch.getRepository()};this.getRepositoryId=function(){return branch.getRepository().getId()};this.getBranch=function(){return branch};this.getBranchId=function(){return branch.getId()};this.base(branch.getPlatform(),object)},clone:function(){return this.getFactory().nodeMap(this.getBranch(),this)},buildObject:function(json){return this.getFactory().node(this.getBranch(),json)},del:function(){var self=this;var uriFunction=function(){return self.getBranch().getUri()+"/nodes/delete"};return this.subchain().then(function(){var nodeIds=this.__keys();return this.chainPost(this,uriFunction,{},{_docs:nodeIds})})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.ReleaseMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.ReleaseMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().releaseMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().release(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.MergeConflictMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(repository,object){this.objectType=function(){return"Gitana.MergeConflictMap"};this.getRepository=function(){return repository};this.getRepositoryId=function(){return repository.getId()};this.base(repository.getPlatform(),object)},clone:function(){return this.getFactory().mergeConflictMap(this.getRepository(),this)},buildObject:function(json){return this.getFactory().mergeConflict(this.getRepository(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TraversalResults=Gitana.AbstractPersistable.extend({constructor:function(branch,object){if(!this._nodes){this._nodes={}}if(!this._associations){this._associations={}}if(!this._config){this._config={}}this.base(branch.getDriver(),object);this.getRepository=function(){return branch.getRepository()};this.getRepositoryId=function(){return branch.getRepository().getId()};this.getBranch=function(){return branch};this.getBranchId=function(){return branch.getId()}},clear:function(){Gitana.deleteProperties(this._nodes,true);Gitana.deleteProperties(this._associations,true);Gitana.deleteProperties(this._config,true)},handleResponse:function(response){this.clear();this.handleSystemProperties(response);Gitana.copyInto(this._nodes,response.nodes);Gitana.copyInto(this._associations,response.associations);Gitana.copyInto(this._config,response.config);this._config.center=response.node},center:function(){var chainable=this.getFactory().node(this.getBranch());var result=this.subchain(chainable);result.subchain(this.getBranch()).readNode(this._config.center).then(function(){result.handleResponse(this)});return result},nodeCount:function(callback){return this.then(function(){callback.call(this,Gitana.getNumberOfKeys(this._nodes))})},associationCount:function(callback){return this.then(function(){callback.call(this,Gitana.getNumberOfKeys(this._associations))})},nodes:function(){var self=this;var result=this.subchain(this.getFactory().nodeMap(this.getBranch()));return result.then(function(){var chain=this;var response={rows:self._nodes};chain.handleResponse(response)})},node:function(id){var self=this;var result=this.subchain(this.getFactory().node(this.getBranch()));return result.then(function(){var nodeObject=self._nodes[id];if(!nodeObject){return self.missingNodeError(id)}this.handleResponse(nodeObject)})},associations:function(){var self=this;var result=this.subchain(this.getFactory().nodeMap(this.getBranch()));return result.then(function(){var chain=this;var response={rows:self._associations};chain.handleResponse(response)})},association:function(id){var self=this;var result=this.subchain(this.getFactory().association(this.getBranch()));return result.then(function(){var associationObject=self._associations[id];if(!associationObject){return self.missingNodeError(id)}this.handleResponse(associationObject)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Definition=Gitana.Node.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Definition"}},clone:function(){return this.getFactory().definition(this.getBranch(),this)},listFormAssociations:function(){var self=this;var uriFunction=function(){return self.getUri()+"/forms"};var chainable=this.getFactory().nodeMap(this.getBranch());return this.chainGet(chainable,uriFunction)},readForm:function(formKey){var self=this;var uriFunction=function(){return self.getUri()+"/forms/"+formKey};var chainable=this.getFactory().form(this.getBranch());return this.chainGet(chainable,uriFunction)},createForm:function(formKey,formObject,formPath){var self=this;if(typeof(formObject)==="string"){formPath=formObject;formObject=null}if(!formObject){formObject={}}formObject._type="n:form";var chainable=this.getFactory().form(this.getBranch());var result=this.subchain(chainable);result.subchain(this.getBranch()).createNode(formObject,formPath).then(function(){var formNode=this;this.subchain(self).then(function(){var associationObject={_type:"a:has_form","form-key":formKey};this.associate(formNode,associationObject).then(function(){var association=this;var uri="/repositories/"+formNode.getRepositoryId()+"/branches/"+formNode.getBranchId()+"/nodes/"+formNode.getId();this.getDriver().gitanaGet(uri,null,{},function(response){result.handleResponse(response);association.next()});return false})})});return result},removeFormAssociation:function(formKey){return this.subchain(this).then(function(){var association=null;this.listFormAssociations().each(function(){if(this.getFormKey()==formKey){association=this}}).then(function(){if(association){this.subchain(association).del()}})})}});Gitana.ObjectFactory.register("d:type",Gitana.Definition);Gitana.ObjectFactory.register("d:feature",Gitana.Definition);Gitana.ObjectFactory.register("d:association",Gitana.Definition)})(window);(function(window){var Gitana=window.Gitana;Gitana.Form=Gitana.Node.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Form"}},clone:function(){return this.getFactory().form(this.getBranch(),this)},getEngineId:function(){return this.get("engineId")},setEngineId:function(engineId){this.set("engineId",engineId)}});Gitana.ObjectFactory.register("n:form",Gitana.Form)})(window);(function(window){var Gitana=window.Gitana;Gitana.HasFormAssociation=Gitana.Association.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.HasFormAssociation"}},clone:function(){return new Gitana.HasFormAssociation(this.getBranch(),this)},getFormKey:function(){return this.get("form-key")},setFormKey:function(formKey){this.set("form-key",formKey)}});Gitana.ObjectFactory.register("a:has_form",Gitana.HasFormAssociation)})(window);(function(window){var Gitana=window.Gitana;Gitana.HasTranslationAssociation=Gitana.Association.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.HasTranslationAssociation"}},clone:function(){return new Gitana.HasTranslationAssociation(this.getBranch(),this)},getLocale:function(){return this.get("locale")},setLocale:function(locale){this.set("locale",locale)},getEdition:function(){return this.get("edition")},setEdition:function(edition){this.set("edition",edition)}});Gitana.ObjectFactory.register("a:has_translation",Gitana.HasTranslationAssociation)})(window);(function(window){var Gitana=window.Gitana;Gitana.Person=Gitana.Node.extend({constructor:function(branch,object){this.base(branch,object);this.objectType=function(){return"Gitana.Person"}},clone:function(){return new Gitana.Person(this.getBranch(),this)},getPrincipalName:function(){return this.get("principal-name")},getPrincipalType:function(){return this.get("principal-type")},getPrincipalId:function(){return this.get("principal-id")},getPrincipalDomainId:function(){return this.get("principal-domain")},readPrincipal:function(){return this.subchain(this.getPlatform()).readDomain(this.getPrincipalDomainId()).readPrincipal(this.getPrincipalId())},getFirstName:function(){return this.get("firstName")},setFirstName:function(firstName){this.set("firstName",firstName)},getLastName:function(){return this.get("lastName")},setLastName:function(lastName){this.set("lastName",lastName)},getCompanyName:function(){return this.get("companyName")},setCompanyName:function(companyName){this.set("companyName",companyName)},getEmail:function(){return this.get("email")},setEmail:function(email){this.set("email",email)},getJobTitle:function(){return this.get("jobTitle")},setJobTitle:function(jobTitle){this.set("jobTitle",jobTitle)},getAddress:function(){return this.get("address")},setAddress:function(address){this.set("address",address)},getCity:function(){return this.get("city")},setCity:function(city){this.set("city",city)},getState:function(){return this.get("state")},setState:function(state){this.set("state",state)},getZipcode:function(){return this.get("zipcode")},setZipcode:function(zipcode){this.set("zipcode",zipcode)},getPhoneNumber:function(){return this.get("phoneNumber")},setPhoneNumber:function(phoneNumber){this.set("phoneNumber",phoneNumber)}});Gitana.ObjectFactory.register("n:person",Gitana.Person)})(window);(function(window){var Gitana=window.Gitana;Gitana.Vault=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.base(platform,object);this.objectType=function(){return"Gitana.Vault"}},getType:function(){return Gitana.TypedIDConstants.TYPE_VAULT},getUri:function(){return"/vaults/"+this.getId()},clone:function(){return this.getFactory().vault(this.getPlatform(),this)},listArchives:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var chainable=this.getFactory().archiveMap(this);return this.chainGet(chainable,this.getUri()+"/archives",params)},readArchive:function(archiveId){var chainable=this.getFactory().archive(this);return this.chainGet(chainable,this.getUri()+"/archives/"+archiveId)},lookupArchive:function(groupId,artifactId,versionId){var chainable=this.getFactory().archive(this);return this.chainGet(chainable,this.getUri()+"/archives/lookup?group="+groupId+"&artifact="+artifactId+"&version="+versionId)},queryArchives:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/archives/query"};var chainable=this.getFactory().archiveMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkArchivePermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/archives/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkArchiveAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/archives/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.VaultMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.VaultMap"};this.base(platform,object)},clone:function(){return this.getFactory().vaultMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().vault(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractVaultObject=Gitana.AbstractPlatformObject.extend({constructor:function(vault,object){this.base(vault.getPlatform(),object);this.objectType=function(){return"Gitana.Archive"};this.getVault=function(){return vault};this.getVaultId=function(){return vault.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getVaultId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Archive=Gitana.AbstractVaultObject.extend({constructor:function(vault,object){this.base(vault,object);this.objectType=function(){return"Gitana.Archive"}},getType:function(){return Gitana.TypedIDConstants.TYPE_ARCHIVE},getUri:function(){return"/vaults/"+this.getVaultId()+"/archives/"+this.getId()},clone:function(){return this.getFactory().archive(this.getVault(),this)},getDownloadUri:function(){return this.getProxiedUri()+"/download"},listAttachments:Gitana.Methods.listAttachments(),attachment:function(attachmentId){return this.listAttachments().select(attachmentId)},attach:Gitana.Methods.attach(),unattach:Gitana.Methods.unattach(),getPreviewUri:Gitana.Methods.getPreviewUri()})})(window);(function(window){var Gitana=window.Gitana;Gitana.ArchiveMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(vault,object){this.objectType=function(){return"Gitana.ArchiveMap"};this.getVault=function(){return vault};this.getVaultId=function(){return vault.getId()};this.base(vault.getPlatform(),object)},clone:function(){return this.getFactory().archiveMap(this.getVault(),this)},buildObject:function(json){return this.getFactory().archive(this.getVault(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.WebHost=Gitana.AbstractPlatformDataStore.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.WebHost"};this.base(platform,object)},getUri:function(){return"/webhosts/"+this.getId()},getType:function(){return Gitana.TypedIDConstants.TYPE_WEB_HOST},clone:function(){return this.getFactory().webhost(this.getPlatform(),this)},getUrlPatterns:function(){return this.get("urlPatterns")},createAutoClientMapping:function(uri,applicationId,clientKey,authGrantKey,object){if(!object){object={}}if(!Gitana.isString(applicationId)){applicationId=applicationId.getId()}if(!Gitana.isString(clientKey)){clientKey=clientKey.getKey()}if(!Gitana.isString(authGrantKey)){authGrantKey=authGrantKey.getKey()}object.uri=uri;object.applicationId=applicationId;object.clientKey=clientKey;object.authGrantKey=authGrantKey;var uriFunction=function(){return"/webhosts/"+this.getId()+"/autoclientmappings"};var chainable=this.getFactory().autoClientMapping(this);return this.chainCreate(chainable,object,uriFunction)},listAutoClientMappings:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/webhosts/"+this.getId()+"/autoclientmappings"};var chainable=this.getFactory().autoClientMappingMap(this);return this.chainGet(chainable,uriFunction,params)},readAutoClientMapping:function(autoClientMappingId){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings/"+autoClientMappingId};var chainable=this.getFactory().autoClientMapping(this);return this.chainGet(chainable,uriFunction)},queryAutoClientMappings:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/autoclientmappings/query"};var chainable=this.getFactory().autoClientMappingMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkAutoClientMappingsPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkAutoClientMappingsAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/autoclientmappings/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},createTrustedDomainMapping:function(host,scope,platformId,object){if(!object){object={}}if(!Gitana.isString(platformId)){platformId=platformId.getId()}object.host=host;object.scope=scope;object.platformId=platformId;var uriFunction=function(){return"/webhosts/"+this.getId()+"/trusteddomainmappings"};var chainable=this.getFactory().trustedDomainMapping(this);return this.chainCreate(chainable,object,uriFunction)},listTrustedDomainMappings:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/webhosts/"+this.getId()+"/trusteddomainmappings"};var chainable=this.getFactory().trustedDomainMappingMap(this);return this.chainGet(chainable,uriFunction,params)},readTrustedDomainMapping:function(trustedDomainMappingId){var self=this;var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/"+trustedDomainMappingId};var chainable=this.getFactory().trustedDomainMapping(this);return this.chainGet(chainable,uriFunction)},queryTrustedDomainMappings:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/query"};var chainable=this.getFactory().trustedDomainMappingMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkTrustedDomainMappingsPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkTrustedDomainMappingsAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/trusteddomainmappings/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},listDeployedApplications:function(pagination){var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return"/webhosts/"+this.getId()+"/applications"};var chainable=this.getFactory().deployedApplicationMap(this);return this.chainGet(chainable,uriFunction,params)},readDeployedApplication:function(deployedApplicationId){var uriFunction=function(){return"/webhosts/"+this.getId()+"/applications/"+deployedApplicationId};var chainable=this.getFactory().deployedApplication(this);return this.chainGet(chainable,uriFunction)},queryDeployedApplications:function(query,pagination){var self=this;var params={};if(pagination){Gitana.copyInto(params,pagination)}var uriFunction=function(){return self.getUri()+"/applications/query"};var chainable=this.getFactory().deployedApplicationMap(this);return this.chainPost(chainable,uriFunction,params,query)},checkDeployedApplicationsPermissions:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/applications/permissions/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})},checkDeployedApplicationsAuthorities:function(checks,callback){var self=this;var uriFunction=function(){return self.getUri()+"/applications/authorities/check"};var object={checks:checks};return this.chainPostResponse(this,uriFunction,{},object).then(function(response){callback.call(this,response.results)})}})})(window);(function(window){var Gitana=window.Gitana;Gitana.WebHostMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(platform,object){this.objectType=function(){return"Gitana.WebHostMap"};this.base(platform,object)},clone:function(){return this.getFactory().webhostMap(this.getPlatform(),this)},buildObject:function(json){return this.getFactory().webhost(this.getPlatform(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AbstractWebHostObject=Gitana.AbstractPlatformObject.extend({constructor:function(webhost,object){this.base(webhost.getPlatform(),object);this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()}},ref:function(){return this.getType()+"://"+this.getPlatformId()+"/"+this.getWebHostId()+"/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AutoClientMapping=Gitana.AbstractWebHostObject.extend({constructor:function(webhost,object){this.base(webhost,object);this.objectType=function(){return"Gitana.AutoClientMapping"}},clone:function(){return this.getFactory().autoClientMapping(this.getWebHost(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_AUTO_CLIENT_MAPPING},getUri:function(){return"/webhosts/"+this.getWebHostId()+"/autoclientmappings/"+this.getId()},getSourceUri:function(){return this.get("uri")},getTargetApplicationId:function(){return this.get("applicationId")},getTargetClientKey:function(){return this.get("clientKey")},getTargetTenantId:function(){return this.get("tenantId")},getAutoManage:function(){return this.get("automanage")}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TrustedDomainMappingMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(webhost,object){this.objectType=function(){return"Gitana.TrustedDomainMappingMap"};this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()};this.base(webhost.getPlatform(),object)},clone:function(){return this.getFactory().trustedDomainMappingMap(this.getWebHost(),this)},buildObject:function(json){return this.getFactory().trustedDomainMapping(this.getWebHost(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.TrustedDomainMapping=Gitana.AbstractWebHostObject.extend({constructor:function(webhost,object){this.base(webhost,object);this.objectType=function(){return"Gitana.TrustedDomainMapping"}},clone:function(){return this.getFactory().trustedDomainMapping(this.getWebHost(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_TRUSTED_DOMAIN_MAPPING},getUri:function(){return"/webhosts/"+this.getWebHostId()+"/trusteddomainmappings/"+this.getId()}})})(window);(function(window){var Gitana=window.Gitana;Gitana.AutoClientMappingMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(webhost,object){this.objectType=function(){return"Gitana.AutoClientMappingMap"};this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()};this.base(webhost.getPlatform(),object)},clone:function(){return this.getFactory().autoClientMappingMap(this.getWebHost(),this)},buildObject:function(json){return this.getFactory().autoClientMapping(this.getWebHost(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DeployedApplication=Gitana.AbstractWebHostObject.extend({constructor:function(webhost,object){this.base(webhost,object);this.objectType=function(){return"Gitana.DeployedApplication"}},clone:function(){return this.getFactory().deployedApplication(this.getWebHost(),this)},getType:function(){return Gitana.TypedIDConstants.TYPE_DEPLOYED_APPLICATION},getUri:function(){return"/webhosts/"+this.getWebHostId()+"/applications/"+this.getId()},undeploy:function(){var uriFunction=function(){return this.getUri()+"/undeploy"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},redeploy:function(){var uriFunction=function(){return this.getUri()+"/redeploy"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},start:function(){var uriFunction=function(){return this.getUri()+"/start"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},stop:function(){var uriFunction=function(){return this.getUri()+"/stop"};return this.chainPostEmpty(this.getWebHost(),uriFunction)},restart:function(){var uriFunction=function(){return this.getUri()+"/restart"};return this.chainPostEmpty(this.getWebHost(),uriFunction)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.DeployedApplicationMap=Gitana.AbstractPlatformObjectMap.extend({constructor:function(webhost,object){this.objectType=function(){return"Gitana.DeployedApplicationMap"};this.getWebHost=function(){return webhost};this.getWebHostId=function(){return webhost.getId()};this.base(webhost.getPlatform(),object)},clone:function(){return this.getFactory().deployedApplicationMap(this.getWebHost(),this)},buildObject:function(json){return this.getFactory().deployedApplication(this.getWebHost(),json)}})})(window);(function(window){var Gitana=window.Gitana;Gitana.Context=Gitana.Chainable.extend({constructor:function(configs){this.base(new Gitana(configs.driver?configs.driver:{}));if(!this.cache){this.cache={}}this.cache.repository=null;this.cache.branch=null;this.cache.platform=null;this.getConfigs=function(){return configs};this.getRepositoryConfigs=function(){var repositoryConfigs=configs.repository;if(typeof repositoryConfigs=="string"){repositoryConfigs={repository:repositoryConfigs}}return repositoryConfigs};this.getBranchConfigs=function(){var branchConfigs=configs.branch?configs.branch:"master";if(typeof branchConfigs=="string"){if(branchConfigs=="master"){branchConfigs={type:"MASTER"}}else{branchConfigs={_doc:branchConfigs}}}return branchConfigs};this.getUserConfigs=function(){return configs.user};this.getDriverConfigs=function(){return configs.driver}},platform:function(platform){if(platform||platform===null){this.cache.platform=platform}return this.cache.platform?Chain(this.cache.platform):null},repository:function(repository){if(repository||repository===null){this.cache.repository=repository}return this.cache.repository?Chain(this.cache.repository):null},branch:function(branch){if(branch||branch===null){this.cache.branch=branch}return this.cache.branch?Chain(this.cache.branch):null},init:function(){var self=this;var loadPlatform=function(successCallback,errorCallback){if(!self.platform()){var authentication=self.getConfigs()["authentication"];self.getDriver().authenticate(authentication,function(http){if(errorCallback){errorCallback({message:"Failed to login Gitana.",reason:"INVALID_LOGIN",error:http})}}).then(function(){self.platform(this);loadRepository(successCallback,errorCallback)})}else{loadRepository(successCallback,errorCallback)}};var loadRepository=function(successCallback,errorCallback){if(!self.repository()){self.platform().trap(function(error){if(errorCallback){errorCallback({message:"Failed to get repository",error:error})}}).queryRepositories(self.getRepositoryConfigs()).count(function(count){if(errorCallback){if(count==0){errorCallback({message:"Cannot find any repository"})}if(count>1){errorCallback({message:"Found more than one repository"})}}}).keepOne().then(function(){self.repository(this);loadBranch(successCallback,errorCallback)})}else{loadBranch(successCallback,errorCallback)}};var loadBranch=function(successCallback,errorCallback){if(!self.branch()){self.repository().trap(function(error){if(errorCallback){errorCallback({message:"Failed to get branch",error:error})}}).queryBranches(self.getBranchConfigs()).count(function(count){if(errorCallback){if(count==0){errorCallback({message:"Cannot find any branch"})}if(count>1){errorCallback({message:"Found more than one branch"})}}}).keepOne().then(function(){self.branch(this);successCallback.call()})}else{successCallback.call()}};var result=Chain(this);return result.subchain().then(function(){var chain=this;loadPlatform(function(){chain.next()},function(err){var errorCallback=self.getConfigs()["error"];if(errorCallback){errorCallback.call(self,err)}});return false})}});Gitana.Context.create=function(config){var context=new Gitana.Context(config);return context.init()}})(window);(function(window){var Gitana=window.Gitana;Gitana.AppHelper=Gitana.AbstractObject.extend({constructor:function(platform,config){this.objectType=function(){return"Gitana.AppHelper"};this.base(platform.getDriver());this.getPlatform=function(){return platform};this.getPlatformId=function(){return platform.getId()};this.getApplicationId=function(){return config.application};this.cache=Gitana.MemoryCache();this.chainedCacheItem=function(key){var chained=null;if(this.cache(key)){chained=Chain(this.cache(key))}return chained}},init:function(callback){var self=this;var p=function(application){var projectId=application.projectId;if(projectId){Chain(self.getPlatform()).trap(function(err){callback()}).readProject(projectId).then(function(){self.cache("project",this);callback()})}else{callback()}};Chain(self.getPlatform()).trap(function(err){callback(err)}).readApplication(self.getApplicationId()).then(function(){self.cache("application",this);var application=this;this.subchain(self.getPlatform()).trap(function(err){p(application)}).findStackForDataStore(Gitana.TypedIDConstants.TYPE_APPLICATION,self.getApplicationId()).then(function(){self.cache("stack",this);this.listDataStores().each(function(key){this["_doc"]=this["datastoreId"];delete this["datastoreTypeId"];self.cache("stack.datastore."+key,this)});this.then(function(){p(application)})})})},platform:function(){return Chain(this.getPlatform())},application:function(){return this.chainedCacheItem("application")},stack:function(){return this.chainedCacheItem("stack")},datastore:function(key){return this.chainedCacheItem("stack.datastore."+key)},project:function(){return this.chainedCacheItem("project")}})})(window);(function(window){var Gitana=window.Gitana;var STATUS_UNRESOLVED="unresolved";var STATUS_RESOLVED="resolved";var STATUS_REJECTED="rejected";var triggerAll=function(val,cbs){for(var i=0;i (http://www.cloudcms.com)", "name": "gitana", "description": "Cloud CMS Gitana Driver for Node JS", - "version": "1.0.225", + "version": "1.0.226", "repository": { "type": "git", "url": "git://github.com/gitana/gitana-node-js.git"