Name

sn_entitlement.UnallocatedEntityCalculation_SubscriptionsContextV2

Description

No description available

Script

/**
* Provides an abstraction over any DAO objects that the core business logic uses for subscription information.
* This allows a layer of indirection from the business logic having more direct knowledge of the schema.
*/
var UnallocatedEntityCalculation_SubscriptionsContextV2 = Class.create();
UnallocatedEntityCalculation_SubscriptionsContextV2.prototype = {

  /**
   * @param {bool} oobRolesOnly A boolean flag that filters the roles to out-of-box roles when true.
   */
  initialize: function(oobRolesOnly) {
      this._subscriptionRoleService = new sn_entitlement.SubscriptionRoleService(oobRolesOnly);
      this._subscriptionEntitlementDao = new sn_entitlement.PassThroughCache(new sn_entitlement.SubscriptionEntitlementDao());
      this._userHasSubscriptionDao = new sn_entitlement.PassThroughCache(new sn_entitlement.UserHasSubscriptionDao());
  },

  /**
   * Retrieves all subscription IDs that are active and per-user
   *
   * @returns {array} An array of subscription IDs
   */
  getSubscriptionIdsByIsPerUser: function() {
      return this._subscriptionEntitlementDao.getSubscriptionIdsByIsPerUser();
  },

  /**
   * Retrieves all of the active subscription ids that have a subscription type 
   * of unrestricted user.
   *
   * @returns {array} An array of subscription IDs
   */
  getSubscriptionIdsByActiveAndIsUnrestrictedUser: function() {
      return this._subscriptionEntitlementDao.getSubscriptionIdsByActiveAndIsUnrestrictedUser();
  },

  /**
   * Retrieves the subscription Ids where the subscription is of type "Module"
   * and does not have a definition
   *
   * @returns {array} An array of subscription_entitlement.sys_id values
   */
  getSubscriptionIdsByIsModuleWithoutCapacityMeter: function() {
      return this._subscriptionEntitlementDao.getSubscriptionIdsByIsModuleWithoutCapacityMeter();
  },

  /**
   * Retrieves all role IDs that require a subscription
   *
   * @returns {array} An array of role IDs
   */
  getRoleIdsByRequiresASubscription: function() {
      return this._subscriptionRoleService.getRoleIdsByRequiresASubscription();
  },

  /**
   * Retrieves all role IDs for the subscription identified that also require a subscription
   *
   * @returns {array} An array of role IDs
   */
  getRoleIdsBySubscriptionIdAndRequiresASubscription: function(subscriptionId) {
      return this._subscriptionRoleService.getRoleIdsBySubscriptionIdAndRequiresASubscription(subscriptionId);
  },

  /**
   * Retrieves all role IDs associated with the subscription identified even if the role is not
   * a metered role for the subscription
   *
   * @param {guid} subscriptionId The subscription ID to get roles for
   * @returns {array} An array of role IDs associated with the subscription
   */
  getRoleIdsBySubscriptionId: function(subscriptionId) {
      return this._subscriptionRoleService.getRoleIdsBySubscriptionId(subscriptionId);
  },

  /**
   * Calculates the number of users that are active and allocated to a subscription
   *
   * @param {guid} subscriptionId The subscription ID to get allocation counts for
   * @returns {number} A number 0 or greater that indicates the number of allocated users
   */
  getUserCountBySubscriptionIdAndUserIsAllocatedAndActive: function(subscriptionId) {
      return this._userHasSubscriptionDao.getCountBySubscriptionIdAndUserIsActive(subscriptionId);
  },

  type: 'UnallocatedEntityCalculation_SubscriptionsContextV2'
};

Sys ID

afdc1fe0ffb02110468365d7d3b8fe85

Offical Documentation

Official Docs: