diff --git a/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js b/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js index ccd7b53d9e4d0fc3179309d08ce8ff17ad651702..d916ea680e646d3f92de179bf93b33a6bbbf260c 100644 --- a/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js +++ b/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js @@ -1,8 +1,6 @@ -import("system.logging"); import("system.vars"); import("system.result"); import("Attribute_lib"); 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/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index e21123c02461a590b8658b3d4b339b58aa3d69ac..c9bad862b06f3f5dafe664a915461139bb590463 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -18,8 +18,8 @@ <entityField> <name>ATTRIBUTE_TYPE</name> <title>Type</title> + <consumer>KeywordAttributeType</consumer> <mandatory v="true" /> - <possibleItemsProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js</possibleItemsProcess> </entityField> <entityField> <name>AB_ATTRIBUTEID</name> @@ -73,6 +73,21 @@ <possibleItemsProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_active/possibleItemsProcess.js</possibleItemsProcess> <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js</valueProcess> </entityField> + <entityConsumer> + <name>KeywordAttributeType</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>containerName_param</name> + <code>%aditoprj%/entity/Attribute_entity/entityfields/keywordattributetype/children/containername_param/code.js</code> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js b/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js deleted file mode 100644 index 3dc3e304437678edc609efc401378f1d2b0d84e9..0000000000000000000000000000000000000000 --- a/entity/Attribute_entity/entityfields/attribute_type/possibleItemsProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Attribute_lib"); - -result.object(AttributeTypes.getTypeList()); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/keywordattributetype/children/containername_param/code.js b/entity/Attribute_entity/entityfields/keywordattributetype/children/containername_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..437ff727d34d1243615ba8b321e0713af35ae485 --- /dev/null +++ b/entity/Attribute_entity/entityfields/keywordattributetype/children/containername_param/code.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Keyword_lib"); + +result.string($KeywordRegistry.get.AttributeType); \ No newline at end of file diff --git a/entity/KeywordEntry_entity/KeywordEntry_entity.aod b/entity/KeywordEntry_entity/KeywordEntry_entity.aod index 6be1227f046be4e01d3026703d495f2859cfdf5c..d37259ed7b39cfb1e1ce0990a8b3a1f256e2fd75 100644 --- a/entity/KeywordEntry_entity/KeywordEntry_entity.aod +++ b/entity/KeywordEntry_entity/KeywordEntry_entity.aod @@ -232,6 +232,12 @@ <fieldName>KeywordKeywordAttributeTypes</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>078bbd52-87fa-44cc-9902-04af935b5fbc</name> + <entityName>Attribute_entity</entityName> + <fieldName>KeywordAttributeType</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/others/db_changes/data_alias/data/AditoBasic/ab_keyword_entry.xml b/others/db_changes/data_alias/data/AditoBasic/ab_keyword_entry.xml index 75f8991f77e2a93ea463d83a66d3e15fb196306e..fef121e16bd9ea4fa1be6d90512b1c3a1c4adb49 100644 --- a/others/db_changes/data_alias/data/AditoBasic/ab_keyword_entry.xml +++ b/others/db_changes/data_alias/data/AditoBasic/ab_keyword_entry.xml @@ -23,4 +23,5 @@ <include relativeToChangelogFile="true" file="ab_keyword_entry/init_TaskStatus.xml"/> <include relativeToChangelogFile="true" file="ab_keyword_entry/init_TaskType.xml"/> <include relativeToChangelogFile="true" file="ab_keyword_entry/init_KeywordAttributeType.xml"/> + <include relativeToChangelogFile="true" file="ab_keyword_entry/init_AttributeType.xml"/> </databaseChangeLog> diff --git a/others/db_changes/data_alias/data/AditoBasic/ab_keyword_entry/init_AttributeType.xml b/others/db_changes/data_alias/data/AditoBasic/ab_keyword_entry/init_AttributeType.xml new file mode 100644 index 0000000000000000000000000000000000000000..af039c84bed9b5847476a55ebc737c1a6f66cb31 --- /dev/null +++ b/others/db_changes/data_alias/data/AditoBasic/ab_keyword_entry/init_AttributeType.xml @@ -0,0 +1,97 @@ +<?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="55a6a9df-5852-4bd4-ad72-8c575c0a27f6"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="972e5eb1-a457-4b75-b966-1183896dac2c"/> + <column name="KEYID" value="TEXT"/> + <column name="TITLE" value="Text"/> + <column name="CONTAINER" value="AttributeType"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="cb7ecaea-b4e6-460e-9006-4a3d059b9857"/> + <column name="KEYID" value="DATE"/> + <column name="TITLE" value="Date"/> + <column name="CONTAINER" value="AttributeType"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="14de196a-aaa6-41b9-b503-3df1d45acc1e"/> + <column name="KEYID" value="NUMBER"/> + <column name="TITLE" value="${NUMBER}"/> + <column name="CONTAINER" value="AttributeType"/> + <column name="SORTING" valueNumeric="2"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="8a9791c1-655f-4340-91b4-cfdf6372fc75"/> + <column name="KEYID" value="BOOLEAN"/> + <column name="TITLE" value="Checkbox"/> + <column name="CONTAINER" value="AttributeType"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="1390813c-6b94-4336-9986-9bcaddab69ac"/> + <column name="KEYID" value="COMBO"/> + <column name="TITLE" value="Combobox"/> + <column name="CONTAINER" value="AttributeType"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="2c188a17-2961-45df-bd68-34b55352375c"/> + <column name="KEYID" value="GROUP"/> + <column name="TITLE" value="Group"/> + <column name="CONTAINER" value="AttributeType"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <rollback> + <delete tableName="AB_KEYWORD_ENTRY"> + <where>AB_KEYWORD_ENTRYID = ?</where> + <whereParams> + <param value="972e5eb1-a457-4b75-b966-1183896dac2c"/> + </whereParams> + </delete> + <delete tableName="AB_KEYWORD_ENTRY"> + <where>AB_KEYWORD_ENTRYID = ?</where> + <whereParams> + <param value="cb7ecaea-b4e6-460e-9006-4a3d059b9857"/> + </whereParams> + </delete> + <delete tableName="AB_KEYWORD_ENTRY"> + <where>AB_KEYWORD_ENTRYID = ?</where> + <whereParams> + <param value="14de196a-aaa6-41b9-b503-3df1d45acc1e"/> + </whereParams> + </delete> + <delete tableName="AB_KEYWORD_ENTRY"> + <where>AB_KEYWORD_ENTRYID = ?</where> + <whereParams> + <param value="8a9791c1-655f-4340-91b4-cfdf6372fc75"/> + </whereParams> + </delete> + <delete tableName="AB_KEYWORD_ENTRY"> + <where>AB_KEYWORD_ENTRYID = ?</where> + <whereParams> + <param value="1390813c-6b94-4336-9986-9bcaddab69ac"/> + </whereParams> + </delete> + <delete tableName="AB_KEYWORD_ENTRY"> + <where>AB_KEYWORD_ENTRYID = ?</where> + <whereParams> + <param value="2c188a17-2961-45df-bd68-34b55352375c"/> + </whereParams> + </delete> + </rollback> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index 04827e89f5fd11c2839281bc494cb43631c24f75..d8692505d9e5f89e7db063fa7b57e491e450bf1b 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -89,7 +89,7 @@ AttributeHandler.prototype._getAttributeType = function () //TODO: maybe the typ attrTypeSelect = SqlCondition.begin() .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", this.attributeId) .buildSql(attrTypeSelect); - this._attributeType = db.cell(attrTypeSelect); + this._attributeType = db.cell(attrTypeSelect).trim(); } return this._attributeType; } @@ -127,63 +127,54 @@ AttributeHandler.prototype.setAttributeValue = function (pValue) * This Object is only for the general definition of attribute types and for getting * data about every type, anything that has to do with a specific attribute (= the function requires an attribute id) * should be done in AttributeUtils. - */ -var AttributeTypes = { - _attributeTypeConfig : {}, - TEXT : "TEXT", - DATE : "DATE", - NUMBER : "NUMBER", - BOOLEAN : "BOOLEAN", - COMBO : "COMBO", - GROUP : "GROUP" -}; - -/** - * These objects hold important data for the attribute types. * The values for each type are: * - * name = the displayed name when selecting the type of an attribute * contentType = the value that is returned in the contentType process for the attribute * databaseField = the database field that holds values of attributes with the type * entityField = the field in the AttributeRelation enity that holds the value of the attribute for that type + * + * The display name is controlled by the keyword 'AttributeType' */ -AttributeTypes._attributeTypeConfig[AttributeTypes.TEXT] = { //TODO: it would probably be better if the name was a keyword - name : "Text", - contentType : "TEXT", - databaseField : "CHAR_VALUE", - entityField : "CHAR_VALUE" -}; -AttributeTypes._attributeTypeConfig[AttributeTypes.DATE] = { - name : "Date", - contentType : "DATE", - databaseField : "DATE_VALUE", - entityField : "DATE_VALUE" -}; -AttributeTypes._attributeTypeConfig[AttributeTypes.NUMBER] = { - name : "${NUMBER}", - contentType : "NUMBER", - databaseField : "NUMBER_VALUE", - entityField : "NUMBER_VALUE" -}; -AttributeTypes._attributeTypeConfig[AttributeTypes.BOOLEAN] = { - name : "Checkbox", - contentType : "BOOLEAN", - databaseField : "BOOL_VALUE", - entityField : "BOOL_VALUE" -}; -AttributeTypes._attributeTypeConfig[AttributeTypes.COMBO] = { - name : "Combobox", - contentType : "TEXT", - databaseField : "ID_VALUE", - entityField : "ID_VALUE" -}; -AttributeTypes._attributeTypeConfig[AttributeTypes.GROUP] = { - name : "Group", - contentType : null, - databaseField : null, - entityField : null +var AttributeTypes = { + TEXT : { + toString : function () {return "TEXT"}, + contentType : "TEXT", + databaseField : "CHAR_VALUE", + entityField : "CHAR_VALUE" + }, + DATE : { + toString : function () {return "DATE"}, + contentType : "DATE", + databaseField : "DATE_VALUE", + entityField : "DATE_VALUE" + }, + NUMBER : { + toString : function () {return "NUMBER"}, + contentType : "NUMBER", + databaseField : "NUMBER_VALUE", + entityField : "NUMBER_VALUE" + }, + BOOLEAN : { + toString : function () {return "BOOLEAN"}, + contentType : "BOOLEAN", + databaseField : "BOOL_VALUE", + entityField : "BOOL_VALUE" + }, + COMBO : { + toString : function () {return "COMBO"}, + contentType : "TEXT", + databaseField : "ID_VALUE", + entityField : "ID_VALUE" + }, + GROUP : { + toString : function () {return "GROUP"}, + contentType : null, + databaseField : null, + entityField : null + } }; + /** * returns the required contentType for the given attribute type * @@ -193,8 +184,8 @@ AttributeTypes._attributeTypeConfig[AttributeTypes.GROUP] = { */ AttributeTypes.getContentType = function (pAttributeType) { - if (pAttributeType in AttributeTypes._attributeTypeConfig) - return AttributeTypes._attributeTypeConfig[pAttributeType].contentType; + if (pAttributeType in AttributeTypes) + return AttributeTypes[pAttributeType].contentType; return null; } @@ -207,8 +198,8 @@ AttributeTypes.getContentType = function (pAttributeType) */ AttributeTypes.getEntityField = function (pAttributeType) { - if (pAttributeType in AttributeTypes._attributeTypeConfig) - return AttributeTypes._attributeTypeConfig[pAttributeType].entityField; + if (pAttributeType in AttributeTypes) + return AttributeTypes[pAttributeType].entityField; return null; } @@ -221,8 +212,8 @@ AttributeTypes.getEntityField = function (pAttributeType) */ AttributeTypes.getDatabaseField = function (pAttributeType) { - if (pAttributeType in AttributeTypes._attributeTypeConfig) - return AttributeTypes._attributeTypeConfig[pAttributeType].databaseField; + if (pAttributeType in AttributeTypes) + return AttributeTypes[pAttributeType].databaseField; return null; } @@ -235,25 +226,7 @@ AttributeTypes.getDatabaseField = function (pAttributeType) */ AttributeTypes.getName = function (pAttributeType) { - if (pAttributeType in AttributeTypes._attributeTypeConfig) - return translate.text(AttributeTypes._attributeTypeConfig[pAttributeType].name); + if (pAttributeType in AttributeTypes) + return translate.text(AttributeTypes[pAttributeType].displayName); return null; } - -/** - * 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, AttributeTypes.getName(AttributeTypes.TEXT)], - [AttributeTypes.COMBO, AttributeTypes.getName(AttributeTypes.COMBO)], - [AttributeTypes.NUMBER, AttributeTypes.getName(AttributeTypes.NUMBER)], - [AttributeTypes.DATE, AttributeTypes.getName(AttributeTypes.DATE)], - [AttributeTypes.BOOLEAN, AttributeTypes.getName(AttributeTypes.BOOLEAN)], - [AttributeTypes.GROUP, AttributeTypes.getName(AttributeTypes.GROUP)] - ]; -} diff --git a/process/Keyword_lib/process.js b/process/Keyword_lib/process.js index f35e876b6ea492b96bd9fa34cf254bcd0b2a9521..5bb2d0e68cc16b7c3558c43904c66581cfa8186f 100644 --- a/process/Keyword_lib/process.js +++ b/process/Keyword_lib/process.js @@ -23,6 +23,7 @@ function $KeywordRegistry(){} //static property $KeywordRegistry.get = { + AttributeType: "AttributeType", KeywordAttributeType: "KeywordAttributeType", ContractPayment: "ContractPayment", ContractStatus: "ContractStatus",