To remove the contents from a folder:
- Check out the folder DDO from which you want to remove
an item.
dsICM.checkOut(ddoFolder);
- 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);
}
}
- Persist the change and check in the folder DDO.
ddoFolder.update();
dsICM.checkIn(ddoFolder);