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

[Projekt: Entwicklung - Neon][TicketNr.: 1032314][Attribut-Entity erstellen]

parent e1eb1f2a
No related branches found
No related tags found
No related merge requests found
Showing
with 1011 additions and 27 deletions
This diff is collapsed.
......@@ -6,6 +6,6 @@ import("Sql_lib");
//TODO: temporary testing code
var isoCode = vars.get("$field.COUNTRY");
var countryName = db.cell(SqlCondition.begin().andPrepare("COUNTRYINFO.ISO2", isoCode).buildSelect("select COUNTRYINFO.NAME_LATIN from COUNTRYINFO"));
var countryName = db.cell(SqlCondition.begin().andPrepare("COUNTRYINFO.ISO2", isoCode).buildSql("select COUNTRYINFO.NAME_LATIN from COUNTRYINFO"));
countryName = translate.text(countryName);
result.string(countryName);
\ No newline at end of file
......@@ -69,7 +69,7 @@
<name>ATTRIBUTE_NAME</name>
</entityField>
<entityParameter>
<name>objectRowId</name>
<name>objectRowId_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
......@@ -87,10 +87,18 @@
<name>ATTRIBUTE_TYPE</name>
</entityField>
<entityParameter>
<name>objectType</name>
<name>objectType_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
<name>BOOL_VALUE</name>
<contentType>BOOLEAN</contentType>
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/bool_value/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>ID_VALUE</name>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -159,6 +167,14 @@
<name>ATTRIBUTE_TYPE.value</name>
<expression>%aditoprj%/entity/AttributeRelation_entity/recordcontainers/db/recordfieldmappings/attribute_type.value/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>BOOL_VALUE.value</name>
<recordfield>AB_ATTRIBUTERELATION.BOOL_VALUE</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ID_VALUE.value</name>
<recordfield>AB_ATTRIBUTERELATION.ID_VALUE</recordfield>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
......
import("system.db");
import("system.vars");
import("system.result");
import("Sql_lib");
//get all attributes for that context
var attrSql = "select AB_ATTRIBUTEID, ATTRIBUTE_NAME from AB_ATTRIBUTE";
attrSql = SqlCondition.begin() //TODO: add condition
.buildSelect(attrSql);
result.object(db.table(attrSql));
\ No newline at end of file
import("Attribute_lib");
result.object(AttributeUtil.getPossibleAttributes(vars.get("$param.objectType_param")));
import("system.logging");
import("system.vars");
import("system.result");
import("Attribute_lib");
var attrType = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeType();
var attrType = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeContentType();
logging.log("type is " + attrType)
result.string(attrType);
\ No newline at end of file
......@@ -3,7 +3,8 @@ import("system.vars");
import("Entity_lib");
import("Attribute_lib");
attrValue = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.ATTRIBUTERELATION_VALUE"));
var attrValue = vars.exists("$field.ATTRIBUTERELATION_VALUE") ? vars.get("$field.ATTRIBUTERELATION_VALUE") : "";
attrValue = ProcessHandlingUtils.getOnValidationValue(attrValue);
var attribute = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID"));
attribute.setAttributeValue(attrValue);
......
......@@ -3,12 +3,12 @@ import("system.result");
import("system.vars");
import("Attribute_lib");
var attrValue = vars.getString("$field.ATTRIBUTERELATION_VALUE");
var attrValue = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeValue();
if (attrValue != "")
//var attrValue = vars.getString("$field.ATTRIBUTERELATION_VALUE");
var attrField = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeField();
if (attrField != null)
{
logging.log("value of " + vars.get("$field.AB_ATTRIBUTERELATIONID") + " (" + vars.get("$field.ATTRIBUTE_NAME") + ") = " + attrValue)
result.string(attrValue);
logging.log("value of " + vars.get("$field.AB_ATTRIBUTERELATIONID") + " (" + vars.get("$field.ATTRIBUTE_NAME") + ") = " + attrField)
result.string(vars.get(attrField));
}
import("system.result");
result.string("0")
\ No newline at end of file
......@@ -2,5 +2,5 @@ import("system.vars");
import("system.result");
import("system.neon");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.objectRowId") && vars.get("$param.objectRowId") != null)
result.string(vars.get("$param.objectRowId"));
\ No newline at end of file
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.objectRowId_param") && vars.get("$param.objectRowId_param") != null)
result.string(vars.get("$param.objectRowId_param"));
\ No newline at end of file
......@@ -2,5 +2,5 @@ import("system.vars");
import("system.result");
import("system.neon");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.objectType") && vars.get("$param.objectType") != null)
result.string(vars.get("$param.objectType"));
\ No newline at end of file
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.objectType_param") && vars.get("$param.objectType_param") != null)
result.string(vars.get("$param.objectType_param"));
\ No newline at end of file
......@@ -3,10 +3,10 @@ import("system.vars");
import("system.result");
import("Sql_lib");
if (vars.exists("$param.objectRowId"))
if (vars.exists("$param.objectRowId_param") && vars.get("$param.objectRowId_param") != null)
{
cond = SqlCondition.begin()
.andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", vars.get("$param.objectRowId"))
.andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", vars.get("$param.objectRowId_param"))
.build();
result.string(db.translateCondition(cond));
}
......
<?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.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.1.1">
<name>AttributeUsage_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<recordContainer>db</recordContainer>
<entityFields>
<entityIncomingField>
<name>#INCOMING</name>
</entityIncomingField>
<entityField>
<name>OBJECT_TYPE</name>
<title>Entity</title>
<possibleItemsProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/object_type/possibleItemsProcess.js</possibleItemsProcess>
</entityField>
<entityField>
<name>DATE_NEW</name>
<contentType>DATE</contentType>
<valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/date_new/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DATE_EDIT</name>
<contentType>DATE</contentType>
</entityField>
<entityField>
<name>USER_NEW</name>
<valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/user_new/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>USER_EDIT</name>
</entityField>
<entityField>
<name>AB_ATTRIBUTEUSAGEID</name>
<valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/ab_attributeusageid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>AB_ATTRIBUTE_ID</name>
<valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js</valueProcess>
</entityField>
<entityIncomingField>
<name>Attribute_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>47ac9f95-8879-43fd-92a9-86079e735e58</name>
<entityName>Attribute_entity</entityName>
<fieldName>AttributeUsage_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
<entityParameter>
<name>attributeId_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
<name>MIN_COUNT</name>
<title>Minimal Count</title>
<contentType>NUMBER</contentType>
<searchable v="false" />
<onValidation>%aditoprj%/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js</onValidation>
</entityField>
<entityField>
<name>MAX_COUNT</name>
<title>Maximal Count</title>
<contentType>NUMBER</contentType>
<searchable v="false" />
<onValidation>%aditoprj%/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js</onValidation>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
<name>db</name>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<linkInformation>
<linkInformation>
<name>c30f5670-580e-4621-95dd-0fec4a99190f</name>
<tableName>AB_ATTRIBUTEUSAGE</tableName>
<primaryKey>AB_ATTRIBUTEUSAGEID</primaryKey>
<isUIDTable v="true" />
<readonly v="false" />
</linkInformation>
</linkInformation>
<recordFieldMappings>
<dbRecordFieldMapping>
<name>AB_ATTRIBUTE_ID.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>AB_ATTRIBUTEUSAGEID.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DATE_EDIT.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.DATE_EDIT</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DATE_NEW.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.DATE_NEW</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>OBJECT_TYPE.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.OBJECT_TYPE</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>USER_EDIT.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.USER_EDIT</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>USER_NEW.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.USER_NEW</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>MAX_COUNT.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.MAX_COUNT</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>MIN_COUNT.value</name>
<recordfield>AB_ATTRIBUTEUSAGE.MIN_COUNT</recordfield>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
</entity>
import("system.vars");
import("system.result");
import("system.neon");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.attributeId_param") && vars.get("$param.attributeId_param") != null)
result.string(vars.get("$param.attributeId_param"));
\ No newline at end of file
import("system.util");
import("system.result");
import("system.neon");
import("system.vars");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
result.string(util.getNewUUID());
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
result.string(vars.getString("$sys.date"));
\ No newline at end of file
import("system.result");
import("system.vars");
import("system.translate");
import("Entity_lib");
var maxCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MAX_COUNT"));
if (maxCount)
{
maxCount = Number(maxCount);
if (maxCount <= 0 || maxCount != Math.floor(maxCount)) //when specified, max count must can't be negative, zero or not an integer
result.string(false);
}
import("system.result");
import("system.vars");
import("system.translate");
import("Entity_lib");
var minCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MIN_COUNT"));
if (minCount)
{
minCount = Number(minCount);
if (minCount < 0 || minCount != Math.floor(minCount)) //when specified, max count must can't be negative or not an integer
result.string(false);
}
import("system.result");
result.object([["Org_context", "Org"]]);
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
result.string(vars.getString("$sys.user"));
\ No newline at end of file
import("system.result");
import("system.vars");
if(vars.exists("$param.attributeId_param") && vars.get("$param.attributeId_param") != null)
result.string("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = ('" + vars.getString("$param.attributeId_param") + "')");
else
result.string("1 = 2");
\ No newline at end of file
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