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

[Projekt: Entwicklung - Neon][TicketNr.: 1022526][Bereitstellung erste Version...

[Projekt: Entwicklung - Neon][TicketNr.: 1022526][Bereitstellung erste Version 5.1 Customizing für Gremium]
parent 7d319f38
No related branches found
No related tags found
No related merge requests found
import("system.db");
import("system.vars");
import("system.result");
import("Pers_lib");
import("Sql_lib");
var orgId = vars.exists("$param.OrgId_param") && vars.get("$param.OrgId_param")
? vars.get("$param.OrgId_param")
: null;
var paramObject = {
"orgId":orgId
};
var orgId, conditionStr, preparedValues
,sqlHelper;
conditionStr = "";
preparedValues = [];
sqlHelper = new SqlUtils();
var generator = persWhereClauseGenerator(paramObject);
if (vars.exists("$param.OrgId_param") && (orgId = vars.getString("$param.OrgId_param"))){
conditionStr += " and RELATION.ORG_ID = ? ";
preparedValues.push([orgId, sqlHelper.getSingleColumnType("RELATION.ORG_ID")]);
}
result.string(generator.generate());
\ No newline at end of file
//TODO; add OBJECT_ID (probably another param)
//conditionStr += " and HISTORYLINK.OBJECT_ID = ? "
//preparedValues.push(["1", sqlHelper.getSingleColumnType("HISTORYLINK.OBJECT_ID")]);
if (conditionStr){
conditionStr = " 1 = 1 " + conditionStr;
result.string(db.translateCondition([conditionStr, preparedValues]));
}
else
result.string("1 = 1");
\ No newline at end of file
import("system.vars");
import("system.result");
import("Pers_lib");
result.string("PERS join RELATION on (RELATION.PERS_ID = PERS.PERSID)");
\ No newline at end of file
<?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.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.1.7">
<name>Pers_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/Pers_lib/process.js</process>
</process>
import("system.logging");
import("system.vars");
import("system.result");
/**
* Function for generating an object, which can generate the from clause of
* PERS_Entity
*
* @class persFromClauseGenerator
* @param {Object} pParamObject contains all neccessary params
*/
function persFromClauseGenerator(pParamObject)
{
//from clause is empty for now
//TODO add join to relation here, when table exists
var fromClause = "PERS";
//generation function for the entity from clause
function _generate()
{
fromClause += " join RELATION on PERS.PERSID = RELATION.PERS_ID ";
if(pParamObject && pParamObject.orgId)
{
fromClause += " join ORG on ORG.ORGID = RELATION.ORG_ID";
}
return fromClause;
}
//return an object with the generate function as member
//the function it self and the values are not visible outside
//and therefor savely encapsulated
return {
/**
*
* Generates the from clause for PERS_Entity
*
* @method generate
* @return {String}
*/
"generate":_generate
}
}
/**
* Function for getting an object, which can generate the where clause of PERS_Entity
* @class persWhereClauseGenerator
* @param {Object} pParamObject contains all neccessary parameters
*/
function persWhereClauseGenerator(pParamObject)
{
var whereClause = ""
, whereClauseArr = []
, i
, len;
function _generate()
{
if(pParamObject && pParamObject.orgId)
{
whereClauseArr.push("RELATION.ORG_ID = '" + pParamObject.orgId + "'");
}
//concating all clauses with and except the first one
len = whereClauseArr.length;
for(i = 0; i < len; i++)
{
whereClause += i ? "and " : "" + whereClauseArr[i] + " ";
}
return whereClause;
}
return {
/**
*
* Generates the where clause for PERS_Entity
*
* @method generate
* @return {String}
*/
"generate":_generate
}
}
Person = function()
{
this.say = function()
{
logging.log("I'm an Instance!");
}
function say()
{
logging.log("I'm static!");
}
}
\ 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