Examples of ObjectContentManager


Examples of org.apache.jackrabbit.ocm.manager.ObjectContentManager

 
}

public void testBeanCollection() {
  ObjectContentManager ocm = this.getObjectContentManager();

  //---------------------------------------------------------------------------------------------------------
  // Insert cmsobjects
  //---------------------------------------------------------------------------------------------------------
   Folder folder = new FolderImpl();   
     folder.setPath("/mainfolder");
     folder.setName("Main folder");       
   
     for (int i=1; i<=100;i++)
     {
         Document document = new DocumentImpl();         
         document.setName("document" + i);
         document.setContentType("plain/text");
         DocumentStream documentStream = new DocumentStream();
         documentStream.setEncoding("utf-8");
         documentStream.setContent("Test Content".getBytes());
         document.setDocumentStream(documentStream);
         folder.addChild(document);
        
         Folder subFolder = new FolderImpl();
         subFolder.setName("folder" + i);
         subFolder.addChild(document);
         folder.addChild(subFolder);
                 
     }
     log.debug("Save the folder and its 200 children");  
     ocm.insert(folder);
     ocm.save();
     log.debug("End - Save the folder and its 200 children");

  //--------------------------------------------------------------------------------------------------------- 
  // Retrieve Folder
  //---------------------------------------------------------------------------------------------------------     
  folder  = (Folder) ocm.getObject("/mainfolder");
  assertNotNull("Folder is null",folder);   
  Collection children = folder.getChildren();
  assertEquals("Invalid number of children", children.size(), 200);
     for (int i=1; i<=100;i++)
     {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.