manager.delete(element);
}
}
// Remove attached workspace permissions.
Policy policy = SecurityServices.lookup().getSecurityPolicy();
policy.removePermissions(workspace);
// Notify instances removal before deleting workspace.
Iterator instanceIt = workspace.getPanelInstancesSet().iterator();
while (instanceIt.hasNext()) {
PanelInstance instance = (PanelInstance) instanceIt.next();
instance.instanceRemoved(session);
}
// Notify panels before deleting workspace.
Iterator sectionIt = workspace.getSections().iterator();
while (sectionIt.hasNext()) {
Section section = (Section) sectionIt.next();
Panel[] panels = section.getAllPanels();
for (int i = 0; i < panels.length; i++) {
Panel panel = panels[i];
panel.getProvider().getDriver().fireBeforePanelRemoved(panel);
panel.panelRemoved();
}
}
policy.save();
// Delete workspace.
session.delete(workspace);
session.flush();