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

Object relation fixes

parent e73af877
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
<title>Type 1</title>
<consumer>Contexts</consumer>
<linkedContext>Context_context</linkedContext>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_type/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_type/displayValueProcess.js</displayValueProcess>
......@@ -23,6 +24,7 @@
<title>Object 1</title>
<consumer>Objects1</consumer>
<linkedContextProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/linkedContextProcess.js</linkedContextProcess>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/displayValueProcess.js</displayValueProcess>
......@@ -35,6 +37,7 @@
<title>Object 2</title>
<consumer>Objects2</consumer>
<linkedContextProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_rowid/linkedContextProcess.js</linkedContextProcess>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_rowid/valueProcess.js</valueProcess>
</entityField>
......@@ -43,6 +46,7 @@
<title>Type 2</title>
<consumer>Contexts</consumer>
<linkedContext>Context_context</linkedContext>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_type/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_type/displayValueProcess.js</displayValueProcess>
......@@ -56,6 +60,8 @@
<entityProvider>
<name>Object1</name>
<fieldType>DEPENDENCY_IN</fieldType>
<targetContextField>OBJECT2_TYPE</targetContextField>
<targetIdField>OBJECT2_ROWID</targetIdField>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
......@@ -105,6 +111,8 @@
<entityProvider>
<name>Object2</name>
<fieldType>DEPENDENCY_IN</fieldType>
<targetContextField>OBJECT1_TYPE</targetContextField>
<targetIdField>OBJECT1_ROWID</targetIdField>
<recordContainer>db</recordContainer>
<children>
<entityParameter>
......@@ -136,6 +144,8 @@
<entityProvider>
<name>BothObjects</name>
<fieldType>DEPENDENCY_IN</fieldType>
<targetContextField>OBJECT2_TYPE</targetContextField>
<targetIdField>OBJECT2_ROWID</targetIdField>
<recordContainer>db</recordContainer>
<children>
<entityParameter>
......@@ -191,8 +201,8 @@
<entityProvider>
<name>AnyObject</name>
<fieldType>DEPENDENCY_IN</fieldType>
<targetContextField>OBJECT1_TYPE</targetContextField>
<targetIdField>OBJECT1_ROWID</targetIdField>
<targetContextField>AnyTargetType</targetContextField>
<targetIdField>AnyTargetRowid</targetIdField>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
......@@ -286,6 +296,14 @@
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>AnyTargetRowid</name>
<valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/anytargetrowid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>AnyTargetType</name>
<valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/anytargettype/valueProcess.js</valueProcess>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.result");
import("system.vars");
var openedType;
var openedRowid;
// any object
if (vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param"))
{
openedType = vars.get("$param.AnyObjectType_param");
if (vars.exists("$param.Object1Rowid_param") && vars.get("$param.Object1Rowid_param"))
{
openedRowid = vars.get("$param.Object1Rowid_param");
// anyObject and object 1 == opened object --> target is object2
if (vars.get("$field.OBJECT1_ROWID") == openedRowid && vars.get("$field.OBJECT1_TYPE") == openedType)
{
result.string(vars.get(vars.get("$field.OBJECT2_ROWID")));
}
// anyObject and object 2 == opened object --> target is object1
else if (vars.get("$field.OBJECT2_ROWID") == openedRowid && vars.get("$field.OBJECT2_TYPE") == openedType)
{
result.string(vars.get(vars.get("$field.OBJECT1_ROWID")));
}
}
}
\ No newline at end of file
import("system.logging");
import("system.result");
import("system.vars");
var openedType;
var openedRowid;
// any object
if (vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param"))
{
openedType = vars.get("$param.AnyObjectType_param");
if (vars.exists("$param.Object1Rowid_param") && vars.get("$param.Object1Rowid_param"))
{
openedRowid = vars.get("$param.Object1Rowid_param");
// anyObject and object 1 == opened object --> target is object2
if (vars.get("$field.OBJECT1_ROWID") == openedRowid && vars.get("$field.OBJECT1_TYPE") == openedType)
{
result.string(vars.get(vars.get("$field.OBJECT2_TYPE")));
}
// anyObject and object 2 == opened object --> target is object1
else if (vars.get("$field.OBJECT2_ROWID") == openedRowid && vars.get("$field.OBJECT2_TYPE") == openedType)
{
result.string(vars.get(vars.get("$field.OBJECT1_TYPE")));
}
}
}
\ No newline at end of file
import("system.logging");
import("system.result");
import("system.neon");
import("system.vars");
var recordstate = vars.get("$sys.recordstate");
logging.log(recordstate)
if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT)
{
if (vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param"))
......@@ -13,4 +16,8 @@ if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE
{
result.string(vars.get("$param.Object1Rowid_param"));
}
else if (!vars.get("$field.OBJECT2_TYPE"))
{
result.string("");
}
}
\ No newline at end of file
......@@ -9,4 +9,8 @@ if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE
{
result.string(vars.get("$param.Object2Rowid_param"));
}
else if (!vars.get("$field.OBJECT2_TYPE"))
{
result.string("");
}
}
\ No newline at end of file
import("system.logging");
import("system.vars");
import("system.result");
logging.log("set type: " + vars.get("$field.OBJECT1_TYPE"))
result.string(vars.get("$field.OBJECT1_TYPE"))
\ No newline at end of file
......@@ -3,6 +3,7 @@
<name>ObjectRelation_context</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<filterview>ObjectRelationFilter_view</filterview>
<editview>ObjectRelationEdit_view</editview>
<preview>ObjectRelationPreview_view</preview>
<entity>ObjectRelation_entity</entity>
<references>
......@@ -14,5 +15,9 @@
<name>dc0bd793-a472-4a7b-8394-06c4bc31258a</name>
<view>ObjectRelationPreview_view</view>
</neonViewReference>
<neonViewReference>
<name>30334c84-5e46-4a4e-a5c4-3c42d1cb109b</name>
<view>ObjectRelationEdit_view</view>
</neonViewReference>
</references>
</neonContext>
<?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>Objects</name>
<editMode v="true" />
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>4bb47cac-47a7-448f-a8e6-ebab641d984f</name>
<entityField>OBJECT1_TYPE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>3c548c29-1f77-47e1-bbad-b3063b71224d</name>
<entityField>OBJECT1_ROWID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>7cfab0c5-06c7-4b1d-84e8-97aa76d5e4f3</name>
<entityField>OBJECT2_TYPE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>d0b4d4b6-ab29-478f-9e07-9de07fed0c32</name>
<entityField>OBJECT2_ROWID</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
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