k..j.m
#1
Briefly : the gis navigation functionality is not working when using a domain associated to an abstract class :
Say we have :
class Superclass;
class TargetClass;
domain SuperclassToTargetClass {1:N} from Superclass to TargetClass;
class Sub1 inherits Superclass;
class Sub2 inherits Superclass;
domain Sub1ToSub2 {1:N} from Sub1 to Sub2;
And we would like to get the following gis navigation :
(Root) Sub1
--(X)> Sub1ToSub2(Sub2)
-(X)-> SuperclassToTargetClass (TargetClass)
-(X)-> SuperclassToTargetClass (TargetClass)
We may define this navigation and be able use it *until* cmdbuild cache is invalidated and/or tomcat is restarted.
When we reload the previous navigation we obtain the following :
(Root) Sub1
--(X)> Sub1ToSub2(Sub2)
-(X)-> SuperclassToTargetClass (TargetClass)
-()-> SuperclassToTargetClass (TargetClass)
That is the last "SuperclassToTargetClass" navigation branch is not activated
We think the problem occurs because of some under requirement in the (javascript) data-model for navigation :
The function "isMyConf" in"CMDBuild.view.administration.gis.CMModGISNavigationConfiguration" is used to
decide if a navigation branch should be checked.
In this code, check is validated only after comparing the domainname and the target class :
var d = this.getDomain();
if (d && d.get("name") != conf.domainName) {
return false;
}
...
return (et.get("name") == conf.targetClassName);
As the parent class is not taken into account , the first "SuperclassToTargetClass" will always returned
by "isMyConf" and thus we get the following navigation tree result when cmdbuild reloads the model from
database :
(Root) Sub1
--(X)> Sub1ToSub2(Sub2)
-(X)-> SuperclassToTargetClass (TargetClass)
-()-> SuperclassToTargetClass (TargetClass)
k..j.m
#3
One solution could be to add the “DomainNavigation” configuration to each related tree node (sorry for my bad ecmascript):
In javascripts/cmdbuild/controller/administration/gis/CMModGISNavigationConfigurationController.js:
at line 42
replace
me.view.setTreeForEntryType(rootEntryType);
by
var rootNode=me.view.setTreeForEntryType(rootEntryType);
then add the line
rootNode.data.navConf = root;
at line 198
insert
node.data.navConf=nodeConf;
In javascripts/cmdbuild/view/administration/gis/ModGISNavigationConfiguration.js
replace line 212 with
return (this.parentNode.data.navConf.id==conf.idParent) && (et.get("name") == conf.targetClassName);