diff --git a/entity/Comm_entity/Comm_entity.aod b/entity/Comm_entity/Comm_entity.aod index 23cfac0ecb0204daf4dc5fa99eaf02951dfdb3fb..533d27b63ad6bbebd403174eaf9804fef4732583 100644 --- a/entity/Comm_entity/Comm_entity.aod +++ b/entity/Comm_entity/Comm_entity.aod @@ -7,6 +7,15 @@ <alias>Data_alias</alias> <conditionProcess>%aditoprj%/entity/Comm_entity/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Comm_entity/orderClauseProcess.js</orderClauseProcess> + <recordContainer>db</recordContainer> + <linkInformation> + <linkInformation> + <name>54875441-f1b0-47d1-9fa6-c1927863f3e3</name> + <tableName>COMM</tableName> + <primaryKey>COMMID</primaryKey> + <isUIDTable v="true" /> + </linkInformation> + </linkInformation> <entityFields> <entityField> <name>ADDR</name> @@ -94,12 +103,59 @@ So, for only showing telephone-types you&apos;ve to specify this parameter w <description>PARAMETER</description> </entityParameter> </entityFields> - <linkInformation> - <linkInformation> - <name>54875441-f1b0-47d1-9fa6-c1927863f3e3</name> - <tableName>COMM</tableName> - <primaryKey>COMMID</primaryKey> - <isUIDTable v="true" /> - </linkInformation> - </linkInformation> + <recordContainers> + <dbRecordContainer> + <name>db</name> + <alias>Data_alias</alias> + <conditionProcess>%aditoprj%/entity/Comm_entity/recordcontainers/db/conditionProcess.js</conditionProcess> + <orderClauseProcess>%aditoprj%/entity/Comm_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <linkInformation> + <linkInformation> + <name>e3567770-187a-4366-bb87-fb22ff7ff257</name> + <tableName>COMM</tableName> + <primaryKey>COMMID</primaryKey> + <isUIDTable v="true" /> + <readonly v="false" /> + </linkInformation> + </linkInformation> + <recordFieldMappings> + <dbRecordFieldMapping> + <name>ADDR.value</name> + <value>COMM.ADDR</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>MEDIUM_ID.value</name> + <value>COMM.MEDIUM_ID</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>COMMID.value</name> + <value>COMM.COMMID</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_ID.value</name> + <value>COMM.RELATION_ID</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_EDIT.value</name> + <value>COMM.DATE_EDIT</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STANDARD.value</name> + <value>COMM.STANDARD</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <value>COMM.DATE_NEW</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_EDIT.value</name> + <value>COMM.USER_EDIT</value> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_NEW.value</name> + <value>COMM.USER_NEW</value> + </dbRecordFieldMapping> + </recordFieldMappings> + </dbRecordContainer> + </recordContainers> </entity> diff --git a/entity/Comm_entity/recordcontainers/db/conditionProcess.js b/entity/Comm_entity/recordcontainers/db/conditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..56359a39d6f6d38933a3322f8a5b514bd1ca5e81 --- /dev/null +++ b/entity/Comm_entity/recordcontainers/db/conditionProcess.js @@ -0,0 +1,27 @@ +import("system.db"); +import("system.result"); +import("Sql_lib"); +import("Keyword_lib"); + +var relId, cond; +cond = new SqlCondition(); + +cond.andPrepareVars("COMM.RELATION_ID", "$param.RelId_param"); + +if (vars.exists("$param.MediumCategoriesFilter_param")){ + mediumCategories = vars.get("$param.MediumCategoriesFilter_param"); + if (mediumCategories != null && mediumCategories != "") { + mediumCategories = text.decodeMS(mediumCategories); + var kwd = KeywordUtils.createKeyword("COMM.MEDIUM"); + kwd.filter(function(id, name, customs){ + return mediumCategories.indexOf(customs.category) > -1; + }); + mediumIds = kwd.toArray("id"); + if (mediumIds.length == 0) + throw new Error();//TODO: add message + + cond.and("COMM.MEDIUM_ID in (" + mediumIds.join(", ") + ")"); + } +} + +result.string(db.translateCondition([cond.toString("1 = 2"), cond.preparedValues])); \ No newline at end of file diff --git a/entity/Comm_entity/recordcontainers/db/orderClauseProcess.js b/entity/Comm_entity/recordcontainers/db/orderClauseProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..59b6f431634dfc3927ca2718723984798a5aaf67 --- /dev/null +++ b/entity/Comm_entity/recordcontainers/db/orderClauseProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.db"); + +result.object({ + "COMM.MEDIUM_ID": db.ASCENDING + }); \ No newline at end of file