On 03/06/2010 01:06 AM, Abel Solórzano Astorga wrote:
> Thanks again Caleb,
>
> I try your suggestion, but I keep getting a null value from *
> valdoc.getDocument().**getxWikiClass().get("Project")*.
>
> The fields Map (
> *valdoc.getDocument().**getxWikiClass().fields.keySet(**)*) is empty.
>
> I put the following line on the code:
>
> *println valdoc.getDocument().getxWikiClass().toString()*
>
> and the result is
>
> *<class>
> <name>ValidationSample.TestClass_6</name>
> <customClass></customClass>
> <customMapping></customMapping>
> <defaultViewSheet></defaultViewSheet>
> <defaultEditSheet></defaultEditSheet>
> <defaultWeb></defaultWeb>
> <nameField></nameField>
> <validationScript></validationScript>
> </class>*
>
> I was expecting to see the properties on the XML.
>
> Abel

Is valdoc the document containing the class? It doesn't look like it 
from the name.

So, you must do something like:

> {{velocity}}
> #set($classDoc = $xwiki.getDocument('Your.Class'))
> #set($propertyDefinition = $classDoc.getxWikiClass().get('project'))
> ## $propertyDefinition.class should now print com.xpn.xwiki.api.PropertyClass
> ## Unfortunately, at this point you need programming rights to go into the 
> inner, protected property definition
> #set($propertyDefinition = $propertyDefinition.getPropertyClass())
> ## $propertyDefinition.class should now print 
> com.xpn.xwiki.objects.classes.StaticListClass
> ## If it doesn't, then you don't have programming rights.
> $propertyDefinition.setValues('a|b|c')
> ## Don't forget to save
> $classDoc.save()
> {{/velocity}}

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to