diff --git a/entity/ObjectRelation_entity/ObjectRelation_entity.aod b/entity/ObjectRelation_entity/ObjectRelation_entity.aod index 1b9041901eddb089d3f4aab84e910782ab82b5ed..20aaa80e4901c0f03e1cefa49693e70b3f80a2ce 100644 --- a/entity/ObjectRelation_entity/ObjectRelation_entity.aod +++ b/entity/ObjectRelation_entity/ObjectRelation_entity.aod @@ -13,6 +13,7 @@ <name>OBJECT1_TYPE</name> <title>Type 1</title> <consumer>Contexts</consumer> + <linkedContextProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_type/linkedContextProcess.js</linkedContextProcess> <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> @@ -20,6 +21,7 @@ <entityField> <name>OBJECT1_ROWID</name> <title>Object 1</title> + <consumer>Objects1</consumer> <linkedContextProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/linkedContextProcess.js</linkedContextProcess> </entityField> <entityField> @@ -28,6 +30,7 @@ <entityField> <name>OBJECT2_ROWID</name> <title>Object 2</title> + <consumer>Objects2</consumer> <linkedContextProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_rowid/linkedContextProcess.js</linkedContextProcess> </entityField> <entityField> @@ -182,6 +185,8 @@ <entityProvider> <name>AnyObject</name> <fieldType>DEPENDENCY_IN</fieldType> + <targetContextField>OBJECT1_TYPE</targetContextField> + <targetIdField>OBJECT1_ROWID</targetIdField> <recordContainer>db</recordContainer> <dependencies> <entityDependency> @@ -245,6 +250,36 @@ <fieldName>#PROVIDER</fieldName> </dependency> </entityConsumer> + <entityConsumer> + <name>Objects1</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>Object_entity</entityName> + <fieldName>AllObjects</fieldName> + </dependency> + <children> + <entityParameter> + <name>ObjectType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/objects1/children/objecttype_param/code.js</code> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>Objects2</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>Object_entity</entityName> + <fieldName>AllObjects</fieldName> + </dependency> + <children> + <entityParameter> + <name>ObjectType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/objects2/children/objecttype_param/code.js</code> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/ObjectRelation_entity/entityfields/object1_type/linkedContextProcess.js b/entity/ObjectRelation_entity/entityfields/object1_type/linkedContextProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/ObjectRelation_entity/entityfields/objects1/children/objecttype_param/code.js b/entity/ObjectRelation_entity/entityfields/objects1/children/objecttype_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..b3edc8d5129d7466309b808d0975584267fffa9d --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/objects1/children/objecttype_param/code.js @@ -0,0 +1,6 @@ +import("system.logging"); +import("system.vars"); +import("system.result"); + +logging.log("type: " + vars.get("$field.OBJECT1_TYPE")) +result.string(vars.get("$field.OBJECT1_TYPE")) \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/objects2/children/objecttype_param/code.js b/entity/ObjectRelation_entity/entityfields/objects2/children/objecttype_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/Object_entity/recordcontainers/jdito/contentProcess.js b/entity/Object_entity/recordcontainers/jdito/contentProcess.js index 261298d70507407f2412c76f8bda51043d2ad848..ddef820042f2f02cf8fdca93586229d3dbf58cf1 100644 --- a/entity/Object_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Object_entity/recordcontainers/jdito/contentProcess.js @@ -1,5 +1,16 @@ +import("system.db"); +import("system.vars"); +import("system.logging"); import("system.result"); import("Context_lib"); +logging.log("huuihuihihi"); -// TODO: no subselect? -result.string(ContextUtils.getNameSubselectSql("OBJECT2_TYPE", "OBJECT2_ROWID")) \ No newline at end of file +if (vars.exists("$param.ObjectType_param")) +{ + if (vars.exists("$param.ObjectRowId_param")) + { + result.object(db.table(vars.get("$param.ObjectRowId_param"), ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowId_param")))); + } + result.object(db.table(ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param")))) +} +result.object([]); \ No newline at end of file diff --git a/neonContext/Object_context/Object_context.aod b/neonContext/Object_context/Object_context.aod index c1da8f8e6f1f0561c1d80fa0f5668662a1c6ef68..c09553d8af6353233bf503cc64a19a918a344222 100644 --- a/neonContext/Object_context/Object_context.aod +++ b/neonContext/Object_context/Object_context.aod @@ -2,5 +2,12 @@ <neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.0.0"> <name>Object_context</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <lookupview>ObjectLookup_view</lookupview> <entity>Object_entity</entity> + <references> + <neonViewReference> + <name>a9193747-07f9-41f4-8bea-97c46e20bd05</name> + <view>ObjectLookup_view</view> + </neonViewReference> + </references> </neonContext> diff --git a/neonView/ContactMain_view/ContactMain_view.aod b/neonView/ContactMain_view/ContactMain_view.aod index ceab7df984efd3bb1f692f5fac7d37440dfee998..ecebeb9bb8368704330bffe02560653a1f65a66b 100644 --- a/neonView/ContactMain_view/ContactMain_view.aod +++ b/neonView/ContactMain_view/ContactMain_view.aod @@ -16,22 +16,22 @@ </neonViewReference> <neonViewReference> <name>d674b32c-0493-47ea-a51f-dff5d13d237d</name> - <entityField>PersActivity_dfo</entityField> + <entityField>Activities</entityField> <view>ActivityFilter_view</view> </neonViewReference> <neonViewReference> <name>4b50b784-484f-4cdf-a705-4c356da763fa</name> - <entityField>PersDocument_dfo</entityField> + <entityField>Documents</entityField> <view>DocumentFilter_view</view> </neonViewReference> <neonViewReference> <name>ec344a07-7b82-4c54-b06b-30ac5b8599f9</name> - <entityField>PersContract_dfo</entityField> + <entityField>Contracts</entityField> <view>ContractFilter_view</view> </neonViewReference> <neonViewReference> <name>726f10a6-dad6-4325-a73e-2d6caf0340db</name> - <entityField>ObjectRelation_dfo</entityField> + <entityField>ObjectRelations</entityField> <view>ObjectRelationFilter_view</view> </neonViewReference> </children> diff --git a/neonView/ObjectLookup_view/ObjectLookup_view.aod b/neonView/ObjectLookup_view/ObjectLookup_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..b6116c46e2266e551978c902600a6281349ec249 --- /dev/null +++ b/neonView/ObjectLookup_view/ObjectLookup_view.aod @@ -0,0 +1,22 @@ +<?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>ObjectLookup_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>objects</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>f131a39f-a3fe-42a6-b5df-65e12ae9eea7</name> + <entityField>TITLE</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 816a7bb13ed0df309bd1e9c79be35e2891eddb5b..0ee031cecc2fb3beca76472d35ca22aafaf41985 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -57,8 +57,8 @@ ContextUtils._getSelectMap = function() var maskingUtils = new SqlMaskingUtils(); return { // contextId nameField Tablename, IDField - "Org_context": ["\"NAME\"", "ORG", "ORGID"], - "Pers_context": [maskingUtils.concat(["FIRSTNAME", "LASTNAME"]), "PERS", "PERSID"], + "Organisation_context": ["\"NAME\"", "ORG", "ORGID"], + "Contact_context": [maskingUtils.concat(["FIRSTNAME", "LASTNAME"]), "PERS", "PERSID"], "Activity_context": ["SUBJECT", "ACTIVITY", "ACTIVITYID"], "Salesproject_context": [maskingUtils.concat([maskingUtils.cast("PROJECTCODE", SQLTYPES.VARCHAR, 10), "':'", "PROJECTTITLE"]), "SALESPROJECT", "SALESPROJECTID"], // TODO: keywords sind noch nicht in der DB somit gibt es nichts ähnliches zu getKeySQL. @@ -74,11 +74,10 @@ ContextUtils.getNameSubselectSql = function(pContextIdDbField, pRowIdDbField) { var select = "(case " + pContextIdDbField + " "; - var selectMap = ContextUtils._getSelectMap() for (let contextId in selectMap) { - select += "when '" + contextId + "' then (select " + selectMap[contextId][0] + " from " + selectMap[contextId][1] + " where " + selectMap[contextId][2] + " = " + pRowIdDbField + ") "; + select += "when '" + contextId + "' then (select " + selectMap[contextId][0] + " from " + selectMap[contextId][1] + (pRowIdDbField ? " where " + selectMap[contextId][2] + " = " + pRowIdDbField : " ") + ") "; } select += "else 'Not defined in ContextUtils.getNameSql()!'"; @@ -102,5 +101,11 @@ ContextUtils.getNameSql = function(pContextId, pRowId) ContextUtils.getContextDataSql = function(pContextId, pRowId) { var selectMap = ContextUtils._getSelectMap() - return SqlCondition.begin().andPrepare(selectMap[pContextId][1] + "." + selectMap[pContextId][2], pRowId).buildSql("select " + selectMap[contextId][2] + ", " + selectMap[contextId][0] + " from " + selectMap[contextId][1], "1=1"); + var cond = SqlCondition.begin(); + if (pRowId) + { + cond.andPrepare(selectMap[pContextId][1] + "." + selectMap[pContextId][2], pRowId) + } + + return cond.buildSql("select " + selectMap[pContextId][2] + ", " + selectMap[pContextId][0] + " from " + selectMap[pContextId][1], "1=1"); } \ No newline at end of file