Skip to content
Snippets Groups Projects
Commit 21e9dbb3 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

wip

parent d74df4c2
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.1">
<name>ObjectRelationEdit_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<genericViewTemplate>
<name>ObjectRelationData</name>
<editMode v="true" />
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>ba83e512-e1d3-4c21-a4d3-067df3816e74</name>
<entityField>OBJECT1_TYPE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>86f45e13-f96b-4d84-908b-444e238bb9ea</name>
<entityField>OBJECT1_ROWID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>3415855d-b97e-46df-9bee-6b33101b950a</name>
<entityField>OBJECT2_TYPE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>e9bb5d31-712f-4643-b183-61584400707c</name>
<entityField>OBJECT2_ROWID</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
......@@ -2,7 +2,7 @@
<preferences xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="3.0.3" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/preferences/3.0.3">
<name>_____PREFERENCES_PROJECT</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<projectName>xRM-Basic2019</projectName>
<projectName>xRM-Basic5</projectName>
<jditoMaxContentSize v="57671680" />
<calendarCategoriesEvent>
<entry>
......
import("system.logging");
import("system.project");
import("system.SQLTYPES");
import("system.vars");
import("Sql_lib");
......@@ -19,6 +21,8 @@ function ContextUtils() {}
ContextUtils.getCurrentContextId = function()
{
var entityName = vars.getString("$sys.currententityname");
//logging.log(vars.getString("$sys.currentcontextname"))
//return vars.getString("$sys.currentcontextname");
// TODO: replace with Core-method instead of switch-case!!!
switch (entityName)
{
......@@ -31,7 +35,7 @@ ContextUtils.getCurrentContextId = function()
}
/**
* TODO: use System function
* TODO: use System function. Currently the Name is also the id.
* Returns the Name of a context by the Id
*
* @param {String} pContextId the id of a context
......@@ -43,23 +47,61 @@ ContextUtils.getContextName = function(pContextId)
return pContextId;
}
/**
* Get all contexts of the project.
*
* @return {String[][]} [ ["contextid", "contextName" ], [..., ...], ...]
*/
ContextUtils.getContexts = function()
{
// TODO: The name is currently also the id. This may change.
return project.getDataModelNames(project.DATAMODEL_KIND_CONTEXT).map(function(contextName) {
return [contextName, ContextUtils.getContextName(contextName)];
});
}
/**
* TODO: !!!temporary function until you can get fields from another Entity!!!
*/
ContextUtils._getNameSelectMap = function()
{
var maskingUtils = new SqlMaskingUtils();
return {
"Org_context": ["select \"NAME\" from ORG", "ORG.ORGID"],
"Pers_context": ["select " + maskingUtils.concat(["FIRSTNAME", "LASTNAME"]) + " from PERS", "PERS.PERSID"],
"Activity_context": ["select SUBJECT from ACTIVITY", "ACTIVITY.ACTIVITYID"],
"Salesproject_context": ["select " + maskingUtils.concat([maskingUtils.cast("PROJECTCODE", SQLTYPES.VARCHAR, 10), "':'", "PROJECTTITLE"]) + " from SALESPROJECT", "SALESPROJECT.SALESPROJECTID"],
// TODO: keywords sind noch nicht in der DB somit gibt es nichts ähnliches zu getKeySQL.
// select " + maskingUtils.concat([SqlMaskingUtils.cast("CONTRACTCODE", "varchar", 10), getKeySQL("CONTRACTTYPE", "CONTRACTTYPE" )]) + " from CONTRACT
"Contract_context": ["select " + maskingUtils.cast("CONTRACTCODE", SQLTYPES.VARCHAR, 10) + " from CONTRACT", "CONTRACT.CONTRACTID"]
}
}
/**
* TODO: !!!temporary function until you can get fields from another Entity!!!
*/
ContextUtils.getNameSubselectSql = function(pContextIdDbField, pRowIdDbField)
{
var select = "(case " + pContextIdDbField + " ";
var maskingUtils = new SqlMaskingUtils();
select += "when 'Org_context' then (select \"NAME\" from ORG where ORG.ORGID = " + pRowIdDbField + ") ";
select += "when 'Pers_context' then (select " + maskingUtils.concat(["FIRSTNAME", "LASTNAME"]) + " from PERS where PERS.PERSID = " + pRowIdDbField + ") ";
select += "when 'Activity_context' then (select SUBJECT from ACTIVITY where ACTIVITY.ACTIVITYID = " + pRowIdDbField + ") ";
select += "when 'Salesproject_context' then (select " + maskingUtils.concat([maskingUtils.cast("PROJECTCODE", SQLTYPES.VARCHAR, 10), "':'", "PROJECTTITLE"]) + " from SALESPROJECT where SALESPROJECT.SALESPROJECTID = " + pRowIdDbField + ") ";
// TODO: keywords sind noch nicht in der DB somit gibt es nichts ähnliches zu getKeySQL.
//select += "when 'Contract_context' then (select " + maskingUtils.concat([SqlMaskingUtils.cast("CONTRACTCODE", "varchar", 10), getKeySQL("CONTRACTTYPE", "CONTRACTTYPE" )]) + " from CONTRACT where CONTRACT.CONTRACTID = " + pRowIdDbField + ") ";
select += "when 'Contract_context' then (select " + maskingUtils.cast("CONTRACTCODE", SQLTYPES.VARCHAR, 10) + " from CONTRACT where CONTRACT.CONTRACTID = " + pRowIdDbField + ") ";
var selectMap = ContextUtils._getNameSelectMap()
for (let contextId in selectMap)
{
select += "when '" + contextId + "' then (" + selectMap[contextId][0] + " where " + selectMap[contextId][1] + " = " + pRowIdDbField + ") ";
}
select += "else 'Not defined in ContextUtils.getNameSql()!'";
select += "end)";
return select;
}
/**
* TODO: !!!temporary function until you can get fields from another Entity!!!
*/
ContextUtils.getNameSql = function(pContextId, pRowId)
{
var selectMap = ContextUtils._getNameSelectMap()
return SqlCondition.begin().andPrepare(selectMap[pContextId][1], pRowId).buildSql(selectMap[pContextId][0], "1=2");
}
\ No newline at end of file
......@@ -44,7 +44,6 @@ ProcessHandlingUtils.initialParamToResult = function(pParamVarName)
result.object(paramValue);
}
}
}
/**
......
<?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>ObjectRelation_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/ObjectRelation_lib/process.js</process>
<variants>
<element>LIBRARY</element>
</variants>
</process>
/**
* Methods to manage ObjectRelations.
* Do not create an instance of this!
*
* @class
*/
function ObjectRelationUtils() {}
/**
*
*/
ObjectRelationUtils.get = function()
{
}
\ 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