diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod index 76217f3083ad4b778071b258c87b84857d5140a7..df8385fa8fbe6b6e32f925fcf2bba765e0d03d3d 100644 --- a/entity/Address_entity/Address_entity.aod +++ b/entity/Address_entity/Address_entity.aod @@ -105,7 +105,6 @@ </entityProvider> <entityParameter> <name>ContactId_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/contactid_param/valueProcess.js</valueProcess> <expose v="true" /> <mandatory v="true" /> <documentation>%aditoprj%/entity/Address_entity/entityfields/contactid_param/documentation.adoc</documentation> diff --git a/entity/Address_entity/entityfields/contactid_param/valueProcess.js b/entity/Address_entity/entityfields/contactid_param/valueProcess.js deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/entity/Attribute_entity/recordcontainers/jdito/onDelete.js b/entity/Attribute_entity/recordcontainers/jdito/onDelete.js index 61929ba31c941a074a9666920632025c03fb614c..046b1dca18f622ac02623b1f82cb419c9d0d5d81 100644 --- a/entity/Attribute_entity/recordcontainers/jdito/onDelete.js +++ b/entity/Attribute_entity/recordcontainers/jdito/onDelete.js @@ -7,13 +7,13 @@ var condition = SqlCondition.begin() .andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.UID") .build("1=2"); -db.deleteData("AB_ATTRIBUTE", conditon); +db.deleteData("AB_ATTRIBUTE", condition); var attributeId = vars.get("$field.UID"); var childIds = AttributeUtil.getAllChildren(attributeId).concat(attributeId); -var condition = SqlCondition.begin() +condition = SqlCondition.begin() .and("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID in ('" + childIds.join("','") + "')") .build(); diff --git a/entity/ObjectTree_entity/ObjectTree_entity.aod b/entity/ObjectTree_entity/ObjectTree_entity.aod index 1be26c1bbfc3609921f444ec9918c1522d1f49a2..9effca076ad7f18b57a5e2de2acc60573e03738c 100644 --- a/entity/ObjectTree_entity/ObjectTree_entity.aod +++ b/entity/ObjectTree_entity/ObjectTree_entity.aod @@ -11,8 +11,6 @@ <entityProvider> <name>TreeProvider</name> <fieldType>DEPENDENCY_IN</fieldType> - <targetContextField>TARGET_CONTEXT</targetContextField> - <targetIdField>TARGET_ID</targetIdField> <dependencies> <entityDependency> <name>f4c0605f-3ccb-4ff1-b460-7268e8553857</name> @@ -42,6 +40,10 @@ <name>RelationType_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>Uid_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityParameter> @@ -61,10 +63,12 @@ </entityField> <entityField> <name>TITLE</name> + <title>Object</title> <searchable v="false" /> </entityField> <entityField> <name>ICON</name> + <contentType>IMAGE</contentType> <searchable v="false" /> <valueProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/icon/valueProcess.js</valueProcess> </entityField> @@ -99,8 +103,12 @@ </entityField> <entityField> <name>TARGET_ID</name> + <title>Object</title> <consumer>Objects</consumer> + <linkedContextProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/target_id/linkedContextProcess.js</linkedContextProcess> <searchable v="false" /> + <stateProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/target_id/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>TARGET_CONTEXT</name> @@ -110,6 +118,7 @@ <entityField> <name>INFO</name> <title>Description</title> + <contentType>LONG_TEXT</contentType> <searchable v="false" /> </entityField> <entityField> @@ -152,6 +161,13 @@ <isSelectionAction v="true" /> <iconId>VAADIN:FILE_TREE_SMALL</iconId> </entityActionField> + <entityActionField> + <name>edit</name> + <fieldType>ACTION</fieldType> + <onActionProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js</onActionProcess> + <isSelectionAction v="true" /> + <iconId>NEON:PENCIL</iconId> + </entityActionField> </children> </entityActionGroup> <entityParameter> @@ -159,6 +175,11 @@ <expose v="true" /> <description>PARAMETER</description> </entityParameter> + <entityParameter> + <name>Uid_param</name> + <expose v="true" /> + <description>Needed to load ONE Objectrelation together with ObjectId_param and ObjectType_param to determine the side</description> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -166,6 +187,7 @@ <jDitoRecordAlias>Data_alias</jDitoRecordAlias> <contentProcess>%aditoprj%/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <onInsert>%aditoprj%/entity/ObjectTree_entity/recordcontainers/jdito/onInsert.js</onInsert> + <onUpdate>%aditoprj%/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js</onUpdate> <onDelete>%aditoprj%/entity/ObjectTree_entity/recordcontainers/jdito/onDelete.js</onDelete> <recordFields> <element>UID.value</element> diff --git a/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js b/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8cbab6477934deb6b65153433d326c1b2b87cbac --- /dev/null +++ b/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js @@ -0,0 +1,18 @@ +import("ObjectRelation_lib"); +import("system.neon"); +import("system.vars"); + +if (vars.exists("$local.rows") && vars.get("$local.rows")) +{ + var selectedRows = JSON.parse(vars.get("$local.rows")); + var uid = JSON.parse(selectedRows[0]["#LOOKUPID"]); + var isObjectRelationNode = typeof uid[2] == "string"; + + if (isObjectRelationNode) + { + var params = { + "Uid_param" : selectedRows[0]["#LOOKUPID"] + } + neon.openContext("ObjectTree", "ObjectTreeEdit_view", null, neon.OPERATINGSTATE_EDIT, params); + } +} \ No newline at end of file diff --git a/entity/ObjectTree_entity/entityfields/objectrelationtypeid/displayValueProcess.js b/entity/ObjectTree_entity/entityfields/objectrelationtypeid/displayValueProcess.js index 83a799bf3424546b0600c284b48eba126d842a1a..e4ddc9dc5979726f1d5d93fc8e5973fcfaaedbc2 100644 --- a/entity/ObjectTree_entity/entityfields/objectrelationtypeid/displayValueProcess.js +++ b/entity/ObjectTree_entity/entityfields/objectrelationtypeid/displayValueProcess.js @@ -1,3 +1,4 @@ +import("system.neon"); import("system.translate"); import("system.result"); import("system.vars"); diff --git a/entity/ObjectTree_entity/entityfields/objectrelationtypeid/stateProcess.js b/entity/ObjectTree_entity/entityfields/objectrelationtypeid/stateProcess.js index 7c27f2f690b8a109532759ab6ed8da6d97c671bb..7d9ab38c5c715f801518573a4c0d3814b0486a6e 100644 --- a/entity/ObjectTree_entity/entityfields/objectrelationtypeid/stateProcess.js +++ b/entity/ObjectTree_entity/entityfields/objectrelationtypeid/stateProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.vars"); import("system.neon"); -if (vars.exists("$param.RelationType_param") && vars.get("$param.RelationType_param")) +if (vars.exists("$param.RelationType_param") && vars.get("$param.RelationType_param") || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { result.string(neon.COMPONENTSTATE_DISABLED); } diff --git a/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js b/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d074689525fa0fc64cc41002e883c2c8cd5579f3 --- /dev/null +++ b/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js @@ -0,0 +1,10 @@ +import("system.db"); +import("system.result"); +import("system.neon"); +import("system.vars"); +import("Context_lib"); + +if (vars.get("$field.TARGET_ID") && vars.get("$field.TARGET_CONTEXT")) +{ + result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.TARGET_CONTEXT"), vars.get("$field.TARGET_ID")))); +} \ No newline at end of file diff --git a/entity/ObjectTree_entity/entityfields/target_id/linkedContextProcess.js b/entity/ObjectTree_entity/entityfields/target_id/linkedContextProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1309ba4e92dedd6284a0482f87b00c1c46a0f7c8 --- /dev/null +++ b/entity/ObjectTree_entity/entityfields/target_id/linkedContextProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); +import("Context_lib"); + +if (vars.get("$field.TARGET_CONTEXT")) +{ + result.string(ContextUtils.getContextName(vars.get("$field.TARGET_CONTEXT"))); +} diff --git a/entity/ObjectTree_entity/entityfields/target_id/stateProcess.js b/entity/ObjectTree_entity/entityfields/target_id/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..432b555ce843a3f52178d01c2cdef62b633ea8cd --- /dev/null +++ b/entity/ObjectTree_entity/entityfields/target_id/stateProcess.js @@ -0,0 +1,12 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + result.string(neon.COMPONENTSTATE_DISABLED); +} +else +{ + result.string(neon.COMPONENTSTATE_AUTO); +} \ No newline at end of file diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js index bc49795bd4cba307a64304d10edd0cc1f6234716..797fe1f60a5613704385b2dd83ab3929066cc320 100644 --- a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js @@ -7,23 +7,45 @@ import("Context_lib"); import("Sql_lib"); var tree = [] -var filter = JSON.parse(vars.get("$local.filter")) -var selectedRelationType = null; -if (filter) +// uidParam: if only one row should be loaded +var uidParam; +if (vars.exists("$param.Uid_param") && vars.get("$param.Uid_param")) { - if (filter.childs.length > 0) + uidParam = vars.get("$param.Uid_param"); +} +else if(vars.exists("$local.idvalues") && vars.get("$local.idvalues") && vars.get("$local.idvalues").length > 0) +{ + uidParam = vars.get("$local.idvalues")[0]; +} + +if (uidParam) +{ + let uid = JSON.parse(uidParam); + + let relationTypeData = ObjectRelationUtils.getRelationType(uid[2]); + _insertEntry(tree, _getEntryData(uid[0], relationTypeData[3], relationTypeData[7], relationTypeData[8], undefined, false, uid[6]), "", 0, uid[3], relationTypeData[10]); +} +else +{ + var filter = JSON.parse(vars.get("$local.filter")) + var selectedRelationType = null; + + if (filter) { - selectedRelationType = filter.childs[0].value; + if (filter.childs.length > 0) + { + selectedRelationType = filter.childs[0].value; + } } -} -var originalObjectId = vars.get("$param.ObjectId_param"); + var originalObjectId = vars.get("$param.ObjectId_param"); -_loadObjectRelationTree(originalObjectId, vars.get("$param.ObjectType_param"), selectedRelationType); + _loadObjectRelationTree(originalObjectId, vars.get("$param.ObjectType_param"), selectedRelationType); +} result.object(tree); -function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, pNodeId, pLayer, pRelationTypeData) +function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, pNodeId, pLayer, pRelationTypeData, pObjectRelationId) { // prevent stack overflows if (pLayer > 30) @@ -41,9 +63,14 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, { if (pLayer == 0) { - if (pObjectRelationTypeId) + // load only one ObjectRelation (e.g. for edit mode) + if (pObjectRelationId) + { + + } + else if (pObjectRelationTypeId) { - var relationTypeData = ObjectRelationUtils.getRelationType(pObjectRelationTypeId); + let relationTypeData = ObjectRelationUtils.getRelationType(pObjectRelationTypeId); // if hirachy: get most top id else use the current currentObjectId if (relationTypeData[4] == "1") @@ -76,7 +103,7 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, let uid = [currentObjectId, i, relationTypes[i]]; tree.push([JSON.stringify(uid), translate.text(relationTypes[i][1]), JSON.stringify(pNodeId), true, null, null, "", relationTypes[i][0]]); - _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, uid, pLayer+1, relationTypeData); + _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, uid, pLayer+1, relationTypes[i]); } } } @@ -154,12 +181,13 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, * @param {String} pDirection * @param {String} pRelationType1 * @param {String} pRelationType2 - * @param {String} pPrevId Id of the previous node to exclude it + * @param {String} [pPrevId=undefined] Id of the previous node to exclude it * @param {Boolean} [pNoRecursion=false] if false: select for direction "same" the other direction, if result is empty. + * @param {Boolean} [pObjectRelationId=false] provide if only one special node is needed * * @return {[][]} */ -function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pPrevId, pNoRecursion) +function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pPrevId, pNoRecursion, pObjectRelationId) { if (pRelationType1 == undefined || pRelationType2 == undefined) return []; @@ -181,7 +209,8 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP var cond = SqlCondition.begin() .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", pRelationType1) .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pRelationType2) - .andPrepare("AB_OBJECTRELATION.OBJECT" + myNum + "_ROWID", pObjectId); + .andPrepare("AB_OBJECTRELATION.OBJECT" + myNum + "_ROWID", pObjectId) + .andPrepareIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", pObjectRelationId); // exclude previous node if (!pPrevId) @@ -193,17 +222,16 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP // TODO: BINDATA? // var image = getImageObject("Beziehung"); - var data = db.table(cond.buildSql( - "select OBJECT" + otherNum + "_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE, INFO, AB_OBJECTRELATIONTYPEID \n\ + "select OBJECT" + (pObjectRelationId ? myNum : otherNum) + "_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE, INFO, AB_OBJECTRELATIONTYPEID \n\ from AB_OBJECTRELATION \n\ join AB_OBJECTRELATIONTYPE on AB_OBJECTRELATIONTYPEID = AB_OBJECTRELATIONTYPE" + myNum + " and ","1=2", "", false)); - - if (data.length == 0 && pDirection == "same" && !pNoRecursion) + + // try again with other side for "same" + if (data.length == 0 && pDirection == "same" && !pNoRecursion || pObjectRelationId && data.length > 0 && !data[0][0]) { - return _getEntryData(pObjectId, "normal", pRelationType1, pRelationType2, pPrevId, true) + return _getEntryData(pObjectId, "normal", pRelationType1, pRelationType2, pPrevId, true, pObjectRelationId) } - // TODO: BINDATA? //for ( var i = 0; i < data.length; i++) data[i][2] = image[data[i][2]] == undefined ? "" : image[data[i][2]]; return data; @@ -226,7 +254,7 @@ function _getRelationTypes(pObjectType) * @param {String} pNewRelationTypeId the RelationType, a new relation should have, if this node is selected. * @param {Integer} [pNum=undefined] optional number added to the key. Needed, if the key would not be unique. * - * @return {Array[][]} the uids of the inserted data. Consists of [ObjectId, pEntryData-Index, AB_OBJECTRELATIONTYPEID, pObjectType, pNodeId, objectrelationid, objecttype + * @return {Array[][]} the uids of the inserted data. Consists of [ObjectId, pEntryData-Index, AB_OBJECTRELATIONTYPEID, pObjectType (from param), pNodeId, objecttype (from entryId), objectrelationid] */ function _insertEntry(pTree, pEntryData, pNodeId, pLayer, pObjectType, pNewRelationTypeId, pNum) { diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js b/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..23a87592d8929a79aa3e55c6ffd11f4616999f6d --- /dev/null +++ b/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js @@ -0,0 +1,18 @@ +import("system.vars"); +import("system.neon"); +import("system.db"); +import("Sql_lib"); + + +var uid = JSON.parse(vars.get("$field.UID")); +var isObjectRelationNode = typeof uid[2] == "string"; + +if (isObjectRelationNode) +{ + var objectRelationId = uid[6]; + + db.updateData("AB_OBJECTRELATION", ["INFO"], null, [vars.get("$field.INFO")], + SqlCondition.begin() + .andPrepareIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId) + .build("1=2")); +} diff --git a/entity/Object_entity/Object_entity.aod b/entity/Object_entity/Object_entity.aod index 189f11b3a9e366446d7115baa6c948503634dc4f..a35318329e9dad635efdbadc4064e3cf77ec41e4 100644 --- a/entity/Object_entity/Object_entity.aod +++ b/entity/Object_entity/Object_entity.aod @@ -9,12 +9,6 @@ <entityProvider> <name>#PROVIDER</name> <recordContainer>jdito</recordContainer> - <children> - <entityParameter> - <name>ObjectRowId_param</name> - <expose v="false" /> - </entityParameter> - </children> </entityProvider> <entityField> <name>UID</name> diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 4da1b5d9f852d529bc3a225c259c17b48d7c2915..0cfafe4ba1e39dc2f16a750f7f01ed590e7ecae3 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -123,10 +123,6 @@ <fieldType>DEPENDENCY_IN</fieldType> <recordContainer>db</recordContainer> <children> - <entityParameter> - <name>ContactId_param</name> - <expose v="true" /> - </entityParameter> <entityParameter> <name>WithPrivate_param</name> <expose v="true" /> @@ -644,10 +640,6 @@ </entityDependency> </dependencies> <children> - <entityParameter> - <name>ContactId_param</name> - <expose v="false" /> - </entityParameter> <entityParameter> <name>ExcludeOrganisationsByPersonId</name> <title></title> @@ -709,10 +701,6 @@ <name>AttributeKeyId_param</name> <expose v="true" /> </entityParameter> - <entityParameter> - <name>ContactId_param</name> - <expose v="false" /> - </entityParameter> <entityParameter> <name>ExcludeOrganisationsByPersonId</name> <expose v="false" /> diff --git a/neonContext/ObjectTree/ObjectTree.aod b/neonContext/ObjectTree/ObjectTree.aod index a8f24a44156098989667e38818ddd4491116b862..3a0bc38b2c9464edf2e3c6d8e510f00b7d7b2182 100644 --- a/neonContext/ObjectTree/ObjectTree.aod +++ b/neonContext/ObjectTree/ObjectTree.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <filterview>ObjectTreeFilter_view</filterview> <editview>ObjectTreeEdit_view</editview> + <preview>ObjectTreePreview</preview> <entity>ObjectTree_entity</entity> <references> <neonViewReference> @@ -14,5 +15,9 @@ <name>1122516a-5f1c-4f08-9995-02acaee2a0cd</name> <view>ObjectTreeEdit_view</view> </neonViewReference> + <neonViewReference> + <name>1caa61e2-0e59-47bd-a996-db49867e3908</name> + <view>ObjectTreePreview</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/ObjectTreePreview/ObjectTreePreview.aod b/neonView/ObjectTreePreview/ObjectTreePreview.aod new file mode 100644 index 0000000000000000000000000000000000000000..b6b2c90c68a7ba9c2b8376378700684acb382a10 --- /dev/null +++ b/neonView/ObjectTreePreview/ObjectTreePreview.aod @@ -0,0 +1,32 @@ +<?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.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1"> + <name>ObjectTreePreview</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Info</name> + <showDrawer v="true" /> + <drawerCaption>Info</drawerCaption> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>a7ff1a5c-1ea5-4904-a802-b3da55c07341</name> + <entityField>OBJECTRELATIONTYPEID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>0b612a60-d882-4def-b569-7146e1b1ccb6</name> + <entityField>TARGET_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>6ed4e675-b1f5-4790-97d1-d015f87f37e4</name> + <entityField>INFO</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/process/ObjectRelation_lib/process.js b/process/ObjectRelation_lib/process.js index 1010f1a6586588e2fcff7907712724881a666d4b..f44bc3ead9245e888330ea4bbbac35e3f80db11e 100644 --- a/process/ObjectRelation_lib/process.js +++ b/process/ObjectRelation_lib/process.js @@ -1,4 +1,4 @@ -import("system.logging"); +import("Sql_lib"); import("system.db"); /** @@ -10,11 +10,11 @@ import("system.db"); function ObjectRelationUtils() {} /** - * Get all possible relationTypes by a objectType. + * Get all possible relationTypes by a objectType. (objectrelationtypeId and title) * Normally it only returns the id and title. If you set pFullInfo to true, you will get additional information, too. * * @param {String} pObjectType the object type to load the relation types for.] - * @param {Boolean} [pFullInfo=false] return also RELATION_TYPE, direction (normal, reverse, same), hierarchy, OBJECT_TYPE dest, OBJECT_TYPE source, objectrelationtypeId1, objectrelationtypeId2, side, otherSide-RELATION_TYPE + * @param {Boolean} [pFullInfo=false] return also RELATION_TYPE, direction (normal, reverse, same), hierarchy, OBJECT_TYPE dest, OBJECT_TYPE source, objectrelationtypeId1, objectrelationtypeId2, side, objectrelationtypeId * * @return {String[][]} */ @@ -54,7 +54,7 @@ ObjectRelationUtils.getPossibleRelationTypes = function(pObjectType, pFullInfo) -- typeId of Object1\n\ case when type2.AB_OBJECTRELATIONTYPEID is null or main.SIDE = 2 then main.AB_OBJECTRELATIONTYPEID\n\ else type2.AB_OBJECTRELATIONTYPEID end objectrelationtypeId2, \n\ - main.SIDE, type2.AB_OBJECTRELATIONTYPEID" + sql, + main.SIDE, case when type2.AB_OBJECTRELATIONTYPEID is null then main.AB_OBJECTRELATIONTYPEID else type2.AB_OBJECTRELATIONTYPEID end" + sql, [ [pObjectType, db.getColumnTypes("AB_OBJECTRELATIONTYPE", ["OBJECT_TYPE"])[0]] ] @@ -64,14 +64,14 @@ ObjectRelationUtils.getPossibleRelationTypes = function(pObjectType, pFullInfo) } /** - * Get all possible relationTypes by a objectType. - * returns the id, title, RELATION_TYPE, direction (normal, reverse, same), hierarchy, OBJECT_TYPE dest, OBJECT_TYPE source, objectrelationtypeId1, objectrelationtypeId2, side, otherSide-RELATION_TYPE + * Get relationType by a RelationTypeId. + * returns the objectrelationtypeId, title, RELATION_TYPE, direction (normal, reverse, same), hierarchy, OBJECT_TYPE dest, OBJECT_TYPE source, objectrelationtypeId1, objectrelationtypeId2, side,objectrelationtypeId * - * @param {String} pObjectTypeId the object type to load the relation types for.] + * @param {String} pRelationTypeId the RelationTypeId to load the full relation type for. * * @return {String[][]} */ -ObjectRelationUtils.getRelationType = function(pObjectTypeId) +ObjectRelationUtils.getRelationType = function(pRelationTypeId) { // TODO: funktionen evtl. zusammenfassen var sql = " from AB_OBJECTRELATIONTYPE main \n\ @@ -94,9 +94,9 @@ ObjectRelationUtils.getRelationType = function(pObjectTypeId) -- typeId of Object1\n\ case when type2.AB_OBJECTRELATIONTYPEID is null or main.SIDE = 2 then main.AB_OBJECTRELATIONTYPEID\n\ else type2.AB_OBJECTRELATIONTYPEID end objectrelationtypeId2, \n\ - main.SIDE, type2.AB_OBJECTRELATIONTYPEID" + sql, + main.SIDE, case when type2.AB_OBJECTRELATIONTYPEID is null then main.AB_OBJECTRELATIONTYPEID else type2.AB_OBJECTRELATIONTYPEID end" + sql, [ - [pObjectTypeId, db.getColumnTypes("AB_OBJECTRELATIONTYPE", ["AB_OBJECTRELATIONTYPEID"])[0]], + [pRelationTypeId, db.getColumnTypes("AB_OBJECTRELATIONTYPE", ["AB_OBJECTRELATIONTYPEID"])[0]], ] ]));