// init AppBase variables variables.appBeanName = ''; variables.appElements = ''; // init CeRecordAPI Config variables variables.useCeRecordAPI = true; variables.ceRecordApiAppConfig = {}; variables.useCeRecordApiMap = {}; super.init(argumentCollection=arguments); // Load objects into THIS local scope loadObjects(); return this; var keys = ""; var i = 1; var objectName = ""; // Loop over the variables - load the objects into this scope keys = StructKeyList(variables); for (i=1; i LTE ListLen(keys); i=i+1){ objectName = ListGetAt(keys,i); if ( (IsObject(variables[objectName])) AND (objectName NEQ "this") ) this[objectName] = variables[objectName]; } var app = ""; var buildError = StructNew(); var logErrorMsg = ""; if ( LEN(arguments.appBeanName) ) { // Update the siteAppList application.ADF.siteAppList = ListAppend(application.ADF.siteAppList, arguments.appBeanName); // Validate if the "appBeanName" exists in the SERVER object factory if ( validateAppBeanExists(arguments.appBeanName) ) { // Create the Application Space for the app bean application[arguments.appBeanName] = StructNew(); // Copy the App bean config struct from server.ADF into application.ADF copyServerBeanToApplication(arguments.appBeanName); // Load the local App components into the object factory loadSiteAppComponents(arguments.appBeanName); // Load the App application[arguments.appBeanName] = application.ADF.objectFactory.getBean(arguments.appBeanName); // set up the configuration of the element setAppConfig(arguments.appBeanName); // Load the site ajax service proxy white list XML loadAppProxyWhiteList(arguments.appBeanName); // run the post init function if it is defined app = application.ADF.objectFactory.getBean(arguments.appBeanName); // [MFC] - Changed "isDefined" to "StructKeyExists" // [MFC] - Added check for if the "app" is a struct. if( isStruct(app) AND StructKeyExists(app, "postInit") ) app.postInit(); } else { // Log the error that the App Bean doesn't exist. logErrorMsg = "The'#arguments.appBeanName#' app could not be loaded. Check that the app exists in the '/ADF/apps/' directory."; // Instead of a cfthrow, add to the Build Error Array buildError.ADFmethodName = "loadApp"; buildError.details = logErrorMsg & " [Site: #request.site.name# - #request.site.id#]."; // Add the buildError struct to the beginning of the server.ADF.buildErrors Array ArrayPrepend(server.ADF.buildErrors,buildError); } } // Load the Apps Configs for CE and XML configs into server.ADF.environment server.ADF.environment[request.site.id][arguments.appBeanName] = StructNew(); StructAppend(server.ADF.environment[request.site.id][arguments.appBeanName], getAppCEConfigs(arguments.appBeanName), true); StructAppend(server.ADF.environment[request.site.id][arguments.appBeanName], getAppXMLConfigs(arguments.appBeanName), true); var retConfigStruct = StructNew(); var configAppXMLPath = "#request.site.csAppsDIR#config/#arguments.appName#.xml"; // Check if the config file exists for the site if ( FileExists(configAppXMLPath) ) retConfigStruct = server.ADF.objectFactory.getBean("CoreConfig").getConfigViaXML(configAppXMLPath); return retConfigStruct; // Get the apps local components var comPath = request.site.csAppsURL & getAppBeanDir(arguments.appBeanName) & "/components"; var appLibPath = request.site.csAppsURL & getAppBeanDir(arguments.appBeanName) & "/lib"; var utilsObj = ""; var siteComponents = QueryNew("tmp"); var siteComponentsFiles = QueryNew("tmp"); var beanData = StructNew(); var i = 1; var refreshObjFactory = false; var beanConfigStruct = application.ADF.beanConfig.getConfigStruct(); // Check if there is a 'components' directory in the site if ( directoryExists(expandPath(comPath)) ) { utilsObj = server.ADF.objectFactory.getBean("utils_2_0"); siteComponents = utilsObj.directoryFiles(expandPath(comPath), "false"); siteComponentsFiles = utilsObj.filterDirectoryQueryByType(siteComponents, '%.cfc'); // Loop over the returned components to add to the application.ADF object factory for ( i = 1; i LTE siteComponentsFiles.RecordCount; i = i + 1) { beanData = application.ADF.beanConfig.buildBeanDataStruct(siteComponentsFiles.directory[i], siteComponentsFiles.name[i]); // 2012-10-18 - Check to see if a bean already exists within an app, and load in the override. if ( StructKeyExists(beanConfigStruct, beanData.beanName) ) { // Get the nickname of the CFC to override if ( StructKeyExists(beanConfigStruct, arguments.appBeanName) AND StructKeyExists(beanConfigStruct[arguments.appBeanName], "CONSTRUCTORDEPENDENCYSTRUCT") AND StructKeyExists(beanConfigStruct[arguments.appBeanName].CONSTRUCTORDEPENDENCYSTRUCT, beanData.beanName) ) { beanData.cfcName = beanConfigStruct[arguments.appBeanName].CONSTRUCTORDEPENDENCYSTRUCT[beanData.beanName]; } } // Add the bean into the Application ADF objectfactory application.ADF.BeanConfig.addSingleton(beanData.cfcPath, beanData.beanName); application.ADF.BeanConfig.addConstructorDependency(arguments.appBeanName, beanData.beanName, beanData.cfcName); } // Set the refresh flag refreshObjFactory = true; } // Check if the Site App has any lib overrides if ( directoryExists(expandPath(appLibPath)) ) { // Load the ADF Lib components application.ADF.beanConfig.loadADFLibComponents("#appLibPath#/", "", "application"); // Set the refresh flag refreshObjFactory = true; } // Refresh the Object Factory if ( refreshObjFactory ) application.ADF.objectFactory = createObject("component","ADF.core.lightwire.LightWireExtendedBase").init(application.ADF.beanConfig); var i = 1; var j = 1; var k = 1; var cd_keys = ""; var md_keys = ""; var sd_keys = ""; var appBeanStruct = server.ADF.beanConfig.getConfigStruct(); // Check if we are working with a server.ADF bean if ( StructKeyExists(appBeanStruct, arguments.beanName) ) { appBeanStruct = appBeanStruct[arguments.beanName]; // Add the bean to the application ADF application.ADF.beanConfig.addConfigStruct(arguments.beanName, appBeanStruct); // Recurse over the beans fields fields to built the structure correctly // Add in the CONSTRUCTORDEPENDENCYSTRUCT beans cd_keys = StructKeyList(appBeanStruct.CONSTRUCTORDEPENDENCYSTRUCT); for ( i = 1; i LTE ListLen(cd_keys); i = i + 1) copyServerBeanToApplication(ListGetAt(cd_keys, i)); // Add in the MIXINDEPENDENCYSTRUCT beans md_keys = StructKeyList(appBeanStruct.MIXINDEPENDENCYSTRUCT); for ( j = 1; j LTE ListLen(md_keys); j = j + 1) copyServerBeanToApplication(ListGetAt(md_keys, j)); // Add in the SETTERDEPENDENCYSTRUCT beans sd_keys = StructKeyList(appBeanStruct.SETTERDEPENDENCYSTRUCT); for ( k = 1; k LTE ListLen(sd_keys); k = k + 1) copyServerBeanToApplication(ListGetAt(sd_keys, k)); } var configStruct = application.ADF.beanConfig.GETCONFIGSTRUCT(); var appBeanStruct = StructNew(); var pathVal = ""; var dir = ""; // find the structkey for the application.ADF if ( StructKeyExists(configStruct, arguments.appBeanName) ) { // get the struct out appBeanStruct = configStruct[#arguments.appBeanName#]; // Check if the path key exists if ( StructKeyExists(appBeanStruct, "path") ) { pathVal = appBeanStruct.path; // Find the list item before 'components' dir name dir = ListGetAt(pathVal, ListFindNoCase(pathVal, 'components', '.') - 1, '.'); } } return dir; var appBeanStruct = application.ADF.beanConfig.getConfigStruct(arguments.appName); var appDirName = ListGetAt(appBeanStruct[arguments.appName].path, 3, "."); var proxyWhiteListXMLPath = ExpandPath("/ADF/apps/#appDirName#/components/proxyWhiteList.xml"); var configStruct = StructNew(); // Check if the config file exists for the site if ( FileExists(proxyWhiteListXMLPath) ) { configStruct = server.ADF.objectFactory.getBean("CoreConfig").getConfigViaXML(proxyWhiteListXMLPath); // Merge this config struct into the application proxy white list application.ADF.proxyWhiteList = server.ADF.objectFactory.getBean("data_2_0").structMerge(application.ADF.proxyWhiteList, configStruct, true); } // Check if the App Bean is created in the Server ADF object factory if ( isObject(server.ADF.objectFactory.getBean(arguments.appName)) ) return true; else return false; var retStruct = {}; if ( StructKeyExists(server,'ADF') AND StructKeyExists(server.ADF,'environment') AND StructKeyExists(server.ADF.environment,request.site.id) AND StructKeyExists(server.ADF.environment[request.site.id],'ceRecordApiConfig') ) { retStruct = server.ADF.environment[request.site.id].ceRecordApiConfig; } return retStruct; var retStruct = {}; var apiConfig = loadCeRecordApiSiteConfig(); if ( StructKeyExists(apiConfig,'apps') AND StructKeyExists(apiConfig.apps,arguments.appName) ) retStruct = apiConfig.apps[arguments.appName]; return retStruct; var config = loadCeRecordApiAppConfig(arguments.appName); setCeRecordApiAppConfig(config); if ( StructKeyExists(variables,'ceRecordApiAppConfig') AND IsStruct(variables.ceRecordApiAppConfig) ) structAppend(variables.ceRecordApiAppConfig, arguments.config, true); else variables.ceRecordApiAppConfig = arguments.config; var config = getCeRecordApiAppConfig(); var useCeRecordAPI = getUseCeRecordAPI(); var elementMap = {}; var appElementList = getAppElements(); var elementArr = listToArray(appElementList,','); // If useCeRecordAPI is set to true (handles version check) if ( useCeRecordAPI ) { // Build the element map - set all items = true for ( var i=1; i <= ArrayLen(elementArr); i++ ) { elementMap[elementArr[i]] = true; } // Check for a config 'elements' node if ( StructKeyExists(config,'elements') ) { for ( key IN elementMap ) { if ( StructKeyExists(config.elements,key) AND StructKeyExists(config.elements[key],'ceRecordAPI') ) elementMap[key] = ( IsBoolean(config.elements[key].ceRecordAPI) AND config.elements[key].ceRecordAPI ) ? true : false; } } } else { // Build the element map - set all items = false for ( var i=1; i <= ArrayLen(elementArr); i++ ) { elementMap[elementArr[i]] = false; } } variables.useCeRecordApiMap = elementMap; var config = getCeRecordApiAppConfig(); // If the version is compatible... then check if the ceRecordAPI config has disabled using ceRecordAPI if ( ceRecordApiMinVersionCheck() ) { variables.useCeRecordAPI = true; if ( StructKeyExists(config,'ceRecordAPI') ) variables.useCeRecordAPI = ( IsBoolean(config.ceRecordAPI) AND config.ceRecordAPI ) ? true : false; } else variables.useCeRecordAPI = false; var retVal = false; var appName = getAppBeanName(); var elementMap = {}; arguments.ceName = TRIM(arguments.ceName); if ( TRIM(arguments.ceName) NEQ '' ) { if ( StructKeyExists(application[appName],'useCeRecordApiMap') ) elementMap = application[appName].useCeRecordApiMap; else elementMap = getUseCeRecordApiMap(); if ( StructKeyExists(elementMap,arguments.ceName) ) retVal = ( IsBoolean(elementMap[arguments.ceName]) AND elementMap[arguments.ceName] ) ? true : false; } return retVal; var minCSversion = 11; var currCSversion = getCSVersion(); if ( ListFirst(currCSversion,".") GTE minCSversion ) return true; else return false;