Skip to content
Snippets Groups Projects
Commit e75f8f63 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch '#1074891-BeobachtungsDependencies' into '2021.1.0'

#1074891 beobachtungs dependencies

See merge request xrm/basic!953
parents 83f3e3d7 a2f0e2e3
No related branches found
No related tags found
No related merge requests found
Showing
with 629 additions and 189 deletions
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
<entityField> <entityField>
<name>DESCRIPTION</name> <name>DESCRIPTION</name>
<title>Description</title> <title>Description</title>
<contentType>HTML</contentType>
</entityField> </entityField>
<entityField> <entityField>
<name>FORCEDPRIORITY</name> <name>FORCEDPRIORITY</name>
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<consumer>Users</consumer> <consumer>Users</consumer>
<groupable v="true" /> <groupable v="true" />
<mandatory v="true" /> <mandatory v="true" />
<state>DISABLED</state>
<valueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/valueProcess.js</valueProcess> <valueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/displayValueProcess.js</displayValueProcess> <displayValueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/displayValueProcess.js</displayValueProcess>
</entityField> </entityField>
......
...@@ -19,4 +19,3 @@ inserted, updated or deleted. ...@@ -19,4 +19,3 @@ inserted, updated or deleted.
* Enable the custom field observation.isEnabled in the _____PREFERENCES_PROJECT * Enable the custom field observation.isEnabled in the _____PREFERENCES_PROJECT
* Create the Observation Context and add the Entity, the Views (ObservationEdit_view, ObservationFilter_view, ObservationPreview_view), the Icon (VAADIN:EYE) and the Tile "Observation" to it * Create the Observation Context and add the Entity, the Views (ObservationEdit_view, ObservationFilter_view, ObservationPreview_view), the Icon (VAADIN:EYE) and the Tile "Observation" to it
...@@ -4,7 +4,7 @@ import("system.result"); ...@@ -4,7 +4,7 @@ import("system.result");
let isIncluded; let isIncluded;
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
{ {
if (vars.get("$field.OBSERVATION_ID")) if (vars.get("$field.OBSERVATION_ID"))
{ {
......
import("system.vars");
import("system.result");
import("Observation_lib");
result.string(Observation.actionState(vars.get("$sys.selection")));
\ No newline at end of file
<?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.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1">
<name>Observation</name>
<title>Observation</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<icon>VAADIN:EYE</icon>
<filterView>ObservationFilter_view</filterView>
<editView>ObservationEdit_view</editView>
<previewView>ObservationPreview_view</previewView>
<entity>Observation_entity</entity>
<references>
<neonViewReference>
<name>081e645d-ede7-4987-891c-725e2300c7a0</name>
<view>ObservationFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>381da87e-006b-4fd6-b2b2-18e53d675928</name>
<view>ObservationEdit_view</view>
</neonViewReference>
<neonViewReference>
<name>8e1417a2-f172-451f-9e76-81b852abcaa1</name>
<view>ObservationPreview_view</view>
</neonViewReference>
</references>
</neonContext>
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
<entityField>TRIGGEREVENTDELETE</entityField> <entityField>TRIGGEREVENTDELETE</entityField>
</entityFieldLink> </entityFieldLink>
<entityFieldLink> <entityFieldLink>
<name>aa93c341-578b-4da9-8ee8-2b3d9ea9e1ca</name> <name>ac899215-4356-4034-b263-d40807f0b0f1</name>
<entityField>includeDependencies</entityField>
</entityFieldLink> </entityFieldLink>
<entityFieldLink> <entityFieldLink>
<name>c6fa82e2-5830-46c5-9127-e273ddf5a194</name> <name>c6fa82e2-5830-46c5-9127-e273ddf5a194</name>
......
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
<customBooleanProperty> <customBooleanProperty>
<name>observation.isEnabled</name> <name>observation.isEnabled</name>
<description>Whether the observations are enabled or not</description> <description>Whether the observations are enabled or not</description>
<property v="false" /> <property v="true" />
</customBooleanProperty> </customBooleanProperty>
<customBooleanProperty> <customBooleanProperty>
<name>observation.isMultiselectionEnabled</name> <name>observation.isMultiselectionEnabled</name>
......
...@@ -75,7 +75,7 @@ Dependency.defaultFunctionForRelation = function (pRelationTable, pRelationField ...@@ -75,7 +75,7 @@ Dependency.defaultFunctionForRelation = function (pRelationTable, pRelationField
return newSelect(pRelationTable + "." + (pSourceField || "OBJECT_ROWID")) return newSelect(pRelationTable + "." + (pSourceField || "OBJECT_ROWID"))
.from(pRelationTable) .from(pRelationTable)
.groupBy(pRelationTable + "." + pSourceField || "OBJECT_ROWID") .groupBy(pRelationTable + "." + (pSourceField || "OBJECT_ROWID"))
.whereIfSet(pRelationTable + "." + pRelationField, relationFieldValue) .whereIfSet(pRelationTable + "." + pRelationField, relationFieldValue)
.andIfSet(pRelationTable + ".OBJECT_TYPE", pContext) .andIfSet(pRelationTable + ".OBJECT_TYPE", pContext)
.arrayColumn(); .arrayColumn();
...@@ -133,7 +133,8 @@ Dependency.mapping = function () ...@@ -133,7 +133,8 @@ Dependency.mapping = function ()
"Person_entity": { "Person_entity": {
"Activity_entity" : { "Activity_entity" : {
"options" : { "options" : {
"isObservable" : true "isObservable" : true,
"isOwnNotified" : true
}, },
"getUIDsfn" : Dependency.defaultFunctionForRelation("ACTIVITYLINK", "OBJECT_ROWID", "CONTACTID", "Person", "CONTACT", "ACTIVITY_ID") "getUIDsfn" : Dependency.defaultFunctionForRelation("ACTIVITYLINK", "OBJECT_ROWID", "CONTACTID", "Person", "CONTACT", "ACTIVITY_ID")
}, },
...@@ -338,7 +339,8 @@ Dependency.mapping = function () ...@@ -338,7 +339,8 @@ Dependency.mapping = function ()
"Activity_entity" : { "Activity_entity" : {
"Person_entity" : { "Person_entity" : {
"options" : { "options" : {
"isObservable" : true "isObservable" : true,
"isOwnNotified" : true
}, },
"getUIDsfn" : Dependency.defaultFunctionForRelation("ACTIVITYLINK", "ACTIVITY_ID", "ACTIVITYID", "Person", "ACTIVITY") "getUIDsfn" : Dependency.defaultFunctionForRelation("ACTIVITYLINK", "ACTIVITY_ID", "ACTIVITYID", "Person", "ACTIVITY")
}, },
......
This diff is collapsed.
<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
<name>Observation_test</name>
<title>[TEST] Observation_lib</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<icon>VAADIN:CHECK_CIRCLE</icon>
<process>%aditoprj%/process/Observation_test/process.js</process>
<variants>
<element>EXECUTABLE</element>
</variants>
</process>
import("Observation_lib");
import("Sql_lib");
import("system.result");
import("system.translate");
import("system.vars");
import("Keyword_lib");
import("UnitTest_lib");
var parseVariableIfNeed = new TestSuite("Observation.parseVariableIfNeed", [
new Test("",
function(pTester, pDataProvider) {
let object = { "TEST" :pDataProvider[0]}
Observation.parseVariableIfNeed(object, "TEST");
var actualValue = object["TEST"];
pTester.expectThat(actualValue).equals(pDataProvider[1]).assert();
},
function dataProvider(){
return [
[JSON.stringify({"NAME" : "HANS"}), {"NAME" : "HANS"}],
[{"NAME" : "HANS"}, {"NAME" : "HANS"}],
[null, null],
[0, 0],
[undefined, undefined],
["[1,2,3]", [1,2,3]],
[[1,2,3], [1,2,3]]
];
}
)
]);
var parseVariableIfNeed = new TestSuite("Observation.parseVariableIfNeed", [
new Test("",
function(pTester, pDataProvider) {
let object = { "TEST" :pDataProvider[0]}
Observation.parseVariableIfNeed(object, "TEST");
var actualValue = object["TEST"];
pTester.expectThat(actualValue).equals(pDataProvider[1]).assert();
},
function dataProvider(){
return [
[JSON.stringify({"NAME" : "HANS"}), {"NAME" : "HANS"}],
[{"NAME" : "HANS"}, {"NAME" : "HANS"}],
[null, null],
["TESTString", "TESTString"],
[0, 0],
[undefined, undefined],
["[1,2,3]", [1,2,3]],
[[1,2,3], [1,2,3]]
];
}
)
]);
var tester = new Tester("Test Observation_lib");
tester.initCoverage(Observation);
tester.test(parseVariableIfNeed);
tester.summary();
result.object(tester.getResults());
\ No newline at end of file
...@@ -215,11 +215,11 @@ WorkflowSignalSender.deleted = function (pVariables, pTargetId, pTargetContext) ...@@ -215,11 +215,11 @@ WorkflowSignalSender.deleted = function (pVariables, pTargetId, pTargetContext)
*/ */
WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext, pVariables) WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext, pVariables)
{ {
let temp = {}; pVariables = pVariables || {};
temp[ WorkflowVariables.TARGET_CONTEXT()] = pTargetContext; pVariables[WorkflowVariables.TARGET_CONTEXT()] = pVariables[WorkflowVariables.TARGET_CONTEXT()] || pTargetContext;
temp[WorkflowVariables.TARGET_ID()] = pTargetId; pVariables[WorkflowVariables.TARGET_ID()] = pVariables[WorkflowVariables.TARGET_ID()] || pTargetId;
temp[WorkflowVariables.TRIGGER()] = pEvent; pVariables[WorkflowVariables.TRIGGER()] = pVariables[WorkflowVariables.TRIGGER()] || pEvent;
let variables = WorkflowVariables.getAllVariablesValue(temp); let variables = WorkflowVariables.getAllVariablesValue(pVariables);
var processConfig = process.createStartAsyncConfig().setName("workflowExtension_serverProcess") var processConfig = process.createStartAsyncConfig().setName("workflowExtension_serverProcess")
.setLocalVariables({"variablesWorkflow" : JSON.stringify(variables)}) .setLocalVariables({"variablesWorkflow" : JSON.stringify(variables)})
...@@ -234,7 +234,7 @@ WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext ...@@ -234,7 +234,7 @@ WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext
{ {
if (_checkCondition(signal.entity, variables[WorkflowVariables.TARGET_ID()], signal.condition)) if (_checkCondition(signal.entity, variables[WorkflowVariables.TARGET_ID()], signal.condition))
{ {
var filteredVariables = pVariables || {}; var filteredVariables = pVariables; // TODO: Evtl machts keinen Sinn mehr.
signal.variables.forEach(function (varName) signal.variables.forEach(function (varName)
{ {
filteredVariables[varName] = variables[varName]; filteredVariables[varName] = variables[varName];
...@@ -333,6 +333,22 @@ WorkflowVariables.TARGET_CONTEXT.getDefaultValue = function () ...@@ -333,6 +333,22 @@ WorkflowVariables.TARGET_CONTEXT.getDefaultValue = function ()
return ContextUtils.getCurrentContextId(); return ContextUtils.getCurrentContextId();
} }
/**
* Returns the variable name for the fileds to load
*/
WorkflowVariables.FIELDS_TO_LOAD = function ()
{
return "fieldsToLoad";
}
/**
* Returns the default value for the fileds to load
*/
WorkflowVariables.FIELDS_TO_LOAD.getDefaultValue = function ()
{
return JSON.stringify([]);
}
/** /**
* Returns the variable name for the rowdata * Returns the variable name for the rowdata
*/ */
...@@ -346,7 +362,7 @@ WorkflowVariables.ROWDATA = function () ...@@ -346,7 +362,7 @@ WorkflowVariables.ROWDATA = function ()
*/ */
WorkflowVariables.ROWDATA.getDefaultValue = function () WorkflowVariables.ROWDATA.getDefaultValue = function ()
{ {
return JSON.stringify(vars.get("$local.rowdata")); return JSON.stringify(( vars.exists("$local.rowdata") ? vars.get("$local.rowdata"): {}));
} }
/** /**
...@@ -362,7 +378,7 @@ WorkflowVariables.INITIAL_ROWDATA = function () ...@@ -362,7 +378,7 @@ WorkflowVariables.INITIAL_ROWDATA = function ()
*/ */
WorkflowVariables.INITIAL_ROWDATA.getDefaultValue = function () WorkflowVariables.INITIAL_ROWDATA.getDefaultValue = function ()
{ {
return JSON.stringify(vars.get("$local.initialRowdata")); return JSON.stringify(( vars.exists("$local.initialRowdata") ? vars.get("$local.initialRowdata"): {}));
} }
/** /**
...@@ -378,7 +394,7 @@ WorkflowVariables.CHANGED_ROWS = function () ...@@ -378,7 +394,7 @@ WorkflowVariables.CHANGED_ROWS = function ()
*/ */
WorkflowVariables.CHANGED_ROWS.getDefaultValue = function () WorkflowVariables.CHANGED_ROWS.getDefaultValue = function ()
{ {
return JSON.stringify(vars.get("$local.changed")); return JSON.stringify(( vars.exists("$local.changed") ? vars.get("$local.changed"): []));
} }
/** /**
...@@ -394,19 +410,37 @@ WorkflowVariables.CHANGED_ROWS_TYPES = function () ...@@ -394,19 +410,37 @@ WorkflowVariables.CHANGED_ROWS_TYPES = function ()
*/ */
WorkflowVariables.CHANGED_ROWS_TYPES.getDefaultValue = function () WorkflowVariables.CHANGED_ROWS_TYPES.getDefaultValue = function ()
{ {
let isDBrc = project.getRecordContainerModel(ContextUtils.getEntity(ContextUtils.getCurrentContextId())).type == project.RECORDCONTAINERTYPE_DB; let types = {};
let types = {} if (vars.exists("$local.changed"))
vars.get("$local.changed").forEach(function(pField) { {
let isDBrc = project.getRecordContainerModel(ContextUtils.getEntity(ContextUtils.getCurrentContextId())).type == project.RECORDCONTAINERTYPE_DB;
vars.get("$local.changed").forEach(function(pField) {
let splitedField = pField.split("."); let splitedField = pField.split(".");
let fieldName; let fieldName;
if (isDBrc) { if (isDBrc)
{
fieldName = splitedField[1] fieldName = splitedField[1]
} else { }
else
{
fieldName = splitedField[0] fieldName = splitedField[0]
} }
if (splitedField[1] != "displayValue" && vars.exists("$property." + fieldName + ".contentType") ) if (splitedField[1] != "displayValue" && vars.exists("$property." + fieldName + ".contentType") )
types[pField] = vars.get("$property." + fieldName + ".contentType"); {
let contentType = vars.get("$property." + fieldName + ".contentType").trim();
types[pField] = contentType;
}
if (splitedField[1] != "displayValue" && vars.exists("$field." + fieldName + ".displayValue") && vars.get("$field." + fieldName + ".displayValue") )
{
types[pField] = "DROP_DOWN" + "::" + vars.get("$field." + fieldName + ".displayValue").trim();
}
}); });
}
return JSON.stringify(types); return JSON.stringify(types);
} }
...@@ -471,7 +505,7 @@ WorkflowVariables.CONTENTTITLE = function () ...@@ -471,7 +505,7 @@ WorkflowVariables.CONTENTTITLE = function ()
*/ */
WorkflowVariables.CONTENTTITLE.getDefaultValue = function () WorkflowVariables.CONTENTTITLE.getDefaultValue = function ()
{ {
return vars.get("$field.#CONTENTTITLE"); return vars.exists("$local.rowdata") ? vars.get("$field.#CONTENTTITLE") : null;
} }
/** /**
...@@ -504,7 +538,8 @@ WorkflowVariables.getAllVariables = function () ...@@ -504,7 +538,8 @@ WorkflowVariables.getAllVariables = function ()
"TARGET_CONTEXT", "TARGET_CONTEXT",
"TARGET_ID", "TARGET_ID",
"TRIGGER", "TRIGGER",
"CONTENTTITLE" "CONTENTTITLE",
"FIELDS_TO_LOAD"
] ]
} }
......
...@@ -13,7 +13,7 @@ var changedRows = JSON.parse(localVariables[WorkflowVariables.CHANGED_ROWS()]); ...@@ -13,7 +13,7 @@ var changedRows = JSON.parse(localVariables[WorkflowVariables.CHANGED_ROWS()]);
if (project.getPreferenceValue("custom.observation.isEnabled", false) == "true") if (project.getPreferenceValue("custom.observation.isEnabled", false) == "true")
{ {
Observation.checkObservation(localVariables); new Observation(localVariables).checkObservation();
} }
ClassificationUtils.setClassificationStorageDatasetsOutdated([targetId], entityName, rowData, changedRows); ClassificationUtils.setClassificationStorageDatasetsOutdated([targetId], entityName, rowData, changedRows);
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