From 7e8da8897671a4394fbcbf8c17f55dbe00f54a5a Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Tue, 12 Feb 2019 15:16:28 +0100 Subject: [PATCH] documentation --- process/Context_lib/process.js | 40 +++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 675e5a981f5..15077d50656 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -36,12 +36,17 @@ ContextUtils.getContextName = function(pContextId) return pContextId; } +/** + * + * @param {Boolean} [pFilter=false] filter only for contexts which have a mapping in ContextUtils._getSelectMap + * + * @return {String[][]} the contexts [[contextId, contextName, contextTitle], [... ], ...] + */ ContextUtils.getContexts = function(pFilter) { if (pFilter == undefined) pFilter = false; - var contexts = project.getDataModels(project.DATAMODEL_KIND_CONTEXT); if (pFilter) @@ -55,23 +60,38 @@ ContextUtils.getContexts = function(pFilter) return contexts.map(ContextUtils._contextDataMapping).sort(function(pContext1, pContext2) - { - // sort after ContextTitle - if (pContext1[2] > pContext2[2]) - return 1; + { + // sort after ContextTitle + if (pContext1[2] > pContext2[2]) + return 1; - if (pContext1[2] < pContext2[2]) - return -1; + if (pContext1[2] < pContext2[2]) + return -1; - return 0; - }); + return 0; + }); } +/** + * get the data of a context + * + * @param {String} pContextId the id of the context + * + * @return {String[]} the contextdata [contextId, contextName, contextTitle] + */ ContextUtils.getContext = function(pContextId) { return ContextUtils._contextDataMapping(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, pContextId)); } +/** + * map the contextData from the system.project-lib to [contextId, contextName, contextTitle] + * + * @param {String[]} pContext the data of a context (e.g. from project.getDataModel()) + * + * @return {String[]} the contextdata [contextId, contextName, contextTitle] + * @ignore + */ ContextUtils._contextDataMapping = function(pContext) { var contextName = ContextUtils.getContextName(pContext[0]); @@ -127,7 +147,7 @@ ContextUtils.getNameSql = function(pContextId, pRowId) } /** - * TODO: Evtl ein anderer Weg ohne hard gecodedeten Selects. + * TODO: !!!temporary function until you can get fields from another Entity!!! */ ContextUtils.getContextDataSql = function(pContextId, pRowId) { -- GitLab