Skip to content
Snippets Groups Projects
Commit da46407f authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1063338][Hinterlegen Standardprozess...

[Projekt: Entwicklung - Neon][TicketNr.: 1063338][Hinterlegen Standardprozess am RecordContainer im cacheKeyProzess]
parent 564926f5
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<aliasDefinition xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/aliasDefinition/1.2.0">
<name>RecordContainerCache</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<datasourceType v="16" />
</aliasDefinition>
......@@ -659,6 +659,8 @@
<conditionProcess>%aditoprj%/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<orderClauseProcess>%aditoprj%/entity/KeywordEntry_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
<onDBDelete>%aditoprj%/entity/KeywordEntry_entity/recordcontainers/db/onDBDelete.js</onDBDelete>
<cacheType>GLOBAL</cacheType>
<cacheKeyProcess>%aditoprj%/entity/KeywordEntry_entity/recordcontainers/db/cacheKeyProcess.js</cacheKeyProcess>
<linkInformation>
<linkInformation>
<name>52acbfe0-57f4-4614-83af-9882e168f431</name>
......
import("CachedRecordContainer_lib");
import("system.result")
var res = CachedRecordContainerUtils.getCommonKey("$param.ContainerName_param", "$param.ExcludedKeyIdsSubquery_param", "$param.OnlyActives_param"
, "$param.WhitelistIds_param");
result.string(res);
......@@ -27,6 +27,7 @@
<value></value>
</entry>
</calendarCategoriesEvent>
<recordContainerCachingAlias>RecordContainerCache</recordContainerCachingAlias>
<clientSearchOptimizedForSpeed v="true" />
<clientSearchExcludeForIgnorecase v="true" />
<neonClientPermissionsEnabled v="true" />
......@@ -133,5 +134,9 @@
<name>sigparser.apiUrl</name>
<description>The url to the mail signature webservice sigparser.</description>
</customStringProperty>
<customBooleanProperty>
<name>dataCaching.client.forceDisable</name>
<description>Enabling this option will disable the per-client-context data-cache within the customzing (for exameple the caching of Keywords). This is usefull if you're testing and want to frequently add data like keywords, etc. which are cached which help of the "DataCaching_lib".</description>
</customBooleanProperty>
</customConfigProperties>
</preferences>
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<name>CachedRecordContainer_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/CachedRecordContainer_lib/process.js</process>
<variants>
<element>LIBRARY</element>
</variants>
</process>
import("system.vars");
/**
* provides field-preset-constants for cached data records
* Do not create an instance of this!
*
* @class
* @static
*/
function CachedRecordContainerFieldPresets(){}
/*this is right now (2020-08-25) the only way to get something like a constant with
- a prober name
- autocomplete support within the ADITO Designer
- and proper packageing all constants together
This may change in the future, if there is something better feel free to improve this */
/**
* Constant for field presets that represents no varaiblenames
*/
CachedRecordContainerFieldPresets.NONE = function(){
return [];
};
/**
* Constant for field presets that represents some standard varaiblenames
* Does not include a locale, but includes:
* <ul>
* <li>$local.idvalues</li>
* <li>$local.filters</li>
* <li>$local.order</li>
* <li>$local.grouping</li>
* <ul>
*/
CachedRecordContainerFieldPresets.STANDARD = function(){
//grants are parts of the $local.filter-variable
return ["$local.idvalues", "$local.filters", "$local.order", "$local.grouping"];
};
/**
* Constant for field presets that represents some standard varaiblenames
* Does include a locale (if clientside) and:
* <ul>
* <li>$local.idvalues</li>
* <li>$local.filters</li>
* <li>$local.order</li>
* <li>$local.grouping</li>
* <ul>
*/
CachedRecordContainerFieldPresets.STANDARD_WITH_LOCALE = function(){
//grants are parts of the $local.filter-variable
var res = CachedRecordContainerFieldPresets.STANDARD();
if (vars.getString("$sys.isclient"))
{
res.unshift("$sys.clientlocale");
}
else
{
//there is no locale-variable for the server, so let's just store THAT it's the locale of the serverprocess
res.unshift("_____serverlocale");
}
res = res.concat(CachedRecordContainerFieldPresets.STANDARD());
return res;
};
/**
* provides utility functions to work with CachedRecordContainers
* Do not create an instance of this!
*
* @class
* @static
*/
function CachedRecordContainerUtils(){}
/**
* Builds a key string that can be used in the cacheKeyProcess of a record container depending on the passed parameters. <br />
* This will use the most common preset by default (this is the preset STANDARD_WITH_LOCALE). <br />
* Therefor you will only need to pass the parameter names ("$param.") that are relevant for the data of your recordContainer.<br />
* The cacheKeyProcess is used to build up a key for retrieving the correct cached records from the cache.<br />
* Will check automatically if the variable exists or is null. You can pass an arbitrary amount of parameters to this functions, all of the parameters
* have to be a name of a varaible to be checked ("$local, $sys, $field, $param, etc.)<br />
*
* @param {String} pExtendedVariable1 <p>Name of the first variable that is checked and
* thats value is used to extend the most common variable names
* @param {String} pExtendedVariableN=undefined <p>Name of the next variables that is checked and
* thats value is used to extend the most common variable names.<br />
* You can pass an arbitrary amount of parameters (see more in the function description text)
*
* @return {String} <p>The key ready to use for the cacheKeyProcess
*
* @example
* var res = CachedRecordContainerUtils.getCommonKey("$param.ContainerName_param", "$param.ExcludedKeyIdsSubquery_param", "$param.OnlyActives_param"
* , "$param.WhitelistIds_param");
* result.string(key);
*/
CachedRecordContainerUtils.getCommonKey = function(pExtendedVariable1, pExtendedVariableN) {
var functionParams = Array.from(arguments);//arguments is an array-like object so let's convert it to an array for further processing
var params = [CachedRecordContainerFieldPresets.STANDARD_WITH_LOCALE].concat(functionParams);
return CachedRecordContainerUtils.getKeyWithPreset.apply(null, params);
};
/**
* Builds a key string that can be used in the cacheKeyProcess of a record container depending on the passed parameters and a given preset.<br />
* The cacheKeyProcess is used to build up a key for retrieving the correct cached records from the cache.<br />
* Will check automatically if the variable exists or is null. You can pass an arbitrary amount of parameters to this functions, all of the parameters
* have to be a name of a varaible to be checked ("$local, $sys, $field, $param, etc.) <br />
*
* @param {function|array} pPreset <p>The preset should be a value of CachedRecordContainerFieldPresets, e.g.
* CachedRecordContainerFieldPresets.STANDARD.<br />
* The following parameters will expand the list of the fields that are used in the preset.<br />
* The function type (e.g.CachedRecordContainerFieldPresets.STANDARD) is supported as well as
* the array type (e.g.CachedRecordContainerFieldPresets.STANDARD()) for better useability.
* @param {String} pExtendedVariable1 <p>Name of the first variable that is checked and thats value is used to extend the preset
* @param {String} pExtendedVariableN=undefined <p>Name of the next variables that is checked and thats value is used to extend the preset.<br />
* You can pass an arbitrary amount of parameters (see more in the function description text)
*
* @return {String} <p>The key ready to use for the cacheKeyProcess
*
* @example
* var key = CachedRecordContainerUtils.getKeyWithPreset(CachedRecordContainerFieldPresets.STANDARD,"$sys.clientlocale", "$param.contactId"
* , "$param.onlyActives");
* result.string(key);
*/
CachedRecordContainerUtils.getKeyWithPreset = function(pPreset, pExtendedVariable1, pExtendedVariableN) {
var varsToCheck;
if (typeof (pPreset) == "function")
varsToCheck = pPreset.call();
else if (Array.isArray(pPreset))
varsToCheck = pPreset;
else
throw new Error();
//skip pPreset with the call of .slice() because it is handled separately above
var functionParams = Array.from(arguments).slice(1); //arguments is an array-like object so let's convert it to an array for further processing
if (functionParams.length > 0)
varsToCheck = varsToCheck.concat(functionParams);
return CachedRecordContainerUtils.getKey.apply(null, varsToCheck);
};
/**
* Builds a key string that can be used in the cacheKeyProcess of a record container depending on the passed parameters. <br />
* The cacheKeyProcess is used to build up a key for retrieving the correct cached records from the cache.<br />
* Will check automatically if the variable exists or is null. You can pass an arbitrary amount of parameters to this functions, all of the parameters
* have to be a name of a varaible to be checked ("$local, $sys, $field, $param, etc.) <br />
*
* @param {String} pVariable1 <p>Name of the first variable that is checked and thats value is used
* @param {String} pVariableN=undefined <p>Name of the next variables that is checked and thats value is used.<br />
* You can pass an arbitrary amount of parameters (see more in the function description text)
*
* @return {String} <p>The key ready to use for the cacheKeyProcess
*
* @example
* var key = CachedRecordContainerUtils.getKey("$sys.clientlocale", "$local.filter", "$param.contactId");
* result.string(key);
*/
CachedRecordContainerUtils.getKey = function(pVariable1, pVariableN) {
var varsToCheck = Array.from(arguments);//arguments is an array-like object so let's convert it to an array for further processing
var key = [];
varsToCheck.forEach(function (varToCheck){
if (vars.exists(varToCheck))
{
var value = vars.getString(varToCheck);
if (value != null)
key.push(value);
else
key.push("_____" + varToCheck);
}
else
{
key.push("_____" + varToCheck);
}
});
return key.join(".");
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment