Logo

Docs

  • HOME

Source: Usage/AccessLog.js

/**
 *
 * Copyright (C) 2021 Akorbi Digital RMP
 *
 * This file is part of RunMyProcess SDK-JS.
 *
 * RunMyProcess SDK-JS is free software: you can redistribute it and/or modify
 * it under the terms of the Apache License Version 2.0 (the "License");
 *
 *   You may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
 /**
  Create a new instance of AccessLog
      @constructor
	@property {Object} access - the objects access
    @property {Array} links - Contains the array of links
    @see ProjectApp
    @see Resource
	@example Load AccessLog
		var a = new AccessLog();
		u.load({
			onSuccess:function(){
				alert(JSON.stringify(a.access));
			}
		});
 */
function AccessLog(){
	this.access = {};
    this.links = [];
};
/**
  @borrows
  Inherits Resource
*/
AccessLog.prototype = new  Resource();
/**
    Overrides Resource's loadPreset method.
    @method
    @see Resource#loadPreset
*/
AccessLog.prototype.loadPreset = function () {
    /**
        Overrides Resource's generateUrl method to return the request url
        @method
        @see Resource#generateUrl
    */
    this.generateUrl = function () {
        return  "logs/access/"+context.customer_id+"/";//HARDCODED
    };
};
/**
    Override Resource load method.
    @method
    @param {object} options - options to be used during the call<br/>
	@param {string} options.period - the period to load
    @param {Resource~onSuccess} options.onSuccess - a callback function called in case of a success
    @param {Resource~onFailure} [options.onFailure] - a callback function called in case of a failure
    @param {String} [options.baseUrl] - base URL. If not set the current base URL will be used
    @see Resource#load
 */
 
AccessLog.prototype.load = function(options){
	var father = this;
	try {
		
		father.pagination = {};//remove current pagination
		father.filters = [];//remove current filters
		father.orderBy = [];//remove current orderBy
		father.mode = '';
		father.parameters = [];

		if(options.removeDefaultFilters) father.defaultFilters = [];
		father.loadPreset();
		if(!jQuery.isEmptyObject(options.pagination))father.pagination = options.pagination;
		if(options.mode)father.mode = options.mode;
		if(options.parameters)father.parameters = options.parameters;
		if(options.filters)father.filters = options.filters;
		if(options.orderBy)father.orderBy = options.orderBy;
		
		
		var loadOptions = {};
		loadOptions.onSuccess = function (rObject) {
			father.object = rObject;
			father.access = rObject.access;
            father.links = rObject.links;
			if (father.linkSearch('next', father.links))father.hasNext=true;
			else father.hasNext=false;
			if (father.linkSearch('previous', father.links)) father.hasPrevious=true;
			else father.hasPrevious=false;
            options.onSuccess(rObject);
		};
		loadOptions.cachedCallback = options.cachedCallback;
		loadOptions.onFailure = function(e){
			options.eObject=e;
			father.errorManager(options);
		};
		loadOptions.baseUrl = options.baseUrl || RMPApplication.getBaseUrl();
		father.dataLoad(loadOptions);
	}catch (e) {
		options.eObject=e;
		father.errorManager(options);
	};
};

Index

Classes

  • AccessLog
  • AllLaneUserList
  • AppInstanceReport
  • Context
  • Customer
  • CustomerDomainList
  • CustomerList
  • CustomerSubscriptionList
  • CustomerTrafficList
  • CustomList
  • CustomListList
  • Domain
  • Host
  • HostList
  • HostMode
  • I18n
  • I18nDico
  • Lane
  • LaneList
  • LanePoolList
  • LogLog
  • Metadata
  • Oauth
  • OauthList
  • Pool
  • PoolList
  • Preferences
  • Process
  • ProcessList
  • Project
  • ProjectAppliQuery
  • ProjectChildList
  • ProjectLaneList
  • ProjectList
  • ProjectProcess
  • ProjectProcessList
  • ProjectProcessQuery
  • ProjectVersion
  • ProjectVersionList
  • Report
  • RequestLog
  • Resource
  • SavedQuery
  • Subscription
  • Token
  • Traffic
  • Usage
  • User
  • UserAccessList
  • UserDelegation
  • UserDelegationList
  • UserLaneList
  • UserList
  • UserRepresentationList
  • UserSupportAuth
  • UserSupportAuthList
  • WebInterface
  • WebInterfaceList

Global

  • context

© Akorbi Digital RMP. All Rights Reserved - Legal terms - Contact