[MGNLMIGRATION-221] Migrate Content: Change from jcr:primaryType "mgnl.contentNode" to "mgnl:component" Created: 07/Feb/13  Updated: 11/Feb/13  Resolved: 11/Feb/13

Status: Closed
Project: Migration 4.4 to 4.5 (closed)
Component/s: Migration Task
Affects Version/s: 1.2
Fix Version/s: 1.2

Type: Task Priority: Major
Reporter: Tom Wespi Assignee: Unassigned
Resolution: Not an issue Votes: 0
Labels: Paragraph, itemtype, migration
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Magnolia EE 4.5.7


Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:

 Description   

After migrating Website Content to 4.5.7, I've to change the old paragraphs jcr:primaryTpye from "mgnl.contentNode" to "mgnl:component"

<sv:node sv:name="0"> <- this is a paragraph
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>mgnl:contentNode</sv:value>
</sv:property>

So I wrote a little script which finds me all paragraphs. When trying

node.setProperty("jcr:primaryType", "mgnl:component");

it always results in a "javax.jcr.nodetype.ConstraintViolationException: Unable to perform operation. Node is protected."

same with
MigrationUtil.updatePropertyIfExist(node, propertyName, oldValue, newValue)

For a proper migration it is necessary to update those nodes types.

How to perform this action with the Magnolia Migration Tool.



 Comments   
Comment by Natascha Desmarais [ 08/Feb/13 ]

Hi Tom

This should usually be done if you use the content migration task. This one calls info.magnolia.migration.task.content.UpdateWebsitePrimaryTypeMigrationTask which will update all necessary primary types.

Did you use ContentModuleMigrationTask(String taskName, String taskDescription, String moduleName, String repository, List<String> sitePaths, boolean disposeObservation, boolean stkSites) for updating your website content? You can pass the sitePaths as follows:
Arrays.asList("/site1", "/site2", "/site3")

Let me know if this answers your question.

Comment by Tom Wespi [ 08/Feb/13 ]

Hi Natascha

due the page is not an STK Site, I think the info.magnolia.migration.task.content.UpdateWebsitePrimaryTypeMigrationTask was not executed.

How to update an non-STK Page?

Comment by Natascha Desmarais [ 09/Feb/13 ]

The update task is executed no matter whether it is an STK based site or not:

ContentModuleMigrationTask.java
  81         // Step Update primary type
  82         executeUpdateWebsitePrimaryTypeMigrationTask(installContext);
  83 
  84         // Step Update template ID
  85         executeUpdateTemplateIdMigrationTask(installContext);
  86 
  87 
  88         if (stkSites) {
  89             executeStkBasedWebsiteMigrationTask(installContext);
  90         }

Please verify that nothing fails in the logs.

Comment by Tom Wespi [ 11/Feb/13 ]

Hello

yes of course! I just had to write a small InstallTask and then it worked like a charm.

Comment by Natascha Desmarais [ 11/Feb/13 ]

Glad you got it to work will close this as "not an issue" in that case.
Cheers
Natascha

Generated at Mon Feb 12 10:18:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.