/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS
*/
/**
* The task that is launched when an entry must be deleted.
*/
{
private int nDeleted;
private long lastProgressTime;
private boolean equivalentCommandWithControlPrinted;
private boolean equivalentCommandWithoutControlPrinted;
private boolean useAdminCtx;
/**
* Constructor of the task.
* @param info the control panel information.
* @param dlg the progress dialog where the task progress will be displayed.
* @param paths the tree paths of the entries that must be deleted.
* @param controller the Browser Controller.
*/
{
backendSet = new HashSet<>();
this.controller = controller;
boolean canPrecalculateNumberOfEntries = true;
{
try
{
}
catch (DirectoryException de)
{
throw new RuntimeException("Unexpected error parsing dn: "+
}
}
{
{
{
{
break;
}
}
}
}
{
nToDelete = -1;
}
}
/** {@inheritDoc} */
{
return Type.DELETE_ENTRY;
}
/** {@inheritDoc} */
{
return backendSet;
}
/** {@inheritDoc} */
{
}
/** {@inheritDoc} */
{
return null;
}
/** {@inheritDoc} */
{
return new ArrayList<>();
}
/** {@inheritDoc} */
{
if (!isServerRunning()
{
// All the operations are incompatible if they apply to this
// backend for safety.
{
return false;
}
}
return true;
}
/** {@inheritDoc} */
public boolean regenerateDescriptor()
{
return false;
}
/** {@inheritDoc} */
public void runTask()
{
try
{
{
try
{
boolean isDnDeleted = false;
{
{
isDnDeleted = true;
break;
}
}
if (!isDnDeleted)
{
if (node.hasSubOrdinates())
{
}
else
{
}
}
}
catch (DirectoryException de)
{
throw new RuntimeException("Unexpected error parsing dn: "+
}
}
{
{
public void run()
{
}
});
}
}
catch (Throwable t)
{
lastException = t;
}
if (nDeleted > 1)
{
}
}
/**
* Notifies that some entries have been deleted. This will basically update
* the browser controller so that the tree reflects the changes that have
* been made.
* @param deletedNodes the nodes that have been deleted.
*/
{
{
if (pathToSelect != null)
{
{
}
}
else
{
}
}
if (pathToSelect != null)
{
if (selectedPath == null)
{
}
{
}
}
}
throws NamingException, DirectoryException
{
lastDn = dnToRemove;
long t = System.currentTimeMillis();
boolean displayProgress =
if (displayProgress)
{
// Only display the first entry equivalent command-line.
{
public void run()
{
{
printEquivalentCommandToDelete(lastDn, false);
}
}
});
}
try
{
"(|(objectClass=*)(objectclass=ldapsubentry))";
try
{
{
{
}
}
}
finally
{
}
} catch (NameNotFoundException nnfe) {
// The entry is not there: it has been removed
}
try
{
{
}
nDeleted ++;
if (displayProgress)
{
lastProgressTime = t;
{
}
else
{
}
{
public void run()
{
{
}
}
});
}
} catch (NameNotFoundException nnfe)
{
// The entry is not there: it has been removed
}
}
throws NamingException
{
long t = System.currentTimeMillis();
// Only display the first entry equivalent command-line.
{
public void run()
{
{
printEquivalentCommandToDelete(lastDn, true);
}
}
});
// Use a copy of the dir context since we are using an specific
// control to delete the subtree and this can cause
// synchronization problems when the tree is refreshed.
try
{
getInfo().getConnectTimeout(),
}
finally
{
try
{
}
{
}
}
nDeleted ++;
lastProgressTime = t;
{
}
{
}
else
{
}
{
public void run()
{
{
}
}
});
}
/**
* Prints in the progress dialog the equivalent command-line to delete a
* subtree.
* @param dn the DN of the subtree to be deleted.
* @param usingControl whether we must include the control or not.
*/
{
getConnectionCommandLineArguments(useAdminCtx, true)));
if (usingControl)
{
}
args,
}
}