IBM Content Manager, Version 8.5           

Removing contents from a folder: Java™

To remove the contents from a folder:
  1. Check out the folder DDO from which you want to remove an item.
    dsICM.checkOut(ddoFolder);
  2. Look for the item to remove by creating an an iterator to iterate through the folder's content. In this case, look for the docItem DDO created earlier.
    dkIterator iter = dkFolder.createIterator();
    String itemPidString = ddoItem.getPidObject().pidString();
    while(iter.more()) {
    // Move the pointer to next element and return that object. 
    // Compare the PID trings of the DDO returned from the iterator 
    // with the DDO that is to be removed.
       DKDDO ddo =(DKDDO)iter.next();
       if(ddo.getPidObject().pidString().equals(itemPidString)) {
          // The item to be removed is found. 
          // Remove it (current element in the iterator)
          dkFolder.removeElementAt(iter);
       }
    }
  3. Persist the change and check in the folder DDO.
    ddoFolder.update();
    dsICM.checkIn(ddoFolder);


Feedback

Last updated: December 2013
dcmcm096.htm

© Copyright IBM Corporation 2013.