Skip to content
Snippets Groups Projects
Commit 8a5581d0 authored by Erika Chiara Pollinger's avatar Erika Chiara Pollinger
Browse files

[Projekt: xRM-Basic][TicketNr.: 1018102][Beginn mit Umsetzung der Entity "PERS"]

Built up Pers Entity as far as possible without interaction with other
Entities
parent c9a92385
No related branches found
No related tags found
No related merge requests found
......@@ -4,25 +4,33 @@
<title>Personen</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<alias>Data_alias</alias>
<fromClauseProcess>%aditoprj%/entity/Pers_entity/fromClauseProcess.js</fromClauseProcess>
<conditionProcess>%aditoprj%/entity/Pers_entity/conditionProcess.js</conditionProcess>
<recordContainerType>DB</recordContainerType>
<caption>Personen</caption>
<captionProcess>%aditoprj%/entity/Pers_entity/captionProcess.js</captionProcess>
<iconId>NEON:ADITO</iconId>
<iconId>VAADIN:MALE</iconId>
<entityFields>
<entityField>
<name>DATEOFBIRTH</name>
<tableName>PERS</tableName>
<columnName>DATEOFBIRTH</columnName>
<contentType>DATE</contentType>
<outputFormat>dd.MM.yyyy</outputFormat>
</entityField>
<entityField>
<name>DATE_EDIT</name>
<tableName>PERS</tableName>
<columnName>DATE_EDIT</columnName>
<contentType>DATE</contentType>
<outputFormat>dd.MM.yyyy hh:mm</outputFormat>
</entityField>
<entityField>
<name>DATE_NEW</name>
<tableName>PERS</tableName>
<columnName>DATE_NEW</columnName>
<contentType>DATE</contentType>
<outputFormat>dd.MM.yyyy hh:mm</outputFormat>
</entityField>
<entityField>
<name>FIRSTNAME</name>
......@@ -33,6 +41,7 @@
<name>GENDER</name>
<tableName>PERS</tableName>
<columnName>GENDER</columnName>
<possibleItemsProcess>%aditoprj%/entity/Pers_entity/entityfields/gender/possibleItemsProcess.js</possibleItemsProcess>
</entityField>
<entityField>
<name>LASTNAME</name>
......@@ -78,6 +87,12 @@
<name>PREVIEWTITLE</name>
<valueProcess>%aditoprj%/entity/Pers_entity/entityfields/previewtitle/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>OrgId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<description>PARAMETER</description>
</entityParameter>
</entityFields>
<linkInformation>
<linkInformation>
......
import("system.vars");
import("system.result");
import("Pers_lib");
var orgId = vars.exists("$param.OrgId_param") && vars.get("$param.OrgId_param")
? vars.get("$param.OrgId_param")
: null;
var paramObject = {
"orgId":orgId
};
var generator = persWhereClauseGenerator(paramObject);
result.string(generator.generate());
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.translate");
//TODO change to keyword after kw are implemented
var gender = [
["1",translate.text("male")]
,["2",translate.text("female")]
,["3",translate.text("other")]
];
result.object(gender);
\ No newline at end of file
import("system.vars");
import("system.result");
import("Pers_lib");
var orgId = (vars.exists("$param.OrgId_param") && vars.get("$param.OrgId_param"))
? vars.get("$param.OrgId_param")
: null;
var paramObject = {
"orgId": orgId
};
var generator = persFromClauseGenerator(paramObject);
result.string(generator.generate());
\ No newline at end of file
......@@ -14,5 +14,27 @@
<descriptionField>DATEOFBIRTH</descriptionField>
<entityField>#ENTITY</entityField>
</previewHeaderNeonViewTemplate>
<rowDataNeonViewTemplate>
<name>PersTestRowData_view</name>
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
<name>b70cd92f-5d81-46ad-b4c4-36f7100171d2</name>
<entityField>DATEOFBIRTH</entityField>
</neonTableColumn>
<neonTableColumn>
<name>822032c2-f0ba-465c-a216-ecb0a242241a</name>
<entityField>DATE_NEW</entityField>
</neonTableColumn>
<neonTableColumn>
<name>2a13996a-4c32-4b04-b08b-6c5ab4cbf0e9</name>
<entityField>USER_NEW</entityField>
</neonTableColumn>
<neonTableColumn>
<name>d5afe634-9be8-4e57-8fc4-d4a0dd7037bd</name>
<entityField>GENDER</entityField>
</neonTableColumn>
</columns>
</rowDataNeonViewTemplate>
</children>
</neonView>
<?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.vars");
import("system.result");
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()
{
if(pParamObject && pParamObject.orgId)
{
fromClause += " join RELATION on PERS.PERSID = REALTION.PERS_ID ";
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 {
"generate":_generate
}
}
function persWhereClauseGenerator(pParamObject)
{
var whereClause = ""
, whereClauseArr = []
, i
, len;
function _generate()
{
if(pParamObject && pParamObject.orgId)
{
whereClauseArr.push("ORG.ORGID = '" + 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 {
"generate":_generate
}
}
\ 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