try {
ObjectContentManager ocm = this.getObjectContentManager();
NTMain main = new NTMain();
main.setPath("/test");
ocm.insert(main);
ocm.save();
//---------------------------------------------------------------------------------------------------------
// Retrieve the main object
//---------------------------------------------------------------------------------------------------------
main = (NTMain) ocm.getObject( "/test");
assertNotNull("main is null", main);
Collection result = main.getProxyCollection();
assertNull("Collection is not null", result);
//---------------------------------------------------------------------------------------------------------
// Update
//---------------------------------------------------------------------------------------------------------
ArrayList details= new ArrayList();
for(int i=1; i<=100;i++)
{
NTDetail detail = new NTDetail();
detail.setField("field" + i);
details.add(detail);
}
main.setProxyCollection(details);
ocm.update(main);
ocm.save();
//---------------------------------------------------------------------------------------------------------
// Retrieve the main object
//---------------------------------------------------------------------------------------------------------
main = (NTMain) ocm.getObject( "/test");
assertNotNull("main is null", main);
result = main.getProxyCollection();
assertEquals("Invalide size", result.size(), 100);
//---------------------------------------------------------------------------------------------------------
// Update
//---------------------------------------------------------------------------------------------------------
NTDetail detail = new NTDetail();
detail.setField("newFieldValue");
result.add(detail);
main.setProxyCollection(result);
ocm.update(main);
ocm.save();
//---------------------------------------------------------------------------------------------------------
// Retrieve the main object
//---------------------------------------------------------------------------------------------------------
main = (NTMain) ocm.getObject("/test");
assertNotNull("main is null", main);
assertEquals("Invalide size",main.getProxyCollection().size(), 101);
//---------------------------------------------------------------------------------------------------------
// Delete the main object
//---------------------------------------------------------------------------------------------------------