Hi,
I spent the last week or so figuring out very strange behavior which I could
not explain. I’m not sure if any sort of code would be helpful so I just
explain what the situation is:
We have a class “caseClass” containing (among others) the following DBList:
Name = product
Pretty Name = product
Custom Display = [
{{velocity}}
#set ($propertyClass = $object.getxWikiClass().get($name))
#if ($type == 'edit')
{{html clean=false}}
$doc.displayEdit($propertyClass, $prefix, $object)
{{/html}}
#else
#set($listMap=$propertyClass.getMapValues())
#foreach($fieldKey in $object.getProperty($name).value)
#set($fieldValue=$listMap.get($fieldKey).getValue())
[[${fieldValue}>>$services.PropertyManager.getSourceURL(${fieldKey})]]
#end
#end
{{/velocity}}
]
DisplayType = select
Multiple Select = true
Since of box = 10
Multiselect seperators = [empty]
Join seperator = [ , ]
Sort = none
Relational Storage = true
Cache = false
Hibernate Query = [
SELECT idVarProp.value, CONCAT(codeVarProp.value, ' - ', naamVarProp.value, '
(', codeProdProp.value, ' - ', naamProdProp.value, ')')
FROM BaseObject obj, StringProperty idVarProp, StringProperty codeVarProp,
StringProperty naamVarProp, StringProperty idVarProdProp,
BaseObject obj2, StringProperty idProdProp, StringProperty codeProdProp,
StringProperty naamProdProp
WHERE obj.className = 'PDCKlassen.VariantClass' AND
obj2.className = 'PDCKlassen.ProductClass' AND
idVarProp.id.id = obj.id AND idVarProp.id.name = 'identificatieString' AND
codeVarProp.id.id = obj.id AND codeVarProp.id.name = 'codeVariant' AND
naamVarProp.id.id = obj.id AND naamVarProp.id.name = 'naamVariant' AND
idVarProdProp.id.id = obj.id AND idVarProdProp.id.name = 'product' AND
idProdProp.id.id = obj2.id AND idProdProp.id.name = 'identificatieString' AND
codeProdProp.id.id = obj2.id AND codeProdProp.id.name = 'productCode' AND
naamProdProp.id.id = obj2.id AND naamProdProp.id.name = 'naam' AND
idVarProdProp.value = idProdProp.value AND
obj.name <> 'PDCKlassen.VariantTemplate' AND obj2.name <>
'PDCKlassen.ProductTemplate'
ORDER BY codeProdProp.value, codeVarProp.value
]
XWiki Class name = [empty]
Id Field Name = [empty]
Value Field Name = [empty]
The functional side is, that this field can contain 0 - n occurrences.
We have a java based listener that is used to save pages with one (and only
one) object this class on the page with a version comment:
xwikiContext.getWiki().saveDocument(XWikiDocument, comment, true, xwikiContext)
Situation 1: The object contains zero references (i.e. is empty)
the following is happening:
Version 1.1 - This is the initial version
After generating a listener event that saves the document (version 1.1) as
above:
Version 1.2 - with the proper comment as passed by the save and as comment
“first comment"
After generating another listener event that saves the same document (version
1.2 this time) as above and as comment “second comment":
Version 1.2 - no change detected. The version comment is still “first comment”
Editing the page and pressing save button:
Version 1.3 (minor edit) of Version 2.1 (major edit)
If I go back to the first step (as described after Version 1.1), the same
results show up.
I have checked everything up to that actual save in the XWiki class. I can see
that the information passed to the saveDocument in the XWiki class is the
‘right’ information.
Situation 2: The object contains one (or more) references (i.e. is not empty)
the following is happening:
Version 1.1 - This is the initial version
After generating a listener event that saves the document (version 1.1) as
above with comment “first comment"
Version 1.2 - with the proper comment as passed by the save and as comment
“first comment"
After generating another listener event that saves the same document (version
1.2 this time) as above and as comment “second comment":
Version 1.3 - with the proper comment as passed by the second save and the
comment “second comment”
Since I did not understand what is actually happening, I have dogged in the
various aspects such as comparing object, sheets and whatnot but I could not
detect any difference.
Until I decided to change “Relational Storage” to false. This resulted in the
proper situation (described by Situation 2 - with an empty DBList as well as an
non-empty DBList)
What is the effect is for the “Relational Storage” parameter?
Why is the situation as above occurring and is this the expected result or is
this a bug or undocumented feature?
I’m sorry for the extensive explanation but it took me also a while to figure
out what happened.
Br,
Peter
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users