+1 Thanks, Marius
On 07/29/2010 12:54 PM, Alex Busenius wrote: > Hi devs, > > > It seems that currently there is no good way to manipulate XWiki objects > and properties in documents without depending on old core. > DocumentAccessBridge defines some methods for changing properties, but > they are very limited, in particular, there is no way to: > > * add a new property (except the first one) > * set a property of n-th object (getting it is possible) > * remove an object > * get the number of objects > > > Therefore I propose to add the following methods to DocumentAccessBridge: > > > // returns index of the new object > int addObject(ObjectReference obj) throws Exception; > > // returns false if there was no object, throws on access error > boolean removeObject(ObjectReference obj, int index) throws Exception; > > // number of objects of the given class > int getObjectCount(ObjectReference obj); > > // returns index of the object that was modified, adds a new object if > // index is out of range > int setProperty(ObjectReference obj, int idx, String prop, Object val) > throws Exception; > > // just to have all needed methods taking object reference > Object getProperty(ObjectReference obj, int index, String propertyName); > > > I've chosen ObjectReference because it contains (almost) all needed > information, including class name and document reference. It would be > better to have the object index stored in the reference too, like in > org.xwiki.annotation.reference.IndexedObjectReference, but this class is > annotation-specific. > > > I need those methods to store certificates in user profile, see > https://svn.xwiki.org/svnroot/xwiki/contrib/sandbox/xwiki-signedscripts > > > WDYT? > > Thanks, > Alex > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

