NMS-7126: Fix circular dependencies while serializing objects to XML/JSO...

...N. Including tests.

* http://issues.opennms.org/browse/NMS-7126
* http://bamboo.internal.opennms.com:8085/browse/OPENNMS-NMS155