Skip to content
Snippets Groups Projects
Commit f3915960 authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

Library Dependency

parent 9081741b
No related branches found
No related tags found
No related merge requests found
<?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>Dependency_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/Dependency_lib/process.js</process>
<variants>
<element>LIBRARY</element>
</variants>
</process>
function Dependency(){}
/**
* This function is the template for the getUIDsfn-Function in the Dependency.mapping
*/
Dependency.templateFunction = function (pTableField) {
return function (pRowData, pChangedData) {
let res = [];
if (pRowData[pTableField])
res.push(pRowData[pTableField])
if (pChangedData[pTableField] && pChangedData[pTableField] != pRowData[pTableField])
res.push(pChangedData[pTableField])
return res;
}
}
/**
* Returns the Mapping of the Dependencies.
*
* The mapping is structured as follows: <br>
*
* @example { "Entity_entity" : { "Dependency_entity": { "getUIDsfn" : fucntion (pRowData, pChangedData) {return //the IDs of the EntityField } } } }
*
* @return {Object}
*/
Dependency.mapping = function ()
{
return {
"Address_entity": {
"Organisation_entity" : {
"getUIDsfn" : function (pRowData, pChangedData) {
var tableField = "ADDRESS.CONTACT_ID";
var res = [];
if (pRowData[tableField])
res.push(pRowData[tableField])
if (pChangedData[tableField] && pChangedData[tableField] != pRowData[tableField])
res.push(pChangedData[tableField])
return res;
}
}
}
};
};
/**
* Returns the dependencies on the entity
*
* @param {String} [pEntity] the name of the entity
* @return {String[]} the founded Dependencies. If no one is found, you get an empty Array
*/
Dependency.getDependency = function (pEntity) {
if (Dependency.mapping()[pEntity])
{
return Object.keys(Dependency.mapping()[pEntity]);
}
return [];
};
/**
* Returns the dependencies that this entity has on others
*
* @param {String} [pEntity] the name of the entity
* @return {String[]} the founded Dependencies. If no one is found, you get an empty Array
*/
Dependency.getReverseDependency = function (pEntity) {
return Object.keys(Dependency.mapping()).filter(function (key) {
return Dependency.mapping()[key][pEntity];
});
}
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