Hi

Is there a best-practise implementation of CRUD avents (Create, Read, Update 
and Delete) in a templatesheet for a class
Default the following is generated for a XWiki class

#set($class = $doc.getObject('CdlsatdCode.CdLSATEPublicQAClass').xWikiClass)
#foreach($prop in $class.properties)
  ; $prop.prettyName
  : $doc.display($prop.getName())
#end

This is fine for Read (=View) and Update events except for rules to be 
implemented around data integrity with update

When I CREATE the object (test for $doc.isNew() in most cases, unless multiple 
objects are created on same document, this might be case for 
internationalization
 typical things to do in CREATE is setting of the defaults value, setting keys 
that link to other objects (child of...)
When I UPDATE the object there might be attributes where we test Old.value 
against New.Value and NEW.Value might
When I DELETE the object (or the containing document) I might want to prevent 
that in order for integrity (by example Parent Child relation ships, do not 
delete the parent while there are still childs)

This is related to my previous post, since I discover the code is really 
becoming a mess if I do not use a best-practise

Who has implemented a practise and can tell me about the pro's and con's, this 
might be even a good thing to publish on the documentation of XWiki.org
since i expect many who are involved in building forms run into the same 
questions

Gerritjan

 
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to