NewEntryTask.java revision 998747bfaaa3c6b28bbfaf0e282e6c0ccbf46bc0
/*
* 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-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* The task launched when we must create an entry.
*
*/
public class NewEntryTask extends Task
{
private BasicNode parentNode;
private BrowserController controller;
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 newEntry the entry containing the new values.
* @param ldif the LDIF representation of the new entry.
* @param controller the BrowserController.
* @param parentNode the parent node in the tree of the entry that we want
* to create.
*/
{
this.parentNode = parentNode;
this.controller = controller;
{
{
{
}
}
}
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
return backendSet;
}
/**
* {@inheritDoc}
*/
public LocalizableMessage getTaskDescription()
{
}
/**
* {@inheritDoc}
*/
protected String getCommandLinePath()
{
return null;
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
boolean canLaunch = true;
if (!isServerRunning())
{
{
// All the operations are incompatible if they apply to this
// backend for safety. This is a short operation so the limitation
// has not a lot of impact.
{
canLaunch = false;
}
}
}
return canLaunch;
}
/**
* {@inheritDoc}
*/
public boolean regenerateDescriptor()
{
return false;
}
/**
* {@inheritDoc}
*/
public void runTask()
{
try
{
if (parentNode != null)
{
}
else
{
useAdminCtx = true;
}
{
}
{
{
}
{
}
}
{
public void run()
{
}
});
attrs);
{
public void run()
{
boolean entryInserted = false;
if (parentNode != null)
{
boolean isReallyParentNode = false;
try
{
}
catch (Throwable t)
{
// Bug
t.printStackTrace();
isReallyParentNode = false;
}
if (isReallyParentNode)
{
entryInserted = true;
}
}
if (!entryInserted)
{
if (realParentNode != null)
{
}
else
{
{
if (nRootChildren > 1)
{
// Insert in the root.
}
}
}
}
}
});
}
catch (Throwable t)
{
lastException = t;
}
}
/**
* Prints the equivalent command-line in the progress dialog.
*
*/
private void printEquivalentCommand()
{
getConnectionCommandLineArguments(useAdminCtx, true)));
args);
{
}
}
{
for (int i=0; i<nRootChildren; i++)
{
try
{
{
{
parentNode = node;
break;
}
else
{
break;
}
}
}
catch (Throwable t)
{
// Bug
throw new RuntimeException("Unexpected error: "+t, t);
}
}
return parentNode;
}
{
if (parentPath != null)
{
{
if (isSuffix)
{
}
else
{
}
{
}
}
}
}
{
boolean isBaseDN = false;
for (BackendDescriptor backend :
{
{
{
isBaseDN = true;
break;
}
}
if (isBaseDN)
{
break;
}
}
return isBaseDN;
}
}