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

Merge master into ObjectRelation2

parents 80f5db0a 9301c5ff
No related branches found
No related tags found
No related merge requests found
Showing
with 147 additions and 66 deletions
......@@ -16,9 +16,10 @@
<entityField>
<name>AB_ATTRIBUTE_ID</name>
<title>Attribute</title>
<consumer>SpecificAttribute</consumer>
<mandatory v="true" />
<possibleItemsProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js</possibleItemsProcess>
<groupable v="true" />
<displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/onValueChange.js</onValueChange>
</entityField>
<entityField>
......@@ -160,6 +161,29 @@
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityConsumer>
<name>SpecificAttribute</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>Attribute_entity</entityName>
<fieldName>SpecificAttribute</fieldName>
</dependency>
<children>
<entityParameter>
<name>objectType_param</name>
<code>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificattribute/children/objecttype_param/code.js</code>
<expose v="true" />
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>filteredAttributeIds_param</name>
<code>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificattribute/children/filteredattributeids_param/code.js</code>
<expose v="true" />
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
import("Attribute_lib");
result.string(AttributeUtil.getFullAttributeName(vars.get("$field.AB_ATTRIBUTE_ID")));
\ No newline at end of file
......@@ -8,4 +8,5 @@ if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT ||
neon.setFieldValue("$field.DATE_VALUE", null);
neon.setFieldValue("$field.ID_VALUE", null);
neon.setFieldValue("$field.NUMBER_VALUE", null);
neon.setFieldValue("$field.MEMO_VALUE", null);
}
\ No newline at end of file
import("system.vars");
import("system.result");
import("Attribute_lib");
var filteredAttributes = [];
if (vars.exists("$param.filteredAttributeIds_param") && vars.get("$param.filteredAttributeIds_param"))
{
filteredAttributes = JSON.parse(vars.get("$param.filteredAttributeIds_param"));
}
result.object(AttributeUtil.getPossibleAttributes(vars.get("$param.objectType_param"), undefined, filteredAttributes));
......@@ -3,39 +3,19 @@ import("system.result");
import("system.vars");
import("Attribute_lib");
"$field.CHAR_VALUE";
"$field.DATE_VALUE";
"$field.NUMBER_VALUE";
"$field.BOOL_VALUE";
"$field.ID_VALUE";
"$field.MEMO_VALUE";
if(vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW)
{
var attrType = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeType();
var attrField = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeField();
var value = null;
if (attrType != null) //load the value from the correct field for the type
{
switch (attrType)
{
case $AttributeTypes.TEXT.toString():
value = vars.get("$field.CHAR_VALUE");
break;
case $AttributeTypes.DATE.toString():
value = vars.get("$field.DATE_VALUE");
break;
case $AttributeTypes.NUMBER.toString():
value = vars.get("$field.NUMBER_VALUE");
break;
case $AttributeTypes.BOOLEAN.toString():
value = vars.get("$field.BOOL_VALUE");
break;
case $AttributeTypes.COMBO.toString():
case $AttributeTypes.KEYWORD.toString():
value = vars.get("$field.ID_VALUE");
break;
case $AttributeTypes.MEMO.toString():
value = vars.get("$field.MEMO_VALUE");
break;
}
}
//var attrField = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeField();
//var value = null;
//if (attrField != null) //load the value from the correct field for the type
// value = vars.get("$field." + attrField);
if (attrField != null) //load the value from the correct field for the type
value = vars.get("$field." + attrField);
if(value != null && value != "")
result.string(value);
......
import("system.vars");
import("system.result");
result.string(vars.exists("$param.filteredAttributeIds_param") ? vars.get("$param.filteredAttributeIds_param") : "");
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.exists("$param.objectType_param") ? vars.get("$param.objectType_param") : "");
\ No newline at end of file
......@@ -29,6 +29,7 @@
</entityField>
<entityField>
<name>AB_ATTRIBUTEID</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/ab_attributeid/valueProcess.js</valueProcess>
</entityField>
<entityField>
......@@ -56,6 +57,11 @@
<triggerRecalculation v="true" />
<mandatory v="false" />
</entityParameter>
<entityParameter>
<name>attrParentType_param</name>
<code>%aditoprj%/entity/Attribute_entity/entityfields/attributechildren/children/attrparenttype_param/code.js</code>
<triggerRecalculation v="true" />
</entityParameter>
</children>
</entityConsumer>
<entityProvider>
......@@ -135,6 +141,48 @@
<state>AUTO</state>
<stateProcess>%aditoprj%/entity/Attribute_entity/entityfields/keyword_container/stateProcess.js</stateProcess>
</entityField>
<entityParameter>
<name>attrParentType_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityParameter>
<name>objectType_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityProvider>
<name>SpecificAttribute</name>
<fieldType>DEPENDENCY_IN</fieldType>
<lookupIdfield>AB_ATTRIBUTEID</lookupIdfield>
<dependencies>
<entityDependency>
<name>342e8ba6-db61-411b-9f79-e9271335b00f</name>
<entityName>AttributeRelation_entity</entityName>
<fieldName>SpecificAttribute</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>objectType_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>filteredAttributeIds_param</name>
<expose v="true" />
</entityParameter>
</children>
</entityProvider>
<entityField>
<name>FULL_ATTRIBUTE_NAME</name>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>filteredAttributeIds_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
import("Attribute_lib");
result.string(AttributeUtil.getFullAttributeName(vars.get("$field.AB_ATTRIBUTEID")));
result.string(vars.get("$field.FULL_ATTRIBUTE_NAME"));
\ No newline at end of file
import("system.vars");
import("system.result");
import("Attribute_lib");
var type = vars.getString("$field.ATTRIBUTE_TYPE").trim();
if (type == $AttributeTypes.GROUP || type == $AttributeTypes.COMBO)
result.string(vars.getString("$field.AB_ATTRIBUTEID"));
else
result.string("");
result.string(vars.getString("$field.AB_ATTRIBUTEID"));
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.getString("$field.ATTRIBUTE_TYPE").trim());
\ No newline at end of file
import("system.vars");
import("system.result");
import("Attribute_lib");
result.string(AttributeUtil.getFullAttributeName(vars.get("$field.AB_ATTRIBUTEID")));
......@@ -4,11 +4,37 @@ import("system.result");
import("Sql_lib");
import("Attribute_lib");
var condition = "AB_ATTRIBUTE.ATTRIBUTE_TYPE = '" + $AttributeTypes.GROUP + "'";
var condition = "1 = 2";
if (vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param"))
condition = "AB_ATTRIBUTE.AB_ATTRIBUTEID in ('" + AttributeUtil.getAllChildren(vars.getString("$param.attrParentId_param")).join("','") + "')";
else if (vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param") !== "")
condition = "";
var objectType = vars.exists("$param.objectType_param") && vars.get("$param.objectType_param");
if (objectType) //if there's an objectType, it comes from the AttributeRelation entity
{
var filteredAttributes = [];
if (vars.exists("$param.filteredAttributeIds_param") && vars.get("$param.filteredAttributeIds_param"))
filteredAttributes = JSON.parse(vars.get("$param.filteredAttributeIds_param"));
var ids = AttributeUtil.getPossibleAttributes(objectType, false, filteredAttributes);
condition = "AB_ATTRIBUTE.AB_ATTRIBUTEID in ('" + ids.join("','") + "')";
}
else
{
var type = vars.exists("$param.attrParentType_param") && vars.get("$param.attrParentType_param");
if (type != $AttributeTypes.COMBOVALUE)
condition = SqlCondition.begin()
.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP)
.build();
if (type == $AttributeTypes.COMBO)
condition = SqlCondition.begin()
.andPrepareVars("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", "$param.attrParentId_param")
.build();
var parentId = vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param");
if (parentId)
condition = "AB_ATTRIBUTE.AB_ATTRIBUTEID in ('" + AttributeUtil.getAllChildren(vars.getString("$param.attrParentId_param")).join("','") + "')";
else if (!type)
condition = "";
}
result.string(condition);
import("system.vars");
import("system.result");
result.string(vars.get("$field.ATTRIBUTE_NAME"));
\ No newline at end of file
result.string(vars.get("$field.FULL_ATTRIBUTE_NAME"));
\ No newline at end of file
......@@ -39,7 +39,7 @@
<name>DATE_EDIT</name>
<title>Datum</title>
<contentType>DATE</contentType>
<outputFormat>yyyy-MM-dd HH:mm:ss</outputFormat>
<resolution>MINUTE</resolution>
<state>READONLY</state>
</entityField>
<entityField>
......
......@@ -8,7 +8,6 @@
<filterview>AttributeFilter_view</filterview>
<editview>AttributeEdit_view</editview>
<preview>AttributePreview_view</preview>
<lookupview>AttributeFilter_view</lookupview>
<entity>Attribute_entity</entity>
<references>
<neonViewReference>
......
......@@ -3,6 +3,7 @@
<name>Home</name>
<title>My Dashboard</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<icon>VAADIN:HOME</icon>
<dashboardType>PRIVATE</dashboardType>
<editRoles />
<defaultDashlets>
......
......@@ -3,7 +3,7 @@
<name>Vertriebsdashboard</name>
<title>Salesdashboard</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<icon>NEON:LOGO_A</icon>
<icon>VAADIN:CHART_GRID</icon>
<dashboardType>PUBLIC</dashboardType>
<editRoles>
<element>INTERNAL_ADMINISTRATOR</element>
......
import("system.logging");
import("system.translate");
import("system.neon");
import("system.vars");
......@@ -15,14 +14,14 @@ import("Sql_lib");
function AttributeUtil () {}
/**
* Gives a list of all available attributes for a context. This is used in the possibleItems
* Gives an array of all available attributes for a context. This is used in the possibleItems
* process for the attribute id in AttributeRelation
*
* @param {String} pObjectType the object type (= context)
* @param {boolean} [pIncludeGroups=false]
* @param {String[]} [pFilteredAttributeIds=[]] Whitleist of attribute ids
*
* @return {String[][]} two-dimensional array of attributeIds and names
* @return {String[]} array of attributeIds
*/
AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups, pFilteredAttributeIds)
{
......@@ -51,10 +50,8 @@ AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups, pFi
if (!pIncludeGroups)
attrCond.and("ATTRIBUTE_TYPE != '" + $AttributeTypes.GROUP + "'");
var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql)).map(function (id)
{
return [id, AttributeUtil.getFullAttributeName(id)];
});
var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql));
return attributes;
}
......
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