| | |
| | | import org.forgerock.opendj.ldif.ConnectionEntryReader; |
| | | import org.opends.admin.ads.util.ConnectionWrapper; |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | | import org.opends.guitools.controlpanel.browser.ConnectionWithControls; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | |
| | | DN dn = node.getDN(); |
| | | if (!isAlreadyDeleted(alreadyDeleted, dn)) |
| | | { |
| | | ConnectionWrapper conn = controller.findConnectionForDisplayedEntry(node); |
| | | ConnectionWithControls conn = controller.findConnectionForDisplayedEntry(node); |
| | | useAdminCtx = controller.isConfigurationNode(node); |
| | | if (node.hasSubOrdinates()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void deleteSubtreeRecursively(ConnectionWrapper conn, DN dnToRemove, TreePath path, |
| | | private void deleteSubtreeRecursively(ConnectionWithControls conn, DN dnToRemove, TreePath path, |
| | | List<BrowserNodeInfo> toNotify) throws NamingException, IOException, DirectoryException |
| | | { |
| | | lastDn = dnToRemove; |
| | |
| | | |
| | | String filter = "(|(objectClass=*)(objectclass=ldapsubentry))"; |
| | | SearchRequest request = newSearchRequest(dnToRemove, SINGLE_LEVEL, Filter.valueOf(filter), NO_ATTRIBUTES); |
| | | try (ConnectionEntryReader entryDNs = conn.getConnection().search(request)) |
| | | try (ConnectionEntryReader entryDNs = conn.search(request)) |
| | | { |
| | | while (entryDNs.hasNext()) |
| | | { |
| | |
| | | |
| | | try |
| | | { |
| | | conn.getConnection().delete(dnToRemove.toString()); |
| | | conn.delete(newDeleteRequest(dnToRemove)); |
| | | if (path != null) |
| | | { |
| | | toNotify.add(controller.getNodeInfoFromPath(path)); |
| | |
| | | } |
| | | } |
| | | |
| | | private void deleteSubtreeWithControl(ConnectionWrapper conn, DN dn, TreePath path, List<BrowserNodeInfo> toNotify) |
| | | throws LdapException, NamingException |
| | | private void deleteSubtreeWithControl(ConnectionWithControls conn, DN dn, TreePath path, |
| | | List<BrowserNodeInfo> toNotify) throws LdapException, NamingException |
| | | { |
| | | lastDn = dn; |
| | | long t = System.currentTimeMillis(); |
| | |
| | | ColorAndFontConstants.defaultFont))); |
| | | } |
| | | }); |
| | | // Use a copy of the dir context since we are using an specific |
| | | // Use a copy of the connection since we are using a specific |
| | | // control to delete the subtree and this can cause |
| | | // synchronization problems when the tree is refreshed. |
| | | ControlPanelInfo info = getInfo(); |
| | | try (ConnectionWrapper conn1 = cloneConnectionWrapper(conn, info.getConnectTimeout(), info.getTrustManager(), null)) |
| | | try (ConnectionWrapper conn1 = |
| | | cloneConnectionWrapper(conn.getConnectionWrapper(), info.getConnectTimeout(), info.getTrustManager(), null)) |
| | | { |
| | | DeleteRequest request = newDeleteRequest(dn).addControl(SubtreeDeleteRequestControl.newControl(true)); |
| | | conn1.getConnection().delete(request); |