Skip to content
Snippets Groups Projects
Commit d03a685f authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

1070913

parent 2033af89
No related branches found
No related tags found
No related merge requests found
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
<include relativeToChangelogFile="true" file="basic/2021.0.0/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2021.0.0/changelog.xml"/>
<!--enable this only when you definetly want to overwrite the existing data with demo records:--> <!--enable this only when you definetly want to overwrite the existing data with demo records:-->
<!--<include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>--> <include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>
</databaseChangeLog> </databaseChangeLog>
...@@ -92,9 +92,17 @@ ...@@ -92,9 +92,17 @@
<children> <children>
<entityActionField> <entityActionField>
<name>UpdateClassification</name> <name>UpdateClassification</name>
<title>Recalculate all Classifications</title> <title>Recalculate Classifications</title>
<onActionProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/filterviewactiongroup/children/updateclassification/onActionProcess.js</onActionProcess> <onActionProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/filterviewactiongroup/children/updateclassification/onActionProcess.js</onActionProcess>
<iconId>VAADIN:AUTOMATION</iconId> <iconId>VAADIN:AUTOMATION</iconId>
<tooltip>Use this to manually start the serverprocess after changes to the configuration of classifications. It will recalculate all outdated classifications.</tooltip>
</entityActionField>
<entityActionField>
<name>UpdateAllClassifications</name>
<title>Recalculate all Classifications</title>
<onActionProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/filterviewactiongroup/children/updateallclassifications/onActionProcess.js</onActionProcess>
<iconId>VAADIN:AUTOMATION</iconId>
<tooltip>Use this to manually start the serverprocess, which will this time recalculate all classifications. Do this after e.g importing data from elswhere where the outdated flag couldn't been set correctly</tooltip>
</entityActionField> </entityActionField>
</children> </children>
</entityActionGroup> </entityActionGroup>
......
import("system.process");
import("system.question");
import("system.text");
import("system.translate");
import("system.util");
import("system.vars");
var execute = question.askYesNo(translate.text("Start Serveprocess"), translate.text("Are you sure you want to recalculate all classifications using the current classificationgradings? This can take some time, since ALL classifications will get freshly calculated and updated if needed."), false);
if(execute)
{
var processConfig = process.createStartAsyncConfig()
.setName("updateClassifications_serverProcess")
.setUser( vars.get("$sys.user"))
.setThreadPriority(process.THREADPRIORITY_LOW)
.setTimerType(process.TIMERTYPE_SERVER)
.setLocalVariables({"recalculateAll_param" : true});
process.startAsync(processConfig);
question.showMessage(translate.text("Serverprocess has been started"), question.INFORMATION, translate.text("Classification"));
}
...@@ -52,23 +52,36 @@ var table = "CLASSIFICATIONSTORAGE"; ...@@ -52,23 +52,36 @@ var table = "CLASSIFICATIONSTORAGE";
var column = ["CLASSIFICATIONVALUE"]; var column = ["CLASSIFICATIONVALUE"];
var runUpdating = 0; var runUpdating = 0;
var singleRefresh = false; var singleRefresh = false;
var recalculateAll = false;
if(vars.exists("$local.refreshSingleRecord_param") && vars.get("$local.refreshSingleRecord_param")) if(vars.exists("$local.refreshSingleRecord_param") && vars.get("$local.refreshSingleRecord_param"))
{ {
singleRefresh = vars.get("$local.refreshSingleRecord_param"); singleRefresh = vars.get("$local.refreshSingleRecord_param");
} }
//all classificationgroups and their object_type that have atleast one classificationtype with the outdated flag set else if(vars.exists("$local.recalculateAll_param") && vars.get("$local.recalculateAll_param"))
if(!singleRefresh) {
recalculateAll = vars.get("$local.recalculateAll_param");
}
if(singleRefresh)
{ {
outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER") outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER")
.from("CLASSIFICATIONTYPE") .from("CLASSIFICATIONTYPE")
.where("CLASSIFICATIONTYPE.OUTDATED", 1) .where("CLASSIFICATIONTYPE.OBJECT_TYPE", vars.get("$local.ObjectType_param"))
.table(); .table();
} }
else else if(recalculateAll)
{ {
outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER") outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER")
.from("CLASSIFICATIONTYPE") .from("CLASSIFICATIONTYPE")
.where("CLASSIFICATIONTYPE.OBJECT_TYPE", vars.get("$local.ObjectType_param")) .table();
}
else //all classificationgroups and their object_type that have atleast one classificationtype with the outdated flag set
{
outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER")
.from("CLASSIFICATIONTYPE")
.where("CLASSIFICATIONTYPE.OUTDATED", 1)
.table(); .table();
} }
...@@ -112,13 +125,25 @@ for (i = 0; i < outdatedGroupsAndObjectTypes.length; i++) ...@@ -112,13 +125,25 @@ for (i = 0; i < outdatedGroupsAndObjectTypes.length; i++)
} }
if(!singleRefresh) if(!singleRefresh)
{ {
//object_type, object_rowId, classificationstorageId and the classificationstring (e.g. "ACB") of the classificationStorage datasets that habe the outdated flag set if(recalculateAll)
outdatedStoredClassifications = newSelect("CLASSIFICATIONSTORAGE.OBJECT_TYPE, CLASSIFICATIONSTORAGE.OBJECT_ROWID, \n\ {
CLASSIFICATIONSTORAGE.CLASSIFICATIONSTORAGEID, CLASSIFICATIONSTORAGE.CLASSIFICATIONVALUE") outdatedStoredClassifications = newSelect("CLASSIFICATIONSTORAGE.OBJECT_TYPE, CLASSIFICATIONSTORAGE.OBJECT_ROWID, \n\
.from("CLASSIFICATIONSTORAGE") CLASSIFICATIONSTORAGE.CLASSIFICATIONSTORAGEID, CLASSIFICATIONSTORAGE.CLASSIFICATIONVALUE")
.where("CLASSIFICATIONSTORAGE.OUTDATED", 1) .from("CLASSIFICATIONSTORAGE")
.orderBy("OBJECT_TYPE") .where("CLASSIFICATIONSTORAGE.OUTDATED", 1)
.table(); .orderBy("OBJECT_TYPE")
.table();
}
else
{
//object_type, object_rowId, classificationstorageId and the classificationstring (e.g. "ACB") of the classificationStorage datasets that habe the outdated flag set
outdatedStoredClassifications = newSelect("CLASSIFICATIONSTORAGE.OBJECT_TYPE, CLASSIFICATIONSTORAGE.OBJECT_ROWID, \n\
CLASSIFICATIONSTORAGE.CLASSIFICATIONSTORAGEID, CLASSIFICATIONSTORAGE.CLASSIFICATIONVALUE")
.from("CLASSIFICATIONSTORAGE")
.where("CLASSIFICATIONSTORAGE.OUTDATED", 1)
.orderBy("OBJECT_TYPE")
.table();
}
helperObject = {}; helperObject = {};
if(outdatedStoredClassifications) if(outdatedStoredClassifications)
{ {
......
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