Hi Nils,

Yes, I filed the following bug in JIRA:
http://jira.magnolia-cms.com/browse/MAGNOLIA-3968

The following bug is related to the actual issue:
http://jira.magnolia-cms.com/browse/MAGNOLIA-3035

Apparently, the issue is fixed in JR 2.2...


The groovy script looks like this:

[code]
def hm = ctx.getHierarchyManager('website')
def valF = hm.getWorkspace().getSession().getValueFactory()
def start = ContentUtil.getContent("website","/some/path")

paragraphs = start.getChildren(ItemType.CONTENTNODE)
for (x in paragraphs) {
  println (x.getName())
  n = x.getNodeData("someproperty")
  val = n.getString()
  n.delete()
  v = NodeDataUtil.createValue(val,javax.jcr.PropertyType.STRING,valF)
  vA = new javax.jcr.Value[1]
  vA[0] = v
  NodeDataUtil.getOrCreateAndSet(x," someproperty ",vA)
  x.save()
}
[/code]

Note that the key idea is that you have to delete the old property and replace 
it with a new property of the same name, whose value is multi-valued (set with 
an array of values).
You could also build in a check to see whether the property already is 
multi-valued, and skip recreating it in that case.

Regards from Vienna,

Richard




-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Im Auftrag von Nils Breunese
Gesendet: Freitag, 14. September 2012 12:01
An: Magnolia User-List
Betreff: Re: [magnolia-user] Bootstrap data files and Magnolia 4.4.9-jr24 
(Jackrabbit 2)

Richard Unger wrote:

> I think you're running into a bug with Jackrabbit. In "system-view" XML 
> exports, the data-representation is not sufficient - multiple-properties are 
> not identified as such. This means: if you set up a node with a 
> multiple-valued property, but only add one value to the property, and then 
> export as XML, there is nothing to distinguish this property as 
> multiple-valued. It looks the same in XML as a single-valued property of the 
> same name.
> When the same XML is imported into another Repo, the property is created as 
> single-valued. Subsequent writes to this property then fail, because the 
> property is supposed to be multi-valued, but isn't.
>
> Ugly bug, but not the fault of magnolia. We worked around this by creating a 
> groovy-skript which iterates over our content, searching for properties that 
> should be multi-valued but are set up as single-valued, and then deleting and 
> recreating these properties as multi-valued.

If a Groovy script can fix it, then I guess an update task in Magnolia can as 
well. Have you reported this as a bug to Magnolia? Any chance you could share 
your Groovy script?

Nils.
------------------------------------------------------------------------
 VPRO   www.vpro.nl
------------------------------------------------------------------------


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, 
E-mail to: <[email protected]>
----------------------------------------------------------------





----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to