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

AttributeRelation Tree

parent 8be41781
No related branches found
No related tags found
No related merge requests found
Showing
with 316 additions and 1 deletion
......@@ -391,6 +391,28 @@
<documentation>%aditoprj%/entity/Activity_entity/entityfields/presetlinks_param/documentation.adoc</documentation>
<description>PARAMETER</description>
</entityParameter>
<entityConsumer>
<name>AttributeTree</name>
<title>Attribute Tree</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AttributeRelationTree_entity</entityName>
<fieldName>TreeProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Activity_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Activity_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.ACTIVITYID"));
\ No newline at end of file
import("system.result");
import("Context_lib");
result.string(ContextUtils.getCurrentContextId());
<?xml version="1.0" encoding="UTF-8"?>
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.0">
<name>AttributeRelationTree_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<recordContainer>jdito</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
</entityProvider>
<entityField>
<name>PARENT_ID</name>
</entityField>
<entityField>
<name>TITLE</name>
</entityField>
<entityField>
<name>UID</name>
</entityField>
<entityParameter>
<name>ObjectType_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityParameter>
<name>ObjectRowId_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityProvider>
<name>TreeProvider</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>e0a7a4bc-ec7f-4f09-9b94-cbeb328cd7b8</name>
<entityName>Organisation_entity</entityName>
<fieldName>AttributeTree</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>f29d91fe-2537-486f-b9de-44065a7790d4</name>
<entityName>Person_entity</entityName>
<fieldName>AttributeTree</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>445c1bd7-4e72-4ab7-a5b1-cc77924eb562</name>
<entityName>Product_entity</entityName>
<fieldName>AttributeTree</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>4498139f-067c-4cca-b122-d9bc9100c53d</name>
<entityName>Activity_entity</entityName>
<fieldName>AttributeTree</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>d6d5f9aa-4582-4ec5-9381-394a38a726e8</name>
<entityName>Offer_entity</entityName>
<fieldName>AttributeTree</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>b728166d-a74f-4ca1-8ce7-7e57032f2a7d</name>
<entityName>Contract_entity</entityName>
<fieldName>AttributeTree</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
<name>jdito</name>
<jDitoRecordAlias>Data_alias</jDitoRecordAlias>
<contentProcess>%aditoprj%/entity/AttributeRelationTree_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
<recordFields>
<element>UID.value</element>
<element>PARENT_ID.value</element>
<element>TITLE.value</element>
</recordFields>
</jDitoRecordContainer>
</recordContainers>
</entity>
import("system.vars");
import("system.result");
import("system.db");
import("Attribute_lib");
import("Sql_lib");
var objectType = vars.get("$param.ObjectType_param");
var rowId = vars.get("$param.ObjectRowId_param");
var attributeObj = {};
var allAttributes = [];
var sqlSelect = "select AB_ATTRIBUTEID, ATTRIBUTE_PARENT_ID, ATTRIBUTE_NAME, ATTRIBUTE_LEVEL from AB_ATTRIBUTE";
var attributeValues = AttributeRelationUtils.getAllAttributes(rowId, objectType, false, true);
_fetchAttributes(attributeValues.map(function (row) {return row[1]}));
allAttributes = allAttributes
.sort(function (a, b) {return a[3] - b[3];}) //sort by level to make sure parents are added first
.map(function (row) {return [row[0], row[1], row[2]];}) //remove level from array
.concat(attributeValues);
result.object(allAttributes);
function _fetchAttributes (pAttributeIds)
{
var condition = SqlCondition.begin();
var nextIds = [];
pAttributeIds.forEach(function (id)
{
if (!(id in this))
condition.orPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", id);
}, attributeObj);
db.table(condition.buildSql(sqlSelect, "1=2"))
.forEach(function (row)
{
this[row[0]] = true;
if (row[1])
nextIds.push(row[1]);
else
row[1] = null;
allAttributes.push(row);
}, attributeObj);
if (nextIds.length)
_fetchAttributes(nextIds);
}
\ No newline at end of file
......@@ -11,6 +11,7 @@
</entityProvider>
<entityField>
<name>AB_ATTRIBUTERELATIONID</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attributerelationid/valueProcess.js</valueProcess>
</entityField>
<entityField>
......@@ -25,11 +26,13 @@
<entityField>
<name>OBJECT_ROWID</name>
<mandatory v="true" />
<searchable v="false" />
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/object_rowid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>OBJECT_TYPE</name>
<mandatory v="true" />
<searchable v="false" />
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/object_type/valueProcess.js</valueProcess>
</entityField>
<entityField>
......@@ -46,6 +49,7 @@
<entityField>
<name>CHAR_VALUE</name>
<mandatory v="false" />
<searchable v="false" />
</entityField>
<entityProvider>
<name>RelationsForSpecificObject</name>
......@@ -105,11 +109,13 @@
<entityField>
<name>DATE_VALUE</name>
<contentType>DATE</contentType>
<searchable v="false" />
<state>EDITABLE</state>
</entityField>
<entityField>
<name>NUMBER_VALUE</name>
<contentType>NUMBER</contentType>
<searchable v="false" />
<state>EDITABLE</state>
</entityField>
<entityParameter>
......@@ -120,16 +126,18 @@
<entityField>
<name>BOOL_VALUE</name>
<contentType>BOOLEAN</contentType>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/bool_value/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>ID_VALUE</name>
<searchable v="false" />
</entityField>
<entityField>
<name>ATTRIBUTE_PARENT_ID</name>
<title>Superordinate Attribute</title>
<possibleItemsProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attribute_parent_id/possibleItemsProcess.js</possibleItemsProcess>
<groupable v="true" />
<searchable v="false" />
<displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attribute_parent_id/displayValueProcess.js</displayValueProcess>
<onValueChangeTypes>
<element>MASK</element>
......@@ -155,6 +163,7 @@
</entityConsumer>
<entityField>
<name>MEMO_VALUE</name>
<searchable v="false" />
</entityField>
<entityParameter>
<name>FilteredAttributeIds_param</name>
......
......@@ -300,6 +300,28 @@
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>AttributeTree</name>
<title>Attribute Tree</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AttributeRelationTree_entity</entityName>
<fieldName>TreeProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Contract_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Contract_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.CONTRACTID"));
import("system.result");
import("Context_lib");
result.string(ContextUtils.getCurrentContextId());
......@@ -636,6 +636,28 @@
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityConsumer>
<name>AttributeTree</name>
<title>Attribute Tree</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AttributeRelationTree_entity</entityName>
<fieldName>TreeProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.OFFERID"));
\ No newline at end of file
import("system.result");
import("Context_lib");
result.string(ContextUtils.getCurrentContextId());
......@@ -398,6 +398,7 @@
<children>
<entityParameter>
<name>ObjectRowId_param</name>
<title></title>
<valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
......@@ -721,6 +722,28 @@
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityConsumer>
<name>AttributeTree</name>
<title>Attribute Tree</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AttributeRelationTree_entity</entityName>
<fieldName>TreeProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.ORGANISATIONID"));
\ No newline at end of file
import("system.result");
import("Context_lib");
result.string(ContextUtils.getCurrentContextId());
......@@ -781,6 +781,28 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>AttributeTree</name>
<title>Attribute Tree</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AttributeRelationTree_entity</entityName>
<fieldName>TreeProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.PERSONID"));
import("system.result");
import("Context_lib");
result.string(ContextUtils.getCurrentContextId());
......@@ -404,6 +404,28 @@
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>AttributeTree</name>
<title>Attribute Tree</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AttributeRelationTree_entity</entityName>
<fieldName>TreeProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Product_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Product_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
import("Context_lib");
result.string(vars.get("$field.PRODUCTID"));
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