Skip to content
Snippets Groups Projects
Commit a2f0e2e3 authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong: Committed by Sebastian Listl
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1074612][[Beobachtungen]...

[Projekt: Entwicklung - Neon][TicketNr.: 1074612][[Beobachtungen] Benachrichtigung bei Felder mit DropDown-process]
parent 41583910
No related branches found
No related tags found
No related merge requests found
Showing
with 629 additions and 189 deletions
......@@ -48,6 +48,7 @@
<entityField>
<name>DESCRIPTION</name>
<title>Description</title>
<contentType>HTML</contentType>
</entityField>
<entityField>
<name>FORCEDPRIORITY</name>
......
......@@ -43,6 +43,7 @@
<consumer>Users</consumer>
<groupable v="true" />
<mandatory v="true" />
<state>DISABLED</state>
<valueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/displayValueProcess.js</displayValueProcess>
</entityField>
......
......@@ -19,4 +19,3 @@ inserted, updated or deleted.
* 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
......@@ -4,7 +4,7 @@ import("system.result");
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"))
{
......
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 @@
<entityField>TRIGGEREVENTDELETE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>aa93c341-578b-4da9-8ee8-2b3d9ea9e1ca</name>
<name>ac899215-4356-4034-b263-d40807f0b0f1</name>
<entityField>includeDependencies</entityField>
</entityFieldLink>
<entityFieldLink>
<name>c6fa82e2-5830-46c5-9127-e273ddf5a194</name>
......
......@@ -172,7 +172,7 @@
<customBooleanProperty>
<name>observation.isEnabled</name>
<description>Whether the observations are enabled or not</description>
<property v="false" />
<property v="true" />
</customBooleanProperty>
<customBooleanProperty>
<name>observation.isMultiselectionEnabled</name>
......
......@@ -75,7 +75,7 @@ Dependency.defaultFunctionForRelation = function (pRelationTable, pRelationField
return newSelect(pRelationTable + "." + (pSourceField || "OBJECT_ROWID"))
.from(pRelationTable)
.groupBy(pRelationTable + "." + pSourceField || "OBJECT_ROWID")
.groupBy(pRelationTable + "." + (pSourceField || "OBJECT_ROWID"))
.whereIfSet(pRelationTable + "." + pRelationField, relationFieldValue)
.andIfSet(pRelationTable + ".OBJECT_TYPE", pContext)
.arrayColumn();
......@@ -133,7 +133,8 @@ Dependency.mapping = function ()
"Person_entity": {
"Activity_entity" : {
"options" : {
"isObservable" : true
"isObservable" : true,
"isOwnNotified" : true
},
"getUIDsfn" : Dependency.defaultFunctionForRelation("ACTIVITYLINK", "OBJECT_ROWID", "CONTACTID", "Person", "CONTACT", "ACTIVITY_ID")
},
......@@ -338,7 +339,8 @@ Dependency.mapping = function ()
"Activity_entity" : {
"Person_entity" : {
"options" : {
"isObservable" : true
"isObservable" : true,
"isOwnNotified" : true
},
"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
......@@ -187,11 +187,11 @@ WorkflowSignalSender.deleted = function (pVariables, pTargetId, pTargetContext)
*/
WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext, pVariables)
{
let temp = {};
temp[ WorkflowVariables.TARGET_CONTEXT()] = pTargetContext;
temp[WorkflowVariables.TARGET_ID()] = pTargetId;
temp[WorkflowVariables.TRIGGER()] = pEvent;
let variables = WorkflowVariables.getAllVariablesValue(temp);
pVariables = pVariables || {};
pVariables[WorkflowVariables.TARGET_CONTEXT()] = pVariables[WorkflowVariables.TARGET_CONTEXT()] || pTargetContext;
pVariables[WorkflowVariables.TARGET_ID()] = pVariables[WorkflowVariables.TARGET_ID()] || pTargetId;
pVariables[WorkflowVariables.TRIGGER()] = pVariables[WorkflowVariables.TRIGGER()] || pEvent;
let variables = WorkflowVariables.getAllVariablesValue(pVariables);
var processConfig = process.createStartAsyncConfig().setName("workflowExtension_serverProcess")
.setLocalVariables({"variablesWorkflow" : JSON.stringify(variables)})
......@@ -206,7 +206,7 @@ WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext
{
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)
{
filteredVariables[varName] = variables[varName];
......@@ -305,6 +305,22 @@ WorkflowVariables.TARGET_CONTEXT.getDefaultValue = function ()
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
*/
......@@ -318,7 +334,7 @@ WorkflowVariables.ROWDATA = function ()
*/
WorkflowVariables.ROWDATA.getDefaultValue = function ()
{
return JSON.stringify(vars.get("$local.rowdata"));
return JSON.stringify(( vars.exists("$local.rowdata") ? vars.get("$local.rowdata"): {}));
}
/**
......@@ -334,7 +350,7 @@ WorkflowVariables.INITIAL_ROWDATA = function ()
*/
WorkflowVariables.INITIAL_ROWDATA.getDefaultValue = function ()
{
return JSON.stringify(vars.get("$local.initialRowdata"));
return JSON.stringify(( vars.exists("$local.initialRowdata") ? vars.get("$local.initialRowdata"): {}));
}
/**
......@@ -350,7 +366,7 @@ WorkflowVariables.CHANGED_ROWS = function ()
*/
WorkflowVariables.CHANGED_ROWS.getDefaultValue = function ()
{
return JSON.stringify(vars.get("$local.changed"));
return JSON.stringify(( vars.exists("$local.changed") ? vars.get("$local.changed"): []));
}
/**
......@@ -366,19 +382,37 @@ WorkflowVariables.CHANGED_ROWS_TYPES = function ()
*/
WorkflowVariables.CHANGED_ROWS_TYPES.getDefaultValue = function ()
{
let isDBrc = project.getRecordContainerModel(ContextUtils.getEntity(ContextUtils.getCurrentContextId())).type == project.RECORDCONTAINERTYPE_DB;
let types = {}
vars.get("$local.changed").forEach(function(pField) {
let types = {};
if (vars.exists("$local.changed"))
{
let isDBrc = project.getRecordContainerModel(ContextUtils.getEntity(ContextUtils.getCurrentContextId())).type == project.RECORDCONTAINERTYPE_DB;
vars.get("$local.changed").forEach(function(pField) {
let splitedField = pField.split(".");
let fieldName;
if (isDBrc) {
if (isDBrc)
{
fieldName = splitedField[1]
} else {
}
else
{
fieldName = splitedField[0]
}
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);
}
......@@ -443,7 +477,7 @@ WorkflowVariables.CONTENTTITLE = function ()
*/
WorkflowVariables.CONTENTTITLE.getDefaultValue = function ()
{
return vars.get("$field.#CONTENTTITLE");
return vars.exists("$local.rowdata") ? vars.get("$field.#CONTENTTITLE") : null;
}
/**
......@@ -476,7 +510,8 @@ WorkflowVariables.getAllVariables = function ()
"TARGET_CONTEXT",
"TARGET_ID",
"TRIGGER",
"CONTENTTITLE"
"CONTENTTITLE",
"FIELDS_TO_LOAD"
]
}
......
......@@ -13,7 +13,7 @@ var changedRows = JSON.parse(localVariables[WorkflowVariables.CHANGED_ROWS()]);
if (project.getPreferenceValue("custom.observation.isEnabled", false) == "true")
{
Observation.checkObservation(localVariables);
new Observation(localVariables).checkObservation();
}
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