Skip to content
Snippets Groups Projects
Commit 1da239b9 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon: Committed by Johannes Goderbauer
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1061095][Aktivität - Registerreiter...

[Projekt: Entwicklung - Neon][TicketNr.: 1061095][Aktivität - Registerreiter Verlauf - Icons der Aktvivtäten]
parent d02e8754
No related branches found
No related tags found
No related merge requests found
Showing
with 483 additions and 145 deletions
...@@ -626,6 +626,72 @@ ...@@ -626,6 +626,72 @@
<name>#PROVIDER_AGGREGATES</name> <name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" /> <useAggregates v="true" />
</entityProvider> </entityProvider>
<entityProvider>
<name>ActivityChildren</name>
<documentation>%aditoprj%/entity/Activity_entity/entityfields/activitychildren/documentation.adoc</documentation>
<children>
<entityParameter>
<name>ActivityIDs_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>InsertLinks_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>Entrydate_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>Info_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>Direction_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>PresetDocuments_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>Subject_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>VisitPlanEntryId_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>RowId_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>Category_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>ObjectId_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>OnlyInnate_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>ParentContext_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>ParentId_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>PresetLinks_param</name>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
</entityFields> </entityFields>
<recordContainers> <recordContainers>
<dbRecordContainer> <dbRecordContainer>
......
Provides Activities that are children of a given record.
The recordContainer filters for data where the stored parent-fields have values dependent on the given parameters.
This is useful for building the `ModuleTree_entity` for example.
\ No newline at end of file
...@@ -56,5 +56,8 @@ if (Utils.toBoolean(vars.get("$param.OnlyInnate_param"))) ...@@ -56,5 +56,8 @@ if (Utils.toBoolean(vars.get("$param.OnlyInnate_param")))
condition.noResult(); condition.noResult();
} }
condition.andIfSet("ACTIVITY.PARENT_ID", "$param.ParentId_param");
condition.andIfSet("ACTIVITY.PARENT_CONTEXT", "$param.ParentContext_param");
//TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026 //TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
result.string(condition.toString()); result.string(condition.toString());
\ No newline at end of file
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
</entityField> </entityField>
<entityField> <entityField>
<name>ICON</name> <name>ICON</name>
<colorProcess>%aditoprj%/entity/ModuleTree_entity/entityfields/icon/colorProcess.js</colorProcess>
<contentType>IMAGE</contentType> <contentType>IMAGE</contentType>
</entityField> </entityField>
<entityProvider> <entityProvider>
<name>TreeProviders</name> <name>TreeProviders</name>
<targetContextField>TYPE</targetContextField> <targetContextField>TYPE</targetContextField>
<targetIdField>UID</targetIdField> <targetIdField>ROW_ID</targetIdField>
<recordContainer>jdito</recordContainer> <recordContainer>jdito</recordContainer>
<dependencies> <dependencies>
<entityDependency> <entityDependency>
...@@ -58,9 +59,11 @@ ...@@ -58,9 +59,11 @@
</entityProvider> </entityProvider>
<entityField> <entityField>
<name>PARENT_ID</name> <name>PARENT_ID</name>
<documentation>%aditoprj%/entity/ModuleTree_entity/entityfields/parent_id/documentation.adoc</documentation>
</entityField> </entityField>
<entityField> <entityField>
<name>UID</name> <name>UID</name>
<documentation>%aditoprj%/entity/ModuleTree_entity/entityfields/uid/documentation.adoc</documentation>
</entityField> </entityField>
<entityField> <entityField>
<name>PARENT_CONTEXT</name> <name>PARENT_CONTEXT</name>
...@@ -84,6 +87,16 @@ ...@@ -84,6 +87,16 @@
<name>#PROVIDER_AGGREGATES</name> <name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" /> <useAggregates v="true" />
</entityProvider> </entityProvider>
<entityField>
<name>ICON_COLOR</name>
</entityField>
<entityField>
<name>ROW_ID</name>
</entityField>
<entityField>
<name>PARENT_ROW_ID</name>
<documentation>%aditoprj%/entity/ModuleTree_entity/entityfields/parent_row_id/documentation.adoc</documentation>
</entityField>
</entityFields> </entityFields>
<recordContainers> <recordContainers>
<jDitoRecordContainer> <jDitoRecordContainer>
...@@ -94,12 +107,18 @@ ...@@ -94,12 +107,18 @@
<jDitoRecordFieldMapping> <jDitoRecordFieldMapping>
<name>UID.value</name> <name>UID.value</name>
</jDitoRecordFieldMapping> </jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ROW_ID.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping> <jDitoRecordFieldMapping>
<name>TYPE.value</name> <name>TYPE.value</name>
</jDitoRecordFieldMapping> </jDitoRecordFieldMapping>
<jDitoRecordFieldMapping> <jDitoRecordFieldMapping>
<name>PARENT_ID.value</name> <name>PARENT_ID.value</name>
</jDitoRecordFieldMapping> </jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>PARENT_ROW_ID.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping> <jDitoRecordFieldMapping>
<name>PARENT_CONTEXT.value</name> <name>PARENT_CONTEXT.value</name>
</jDitoRecordFieldMapping> </jDitoRecordFieldMapping>
...@@ -112,6 +131,9 @@ ...@@ -112,6 +131,9 @@
<jDitoRecordFieldMapping> <jDitoRecordFieldMapping>
<name>ICON.value</name> <name>ICON.value</name>
</jDitoRecordFieldMapping> </jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ICON_COLOR.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings> </recordFieldMappings>
</jDitoRecordContainer> </jDitoRecordContainer>
</recordContainers> </recordContainers>
......
import("system.vars");
import("system.result");
var color = vars.get("$field.ICON_COLOR");
//only return a value if there is acutally one because otherwise (if giving null for exmaple) the records would inherit the color of the previous record
if (color)
result.string(color);
This field containts the parents UID (if existant) or `null` (if it's a root element).
The field is needed to build a tree/treeTable.
Do not confuse this with the `PARENT_ROW_ID`-field.
\ No newline at end of file
This field contains the actual rowId of the record, which is dependent on the `TYPE`-field.
So for example if the TYPE is `Activity` this field contains the Activities UID (`ACTIVITYID`).
If the TYPE is `Task` this field containst the Tasks UID (`TASKID`) and so on.
Do not confuse this with the `PARENT_ID`-field.
The UID is composed of some other data:
* `ROW_ID` of the actual record
* `OBJECT_TYPE` of the actual record (=the contextid)
The ID is encoded as json string of an object with the following properties:
* `id` which is the `ROW_ID`
* `type` which is the `OBJECT_TYPE`
See these examples of uids:
* `{"id":"634ad7a8-9c68-4ea4-8385-f5bb37224482","type":"SupportTicket"}`
* `{"id":"b8067a42-d059-4d86-88b0-485a194faa36","type":"Activity"}`
* `{"id":"ccdea060-a151-44b2-b7ff-74fdcd0ce333","type":"Task"}`
* `{"id":"453ff4dd-ffa1-4bb0-a5dc-45b9d333a853","type":"Task"}`
The *reason* for this encoding is to grant better performance when data is requested from the kernel
while giving the `$local.idvalues`-Variable.
When we know the objectType and the rowId we can directly load data with the given rowId from
the objectTypes entity.
If we only had the rowId it would be necessary to try all possible entities (objectTypes) for a match
in the worst cases.
The information of `ROW_ID` and `OBJECT_TYPE` cannot change during runtime, so this cannot lead to errors.
\ No newline at end of file
import("system.logging");
import("system.neon");
import("system.entities"); import("system.entities");
import("Keyword_lib"); import("Keyword_lib");
import("KeywordRegistry_basic"); import("KeywordRegistry_basic");
...@@ -6,28 +8,59 @@ import("Sql_lib") ...@@ -6,28 +8,59 @@ import("Sql_lib")
import("system.result"); import("system.result");
import("system.db"); import("system.db");
var fixedContextName = vars.get("$param.ContextName_param"); var resArray = [];
var fixedID = vars.get("$param.ID_param");
let resArray = []; var idValues;
if (vars.exists("$local.idvalues") )
idValues = vars.get("$local.idvalues");
// Query root element if (idValues)
var root = queryRootElement(fixedContextName, fixedID, true); {
/* Currently there is no known use case for the ModuleTree_entity where the idValues is actually more than one.
* Every uid contains:
* a) the row_id of the record
* b) the type (contextid) of the record
*
* The process loads at the moment for every idValue in idValues the record.
* From a perfromance perspective it would be probably better to:
* - collect the row_id values of every type
* - request for that type all the data at once
* - augment all the data and prepare it for returning to this jditoRC
*
**/
if (idValues.length > 15)
logging.log("[ModuleTree_entity]Performance warning: The ModuleTree_entity has received an request for " + idValues.length + " ids, "
+ "but it is not optimized for such requests. See the ModuleTree_entity.contentProcess and this message.", logging.WARNING);
idValues.forEach(function (uid){
uid = JSON.parse(uid);
var singleElement = queryRootElement(uid.type, uid.id, true);
if (singleElement)
resArray.push(singleElement);
});
}
else
{
var fixedContextName = vars.get("$param.ContextName_param");
var fixedID = vars.get("$param.ID_param");
if (root !== null) { // Query root element
// Push root element var root = queryRootElement(fixedContextName, fixedID, true);
resArray.push(root);
// Query children of root if (root !== null) {
var children = queryChildrenElements(fixedContextName, fixedID); // Push root element
resArray.push(root);
if (children !== null) {
// Query children of root
// Push each children var children = queryChildrenElements(fixedContextName, fixedID);
resArray = resArray.concat(children);
result.object(resArray); if (children !== null) {
// Push each children
resArray = resArray.concat(children);
}
} }
} }
result.object(resArray);
/** /**
* Queries the children of the given parent element. * Queries the children of the given parent element.
...@@ -36,27 +69,40 @@ if (root !== null) { ...@@ -36,27 +69,40 @@ if (root !== null) {
* @param pContextName Context name of the parent element. * @param pContextName Context name of the parent element.
* @param pID ID of the parent element. * @param pID ID of the parent element.
*/ */
function queryChildrenElements (pContextName, pID) { function queryChildrenElements (pContextName, pID)
{
var taskResult = newSelect("TASKID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION") //Tasks:
.from("TASK") var taskConf = _getConfigForLoadingTaskRows()
.where("TASK.PARENT_ID", pID) .provider("TaskChildren")
.and("TASK.PARENT_CONTEXT", pContextName) .addParameter("ParentId_param", pID)
.and("TASK.KIND", $KeywordRegistry.taskType$task()) .addParameter("ParentContext_param", pContextName);
.table(); var taskRows = entities.getRows(taskConf);
//remap the data to the format like the augmentdata function needs it
var ticketResult = newSelect("TICKETID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION") var taskResult = taskRows.map(function (rowValues){
.from("TICKET") return _mapTaskRow(rowValues);
.leftJoin("TASK", "TASK_ID = TASKID") });
.where("TASK.PARENT_ID", pID)
.and("TASK.PARENT_CONTEXT", pContextName) //Tickets:
.table(); var supportTicketConf = _getConfigForLoadingSupportTicketRows()
.provider("SupportTicketChildren")
.addParameter("ParentId_param", pID)
.addParameter("ParentContext_param", pContextName);
var supportTicketRows = entities.getRows(supportTicketConf);
//remap the data to the format like the augmentdata function needs it
var ticketResult = supportTicketRows.map(function (rowValues){
return _mapSupportTicketRow(rowValues);
});
var activityResult = newSelect("ACTIVITYID, PARENT_ID, PARENT_CONTEXT, SUBJECT, INFO") //Activities:
.from("ACTIVITY") var activityConf = _getConfigForLoadingActivityRows()
.where("ACTIVITY.PARENT_ID", pID) .provider("ActivityChildren")
.and("ACTIVITY.PARENT_CONTEXT", pContextName) .addParameter("ParentId_param", pID)
.table(); .addParameter("ParentContext_param", pContextName);
var activityRows = entities.getRows(activityConf);
//remap the data to the format like the augmentdata function needs it
var activityResult = activityRows.map(function (rowValues){
return _mapActivityRow(rowValues);
});
var res = [] var res = []
...@@ -66,7 +112,7 @@ function queryChildrenElements (pContextName, pID) { ...@@ -66,7 +112,7 @@ function queryChildrenElements (pContextName, pID) {
res.push(taskResult[i]); res.push(taskResult[i]);
// Query children // Query children
let children = queryChildrenElements("Task", taskResult[i][0]); let children = queryChildrenElements("Task", taskResult[i][1]);
res = res.concat(children); res = res.concat(children);
} }
...@@ -76,7 +122,7 @@ function queryChildrenElements (pContextName, pID) { ...@@ -76,7 +122,7 @@ function queryChildrenElements (pContextName, pID) {
res.push(activityResult[i]); res.push(activityResult[i]);
// Query children // Query children
let children = queryChildrenElements("Activity", activityResult[i][0]); let children = queryChildrenElements("Activity", activityResult[i][1]);
res = res.concat(children); res = res.concat(children);
} }
...@@ -86,7 +132,7 @@ function queryChildrenElements (pContextName, pID) { ...@@ -86,7 +132,7 @@ function queryChildrenElements (pContextName, pID) {
res.push(ticketResult[i]); res.push(ticketResult[i]);
// Query children // Query children
let children = queryChildrenElements("SupportTicket", ticketResult[i][0]); let children = queryChildrenElements("SupportTicket", ticketResult[i][1]);
res = res.concat(children); res = res.concat(children);
} }
...@@ -100,23 +146,15 @@ function queryChildrenElements (pContextName, pID) { ...@@ -100,23 +146,15 @@ function queryChildrenElements (pContextName, pID) {
* @param pID ID of the root element. * @param pID ID of the root element.
* @param pGetFirst start from the first element * @param pGetFirst start from the first element
*/ */
function queryRootElement (pContextName, pID, pGetFirst) { function queryRootElement (pContextName, pID, pGetFirst)
var resultArray, rowValues, conf, icon; {
var resultArray, rowValues, conf;
if (pContextName === "Task") { if (pContextName === "Task")
{
conf = entities.createConfigForLoadingRows() conf = _getConfigForLoadingTaskRows().uid(pID);
.entity("Task_entity")
.fields(["TASKID", "PARENT_ID", "PARENT_CONTEXT", "SUBJECT", "DESCRIPTION"])
.uid(pID);
rowValues = entities.getRow(conf); rowValues = entities.getRow(conf);
resultArray = _mapTaskRow(rowValues);
resultArray = [rowValues["TASKID"],
rowValues["PARENT_ID"],
rowValues["PARENT_CONTEXT"],
rowValues["SUBJECT"],
rowValues["DESCRIPTION"]];
if (resultArray.length === 0) { if (resultArray.length === 0) {
return null; return null;
...@@ -130,20 +168,9 @@ function queryRootElement (pContextName, pID, pGetFirst) { ...@@ -130,20 +168,9 @@ function queryRootElement (pContextName, pID, pGetFirst) {
} }
return augmentData(resultArray, "Task"); return augmentData(resultArray, "Task");
} else if (pContextName === "Activity") { } else if (pContextName === "Activity") {
conf = entities.createConfigForLoadingRows() conf = _getConfigForLoadingActivityRows().uid(pID);
.entity("Activity_entity")
.fields(["ACTIVITYID", "PARENT_ID", "PARENT_CONTEXT", "SUBJECT", "INFO", "#IMAGE"])
.uid(pID);
rowValues = entities.getRow(conf); rowValues = entities.getRow(conf);
resultArray = _mapActivityRow(rowValues);
resultArray = [rowValues["ACTIVITYID"],
rowValues["PARENT_ID"],
rowValues["PARENT_CONTEXT"],
rowValues["SUBJECT"],
rowValues["INFO"]];
icon = rowValues["#IMAGE"];
if (resultArray.length === 0) { if (resultArray.length === 0) {
return null; return null;
...@@ -155,22 +182,13 @@ function queryRootElement (pContextName, pID, pGetFirst) { ...@@ -155,22 +182,13 @@ function queryRootElement (pContextName, pID, pGetFirst) {
fixedContextName = "Activity"; fixedContextName = "Activity";
fixedID = resultArray[0]; fixedID = resultArray[0];
} }
return augmentData(resultArray, "Activity", icon); return augmentData(resultArray, "Activity");
} }
else if (pContextName === "SupportTicket") { else if (pContextName === "SupportTicket") {
conf = entities.createConfigForLoadingRows() conf = _getConfigForLoadingSupportTicketRows().uid(pID);
.entity("SupportTicket_entity")
.fields(["TICKETID", "TASK_PARENT_ID", "TASK_PARENT_CONTEXT", "TASK_SUBJECT", "TASK_DESCRIPTION"])
.uid(pID);
rowValues = entities.getRow(conf); rowValues = entities.getRow(conf);
resultArray = _mapSupportTicketRow(rowValues);
resultArray = [rowValues["TICKETID"],
rowValues["TASK_PARENT_ID"],
rowValues["TASK_PARENT_CONTEXT"],
rowValues["TASK_SUBJECT"],
rowValues["TASK_DESCRIPTION"]];
if (resultArray.length === 0) { if (resultArray.length === 0) {
return null; return null;
...@@ -192,14 +210,12 @@ function queryRootElement (pContextName, pID, pGetFirst) { ...@@ -192,14 +210,12 @@ function queryRootElement (pContextName, pID, pGetFirst) {
* Augments the given row to match the required result signature. * Augments the given row to match the required result signature.
* *
* @param pDataRow Requires the following format: * @param pDataRow Requires the following format:
* UID, PARENT_ID, PARENT_CONTEXT, TITLE, DESCRIPTION * UID, PARENT_ID, PARENT_CONTEXT, TITLE, DESCRIPTION, ICON, ICON_COLOR
* @param pType The type of the row which needs adjustment. * @param pType The type of the row which needs adjustment.
* @param pIcon The Icon (only needed for activities) * @return Returns the data in the form how the record container requests it
* @return Returns the following format:
* UID, KIND, PARENT_ID, PARENT_CONTEX, TITL, DESCRIPTION, ICON
* *
*/ */
function augmentData (pDataRow, pType, pIcon) { function augmentData (pDataRow, pType) {
if (pDataRow === null || pDataRow === undefined) if (pDataRow === null || pDataRow === undefined)
return null; return null;
...@@ -209,19 +225,118 @@ function augmentData (pDataRow, pType, pIcon) { ...@@ -209,19 +225,118 @@ function augmentData (pDataRow, pType, pIcon) {
if (pType !== "Task" && pType !== "Activity" && pType !="SupportTicket") if (pType !== "Task" && pType !== "Activity" && pType !="SupportTicket")
return null; return null;
var rowId, parentId, parentContext, title, description, icon, iconColor;
[rowId, parentId, parentContext, title, description, icon, iconColor] = pDataRow;
// PARENT_ID check // PARENT_ID check
if (pDataRow[2] === "") if (parentId === "")
pDataRow[2] = null; parentId = null;
// PARENT_CONTEXT check // PARENT_CONTEXT check
if (pDataRow[3] === "") if (parentId === "")
pDataRow[3] = null; parentId = null;
// Insert type if (!iconColor)
pDataRow.splice(1, 0, pType); iconColor = "";
// Insert icon var uid = JSON.stringify({id: rowId, type: pType});
pDataRow.splice(6, 0, pType === "Task" ? "VAADIN:TASKS" : pType === "Activity" ? pIcon : pType ==="SupportTicket" ? "VAADIN:chat": null); var parentUid = null;
if (parentId && parentContext)
return pDataRow; parentUid = JSON.stringify({id: parentId, type: parentContext});
//we have no access to the datamodels iconId here, so therefor the icon values are hardcoded //TODO: optimize and load automatically
var resIcon = icon || (pType === "Task" ? "VAADIN:TASKS" : pType === "Activity" ? "VAADIN:HOURGLASS_END" : pType ==="SupportTicket" ? "VAADIN:chat" : null);
var res = [uid, rowId, pType, parentUid, parentId, parentContext, title, description, resIcon, iconColor];
return res;
}
/*
* private helper function for creating the base config for loading TASKS
* You need to extend it for example with uids or parameters to limit the data
* This is used for the root and the child items, so if you want to change it you have only to change it once
*/
function _getConfigForLoadingTaskRows()
{
var res = entities.createConfigForLoadingRows()
.entity("Task_entity")
.fields(["TASKID", "PARENT_ID", "PARENT_CONTEXT", "SUBJECT", "DESCRIPTION", "PRIORITY_ICON", "ICON_COLOR"]);
return res;
}
/*
* private helper function for mapping the result of entities.getRows where the given config was created by _getConfigForLoadingTaskRows(...)
* This is used for the root and the child items, so if you want to change it you have only to change it once
*/
function _mapTaskRow(pRowValues)
{
return [
pRowValues["TASKID"]
,pRowValues["PARENT_ID"]
,pRowValues["PARENT_CONTEXT"]
,pRowValues["SUBJECT"]
,pRowValues["DESCRIPTION"]
,pRowValues["PRIORITY_ICON"]
,pRowValues["ICON_COLOR"]
];
}
/*
* private helper function for creating the base config for loading SUPPORT TICKETS
* You need to extend it for example with uids or parameters to limit the data
* This is used for the root and the child items, so if you want to change it you have only to change it once
*/
function _getConfigForLoadingSupportTicketRows()
{
var res = entities.createConfigForLoadingRows()
.entity("SupportTicket_entity")
.fields(["TICKETID", "TASK_PARENT_ID", "TASK_PARENT_CONTEXT", "TASK_SUBJECT", "TASK_DESCRIPTION", "TASK_PRIORITY_ICON", "TASK_ICON_COLOR"])
return res;
}
/*
* private helper function for mapping the result of entities.getRows where the given config was created by _getConfigForLoadingSupportTicketRows(...)
* This is used for the root and the child items, so if you want to change it you have only to change it once
*/
function _mapSupportTicketRow(pRowValues)
{
return [
pRowValues["TICKETID"]
,pRowValues["TASK_PARENT_ID"]
,pRowValues["TASK_PARENT_CONTEXT"]
,pRowValues["TASK_SUBJECT"]
,pRowValues["TASK_DESCRIPTION"]
,pRowValues["TASK_PRIORITY_ICON"]
,pRowValues["TASK_ICON_COLOR"]
];
}
/*
* private helper function for creating the base config for loading ACTIVITES
* You need to extend it for example with uids or parameters to limit the data
* This is used for the root and the child items, so if you want to change it you have only to change it once
*/
function _getConfigForLoadingActivityRows()
{
//activity has currently no icon color, therefor nothing to specify here
var res = entities.createConfigForLoadingRows()
.entity("Activity_entity")
.fields(["ACTIVITYID", "PARENT_ID", "PARENT_CONTEXT", "SUBJECT", "INFO", "#IMAGE"]);
return res;
}
/*
* private helper function for mapping the result of entities.getRows where the given config was created by _getConfigForLoadingActivityRows(...)
* This is used for the root and the child items, so if you want to change it you have only to change it once
*/
function _mapActivityRow(pRowValues)
{
return [
pRowValues["ACTIVITYID"]
,pRowValues["PARENT_ID"]
,pRowValues["PARENT_CONTEXT"]
,pRowValues["SUBJECT"]
,pRowValues["INFO"]
,pRowValues["#IMAGE"]
,null //activity has currently no icon color, therefor give a placeholder value
];
} }
\ No newline at end of file
...@@ -421,6 +421,44 @@ ...@@ -421,6 +421,44 @@
<name>#PROVIDER_AGGREGATES</name> <name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" /> <useAggregates v="true" />
</entityProvider> </entityProvider>
<entityProvider>
<name>SupportTicketChildren</name>
<documentation>%aditoprj%/entity/SupportTicket_entity/entityfields/supportticketchildren/documentation.adoc</documentation>
<children>
<entityParameter>
<name>RowId_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>TicketType_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>PresetLinks_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>FilterOnlyOwnTicket_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>ParentContext_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>ParentId_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>ObjectId_param</name>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityField>
<name>TASK_ICON_COLOR</name>
<valueProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/task_icon_color/valueProcess.js</valueProcess>
</entityField>
</entityFields> </entityFields>
<recordContainers> <recordContainers>
<dbRecordContainer> <dbRecordContainer>
......
...@@ -8,16 +8,6 @@ import("ActivityTask_lib"); ...@@ -8,16 +8,6 @@ import("ActivityTask_lib");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
{ {
var presetLinks = JSON.parse(vars.getString("$param.PresetLinks_param")); TaskUtils.addLinkRecords("$param.ObjectId_param", "$param.RowId_param", "$param.PresetLinks_param", "$field.TASK_PARENT_CONTEXT", "$field.TASK_PARENT_ID");
if(presetLinks[0][0] == "Person")
{
var contactId = presetLinks[0][1];
var orgContactId = ContactUtils.getOrganisationContactId(contactId);
presetLinks[1] = ["Organisation", orgContactId];
}
TaskUtils.addLinkRecords("$param.ObjectId_param", "$param.RowId_param", presetLinks, "$field.TASK_PARENT_CONTEXT", "$field.TASK_PARENT_ID");
AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes", TicketUtils.begin(vars.get("$field.TICKETTYPE")).getTypeAttributes()); AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes", TicketUtils.begin(vars.get("$field.TICKETTYPE")).getTypeAttributes());
} }
\ No newline at end of file
Provides SupportTickets that are children of a given record.
The recordContainer filters for data where the stored parent-fields have values dependent on the given parameters.
This is useful for building the `ModuleTree_entity` for example.
\ No newline at end of file
import("system.vars");
import("KeywordRegistry_basic");
import("system.result");
import("system.neon");
switch(vars.getString("$field.TASK_PRIORITY"))
{
case $KeywordRegistry.taskPriority$none():
result.string(neon.PRIORITY_NONE_COLOR);
break;
case $KeywordRegistry.taskPriority$low():
result.string(neon.PRIORITY_LOW_COLOR);
break;
case $KeywordRegistry.taskPriority$medium():
result.string(neon.PRIORITY_MEDIUM_COLOR);
break;
case $KeywordRegistry.taskPriority$high():
result.string(neon.PRIORITY_HIGH_COLOR);
break;
}
import("system.vars"); import("system.vars");
import("KeywordRegistry_basic");
import("system.result"); import("system.result");
import("system.neon");
switch(vars.getString("$field.TASK_PRIORITY"))
{
case $KeywordRegistry.taskPriority$none():
result.string(neon.PRIORITY_NONE_COLOR);
break;
case $KeywordRegistry.taskPriority$low():
result.string(neon.PRIORITY_LOW_COLOR);
break;
case $KeywordRegistry.taskPriority$medium():
result.string(neon.PRIORITY_MEDIUM_COLOR);
break;
case $KeywordRegistry.taskPriority$high():
result.string(neon.PRIORITY_HIGH_COLOR);
break;
}
result.string(vars.get("$field.TASK_ICON_COLOR"))
\ No newline at end of file
...@@ -28,5 +28,8 @@ if (vars.get("$param.RowId_param") && vars.get("$param.ObjectId_param")) ...@@ -28,5 +28,8 @@ if (vars.get("$param.RowId_param") && vars.get("$param.ObjectId_param"))
, SqlBuilder.IN()); , SqlBuilder.IN());
} }
cond.andIfSet("TASK.PARENT_ID", "$param.ParentId_param");
cond.andIfSet("TASK.PARENT_CONTEXT", "$param.ParentContext_param");
//TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026 //TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
result.string(cond.toString()); result.string(cond.toString());
\ No newline at end of file
...@@ -469,6 +469,40 @@ ...@@ -469,6 +469,40 @@
<name>#PROVIDER_AGGREGATES</name> <name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" /> <useAggregates v="true" />
</entityProvider> </entityProvider>
<entityProvider>
<name>TaskChildren</name>
<documentation>%aditoprj%/entity/Task_entity/entityfields/taskchildren/documentation.adoc</documentation>
<children>
<entityParameter>
<name>ObjectId_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>ParentContext_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>FilterOnlyOwnTask_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>ParentId_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>RowId_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>PresetLinks_param</name>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityField>
<name>ICON_COLOR</name>
<valueProcess>%aditoprj%/entity/Task_entity/entityfields/icon_color/valueProcess.js</valueProcess>
</entityField>
</entityFields> </entityFields>
<recordContainers> <recordContainers>
<dbRecordContainer> <dbRecordContainer>
......
import("system.vars");
import("KeywordRegistry_basic");
import("system.result");
import("system.neon");
switch(vars.getString("$field.PRIORITY"))
{
case $KeywordRegistry.taskPriority$none():
result.string(neon.PRIORITY_NONE_COLOR);
break;
case $KeywordRegistry.taskPriority$low():
result.string(neon.PRIORITY_LOW_COLOR);
break;
case $KeywordRegistry.taskPriority$medium():
result.string(neon.PRIORITY_MEDIUM_COLOR);
break;
case $KeywordRegistry.taskPriority$high():
result.string(neon.PRIORITY_HIGH_COLOR);
break;
}
import("system.vars"); import("system.vars");
import("KeywordRegistry_basic");
import("system.result"); import("system.result");
import("system.neon");
switch(vars.getString("$field.PRIORITY"))
{
case $KeywordRegistry.taskPriority$none():
result.string(neon.PRIORITY_NONE_COLOR);
break;
case $KeywordRegistry.taskPriority$low():
result.string(neon.PRIORITY_LOW_COLOR);
break;
case $KeywordRegistry.taskPriority$medium():
result.string(neon.PRIORITY_MEDIUM_COLOR);
break;
case $KeywordRegistry.taskPriority$high():
result.string(neon.PRIORITY_HIGH_COLOR);
break;
}
result.string(vars.get("$field.ICON_COLOR"));
\ No newline at end of file
Provides Tasks that are children of a given record.
The recordContainer filters for data where the stored parent-fields have values dependent on the given parameters.
This is useful for building the `ModuleTree_entity` for example.
\ No newline at end of file
...@@ -26,6 +26,8 @@ if (vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars. ...@@ -26,6 +26,8 @@ if (vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars.
.and("TASKLINK.OBJECT_TYPE", "$param.ObjectId_param") .and("TASKLINK.OBJECT_TYPE", "$param.ObjectId_param")
, SqlBuilder.IN()); , SqlBuilder.IN());
} }
cond.andIfSet("TASK.PARENT_ID", "$param.ParentId_param");
cond.andIfSet("TASK.PARENT_CONTEXT", "$param.ParentContext_param");
if (loadNothing) if (loadNothing)
{ {
...@@ -44,7 +46,7 @@ else ...@@ -44,7 +46,7 @@ else
) )
); );
} }
cond.and(protectionLevelCondition) cond.and(protectionLevelCondition);
//TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026 //TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
result.string(cond.toString()); result.string(cond.toString());
......
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