the contentObjectAttribute argument is the eZContentObjectAttribute of the ContentObject (see eZContentObjectAttribute documentation here:http://pubsvn.ez.no/doxygen/trunk/html/classeZContentObjectAttribute.html). The code was a snipped from eZ's source code, not working out of the box.
What I meant is that you can start looking at how this has been implemented, how eZ Publish does it.