Skip to content
Snippets Groups Projects
Commit 52ce8f5b authored by Alexander Niebisch's avatar Alexander Niebisch :coffee:
Browse files

#1040248 Erste Konfiguration der Indexgruppen über den IndexRecordContainer

parent 30cf64f2
No related branches found
No related tags found
No related merge requests found
Showing
with 247 additions and 5 deletions
import("system.db");
import("system.result");
import("system.vars");
import("IndexSearch_lib");
import("Sql_lib");
var infoContainer, onUpdFn, tableName, res;
tableName = vars.get("$local.table");
idValue = vars.get("$local.idvalue");
infoContainer = IndexsearchUtils.createAffectedInfoContainer(idValue, null, vars.get("$local.action")
,function (){return vars.get("$local.columns")}
,function (){return vars.get("$local.oldvalues")}
,function (){return vars.get("$local.values")});
//switch (tableName)
//{
// case "CONTACT":
// res = [idValue];
// break;
// case "PERSON":
// res = db.array(db.COLUMN, "select CONTACT.CONTACTID from CONTACT where CONTACT.PERSON_ID = '" + idValue + "'");
// break;
// case "ORGANISATION":
// res = db.array(db.COLUMN, "select CONTACT.CONTACTID from CONTACT where CONTACT.PERSON_ID is not null and CONTACT.ORGANISATION_ID = '" + idValue + "'");
// break;
// case "ADDRESS":
// res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
// return db.array(db.COLUMN, ["select ADDRESS.CONTACT_ID from ADDRESS where ADDRESS.ADDRESSID = ?", [
// [id, SqlUtils.getSingleColumnType("ADDRESS", "ADDRESSID")]
// ]]);
// });
// break;
// case "COMMUNICATION":
// res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
// return db.array(db.COLUMN, ["select COMMUNICATION.CONTACT_ID from COMMUNICATION where COMMUNICATIONID = ?", [
// [id, SqlUtils.getSingleColumnType("COMMUNICATION", "COMMUNICATIONID")]
// ]]);
// });
// break;
//}
switch (tableName)
{
case "PERSON":
res = [idValue];
break;
case "CONTACT":
res = db.array(db.COLUMN, "select CONTACT.PERSON_ID from CONTACT where CONTACT.CONTACTID = '" + idValue + "'");
break;
case "ORGANISATION":
res = db.array(db.COLUMN, "select CONTACT.PERSON_ID from CONTACT where CONTACT.PERSON_ID is not null and CONTACT.ORGANISATION_ID = '" + idValue + "'");
break;
case "ADDRESS":
res = IndexsearchUtils.getAffectedIdValues("PERSON_ID", infoContainer, function (id){
return db.array(db.COLUMN, ["select CONTACT.PERSON_ID from ADDRESS left join CONTACT on CONTACT.CONTACTID = ADDRESS.CONTACT_ID where CONTACT.PERSON_ID is not null and ADDRESS.ADDRESSID = ?", [
[id, SqlUtils.getSingleColumnType("ADDRESS", "ADDRESSID")]
]]);
});
break;
case "COMMUNICATION":
res = IndexsearchUtils.getAffectedIdValues("PERSON_ID", infoContainer, function (id){
return db.array(db.COLUMN, ["select CONTACT.PERSON_ID from COMMUNICATION left join CONTACT on CONTACT.CONTACTID = COMMUNICATION.CONTACT_ID where CONTACT.PERSON_ID is not null and where COMMUNICATIONID = ?", [
[id, SqlUtils.getSingleColumnType("COMMUNICATION", "COMMUNICATIONID")]
]]);
});
break;
}
if (res) {
result.object(res);
}
\ No newline at end of file
import("system.vars");
import("system.result");
var pattern = vars.get("$local.pattern");
var extension = "";
if(pattern.search("AG") != -1 || pattern.search("ag") != -1){
extension += "-firstname:anja";
}
result.string(extension);
\ No newline at end of file
import("system.translate");
import("system.result");
import("system.vars");
import("system.calendars");
import("system.db");
import("Sql_lib");
import("Communication_lib");
var sqlQuery, sqlHelper, queryCondition, affectedIds;
if (vars.exists("$local.idvalue")) {
affectedIds = vars.get("$local.idvalue");
queryCondition = "where CONTACT.CONTACTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')";
//TODO: refactor this for incremental indexer (injections?)
}
sqlHelper = new SqlMaskingUtils();
sqlQuery = "select PERSON.PERSONID as uid "
+ "," + sqlHelper.concat(["PERSON.SALUTATION", "PERSON.FIRSTNAME", "PERSON.LASTNAME", "'|'", "ORGANISATION.NAME"])
+ ' as "_title_" '
+ "," + sqlHelper.concat([
sqlHelper.concat(["defaultAddress.ADDRESS", "defaultAddress.BUILDINGNO", "'-'"
,"defaultAddress.COUNTRY", "defaultAddress.ZIP", "defaultAddress.CITY"])
,sqlHelper.concat(["'" + translate.text("Phone") + ":'", "(" + CommUtil.getStandardSubSqlPhone() + ")"])
,sqlHelper.concat(["'" + translate.text("Email") + ":'", "(" + CommUtil.getStandardSubSqlMail() + ")"])
], " | ") + " as description "
//additional indexed fields
+ ", PERSON.PERSONID "
+ ", PERSON.FIRSTNAME "
+ ", PERSON.LASTNAME "
+ ", PERSON.SALUTATION "
+ ', PERSON.TITLE as "TITLE.value"'
+ ", CONTACT.CONTACTID "
+ ", CONTACT.ORGANISATION_ID "
+ ", ORGANISATION.NAME "
+ " from PERSON "
+ " join CONTACT on CONTACT.PERSON_ID = PERSON.PERSONID "
+ " join ORGANISATION on CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID "
+ " left join ADDRESS defaultAddress on defaultAddress.ADDRESSID = CONTACT.ADDRESS_ID "
+ " left join COMMUNICATION on COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID "
+ (queryCondition || "")
+ " order by CONTACT.CONTACTID ";
result.string(sqlQuery);
\ No newline at end of file
......@@ -554,5 +554,21 @@
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
<indexRecordContainer>
<name>index</name>
<configMode>INDEXGROUP_DEFINITION</configMode>
<query>%aditoprj%/entity/Product_entity/recordcontainers/index/query.js</query>
<affectedTables>
<element>PRODUCT</element>
</affectedTables>
<affectedIds>%aditoprj%/entity/Product_entity/recordcontainers/index/affectedIds.js</affectedIds>
<indexRecordAlias>Data_alias</indexRecordAlias>
<indexFieldMappings>
<indexRecordFieldMapping>
<name>PRODUCTCODE.value</name>
<indexFieldType>TEXT_PLAIN</indexFieldType>
</indexRecordFieldMapping>
</indexFieldMappings>
</indexRecordContainer>
</recordContainers>
</entity>
import("system.vars");
import("system.result");
result.object([vars.getString("$local.idvalue")]);
\ No newline at end of file
import("system.result");
import("system.vars");
import("system.calendars");
import("system.db");
import("Keyword_lib");
import("Sql_lib");
import("KeywordRegistry_basic");
var sqlQuery, sqlHelper, queryCondition, affectedIds;
queryCondition = "";
if (vars.exists("$local.idvalue")) {
affectedIds = vars.get("$local.idvalue");
queryCondition = "where PRODUCTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')";
//TODO: refactor this for incremental indexer (injections?)
}
sqlHelper = new SqlMaskingUtils();
sqlQuery = "select PRODUCTID as uid, "
+ sqlHelper.concat(["PRODUCTCODE", "PRODUCTNAME"], " | ")
+ " as title, "
+ KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.productGroupcode(), "GROUPCODEID")
+ " as description"
+ ", PRODUCTCODE "
+ " from PRODUCT "
+ queryCondition + " order by PRODUCTCODE ";
result.string(sqlQuery);
\ No newline at end of file
......@@ -772,5 +772,42 @@
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
<indexRecordContainer>
<name>index</name>
<configMode>INDEXGROUP_DEFINITION</configMode>
<query>%aditoprj%/entity/Salesproject_entity/recordcontainers/index/query.js</query>
<affectedTables>
<element>SALESPROJECT</element>
</affectedTables>
<affectedIds>%aditoprj%/entity/Salesproject_entity/recordcontainers/index/affectedIds.js</affectedIds>
<indexRecordAlias>Data_alias</indexRecordAlias>
<indexFieldMappings>
<indexRecordFieldMapping>
<name>PROJECTCODE.value</name>
<indexFieldType>STRING</indexFieldType>
</indexRecordFieldMapping>
<indexRecordFieldMapping>
<name>PROJECTTITLE.value</name>
<indexFieldType>TEXT</indexFieldType>
<stored v="false" />
</indexRecordFieldMapping>
<indexRecordFieldMapping>
<name>STATE.value</name>
<indexFieldType>STRING</indexFieldType>
</indexRecordFieldMapping>
<indexRecordFieldMapping>
<name>STATE.displayValue</name>
<indexFieldType>TEXT_PLAIN</indexFieldType>
</indexRecordFieldMapping>
<indexRecordFieldMapping>
<name>PHASE.value</name>
<indexFieldType>STRING</indexFieldType>
</indexRecordFieldMapping>
<indexRecordFieldMapping>
<name>PHASE.displayValue</name>
<indexFieldType>TEXT_PLAIN</indexFieldType>
</indexRecordFieldMapping>
</indexFieldMappings>
</indexRecordContainer>
</recordContainers>
</entity>
import("system.vars");
import("system.result");
result.object([vars.getString("$local.idvalue")]);
\ No newline at end of file
import("system.translate");
import("system.result");
import("system.vars");
import("system.calendars");
import("system.db");
import("Keyword_lib");
import("Sql_lib");
import("KeywordRegistry_basic");
var sqlQuery, sqlHelper, queryCondition, affectedIds;
queryCondition = "";
if (vars.exists("$local.idvalue")) {
affectedIds = vars.get("$local.idvalue");
queryCondition = "where SALESPROJECTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')";
//TODO: refactor this for incremental indexer (injections?)
}
sqlHelper = new SqlMaskingUtils();
sqlQuery = "select SALESPROJECTID as uid"
+ ", PROJECTTITLE as title, "
+ sqlHelper.concat([
"'" + translate.text("Status") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATE"),
"'| " + translate.text("Phase") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "PHASE")
])
+ " as description"
+ ", PROJECTCODE"
+ ", PROJECTTITLE"
+ ", STATE"
+ ', ' + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATE") + ' as "STATE.displayValue"'
+ ", PHASE"
+ ', ' + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "PHASE") + ' as "PHASE.displayValue"'
+ " from SALESPROJECT "
+ queryCondition + " order by PROJECTCODE ";
result.string(sqlQuery);
\ No newline at end of file
......@@ -32,12 +32,14 @@
<blobHandlingMethod>DATABASE</blobHandlingMethod>
<databaseAuditGetOldValueLobs v="false" />
<indexsearchGlobalEnabled v="true" />
<indexsearchUseLegacyConfiguration v="false" />
<indexsearchFullIndexerEnabled v="true" />
<indexsearchFullIndexerInterval v="0" />
<indexsearchIncrementingIndexerEnabled v="true" />
<indexsearchIncrementingIndexerInterval v="1000" />
<indexsearchIncrementingIndexerBunchSize v="250" />
<indexsearchMaximumHits v="50000" />
<indexsearchEnableChildDocSearches v="true" />
<customProperties>
<customBooleanProperty>
<name>phoneValidation.enable</name>
......
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<name>indexsearch_patternextension</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
</process>
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