Skip to content
Snippets Groups Projects
Commit 7f08deaa authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Classification Admin-refactorings

parent dbada8a6
No related branches found
No related tags found
No related merge requests found
Showing
with 140 additions and 65 deletions
......@@ -44,6 +44,7 @@
<node name="KeywordAttribute" kind="10077" />
<node name="ObjectRelationType" kind="10077" />
<node name="ClassificationAdmin" kind="10077" />
<node name="Classification" kind="10077" />
<node name="Salutation" kind="10077" />
<node name="INTERNAL_ADMINISTRATOR" kind="159" />
</node>
......
......@@ -38,12 +38,6 @@
<entityName>Classification_entity</entityName>
<fieldName>ClassificationsAdministration</fieldName>
</dependency>
<children>
<entityParameter>
<name>ClassificationType_param</name>
<valueProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/classificationsadmin/children/classificationtype_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>KeywordClassificationTypes</name>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.UID"));
\ No newline at end of file
import("system.result");
import("system.db");
result.object(db.table("select distinct CLASSIFICATIONTYPE from CLASSIFICATIONTYPE"));
\ No newline at end of file
result.object([[""]]);
\ No newline at end of file
......@@ -13,12 +13,14 @@
</entityProvider>
<entityField>
<name>CLASSIFICATIONID</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>CLASSIFICATIONSCORE_ID</name>
<title>Selection</title>
<consumer>ClassificationScores</consumer>
<searchable v="false" />
<titleProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationscore_id/titleProcess.js</titleProcess>
<displayValueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationscore_id/displayValueProcess.js</displayValueProcess>
</entityField>
......@@ -66,12 +68,14 @@
</entityProvider>
<entityField>
<name>CLASSIFICATIONTYPEID</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationtypeid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>SCORETYPE</name>
<title>Scoretype</title>
<mandatoryProcess>%aditoprj%/entity/Classification_entity/entityfields/scoretype/mandatoryProcess.js</mandatoryProcess>
<searchable v="false" />
<groupable v="true" />
<stateProcess>%aditoprj%/entity/Classification_entity/entityfields/scoretype/stateProcess.js</stateProcess>
<displayValueProcess>%aditoprj%/entity/Classification_entity/entityfields/scoretype/displayValueProcess.js</displayValueProcess>
......@@ -83,6 +87,7 @@
<mandatoryProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationgroup/mandatoryProcess.js</mandatoryProcess>
<dropDownProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationgroup/dropDownProcess.js</dropDownProcess>
<textInputAllowed v="true" />
<searchable v="false" />
<groupable v="true" />
<titleProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationgroup/titleProcess.js</titleProcess>
<displayValueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationgroup/displayValueProcess.js</displayValueProcess>
......@@ -90,18 +95,22 @@
</entityField>
<entityField>
<name>CLASSIFICATIONTYPE_ID</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>OBJECT_ROWID</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/object_rowid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>OBJECT_TYPE</name>
<searchable v="false" />
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/object_type/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>UID</name>
<searchable v="false" />
</entityField>
<entityConsumer>
<name>ClassificationScores</name>
......@@ -138,10 +147,13 @@
</entityParameter>
<entityField>
<name>CLASSIFICATIONTYPE</name>
<consumer>ClassificationTypes</consumer>
<title>Usage</title>
<consumer>KeywordClassificationTypes</consumer>
<searchable v="true" />
<groupable v="true" />
<state>EDITABLE</state>
<stateProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationtype/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationtype/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationtype/displayValueProcess.js</displayValueProcess>
</entityField>
<entityProvider>
<name>ClassificationsAdministration</name>
......@@ -176,11 +188,13 @@
<name>Info</name>
<title>Rating</title>
<contentType>HTML</contentType>
<searchable v="false" />
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/info/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>SCORE_RESULTS</name>
<searchable v="false" />
</entityField>
<entityConsumer>
<name>ClassificationTypes</name>
......@@ -191,11 +205,28 @@
<fieldName>#PROVIDER</fieldName>
</dependency>
</entityConsumer>
<entityConsumer>
<name>KeywordClassificationTypes</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>KeywordEntry_entity</entityName>
<fieldName>SpecificContainerKeywords</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/Classification_entity/entityfields/keywordclassificationtypes/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
<name>jdito</name>
<jDitoRecordAlias>Data_alias</jDitoRecordAlias>
<isFilterable v="true" />
<isRequireContainerFiltering v="true" />
<contentProcess>%aditoprj%/entity/Classification_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
<onInsert>%aditoprj%/entity/Classification_entity/recordcontainers/jdito/onInsert.js</onInsert>
<onUpdate>%aditoprj%/entity/Classification_entity/recordcontainers/jdito/onUpdate.js</onUpdate>
......
......@@ -4,10 +4,12 @@ import("system.neon");
import("system.vars");
import("system.db");
import("system.result");
logging.log(vars.get("$param.IsAdminMode_param"))
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.IsAdminMode_param") && vars.get("$param.IsAdminMode_param") == "1")
{
logging.log(vars.get("$param.ClassificationType_param"))
logging.log(ClassificationUtils.getAllGroups(vars.get("$param.ClassificationType_param"), true).toSource())
result.object(ClassificationUtils.getAllGroups(vars.get("$param.ClassificationType_param"), true));
// use param if available or current selectionRows
var classificationType = vars.get("$field.CLASSIFICATIONTYPE")
logging.log("asdf " + vars.get("$field.CLASSIFICATIONTYPE"))
if (classificationType)
result.object(ClassificationUtils.getAllGroups(classificationType, true));
}
\ No newline at end of file
......@@ -8,10 +8,21 @@ import("Entity_lib");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.exists("$param.IsAdminMode_param") && vars.get("$param.IsAdminMode_param") == "1")
{
var newGroup = ProcessHandlingUtils.getOnValidationValue();
var groups = ClassificationUtils.getAllGroups(vars.get("$param.ClassificationType_param"), false)
// use param if available or current selectionRows
var classificationType = ClassificationUtils.getUsageType("$param.ClassificationType_param", "$sys.selectionRows");
if (groups.indexOf(newGroup, 0) != -1 && ClassificationUtils.getGroupFromDb(vars.get("$field.CLASSIFICATIONTYPEID")) != newGroup)
if (classificationType)
{
var groups = ClassificationUtils.getAllGroups(classificationType, false)
if (groups.indexOf(newGroup, 0) != -1 && ClassificationUtils.getGroupFromDb(vars.get("$field.CLASSIFICATIONTYPEID")) != newGroup)
{
result.string(translate.text("The new Classification name already exists."));
}
}
else
{
result.string(translate.text("The new Classification name already exists."));
result.string(translate.text("Could not determine the current Classification type (usage)."));
}
}
import("system.result");
import("system.vars");
import("Keyword_lib");
import("KeywordRegistry_basic");
result.string(KeywordUtils.getViewValue($KeywordRegistry.classificationType(), vars.get("$this.value")));
\ No newline at end of file
import("system.result");
import("system.neon");
import("system.vars");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
else
{
result.string(neon.COMPONENTSTATE_READONLY);
}
\ No newline at end of file
import("system.result");
import("KeywordRegistry_basic")
result.string($KeywordRegistry.classificationType())
\ No newline at end of file
import("JditoFilter_lib");
import("system.logging");
import("Classification_lib");
import("system.vars");
......@@ -8,6 +9,8 @@ import("system.result");
var admin = (vars.exists("$param.IsAdminMode_param") && vars.get("$param.IsAdminMode_param") == "1")
var scores = {};
if (!admin)
{
scores = JSON.stringify(ClassificationUtils.getScore(vars.get("$param.ClassificationType_param"), vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowid_param")));
......@@ -48,19 +51,21 @@ if (!classificationId)
.or("CLASSIFICATION.OBJECT_ROWID is null"))
}
logging.log(db.translateStatement(cond.buildSql("select case when CLASSIFICATIONID is not null then 'C,' || CLASSIFICATIONID else 'T,' || CLASSIFICATIONTYPEID end, CLASSIFICATIONID, CLASSIFICATIONGROUP, CLASSIFICATIONSCORE_ID, CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE_ID, OBJECT_TYPE, OBJECT_ROWID, SCORETYPE, CLASSIFICATIONTYPE.CLASSIFICATIONTYPE from CLASSIFICATION \n\
right join CLASSIFICATIONTYPE on " + db.translateCondition(SqlCondition.begin()
.and("CLASSIFICATIONTYPE_ID = CLASSIFICATIONTYPEID")
.andPrepareVars("CLASSIFICATION.OBJECT_TYPE", "$param.ObjectType_param")
.andPrepareVars("CLASSIFICATION.OBJECT_ROWID", "$param.ObjectRowid_param").build()), (admin ? "1=1" : "1=2"), "order by CLASSIFICATIONGROUP asc")))
if (vars.exists("$local.userfilter") && vars.get("$local.userfilter"))
{
var filter = vars.get("$local.userfilter");
cond.andSqlCondition((JditoFilterUtils.getSqlCondition(filter, "CLASSIFICATION", undefined, {
CLASSIFICATIONTYPE : "CLASSIFICATIONTYPE.CLASSIFICATIONTYPE"
})));
}
result.object(db.table(cond.buildSql("select case when CLASSIFICATIONID is not null then 'C,' || CLASSIFICATIONID else 'T,' || CLASSIFICATIONTYPEID end, CLASSIFICATIONID, CLASSIFICATIONGROUP, CLASSIFICATIONSCORE_ID, CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE_ID, OBJECT_TYPE, OBJECT_ROWID, SCORETYPE, CLASSIFICATIONTYPE.CLASSIFICATIONTYPE from CLASSIFICATION \n\
right join CLASSIFICATIONTYPE on " + db.translateCondition(SqlCondition.begin()
.and("CLASSIFICATIONTYPE_ID = CLASSIFICATIONTYPEID")
.andPrepareVars("CLASSIFICATION.OBJECT_TYPE", "$param.ObjectType_param")
.andPrepareVars("CLASSIFICATION.OBJECT_ROWID", "$param.ObjectRowid_param").build()), (admin ? "1=1" : "1=2"), "order by CLASSIFICATIONGROUP asc"))
.map(function(pRow)
{
pRow.push(scores);
return pRow;
}));
\ No newline at end of file
right join CLASSIFICATIONTYPE on " + db.translateCondition(SqlCondition.begin()
.and("CLASSIFICATIONTYPE_ID = CLASSIFICATIONTYPEID")
.andPrepareVars("CLASSIFICATION.OBJECT_TYPE", "$param.ObjectType_param")
.andPrepareVars("CLASSIFICATION.OBJECT_ROWID", "$param.ObjectRowid_param").build()), (admin ? "1=1" : "1=2"), "order by CLASSIFICATIONGROUP asc"))
.map(function(pRow)
{
pRow.push(scores);
return pRow;
}));
\ No newline at end of file
......@@ -8,7 +8,6 @@ import("system.vars");
var changed = vars.get("$local.changed");
logging.log(vars.get("$field.CLASSIFICATIONID"))
// check if it already exists. Else it only exists as ScoreType but has no Classification-Entry
if (vars.get("$field.CLASSIFICATIONID"))
{
......@@ -42,7 +41,6 @@ if (vars.exists("$param.IsAdminMode_param") && vars.exists("$param.IsAdminMode_p
{
changed.forEach(function(change)
{
logging.log(change)
switch (change)
{
case "CLASSIFICATIONGROUP.value":
......@@ -50,6 +48,11 @@ if (vars.exists("$param.IsAdminMode_param") && vars.exists("$param.IsAdminMode_p
var newGroupName = vars.get("$field.CLASSIFICATIONGROUP");
ClassificationUtils.changeGroupName(oldGroupName, newGroupName, vars.get("$field.CLASSIFICATIONTYPE"))
case "SCORE_TYPE.value":
var scoreId = vars.get("$field.CLASSIFICATIONSCORE_ID");
var newScoreName = vars.get("$field.SCORE_TYPE");
ClassificationUtils.changeScoreName(newScoreName, scoreId);
}
})
......
......@@ -392,6 +392,12 @@
<fieldName>KeywordClassificationTypes</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>3a81e886-0d83-47f0-9ec7-c864ffc57cda</name>
<entityName>Classification_entity</entityName>
<fieldName>KeywordClassificationTypes</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
......
......@@ -3,13 +3,8 @@
<name>ClassificationAdmin</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<mainview>ClassificationAdminMain_view</mainview>
<filterview>ClassificationAdminFilter_view</filterview>
<entity>ClassificationAdmin_entity</entity>
<references>
<neonViewReference>
<name>e29a0221-6ac6-47d3-bee0-950def1847a8</name>
<view>ClassificationAdminFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>4a240156-6c62-46d8-890e-b5c239ef8128</name>
<view>ClassificationAdminMain_view</view>
......
<?xml version="1.0" encoding="UTF-8"?>
<neonView 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/neonView/1.1.1">
<name>ClassificationAdminFilter_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<tableViewTemplate>
<name>Classificationtypes</name>
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
<name>44e91668-7947-49e2-8aa4-b9a03bc87842</name>
<entityField>UID</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
</neonView>
......@@ -2,16 +2,18 @@
<neonView 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/neonView/1.1.1">
<name>ClassificationAdminTree_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<filterable v="true" />
<layout>
<noneLayout>
<boxLayout>
<name>layout</name>
</noneLayout>
</boxLayout>
</layout>
<children>
<treeViewTemplate>
<name>classificationTree</name>
<titleField>SCORETYPE</titleField>
<defaultGroupFields>
<element>CLASSIFICATIONTYPE</element>
<element>CLASSIFICATIONGROUP</element>
</defaultGroupFields>
<hideContentSearch v="true" />
......
......@@ -15,6 +15,10 @@
<drawerCaption>Classification</drawerCaption>
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>31662c73-7352-4eb2-889d-3f63bff25686</name>
<entityField>CLASSIFICATIONTYPE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>7fddc4d4-6bdc-4c7a-9d69-bba4a9506707</name>
<entityField>CLASSIFICATIONGROUP</entityField>
......
......@@ -89,6 +89,32 @@ ClassificationUtils.changeGroupName = function(pOldName, pNewName, pClassificati
{
var groups = ClassificationUtils.getAllGroups(pClassificationType, false)
if (groups.indexOf(pNewName, 0) == -1)
{
db.updateData("CLASSIFICATIONTYPE", ["CLASSIFICATIONGROUP"], null, [pNewName], SqlCondition.equals("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP", pOldName, "1=2"));
}
}
ClassificationUtils.getUsageType = function(pParamField, pSelectionField)
{
if (vars.exists(pParamField) && vars.get(pParamField))
classificationType = vars.get(pParamField);
else if (vars.exists(pSelectionField) && vars.get(pSelectionField))
{
var selection = vars.get(pSelectionField);
if (selection.length > 0 && selection[0]["CLASSIFICATIONTYPE"])
{
classificationType = selection[0]["CLASSIFICATIONTYPE"];
}
}
return classificationType;
}
ClassificationUtils.changeScoreName = function(pOldScoreName, pNewScoreName, pScoreId)
{
var groups = ClassificationUtils.getAllScores(pClassificationGroup, false)
if (groups.indexOf(pNewName, 0) == -1)
{
db.updateData("CLASSIFICATIONTYPE", ["CLASSIFICATIONGROUP"], null, [pNewName], SqlCondition.equals("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP", pOldName, "1=2"));
......
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