diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 0b734992cbf469c8ad0c53e3ec90f2ef3f35c583..eed1bb576180f095df20d45252e1b2d7d5f7adf1 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -5116,6 +5116,787 @@ </entityFieldDb> </entityFields> </entityDb> + <entityDb> + <name>AB_ATTRIBUTEUSAGE</name> + <dbName></dbName> + <idColumn>AB_ATTRIBUTEUSAGEID</idColumn> + <idGeneratorType v="0" /> + <idGeneratorInterval v="1" /> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="0" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>AB_ATTRIBUTEUSAGEID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>AB_ATTRIBUTE_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>OBJECT_TYPE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="63" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>MIN_COUNT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="4" /> + <size v="10" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>MAX_COUNT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="4" /> + <size v="10" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> + <entityDb> + <name>AB_ATTRIBUTE</name> + <dbName></dbName> + <idColumn>AB_ATTRIBUTEID</idColumn> + <idGeneratorType v="0" /> + <idGeneratorInterval v="1" /> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="0" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>ATTRIBUTE_NAME</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="63" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ATTRIBUTE_TYPE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="63" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>AB_ATTRIBUTEID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ATTRIBUTE_ACTIVE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="5" /> + <size v="5" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ATTRIBUTE_PARENT_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> + <entityDb> + <name>AB_ATTRIBUTERELATION</name> + <dbName></dbName> + <idColumn>AB_ATTRIBUTERELATIONID</idColumn> + <idGeneratorType v="0" /> + <idGeneratorInterval v="1" /> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="0" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>OBJECT_ROWID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>BOOL_VALUE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="5" /> + <size v="5" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_VALUE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>NUMBER_VALUE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="2" /> + <size v="14" /> + <scale v="2" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>AB_ATTRIBUTERELATIONID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>OBJECT_TYPE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="63" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CHAR_VALUE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="63" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>AB_ATTRIBUTE_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ID_VALUE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> + <entityDb> + <name>DATABASECHANGELOG</name> + <dbName></dbName> + <idColumn></idColumn> + <idGeneratorType v="1" /> + <idGeneratorInterval v="1" /> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="0" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>EXECTYPE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="10" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATEEXECUTED</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ORDEREXECUTED</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="4" /> + <size v="10" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>COMMENTS</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>AUTHOR</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CONTEXTS</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>MD5SUM</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="35" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DESCRIPTION</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>LIQUIBASE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="20" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DEPLOYMENT_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="10" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>TAG</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>LABELS</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>FILENAME</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> + <entityDb> + <name>DATABASECHANGELOGLOCK</name> + <dbName></dbName> + <idColumn>ID</idColumn> + <idGeneratorType v="1" /> + <idGeneratorInterval v="1" /> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="0" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>LOCKGRANTED</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>LOCKED</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="16" /> + <size v="1" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>LOCKEDBY</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="255" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="4" /> + <size v="10" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> </entities> </entityGroup> </aliasDefDb> diff --git a/entity/Address_entity/entityfields/country/displayValueProcess.js b/entity/Address_entity/entityfields/country/displayValueProcess.js index c030b65a02e1a02786c9791741fb73746b54f901..227f7b918bd110839b2b8d801078b239d8f56b7f 100644 --- a/entity/Address_entity/entityfields/country/displayValueProcess.js +++ b/entity/Address_entity/entityfields/country/displayValueProcess.js @@ -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 diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index 20938e93f594c2d2e64717e1079456d90e61008c..1e4c91f04cc6179015626206d42773394e0caba3 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -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> diff --git a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js index db23dc640cdb99f86570478770bd76a37acdbeaf..2449074c9672b85ce7ddec1e78cfce6710a1e7fb 100644 --- a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js +++ b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js @@ -1,11 +1,5 @@ -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"))); diff --git a/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js b/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js index fe458c9ab433005cbde2e975aa2c02621a1a7f42..ccd7b53d9e4d0fc3179309d08ce8ff17ad651702 100644 --- a/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js +++ b/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js @@ -1,6 +1,8 @@ +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 diff --git a/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js b/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js index 7937f8e04a370bd7ddee7d8604a6609d3e86f5e8..0dcab8e25a383d7f578549187155687ac32d89c5 100644 --- a/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js +++ b/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js @@ -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); diff --git a/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js b/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js index 59280880c332f6d5a36c650a1ef0fccfbf3e2651..dc4b3c47bae965a6a21168c8ce6c4ef087ae0176 100644 --- a/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js +++ b/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js @@ -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)); } diff --git a/entity/AttributeRelation_entity/entityfields/bool_value/valueProcess.js b/entity/AttributeRelation_entity/entityfields/bool_value/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..13b11be60e6ff9abcd2ae44306b70f3367cdb5ed --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/bool_value/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("0") \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/object_rowid/valueProcess.js b/entity/AttributeRelation_entity/entityfields/object_rowid/valueProcess.js index 99b42d18f75e3441154047d5f9b7136e8ef5166e..83fdc179510373157ac394d755c406adc59e1c43 100644 --- a/entity/AttributeRelation_entity/entityfields/object_rowid/valueProcess.js +++ b/entity/AttributeRelation_entity/entityfields/object_rowid/valueProcess.js @@ -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 diff --git a/entity/AttributeRelation_entity/entityfields/object_type/valueProcess.js b/entity/AttributeRelation_entity/entityfields/object_type/valueProcess.js index 66c6cdedc9052d770105010df3701efec0e71e5f..a2239bdb8c4a4c4cc92b319a4e90a2a64260b97e 100644 --- a/entity/AttributeRelation_entity/entityfields/object_type/valueProcess.js +++ b/entity/AttributeRelation_entity/entityfields/object_type/valueProcess.js @@ -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 diff --git a/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js b/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js index 689065291e1ef2f0f3d59d09cac9d07ec7faeae5..f83ae05abaf417c8b8502955eb3a6af39a9d4f89 100644 --- a/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js +++ b/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js @@ -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)); } diff --git a/entity/AttributeUsage_entity/AttributeUsage_entity.aod b/entity/AttributeUsage_entity/AttributeUsage_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..02591fac2b2e708712f9a5e6fd813446eff12191 --- /dev/null +++ b/entity/AttributeUsage_entity/AttributeUsage_entity.aod @@ -0,0 +1,126 @@ +<?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> diff --git a/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js b/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d3399e68903611cd80b239a5b3a24bb62282d0fc --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js @@ -0,0 +1,6 @@ +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 diff --git a/entity/AttributeUsage_entity/entityfields/ab_attributeusageid/valueProcess.js b/entity/AttributeUsage_entity/entityfields/ab_attributeusageid/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7df83b4096e7df4d63cc4d81f8fadf0884444479 --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/ab_attributeusageid/valueProcess.js @@ -0,0 +1,7 @@ +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 diff --git a/entity/AttributeUsage_entity/entityfields/date_new/valueProcess.js b/entity/AttributeUsage_entity/entityfields/date_new/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7acb3c80848f54a4c6dfee5efa7a5b8514dd4a71 --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/date_new/valueProcess.js @@ -0,0 +1,6 @@ +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 diff --git a/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js b/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..cfec392b7024d4f7c6113dfc840fb39aa8b6e96f --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js @@ -0,0 +1,13 @@ +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); +} diff --git a/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js b/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..36ddf1f1fdf60592f1f46cec7c9983495ccb9e6c --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js @@ -0,0 +1,13 @@ +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); +} diff --git a/entity/AttributeUsage_entity/entityfields/object_type/possibleItemsProcess.js b/entity/AttributeUsage_entity/entityfields/object_type/possibleItemsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ad231346ea73dafb48059894d1f10c3d36050ef2 --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/object_type/possibleItemsProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.object([["Org_context", "Org"]]); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/user_new/valueProcess.js b/entity/AttributeUsage_entity/entityfields/user_new/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a8a5e28793c742f8f3e10907976e746faf43c67c --- /dev/null +++ b/entity/AttributeUsage_entity/entityfields/user_new/valueProcess.js @@ -0,0 +1,6 @@ +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 diff --git a/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js b/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f7bc09814242ecd21bf3ad37099740d77f73fa32 --- /dev/null +++ b/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js @@ -0,0 +1,7 @@ +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 diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index 9a4ed6eb7a35f7f4cd09d15c1e18af18b59f628f..2a9637e1bd5623990e3aa29d003d3afdb8fda758 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -26,7 +26,6 @@ </entityField> <entityField> <name>ATTRIBUTE_PARENT_ID</name> - <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js</valueProcess> </entityField> <entityField> <name>DATE_NEW</name> @@ -46,12 +45,55 @@ <entityField> <name>USER_EDIT</name> </entityField> + <entityOutgoingField> + <name>AttributeChild_dfo</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <fieldName></fieldName> + </dependency> + </entityOutgoingField> + <entityIncomingField> + <name>AttributeParent_dfi</name> + <fieldType>DEPENDENCY_IN</fieldType> + <recordContainer>db</recordContainer> + </entityIncomingField> + <entityParameter> + <name>attrParentId_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> + <entityOutgoingField> + <name>AttributeUsage_dfo</name> + <title>Usage</title> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>AttributeUsage_entity</entityName> + <fieldName>Attribute_dfi</fieldName> + </dependency> + <children> + <entityParameter> + <name>attributeId_param</name> + <code>%aditoprj%/entity/Attribute_entity/entityfields/attributeusage_dfo/children/attributeid_param/code.js</code> + <triggerRecalculation v="true" /> + </entityParameter> + </children> + </entityOutgoingField> + <entityField> + <name>ATTRIBUTE_ACTIVE</name> + <title>Active</title> + <contentType>BOOLEAN</contentType> + <possibleItemsProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_active/possibleItemsProcess.js</possibleItemsProcess> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js</valueProcess> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> <conditionProcess>%aditoprj%/entity/Attribute_entity/recordcontainers/db/conditionProcess.js</conditionProcess> + <onDBDelete>%aditoprj%/entity/Attribute_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> <name>b5fd38e1-b315-4e66-bd68-569dfc04710c</name> @@ -93,6 +135,10 @@ <name>USER_NEW.value</name> <recordfield>AB_ATTRIBUTE.USER_NEW</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ATTRIBUTE_ACTIVE.value</name> + <recordfield>AB_ATTRIBUTE.ATTRIBUTE_ACTIVE</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Attribute_entity/entityfields/attribute_active/possibleItemsProcess.js b/entity/Attribute_entity/entityfields/attribute_active/possibleItemsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e4c1d8a78277a5e9b51c2d33a8a96bd3f26186cb --- /dev/null +++ b/entity/Attribute_entity/entityfields/attribute_active/possibleItemsProcess.js @@ -0,0 +1,7 @@ +import("system.translate"); +import("system.result"); + +result.object([ + ["1", translate.text("Yes")], + ["0", translate.text("No")] +]); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js b/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..246c17c087fbbb4d52c421b75fd2ed3cecd21442 --- /dev/null +++ b/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string("1"); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js b/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js deleted file mode 100644 index 229750916e60d67850d99af11ea9f1de22c7c8f5..0000000000000000000000000000000000000000 --- a/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.vars"); -import("system.result"); - -if (vars.exists("$field.AB_ATTRIBUTEID")) - result.string(vars.get("$field.AB_ATTRIBUTEID")); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js b/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js index 3ad103318252b8d15150a637ef00da854b5f7927..3dc3e304437678edc609efc401378f1d2b0d84e9 100644 --- a/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js @@ -1,12 +1,4 @@ -import("system.translate"); import("system.result"); +import("Attribute_lib"); -var contentTypes = [ - ["PARENT", translate.text("Group")], - ["TEXT", translate.text("Text")], - ["NUMBER", translate.text("Number")], - ["DATE", translate.text("Date")], - ["BOOLEAN", translate.text("Checkbox")] -]; - -result.object(contentTypes); \ No newline at end of file +result.object(AttributeTypes.getTypeList()); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attributeusage_dfo/children/attributeid_param/code.js b/entity/Attribute_entity/entityfields/attributeusage_dfo/children/attributeid_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..033bf9a666c5254c8945077776b2834560164e56 --- /dev/null +++ b/entity/Attribute_entity/entityfields/attributeusage_dfo/children/attributeid_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.AB_ATTRIBUTEID")); \ No newline at end of file diff --git a/entity/Attribute_entity/recordcontainers/db/onDBDelete.js b/entity/Attribute_entity/recordcontainers/db/onDBDelete.js new file mode 100644 index 0000000000000000000000000000000000000000..504e2d5e4f82c9ccbdeb7b380f546003c3f5f9a8 --- /dev/null +++ b/entity/Attribute_entity/recordcontainers/db/onDBDelete.js @@ -0,0 +1,11 @@ +import("system.vars"); +import("system.db"); +import("Sql_lib"); + +var attributeId = vars.get("$field.AB_ATTRIBUTEID"); +var usageCondition = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", attributeId) + .build(); + +//delete all entries in AB_ATTRIBUTEUSAGE belonging to the attribute to avoid unrelated entries +db.deleteData("AB_ATTRIBUTEUSAGE", usageCondition); \ No newline at end of file diff --git a/entity/Org_entity/Org_entity.aod b/entity/Org_entity/Org_entity.aod index ae97f276c3cb95adaa22e5cde20a78cb0538cb12..7aad5dc5f50cca43077eb0f71d7b771003c94eae 100644 --- a/entity/Org_entity/Org_entity.aod +++ b/entity/Org_entity/Org_entity.aod @@ -466,6 +466,8 @@ <entityName>Countries_Entity</entityName> <fieldName>ISO2_NAME</fieldName> </dependency> + </entityOutgoingField> + <entityOutgoingField> <name>OrgAttr_dfo</name> <title>Attributes</title> <fieldType>DEPENDENCY_OUT</fieldType> @@ -476,8 +478,13 @@ </dependency> <children> <entityParameter> - <name>objectRowId</name> - <code>%aditoprj%/entity/Org_entity/entityfields/orgattr_dfo/children/objectrowid/code.js</code> + <name>objectRowId_param</name> + <code>%aditoprj%/entity/Org_entity/entityfields/orgattr_dfo/children/objectrowid_param/code.js</code> + <triggerRecalculation v="true" /> + </entityParameter> + <entityParameter> + <name>objectType_param</name> + <code>%aditoprj%/entity/Org_entity/entityfields/orgattr_dfo/children/objecttype_param/code.js</code> <triggerRecalculation v="true" /> </entityParameter> </children> diff --git a/entity/Org_entity/entityfields/language/displayValueProcess.js b/entity/Org_entity/entityfields/language/displayValueProcess.js index 434f279047976fe4508d8618e40717c3bde40fb0..d8f39933bb77696608441a3f4b99abafcc0ba9db 100644 --- a/entity/Org_entity/entityfields/language/displayValueProcess.js +++ b/entity/Org_entity/entityfields/language/displayValueProcess.js @@ -6,6 +6,6 @@ import("Sql_lib"); //TODO: temporary testing code var isoCode = vars.get("$field.LANGUAGE"); -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 diff --git a/entity/Org_entity/entityfields/orgattr_dfo/children/objectrowid/code.js b/entity/Org_entity/entityfields/orgattr_dfo/children/objectrowid_param/code.js similarity index 100% rename from entity/Org_entity/entityfields/orgattr_dfo/children/objectrowid/code.js rename to entity/Org_entity/entityfields/orgattr_dfo/children/objectrowid_param/code.js diff --git a/entity/Org_entity/entityfields/orgattr_dfo/children/objecttype_param/code.js b/entity/Org_entity/entityfields/orgattr_dfo/children/objecttype_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..5996e99db232db8df50f155732110608e5abff4e --- /dev/null +++ b/entity/Org_entity/entityfields/orgattr_dfo/children/objecttype_param/code.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getCurrentContextId()); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 1827341f95eac8a925c1bd316d285373208a5e8b..7b5592f85ebcf7b63d8ceab1be399b2cfe734e14 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -1461,6 +1461,18 @@ <entry> <key>${ADDRESS_STATE}</key> </entry> + <entry> + <key>${NUMBER}</key> + </entry> + <entry> + <key>Usage</key> + </entry> + <entry> + <key>Maximal Count</key> + </entry> + <entry> + <key>Minimal Count</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 304422d8f287882831d2253eb7a8d255c33a65b8..014c54344e826da644c36e2fc6b4e9910b88d54f 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -22,6 +22,10 @@ <key>E-Mail</key> <value>E-Mail</value> </entry> + <entry> + <key>Maximal Count</key> + <value>Maximale Anzahl</value> + </entry> <entry> <key>Customer</key> <value>Kunde</value> @@ -30,6 +34,10 @@ <key>Internal</key> <value>Intern</value> </entry> + <entry> + <key>Usage</key> + <value>Verwendung</value> + </entry> <entry> <key>Show all activities</key> <value>Alle Aktivitäten anzeigen</value> @@ -114,6 +122,10 @@ <key>Online-Meeting</key> <value>Online-Meeting</value> </entry> + <entry> + <key>${NUMBER}</key> + <value>Zahl</value> + </entry> <entry> <key>Choose address</key> <value>Adresse auswählen</value> @@ -925,6 +937,10 @@ <key>Total gross</key> <value>Betrag brutto</value> </entry> + <entry> + <key>Minimal Count</key> + <value>Minimale Anzahl</value> + </entry> <entry> <key>${ORGTYPE_OTHER}</key> <value>Sonstige</value> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index ea7e8213f71c4113797f8fb6b391461d8fc40bea..ef18f89bf9a6e332acbcf563985bd312f0a471cf 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -1491,6 +1491,19 @@ <key>${ADDRESS_STATE}</key> <value>state</value> </entry> + <entry> + <key>${NUMBER}</key> + <value>Number</value> + </entry> + <entry> + <key>Usage</key> + </entry> + <entry> + <key>Maximal Count</key> + </entry> + <entry> + <key>Minimal Count</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/AttributeUsage_context/AttributeUsage_context.aod b/neonContext/AttributeUsage_context/AttributeUsage_context.aod new file mode 100644 index 0000000000000000000000000000000000000000..520b5db6374fe8a00aea3a0141b481f10407b9c9 --- /dev/null +++ b/neonContext/AttributeUsage_context/AttributeUsage_context.aod @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.0.0"> + <name>AttributeUsage_context</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <entity>AttributeUsage_entity</entity> + <references> + <neonViewReference> + <name>6f384e66-886a-4a88-90b2-3fa74447b485</name> + <view>AttributeUsageFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>db6545ff-cbf4-4c47-aa52-30ae7e203448</name> + <view>AttributeUsageMultiEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonView/AttributeEdit_view/AttributeEdit_view.aod b/neonView/AttributeEdit_view/AttributeEdit_view.aod index 8b8e4d7257f0306adec5f8944570728b343cb119..5409c8302b77e6c2062b0f7065aa7ea4978de2fd 100644 --- a/neonView/AttributeEdit_view/AttributeEdit_view.aod +++ b/neonView/AttributeEdit_view/AttributeEdit_view.aod @@ -21,7 +21,16 @@ <name>8cbc6049-2530-4960-b45f-830f3220889e</name> <entityField>ATTRIBUTE_TYPE</entityField> </entityFieldLink> + <entityFieldLink> + <name>d26696ac-199c-45f0-9147-b75dee3f4b65</name> + <entityField>ATTRIBUTE_ACTIVE</entityField> + </entityFieldLink> </fields> </genericViewTemplate> + <neonViewReference> + <name>8387ef27-9565-400f-a0d5-ef1d2019b722</name> + <entityField>AttributeUsage_dfo</entityField> + <view>AttributeUsageMultiEdit_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/AttributeMain_view/AttributeMain_view.aod b/neonView/AttributeMain_view/AttributeMain_view.aod index a05ff63592482a74910ad7c4acb5d15c63d3c7c5..38b0c466d6f319a0bc156fac223aa1eacaba6884 100644 --- a/neonView/AttributeMain_view/AttributeMain_view.aod +++ b/neonView/AttributeMain_view/AttributeMain_view.aod @@ -19,5 +19,10 @@ <entityField>#ENTITY</entityField> <view>AttributeFilter_view</view> </neonViewReference> + <neonViewReference> + <name>5dee1c0b-c670-4eb9-bd95-6f6474709aa2</name> + <entityField>AttributeUsage_dfo</entityField> + <view>AttributeUsageFilter_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/AttributeRelationMultiEdit_view/AttributeRelationMultiEdit_view.aod b/neonView/AttributeRelationMultiEdit_view/AttributeRelationMultiEdit_view.aod index ca31736c723a102cd2a0f3bb847bed95199fe535..e872c8b1638a2da5e853d68863a813bdf62890cd 100644 --- a/neonView/AttributeRelationMultiEdit_view/AttributeRelationMultiEdit_view.aod +++ b/neonView/AttributeRelationMultiEdit_view/AttributeRelationMultiEdit_view.aod @@ -9,15 +9,15 @@ </layout> <children> <genericMultipleViewTemplate> - <name>AttrEdit_template</name> + <name>GenericMultiple</name> <entityField>#ENTITY</entityField> <columns> <neonTableColumn> - <name>1f770fc2-2a07-4f7b-b699-b7bbbeb6e9aa</name> + <name>beb3a9bd-ca81-42ce-8d43-d0984946c81e</name> <entityField>AB_ATTRIBUTE_ID</entityField> </neonTableColumn> <neonTableColumn> - <name>f0d587b2-86c2-4bc2-9d6b-61a5e64c7929</name> + <name>29e9bc62-c748-471e-85ae-6c87e8f2dee1</name> <entityField>ATTRIBUTERELATION_VALUE</entityField> </neonTableColumn> </columns> diff --git a/neonView/AttributeRelationTree_view/AttributeRelationTree_view.aod b/neonView/AttributeRelationTree_view/AttributeRelationTree_view.aod index f2ce9e62c6ed051430b89e2c7a94178ded87c1a0..df5ce99c93fe244f3c03b0cc7bb6adc9f2fc7715 100644 --- a/neonView/AttributeRelationTree_view/AttributeRelationTree_view.aod +++ b/neonView/AttributeRelationTree_view/AttributeRelationTree_view.aod @@ -9,12 +9,20 @@ </boxLayout> </layout> <children> - <treetableViewTemplate> - <name>AttrRelationTree_template</name> - <titleField>ATTRIBUTE_NAME</titleField> - <descriptionField>ATTRIBUTERELATION_VALUE</descriptionField> + <tableViewTemplate> + <name>Table</name> + <autoNewRow v="false" /> <entityField>#ENTITY</entityField> - <title>Attributes</title> - </treetableViewTemplate> + <columns> + <neonTableColumn> + <name>b37d207a-6119-454a-8fc6-073e9d54b1d3</name> + <entityField>AB_ATTRIBUTE_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>83a10d52-9eaf-4901-935e-2a7410831861</name> + <entityField>ATTRIBUTERELATION_VALUE</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> </children> </neonView> diff --git a/neonView/AttributeUsageFilter_view/AttributeUsageFilter_view.aod b/neonView/AttributeUsageFilter_view/AttributeUsageFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..78e83f9ef0da3853e12c6c5274f14cc9ecef5c48 --- /dev/null +++ b/neonView/AttributeUsageFilter_view/AttributeUsageFilter_view.aod @@ -0,0 +1,30 @@ +<?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.0.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.1"> + <name>AttributeUsageFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>UsageTable_template</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>ba8d5468-4e59-4ab8-8174-afcca1ae0d9e</name> + <entityField>OBJECT_TYPE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>7e7ebe69-2c09-402c-9264-5c5ea48a202b</name> + <entityField>MIN_COUNT</entityField> + </neonTableColumn> + <neonTableColumn> + <name>07683f36-9b32-43aa-8bd5-51c3d7761c76</name> + <entityField>MAX_COUNT</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/AttributeUsageMultiEdit_view/AttributeUsageMultiEdit_view.aod b/neonView/AttributeUsageMultiEdit_view/AttributeUsageMultiEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..d4c440597438eeaa4c21caa866e4262314bc19d6 --- /dev/null +++ b/neonView/AttributeUsageMultiEdit_view/AttributeUsageMultiEdit_view.aod @@ -0,0 +1,35 @@ +<?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.0.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.1"> + <name>AttributeUsageMultiEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericMultipleViewTemplate> + <name>UsageEdit_template</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>a2efb4ca-4e8d-4e90-9870-2cebf338d95f</name> + <entityField>OBJECT_TYPE</entityField> + <width v="75" /> + </neonTableColumn> + <neonTableColumn> + <name>0ea0ead0-99a7-460a-ab8a-d3ef5f780682</name> + <entityField>MIN_COUNT</entityField> + <width v="75" /> + <expandRatio v="100" /> + </neonTableColumn> + <neonTableColumn> + <name>6fcd2a5b-641f-4b8f-aee0-cb18987b8a04</name> + <entityField>MAX_COUNT</entityField> + <width v="75" /> + <expandRatio v="100" /> + </neonTableColumn> + </columns> + </genericMultipleViewTemplate> + </children> +</neonView> diff --git a/others/db_changes/data_alias/struct/AditoBasic/create_ab_attribute.xml b/others/db_changes/data_alias/struct/AditoBasic/create_ab_attribute.xml index c273b1d47371ffc9301454e9dbc0857376a0a75f..ccff0d652557dbee6f8887e42c95b9bfb2ef9023 100644 --- a/others/db_changes/data_alias/struct/AditoBasic/create_ab_attribute.xml +++ b/others/db_changes/data_alias/struct/AditoBasic/create_ab_attribute.xml @@ -13,6 +13,9 @@ <column name="ATTRIBUTE_NAME" type="NVARCHAR(63)"> <constraints nullable="false"/> </column> + <column name="ATTRIBUTE_ACTIVE" type="TINYINT"> + <constraints nullable="false"/> + </column> <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> diff --git a/others/db_changes/data_alias/struct/AditoBasic/create_ab_attributerelation.xml b/others/db_changes/data_alias/struct/AditoBasic/create_ab_attributerelation.xml index cf41044fa1bbb8a96838a1141eeaaacb6e184eac..77936415efd5e740191953ad7ff7a9fbe013b039 100644 --- a/others/db_changes/data_alias/struct/AditoBasic/create_ab_attributerelation.xml +++ b/others/db_changes/data_alias/struct/AditoBasic/create_ab_attributerelation.xml @@ -15,9 +15,12 @@ <constraints nullable="false"/> </column> <column name="CHAR_VALUE" type="NVARCHAR(63)"/> + <column name="ID_VALUE" type="CHAR(36)"/> <column name="DATE_VALUE" type="TIMESTAMP"/> <column name="NUMBER_VALUE" type="NUMERIC(14,2)"/> - <column name="ID_VALUE" type="CHAR(36)"/> + <column name="BOOL_VALUE" type="TINYINT"> + <constraints nullable="false"/> + </column> <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> diff --git a/others/db_changes/data_alias/struct/AditoBasic/create_ab_attributeusage.xml b/others/db_changes/data_alias/struct/AditoBasic/create_ab_attributeusage.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b4aa710596aefc6d3917d1a5775031d4537d990 --- /dev/null +++ b/others/db_changes/data_alias/struct/AditoBasic/create_ab_attributeusage.xml @@ -0,0 +1,25 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="s.listl" id="f303c620-ebe0-4c47-a05a-d987c9a1514d"> + <createTable tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" type="CHAR(36)"> + <constraints primaryKey="true" primaryKeyName="PK_AB_ATTRIBUTEUSAGE_AB_ATTRIBUTEUSAGEID"/> + </column> + <column name="AB_ATTRIBUTE_ID" type="CHAR(36)"> + </column> + <column name="OBJECT_TYPE" type="NVARCHAR(63)"> + <constraints nullable="false"/> + </column> + <column name="MIN_COUNT" type="INTEGER"/> + <column name="MAX_COUNT" type="INTEGER"/> + <column name="USER_NEW" type="NVARCHAR(50)"> + <constraints nullable="false"/> + </column> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="DATE_NEW" type="TIMESTAMP"> + <constraints nullable="false"/> + </column> + <column name="DATE_EDIT" type="TIMESTAMP"/> + </createTable> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/others/db_changes/masterChangelog.xml b/others/db_changes/masterChangelog.xml index b805a9c6776c219e9f6149e5f756ac4faef1679b..c55cf19447048d87214f64b25ccbf144ad283619 100644 --- a/others/db_changes/masterChangelog.xml +++ b/others/db_changes/masterChangelog.xml @@ -3,6 +3,7 @@ <include file="data_alias/struct/AditoBasic/create_ab_objectrelation.xml"/> <include file="data_alias/struct/AditoBasic/create_ab_attribute.xml"/> <include file="data_alias/struct/AditoBasic/create_ab_attributerelation.xml"/> + <include file="data_alias/struct/AditoBasic/create_ab_attributeusage.xml"/> <include file="data_alias/struct/create_pers.xml"/> <include file="data_alias/struct/create_org.xml"/> diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index 83a8f7163a8703181b5b42c2a52d9343056015e1..8c541df0b19762c4742612df3c2f65691b46f8b5 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -1,12 +1,50 @@ +import("system.translate"); import("system.neon"); import("system.vars"); import("system.db"); import("Sql_lib"); +/** + * Provides functions for the work with attributes. + * Don't instanciate this! + * + * @class + */ function AttributeUtil () {} +AttributeUtil.getPossibleAttributes = function (pObjectType) +{ + if (pObjectType == null) + return []; + + var attrSql = "select AB_ATTRIBUTEID, ATTRIBUTE_NAME from AB_ATTRIBUTE" + + " join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID"; + attrSql = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) + .buildSql(attrSql); + + return db.table(attrSql); +} + +AttributeUtil.getAttribute = function () +{ + +} + +AttributeUtil.getAttributes = function () +{ + +} + +AttributeUtil.setAttribute = function () +{ + +} +/** + * object for handling values of the AttributeRelation entity + */ function AttributeHandler (pAttrId) { this.attributeId = pAttrId; @@ -18,40 +56,38 @@ AttributeHandler.begin = function (pAttrId) return new AttributeHandler(pAttrId); } -AttributeHandler.prototype.getAttributeType = function () +/** + * gets the type of the attribute by the attributeId, after the first call the value + * is stored so that the sql selection is done only once + * + * @return {String} attribute type + */ +AttributeHandler.prototype._getAttributeType = function () { if (this._attributeType == null && this.attributeId != null) { var attrTypeSelect = "select ATTRIBUTE_TYPE from AB_ATTRIBUTE"; attrTypeSelect = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", this.attributeId) - .buildSelect(attrTypeSelect); + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", this.attributeId) + .buildSql(attrTypeSelect); this._attributeType = db.cell(attrTypeSelect); } return this._attributeType; } +/** + * returns the field that belongs to the type of the attribute + * + * @return {String} attribute field + */ AttributeHandler.prototype.getAttributeField = function () { - switch (this.getAttributeType()) - { - case "TEXT": - return "$field.CHAR_VALUE"; - case "DATE": - return "$field.DATE_VALUE"; - case "NUMBER": - return "$field.NUMBER_VALUE"; - default: - return null; //TODO: change default value maybe - } + return AttributeTypes.getAttributeField(this._getAttributeType()); } -AttributeHandler.prototype.getAttributeValue = function () +AttributeHandler.prototype.getAttributeContentType = function () { - var field = this.getAttributeField(); - if (field != null && vars.exists(field)) - return vars.get(field); - return null; //TODO: change default value maybe + return AttributeTypes.getContentType(this._getAttributeType()); } AttributeHandler.prototype.setAttributeValue = function (pValue) @@ -60,4 +96,83 @@ AttributeHandler.prototype.setAttributeValue = function (pValue) if (field != null && vars.exists(field)) neon.setFieldValue(field, pValue) return pValue; -} \ No newline at end of file +} + +/** + * Object for the enumeration of all attribute types. + */ +var AttributeTypes = { + TEXT : "TEXT", + DATE : "DATE", + NUMBER : "NUMBER", + BOOLEAN : "BOOLEAN", + COMBO : "COMBO", + GROUP : "GROUP" +} + +/** + * returns the required contentType for the given attribute type + * + * @param {String} pAttributeType the attribute type + * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) + * @return {String} the contentType for the attribute + */ +AttributeTypes.getContentType = function (pAttributeType) +{ + switch (pAttributeType) + { + case AttributeTypes.TEXT: + case AttributeTypes.DATE: + case AttributeTypes.NUMBER: + case AttributeTypes.BOOLEAN: + return pAttributeType; + case AttributeTypes.COMBO: + return AttributeTypes.TEXT; + default: + return null; //TODO: change default value maybe + } +} + +/** + * returns the required field for the given attribute type that holds the value of the attribute + * + * @param {String} pAttributeType the attribute type + * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) + * @return {String} the field for the attribute + */ +AttributeTypes.getAttributeField = function (pAttributeType) +{ + switch (pAttributeType) + { + case AttributeTypes.TEXT: + return "$field.CHAR_VALUE"; + case AttributeTypes.DATE: + return "$field.DATE_VALUE"; + case AttributeTypes.NUMBER: + return "$field.NUMBER_VALUE"; + case AttributeTypes.BOOLEAN: + return "$field.BOOL_VALUE"; + case AttributeTypes.COMBO: + return "$field.ID_VALUE"; + default: + return null; //TODO: change default value maybe + } +} + +/** + * Makes a two-dimensional array of the attribute types and the corresponding names. + * This is used for the selection of the type when creating an attribute. + * + * @return {String[][]} array with attribute types and names + */ +AttributeTypes.getTypeList = function () +{ + return [ + [AttributeTypes.TEXT, translate.text("Text")], + [AttributeTypes.DATE, translate.text("Date")], + [AttributeTypes.NUMBER, translate.text("${NUMBER}")], + [AttributeTypes.BOOLEAN, translate.text("Checkbox")], + [AttributeTypes.COMBO, translate.text("Combobox")], + [AttributeTypes.GROUP, translate.text("Group")] + ]; +}