Name

sn_mab_api.MobileDAOCache

Description

A cache to avoid creating multiple copies of a Mobile DAO

Script

var MobileDAOCache = Class.create();
MobileDAOCache.prototype = {
  initialize: function() {
      this.cache = {};
  },

  getDAO: function(tableName) {
      if (!tableName) {
          throw 'Bad tablename specified';
      }
      if (!this.isTableAccessible(tableName)) {
          throw 'Table is not accessible';
      }

      var mobileDao = this.cache[tableName];
      if (!mobileDao) {
          mobileDao = new sn_mab_api.MobileAppBuilderDAO(tableName);
          this.cache[tableName] = mobileDao;
      }

      return mobileDao;
  },

  isTableAccessible: function(tableName) {
      return MobileAppBuilderDAO.isTableAccessible(tableName);
  },

  type: 'MobileDAOCache'
};

Sys ID

46d1f26253d22010c722ddeeff7b12c5

Offical Documentation

Official Docs: