From 1d26c9dd4c555b9a2b6868027c7f3a92ee1927a3 Mon Sep 17 00:00:00 2001 From: "j.goderbauer" <j.goderbauer@adito.de> Date: Thu, 16 Aug 2018 15:46:39 +0200 Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?= =?UTF-8?q?=201022526][Bereitstellung=20erste=20Version=205.1=20Customizin?= =?UTF-8?q?g=20f=C3=BCr=20Gremium]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/Pers_entity/conditionProcess.js | 32 ++++++--- entity/Pers_entity/fromClauseProcess.js | 1 - process/Pers_lib/Pers_lib.aod | 6 -- process/Pers_lib/process.js | 95 ------------------------- 4 files changed, 22 insertions(+), 112 deletions(-) delete mode 100644 process/Pers_lib/Pers_lib.aod delete mode 100644 process/Pers_lib/process.js diff --git a/entity/Pers_entity/conditionProcess.js b/entity/Pers_entity/conditionProcess.js index e3289362d9..0459862542 100644 --- a/entity/Pers_entity/conditionProcess.js +++ b/entity/Pers_entity/conditionProcess.js @@ -1,15 +1,27 @@ +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 diff --git a/entity/Pers_entity/fromClauseProcess.js b/entity/Pers_entity/fromClauseProcess.js index ca3088cbae..ea75988bad 100644 --- a/entity/Pers_entity/fromClauseProcess.js +++ b/entity/Pers_entity/fromClauseProcess.js @@ -1,5 +1,4 @@ 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 diff --git a/process/Pers_lib/Pers_lib.aod b/process/Pers_lib/Pers_lib.aod deleted file mode 100644 index f5a56c3037..0000000000 --- a/process/Pers_lib/Pers_lib.aod +++ /dev/null @@ -1,6 +0,0 @@ -<?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> diff --git a/process/Pers_lib/process.js b/process/Pers_lib/process.js deleted file mode 100644 index 91f9f28cd3..0000000000 --- a/process/Pers_lib/process.js +++ /dev/null @@ -1,95 +0,0 @@ -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 -- GitLab