Skip to content
Snippets Groups Projects
Commit 77e1b637 authored by S.Listl's avatar S.Listl
Browse files

Attribute tree: faster loading of the full name

parent 4427ceeb
No related branches found
No related tags found
No related merge requests found
...@@ -11,10 +11,11 @@ import("Attribute_lib"); ...@@ -11,10 +11,11 @@ import("Attribute_lib");
var uidTableAlias = "SELF"; var uidTableAlias = "SELF";
var sqlSelect = "select SELF.AB_ATTRIBUTEID, SELF.ATTRIBUTE_PARENT_ID, SELF.ATTRIBUTE_ACTIVE, SELF.KEYWORD_CONTAINER, SELF.SORTING, SELF.ATTRIBUTE_TYPE, " var sqlSelect = "select SELF.AB_ATTRIBUTEID, SELF.ATTRIBUTE_PARENT_ID, SELF.ATTRIBUTE_ACTIVE, SELF.KEYWORD_CONTAINER, SELF.SORTING, SELF.ATTRIBUTE_TYPE, "
+ KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.attributeType(), "SELF.ATTRIBUTE_TYPE") //3 + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.attributeType(), "SELF.ATTRIBUTE_TYPE") //3
+ ", '', SELF.ATTRIBUTE_NAME, PARENT1.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_PARENT_ID " + ", '', SELF.ATTRIBUTE_NAME, PARENT1.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_NAME, PARENT3.ATTRIBUTE_NAME, PARENT3.ATTRIBUTE_PARENT_ID "
+ "from AB_ATTRIBUTE SELF " + "from AB_ATTRIBUTE SELF "
+ "left join AB_ATTRIBUTE PARENT1 on SELF.ATTRIBUTE_PARENT_ID = PARENT1.AB_ATTRIBUTEID " //always select the names of the next 2 parents so that less queries + "left join AB_ATTRIBUTE PARENT1 on SELF.ATTRIBUTE_PARENT_ID = PARENT1.AB_ATTRIBUTEID " //always select the names of the next 3 parents so that less queries
+ "left join AB_ATTRIBUTE PARENT2 ON PARENT1.ATTRIBUTE_PARENT_ID = PARENT2.AB_ATTRIBUTEID"; //are required later when buildung the full name + "left join AB_ATTRIBUTE PARENT2 ON PARENT1.ATTRIBUTE_PARENT_ID = PARENT2.AB_ATTRIBUTEID " //are required later when buildung the full name
+ "left join AB_ATTRIBUTE PARENT3 ON PARENT2.ATTRIBUTE_PARENT_ID = PARENT3.AB_ATTRIBUTEID";
var condition = SqlCondition.begin(); var condition = SqlCondition.begin();
var sqlOrder = " order by SELF.ATTRIBUTE_PARENT_ID asc, SELF.SORTING asc"; var sqlOrder = " order by SELF.ATTRIBUTE_PARENT_ID asc, SELF.SORTING asc";
...@@ -120,18 +121,18 @@ function _buildAttributeTable (pAttributes) ...@@ -120,18 +121,18 @@ function _buildAttributeTable (pAttributes)
} }
var fullName = displaySimpleName var fullName = displaySimpleName
? rowData[8] ? rowData[8]
: _getFullName(rowData[8], rowData[9], rowData[10], rowData[11]); : _getFullName(rowData[8], rowData[9], rowData[10], rowData[11], rowData[12]);
rowData.splice(9, 3, fullName); rowData.splice(9, 4, fullName);
sortedArray[rows[i].index] = rowData; sortedArray[rows[i].index] = rowData;
} }
return sortedArray; return sortedArray;
} }
function _getFullName (pAttributeName, pParent1Name, pParent2Name, pParent3Id) function _getFullName (pAttributeName, pParent1Name, pParent2Name, pParent3Name, pParent4Id)
{ {
var parent3FullName = pParent3Id ? AttributeUtil.getFullAttributeName(pParent3Id) : null; var parent4FullName = pParent4Id ? AttributeUtil.getFullAttributeName(pParent4Id) : null;
pAttributeName = ArrayUtils.joinNonEmptyFields([parent3FullName, pParent2Name, pParent1Name, pAttributeName], " / "); pAttributeName = ArrayUtils.joinNonEmptyFields([parent4FullName, pParent3Name, pParent2Name, pParent1Name, pAttributeName], " / ");
return pAttributeName; return pAttributeName;
} }
\ No newline at end of file
...@@ -91,13 +91,20 @@ AttributeUtil.getFullAttributeName = function (pAttributeId, pSimpleName) ...@@ -91,13 +91,20 @@ AttributeUtil.getFullAttributeName = function (pAttributeId, pSimpleName)
var attribute; var attribute;
do { do {
attribute = db.array(db.ROW, SqlCondition.begin() attribute = db.array(db.ROW, SqlCondition.begin()
.andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) .andPrepare(["AB_ATTRIBUTE", "AB_ATTRIBUTEID", "ATTRIBUTE"], pAttributeId)
.buildSql("select ATTRIBUTE_NAME, ATTRIBUTE_PARENT_ID from AB_ATTRIBUTE") .buildSql("select ATTRIBUTE.ATTRIBUTE_NAME, PARENT1.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_PARENT_ID \n\
from AB_ATTRIBUTE ATTRIBUTE \n\
left join AB_ATTRIBUTE PARENT1 on ATTRIBUTE.ATTRIBUTE_PARENT_ID = PARENT1.AB_ATTRIBUTEID \n\
left join AB_ATTRIBUTE PARENT2 on PARENT1.ATTRIBUTE_PARENT_ID = PARENT2.AB_ATTRIBUTEID")
); );
if (attribute.length > 0) if (attribute.length > 0)
{ {
attributeNames.push(attribute[0]); attributeNames.push(attribute[0]);
pAttributeId = attribute[1]; if (attribute[1])
attributeNames.push(attribute[1]);
if (attribute[2])
attributeNames.push(attribute[2]);
pAttributeId = attribute[3];
} }
else else
pAttributeId = ""; pAttributeId = "";
......
<?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.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<name>DocumentTemplate_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/DocumentTemplate_lib/process.js</process>
</process>
This diff is collapsed.
<?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.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<name>getDocxDocument_serverProcess</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/getDocxDocument_serverProcess/process.js</process>
</process>
This diff is collapsed.
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