[MGNLDATA-107] When you install a module that adds datatypes, you can not install content of that datatype Created: 28/Sep/10  Updated: 17/Dec/10  Resolved: 28/Sep/10

Status: Closed
Project: Magnolia Data Module (closed)
Component/s: None
Affects Version/s: 1.4.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Ernst Bunders Assignee: Philipp Bärfuss
Resolution: Workaround exists Votes: 0
Labels: vpro
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

When you add some data (node) types during the installation of a module by bootstrapping /config/modules/data/config/types/xx and you want to bootstrap some nodes of that type as well, you get an exception, becouse the types are not yet registered in the jcr.



 Comments   
Comment by Philipp Bärfuss [ 28/Sep/10 ]

You have to register the node type explicitly. You find an example in the rss module.

    @Override
    protected List getBasicInstallTasks(InstallContext installContext) {
        final List<Task> installTasks = new ArrayList<Task>();
        // make sure we register the type before doing anything else
        installTasks.add(new RegisterNodeTypeTask("RssAggregator"));
        installTasks.addAll(super.getBasicInstallTasks(installContext));
        return installTasks;
    }
Comment by Ernst Bunders [ 29/Sep/10 ]

Hello Philipp

thanks for the info. Nice that there is a solution for this problem.

regards,

Ernst

Comment by Magnolia International [ 17/Dec/10 ]

Note that the important trick is to add this task in the basic install tasks, before any of the other tasks, i.e before Magnolia attempts to bootstrap your content (which is one of the default tasks registered by super.getBasicInstallTasks() in the snippet above)

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