[MGNLDATA-125] Missing adminInterface menu under certain condition. Created: 04/Jul/11  Updated: 25/Mar/13  Resolved: 24/Jul/12

Status: Closed
Project: Magnolia Data Module (closed)
Component/s: None
Affects Version/s: 1.6.3, 1.7.2
Fix Version/s: 1.7.3

Type: Bug Priority: Major
Reporter: Danilo Ghirardelli Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File RootTypes.patch    
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Date of First Response:

 Description   

There is a problem that prevents to generate the data menu correctly in some cases, but I haven't yet found a way to always reproduce it, because it depends deeply on the order in which types are registered, which is not guaranteed.
On my system, these steps will often lead to the problem, but not always:

  • create a new type named "z" (without quotes), with a base foder of "/z"
  • create a new subtype for "z", named "a" (without quotes), with the same base folder.
  • export the trees, type nodes and the dialogues for these new types. Do not export adminInterface/config/menu, because it is expected to be recreated if missing.
  • you may logout/login to check that the adminInterface menu was created correctly.
  • restart the webapp.

You would expect that the adminInterface menu is created again correctly, but often it isn't.
The problem lays in the DataModule class, lines 186-191:

                if(!allRootPaths.contains(type.getRootPath())) {
                    allRootPaths.add(type.getRootPath());
                    // create rootPath and a menu entry for each if necessary
                    createRootPath(type);
                    updateDataMenu(type);
                }

If you check the code you'll see that "types" are considered all at the same level, because they are stored in a map. If for any reason a subtype is returned by the map before its parent, these lines will add the root path to the list, but the "updateDataMenu" will skip the menu creation because it is a subtype. When the type is returned by the map, the root path is already in the list and it's skipped, so the menu is not created.
It's subtle but quite annoying, because there is no way to know which menu will be missing on various installations. Maybe it would be nice to either sort the map having types first, or add the rootPath to the list only if it's not a subtype.



 Comments   
Comment by Danilo Ghirardelli [ 04/Jul/11 ]

As a simple workaround you can export the generated adminInterface menu config and force you code to import that, but it would be nice to have the module do its work correctly.

Comment by Danilo Ghirardelli [ 04/Oct/11 ]

The attached patch corrects the problem in one direction: if a subtype is processed before its parent, the path is not added until the parent is processed, this way you are sure that all the menus are created.

Comment by Jan Haderka [ 19/Jul/12 ]

Test?

Generated at Mon Feb 12 05:11:36 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.