src/com/netscape/admin/dirserv/ContentMenuController.java | 66 -
src/com/netscape/admin/dirserv/DSBaseModel.java | 2
src/com/netscape/admin/dirserv/DSContentPage.java | 922 ++++++++------
src/com/netscape/admin/dirserv/DSResourceModel.java | 6
src/com/netscape/admin/dirserv/dirserv.properties | 4
5 files changed, 634 insertions(+), 366 deletions(-)
New commits:
commit e2ab4839652b75e678be9dd8225b050d16c2cfd5
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Oct 23 10:52:03 2014 -0700
Ticket #47380 - RFE: Winsync loses connection with AD objects when they move from the
console.
Description: Previously, "move" operation was implemented as the
combination of "cut" and "paste", which was internally,
"delete"
and "add". In the windows sync context, delete and add on one
side does not fully recover the other side.
This patch replaces "cut" and "pasted" with "move" and
"movepaste".
By "move", it puts selected DN(s) into DN clipboard. If the DN
clipboard is not empty, "movepaste" is enabled, moving the cursor,
selecting the new superior, then choosing movepaste, the entries
in the DN clipboard are moved to the new superior by modrdn. The
movepaste is restlicted to one time operation, that is, once the
move was done, the DN clipboard is cleaned up and movepaste in the
menu is grayed out.
In terms of windows sync, since the modrdn operation is sent and
replayed on the AD, the results on DS and AD are in sync.
Note: At the "move" phase, you could choose multiple entries and
move them into the same destination.
https://fedorahosted.org/389/ticket/47380
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
Per suggestion by Mark, replaced the C style comments with the Java
style ones.
diff --git a/src/com/netscape/admin/dirserv/ContentMenuController.java
b/src/com/netscape/admin/dirserv/ContentMenuController.java
index e89841f..9a9121b 100644
--- a/src/com/netscape/admin/dirserv/ContentMenuController.java
+++ b/src/com/netscape/admin/dirserv/ContentMenuController.java
@@ -91,12 +91,13 @@ public class ContentMenuController {
* Enables/disables the menu items, according to which entry is selected.
* It assumes that an object is selected in the tree.
*/
- public void updateMenuState() {
+ public void updateMenuState() {
boolean isRootSelected = _contentPage.isRootSelected();
boolean isSelectedNodeRemote = _contentPage.isSelectedNodeRemote();
boolean isSuffixSelected = _contentPage.isSelectedNodeSuffix();
- boolean isClipboardEmpty = _contentPage.isClipboardEmpty();
- Integer selectionActivationState = new
Integer(AccountInactivation.CANNOT_BE_ACTIVATED_INACTIVATED);
+ boolean isClipboardEmpty = _contentPage.isClipboardEmpty();
+ boolean isDnInClipboardEmpty = _contentPage.isDnInClipboardEmpty(); // used by move
+ Integer selectionActivationState = new
Integer(AccountInactivation.CANNOT_BE_ACTIVATED_INACTIVATED);
Integer selectionVlvState = new Integer(CreateVLVIndex.CAN_NOT_HAVE_INDEX);
Integer selectionPWPState = new Integer(PasswordPolicyPanel.NO_PWP);
@@ -110,9 +111,10 @@ public class ContentMenuController {
updateAciMenuItems(isRootSelected);
updateRoleMenuItems(isRootSelected);
updateReferralMenuItems(isRootSelected);
- updateCutCopyPasteMenuItems(isRootSelected,
+ updateMoveCopyPasteMenuItems(isRootSelected,
isSuffixSelected,
- isClipboardEmpty);
+ isClipboardEmpty,
+ isDnInClipboardEmpty);
updateSearchMenuItems(isRootSelected);
updateActivateInactivateMenuItems(selectionActivationState, isSelectedNodeRemote);
updateVLVMenuItems(selectionVlvState, isSelectedNodeRemote);
@@ -232,10 +234,10 @@ public class ContentMenuController {
_resource.getString("menu", "inactivate-description"),
_listener),
new MenuItemSeparator(),
- new MenuItemText( CUT,
- _resource.getString("menu", "EditCut"),
+ new MenuItemText( MOVE,
+ _resource.getString("menu", "EditMove"),
_resource.getString("menu",
- "EditCut-description"),
+ "EditMove"),
_listener),
new MenuItemText( COPY,
_resource.getString("menu", "EditCopy"),
@@ -247,6 +249,11 @@ public class ContentMenuController {
_resource.getString("menu",
"EditPaste-description"),
_listener),
+ new MenuItemText( MOVEPASTE,
+ _resource.getString("menu", "EditMovePaste"),
+ _resource.getString("menu",
+ "EditMovePaste-description"),
+ _listener),
new MenuItemText( DELETE,
_resource.getString("menu", "EditDelete"),
_resource.getString("menu",
@@ -257,8 +264,8 @@ public class ContentMenuController {
_resource.getString("menu", "refresh"),
_resource.getString("menu",
"refresh-description"),
- _listener),
- };
+ _listener),
+ };
addShortCuts(_contextMenuItems);
setActionCommand(_contextMenuItems);
}
@@ -453,10 +460,10 @@ public class ContentMenuController {
private void createEditMenuItems() {
_editMenuItems = new IMenuItem[] {
new MenuItemSeparator(),
- new MenuItemText( CUT,
- _resource.getString("menu", "EditCut"),
+ new MenuItemText( MOVE,
+ _resource.getString("menu", "EditMove"),
_resource.getString("menu",
- "EditCut-description"),
+ "EditMove-description"),
_listener),
new MenuItemText( COPY,
_resource.getString("menu", "EditCopy"),
@@ -468,6 +475,11 @@ public class ContentMenuController {
_resource.getString("menu",
"EditPaste-description"),
_listener),
+ new MenuItemText(
+ _resource.getString("menu", "EditMovePaste"),
+ _resource.getString("menu",
+ "EditMovePaste-description"),
+ _listener),
new MenuItemText( DELETE,
_resource.getString("menu", "EditDelete"),
_resource.getString("menu",
@@ -1000,24 +1012,28 @@ public class ContentMenuController {
setEnabledMenuItem(_contextMenuItems, SET_REFERRALS, !isRootSelected);
}
- private void updateCutCopyPasteMenuItems(boolean isRootSelected,
- boolean isSuffixSelected,
- boolean isClipboardEmpty) {
+ private void updateMoveCopyPasteMenuItems(boolean isRootSelected,
+ boolean isSuffixSelected,
+ boolean isClipboardEmpty,
+ boolean isDnInClipboardEmpty) {
setEnabledMenuItem(_editMenuItems, COPY, (!isRootSelected &&
!isSuffixSelected));
setEnabledMenuItem(_contextMenuItems, COPY, (!isRootSelected &&
!isSuffixSelected));
- setEnabledMenuItem(_editMenuItems, CUT, (!isRootSelected &&
!isSuffixSelected));
- setEnabledMenuItem(_contextMenuItems, CUT, (!isRootSelected &&
!isSuffixSelected));
+ setEnabledMenuItem(_editMenuItems, MOVE, (!isRootSelected &&
!isSuffixSelected));
+ setEnabledMenuItem(_contextMenuItems, MOVE, (!isRootSelected &&
!isSuffixSelected));
setEnabledMenuItem(_editMenuItems, DELETE, (!isRootSelected &&
!isSuffixSelected));
setEnabledMenuItem(_contextMenuItems, DELETE, (!isRootSelected &&
!isSuffixSelected));
- setEnabledMenuItem(_editMenuItems, COPYDN, !isRootSelected);
- setEnabledMenuItem(_editMenuItems, COPYLDAPURL, !isRootSelected);
-
+ setEnabledMenuItem(_editMenuItems, COPYDN, !isRootSelected);
+ setEnabledMenuItem(_editMenuItems, COPYLDAPURL, !isRootSelected);
+
setEnabledMenuItem(_editMenuItems, PASTE, !isRootSelected &&
!isClipboardEmpty);
- setEnabledMenuItem(_contextMenuItems, PASTE, !isRootSelected &&
!isClipboardEmpty);
+ setEnabledMenuItem(_contextMenuItems, PASTE, !isRootSelected &&
!isClipboardEmpty);
+
+ setEnabledMenuItem(_editMenuItems, MOVEPASTE, !isRootSelected &&
!isDnInClipboardEmpty);
+ setEnabledMenuItem(_contextMenuItems, MOVEPASTE, !isRootSelected &&
!isDnInClipboardEmpty);
}
private void updatePWPMenuItems(Integer selectionPWPState,
@@ -1136,8 +1152,9 @@ public class ContentMenuController {
//_shortCutTable.put(REFRESHTREE, KeyStroke.getKeyStroke(KeyEvent.VK_R,
Event.CTRL_MASK));
_shortCutTable.put(REFRESHNODE, KeyStroke.getKeyStroke(KeyEvent.VK_R,
Event.CTRL_MASK));
_shortCutTable.put(COPY, KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK));
- _shortCutTable.put(CUT, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK));
+ _shortCutTable.put(MOVE, KeyStroke.getKeyStroke(KeyEvent.VK_M, Event.CTRL_MASK));
_shortCutTable.put(PASTE, KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK));
+ _shortCutTable.put(MOVEPASTE, KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK));
_shortCutTable.put(DELETE, KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK));
}
@@ -1190,9 +1207,10 @@ public class ContentMenuController {
static final String ROLES = "roles";
static final String SET_REFERRALS = "referral";
static final String AUTHENTICATE = "authenticate";
- static final String CUT = "cut";
+ static final String MOVE = "move";
static final String COPY = "copy";
static final String PASTE = "paste";
+ static final String MOVEPASTE = "movepaste";
static final String UNDO = "undo";
static final String DELETE = "delete";
static final String NEW_USER = "newuser";
diff --git a/src/com/netscape/admin/dirserv/DSBaseModel.java
b/src/com/netscape/admin/dirserv/DSBaseModel.java
index 1e719d9..bff044c 100644
--- a/src/com/netscape/admin/dirserv/DSBaseModel.java
+++ b/src/com/netscape/admin/dirserv/DSBaseModel.java
@@ -455,8 +455,10 @@ abstract public class DSBaseModel extends ResourceModel
static final String ROLES = "roles";
static final String AUTHENTICATE = "authenticate";
static final String CUT = "cut";
+ static final String MOVE = "move";
static final String COPY = "copy";
static final String PASTE = "paste";
+ static final String MOVEPASTE = "movepaste";
static final String UNDO = "undo";
static final String DELETE = "delete";
static final String NEW_USER = "newuser";
diff --git a/src/com/netscape/admin/dirserv/DSContentPage.java
b/src/com/netscape/admin/dirserv/DSContentPage.java
index bb6de7b..57f6503 100644
--- a/src/com/netscape/admin/dirserv/DSContentPage.java
+++ b/src/com/netscape/admin/dirserv/DSContentPage.java
@@ -71,7 +71,6 @@ implements IPage,
}
-
/**
* IPage implementation
* ====================
@@ -184,7 +183,7 @@ implements IPage,
_controller.setContainerClasses(CONTAINER_OBJECTCLASSES);
_controller.setMaxChildren(DISPLAYED_CHILDREN_LIMIT);
- /* Create the children controller */
+ // Create the children controller
_childrenController = new ChildrenController(_list,
_connectionPool,
_iconPool);
@@ -198,14 +197,14 @@ implements IPage,
_attributePanel);
- /* Create the database config object */
+ // Create the database config object
_databaseConfig = new DatabaseConfig();
// NUMSUBORDINATE HACK
// We attach the hacker to the (tree) browser controller.
_controller.setNumSubordinateHacker(_databaseConfig.getNumSubordinateHacker());
- /* Create the menu controller */
+ // Create the menu controller
_menuController = new ContentMenuController(DSContentPage.this,
_contextMenu,
_framework,
@@ -237,7 +236,7 @@ implements IPage,
}});
}
- /* Create the entry editor */
+ // Create the entry editor
_entryEditor = new EntryEditor(getSchema(), _framework, _databaseConfig);
Vector vSuffixes = _databaseConfig.getRootSuffixesWithEntry();
if (vSuffixes.size() > 0) {
@@ -273,7 +272,7 @@ implements IPage,
_childrenController.setFollowReferrals(followReferrals);
- /* Initialize the display */
+ // Initialize the display
_controller.setDisplayFlags(_display);
_childrenController.setDisplayFlags(_display);
@@ -376,10 +375,10 @@ implements IPage,
if (_isInitialized) {
try {
refreshDatabaseConfigAndSuffixes(/*refreshAll=*/false);
- /* Give the focus to the main tree */
+ // Give the focus to the main tree
_tree.grabFocus();
_menuController.populateMenuItems();
- /* Refresh the menus */
+ // Refresh the menus
_menuController.recreateDynamicMenus();
} catch (Exception e) {
}
@@ -406,9 +405,9 @@ implements IPage,
* IContentPageInfo implementation
* ============================================
*/
- /**
- * Implements IContentPageInfo
- */
+ /**
+ * Implements IContentPageInfo
+ */
public boolean isRootSelected() {
boolean isRootSelected = false;
IBrowserNodeInfo node = getSelectedNodeInfo();
@@ -438,18 +437,23 @@ implements IPage,
}
return isSelectedNodeSuffix;
}
- /**
- * Implements IContentPageInfo
- */
+
+ /**
+ * Implements IContentPageInfo
+ */
public boolean isClipboardEmpty() {
return (_clipboard.isEmpty());
}
- /**
- * Implements IContentPageInfo
- *
- * Should not be called if the node is remote
- */
+ public boolean isDnInClipboardEmpty() {
+ return (_clipboard.isDnEmpty());
+ }
+
+ /**
+ * Implements IContentPageInfo
+ *
+ * Should not be called if the node is remote
+ */
public Integer getSelectionVlvState() {
IBrowserNodeInfo node = getSelectedNodeInfo();
return getNodeVlvState(node);
@@ -458,22 +462,22 @@ implements IPage,
/**
*
* Should not be called if the node is remote
- */
+ */
Integer getNodeVlvState(IBrowserNodeInfo node) {
Integer state = new Integer(CreateVLVIndex.CAN_NOT_HAVE_INDEX);
- if (node != null) {
- String dn = Helper.getNodeInfoDN(node);
+ if (node != null) {
+ String dn = Helper.getNodeInfoDN(node);
if (dn != null) {
- state = (Integer)_vlvCache.get(dn);
- if (state == null) {
+ state = (Integer)_vlvCache.get(dn);
+ if (state == null) {
try {
state = new Integer(CreateVLVIndex.CAN_NOT_HAVE_INDEX);
state = new Integer(CreateVLVIndex.indexStatus(dn,
-
_framework.getServerObject().getServerInfo()));
- } catch (LDAPException lde) {
+
_framework.getServerObject().getServerInfo()));
+ } catch (LDAPException lde) {
/* If something gone wrong we keep the default value
CAN_NOT_HAVE_INDEX:
- this is called by the menu controller and it has no context
enough to display error*/
- }
+ this is called by the menu controller and it has no context
enough to display error*/
+ }
_vlvCache.put(dn, state);
}
}
@@ -482,31 +486,31 @@ implements IPage,
}
/**
- * This method should return what type of PWP may be added to the selected
- * node. Options are NO_PWP, USER_PWP, SUBTREE_PWP or BOTH_PWP (defined in
- * PasswordPolicyPanel.
- *
- * Should not be called if the node is remote
- */
+ * This method should return what type of PWP may be added to the selected
+ * node. Options are NO_PWP, USER_PWP, SUBTREE_PWP or BOTH_PWP (defined in
+ * PasswordPolicyPanel.
+ *
+ * Should not be called if the node is remote
+ */
public Integer getSelectionPWPState() {
Integer state = new Integer(PasswordPolicyPanel.BOTH_PWP);
return state;
}
- /**
- * Implements IContentPageInfo
- *
- * Should not be called if the node is remote
- */
+ /**
+ * Implements IContentPageInfo
+ *
+ * Should not be called if the node is remote
+ */
public Integer getSelectionActivationState() {
Integer state = new
Integer(AccountInactivation.CANNOT_BE_ACTIVATED_INACTIVATED);
IBrowserNodeInfo node = getSelectedNodeInfo();
- if (node != null && node.getErrorType() == node.ERROR_NONE) {
- String dn = Helper.getNodeInfoDN(node);
+ if (node != null && node.getErrorType() == node.ERROR_NONE) {
+ String dn = Helper.getNodeInfoDN(node);
if (dn != null) {
- state = (Integer)_activationCache.get(dn);
- if (state == null) {
+ state = (Integer)_activationCache.get(dn);
+ if (state == null) {
try {
state = new
Integer(AccountInactivation.CANNOT_BE_ACTIVATED_INACTIVATED);
String[] attrs = {"nsrole", "nsroledn",
"objectclass", "nsAccountLock"};
@@ -515,16 +519,16 @@ implements IPage,
LDAPEntry entry = ldc.read(dn, attrs);
if (entry != null) {
AccountInactivation account = new
AccountInactivation(entry);
- state = new Integer(account.operationAllowed(ldc));
+ state = new Integer(account.operationAllowed(ldc));
}
try {
ldc.disconnect(); // prepareReferralConnection clones
connection
} catch (Exception ignore) {}
_connectionPool.releaseConnection(ldc0);
- } catch (LDAPException lde) {
+ } catch (LDAPException lde) {
/* If something gone wrong we keep the default value
CANNOT_BE_ACTIVATED_INACTIVATED:
this is called by the menu controller and it has no context
enough to display error*/
- }
+ }
_activationCache.put(dn, state);
}
}
@@ -532,37 +536,37 @@ implements IPage,
return state;
}
- /**
- * Implements IContentPageInfo
- */
+ /**
+ * Implements IContentPageInfo
+ */
public String getPanelLayout() {
return _layout;
}
- /**
- * Implements IContentPageInfo
- */
+ /**
+ * Implements IContentPageInfo
+ */
public int getDisplay() {
return _display;
}
- /**
- * Implements IContentPageInfo
- */
+ /**
+ * Implements IContentPageInfo
+ */
public boolean isSorted() {
return _controller.isSorted();
}
- /**
- * Implements IContentPageInfo
- */
+ /**
+ * Implements IContentPageInfo
+ */
public boolean getFollowReferrals() {
return _controller.getFollowReferrals();
}
- /**
- * Implements IContentPageInfo
- */
+ /**
+ * Implements IContentPageInfo
+ */
public String getSelectedPartitionView() {
return _selectedPartitionView;
}
@@ -803,19 +807,22 @@ implements IPage,
actionAuthenticate();
} else if( cmd.equals( ContentMenuController.COPY ) ) {
- actionCopy( );
+ actionCopy();
+
+ } else if( cmd.equals( ContentMenuController.PASTE ) ) {
+ actionPaste();
- } else if( cmd.equals( ContentMenuController.PASTE ) ) {
- actionPaste( );
+ } else if( cmd.equals( ContentMenuController.MOVEPASTE ) ) {
+ actionMovePaste();
- } else if( cmd.equals( ContentMenuController.CUT ) ) {
- actionCut();
+ } else if( cmd.equals( ContentMenuController.MOVE ) ) {
+ actionMove();
} else if( cmd.equals( ContentMenuController.DELETE ) ) {
actionDelete();
} else if( cmd.equals( ContentMenuController.COPYDN ) ) {
- actionCopyDN( );
+ actionCopyDN(false);
} else if( cmd.equals( ContentMenuController.COPYLDAPURL ) ) {
actionCopyLDAPURL( );
@@ -856,11 +863,11 @@ implements IPage,
} else if( cmd.equals( ContentMenuController.DELETE_VLV_INDEX ) ) {
actionDeleteVLVIndex( );
- } else if( cmd.equals( ContentMenuController.SET_PWP_USER ) ) {
- actionSetPWP(PasswordPolicyPanel.FINEGRAINED_USER );
+ } else if( cmd.equals( ContentMenuController.SET_PWP_USER ) ) {
+ actionSetPWP(PasswordPolicyPanel.FINEGRAINED_USER );
- } else if( cmd.equals( ContentMenuController.SET_PWP_SUBTREE ) ) {
- actionSetPWP(PasswordPolicyPanel.FINEGRAINED_SUBTREE );
+ } else if( cmd.equals( ContentMenuController.SET_PWP_SUBTREE ) ) {
+ actionSetPWP(PasswordPolicyPanel.FINEGRAINED_SUBTREE );
} else if ( cmd.equals( ContentMenuController.FOLLOW_REFERRALS ) ) {
actionFollowReferrals();
@@ -1040,7 +1047,7 @@ implements IPage,
public void mouseEntered(MouseEvent e) {
}
- /**
+ /**
* MouseListener implementation
* ====================================
*
@@ -1048,7 +1055,7 @@ implements IPage,
public void mouseExited(MouseEvent e) {
}
- /**
+ /**
* MouseListener implementation
* ====================================
*
@@ -1063,7 +1070,7 @@ implements IPage,
}
}
- /**
+ /**
* FocusListener implementation
* ====================================
*/
@@ -1149,16 +1156,16 @@ implements IPage,
}
}
- /**
- * This method is called before we expand a node in the tree, or we select a node
and we have
- * a node/leaf view. In other words, before we search for the children of a
node.
- *
- * Checks the number of children of a given node, and, considering the display
options
- * chosen, asks the user for confirmation to continue or not.
- *
- * Return true if the user chooses to continue with the operation (display
children of the node).
- * false otherwise.
- */
+ /**
+ * This method is called before we expand a node in the tree, or we select a node and
we have
+ * a node/leaf view. In other words, before we search for the children of a node.
+ *
+ * Checks the number of children of a given node, and, considering the display
options
+ * chosen, asks the user for confirmation to continue or not.
+ *
+ * Return true if the user chooses to continue with the operation (display children
of the node).
+ * false otherwise.
+ */
private boolean checkChildrenForNode(IBrowserNodeInfo node) {
int vlvState = getNodeVlvState(node).intValue();
@@ -1264,16 +1271,16 @@ implements IPage,
_controller.setFollowReferrals(!_controller.getFollowReferrals());
_childrenController.setFollowReferrals(_controller.getFollowReferrals());
- /* Clear the selection... */
+ // Clear the selection...
_tree.clearSelection();
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
- /* Refresh the vlv cache */
+ // Refresh the vlv cache
_vlvCache.clear();
- /* Refresh the activation cache */
+ // Refresh the activation cache
_activationCache.clear();
_preferences.set(FOLLOW_REFERRALS_PREFERENCES,
_controller.getFollowReferrals());
@@ -1281,35 +1288,35 @@ implements IPage,
private void actionRefreshTree() {
- /* Clear the selection... */
+ // Clear the selection...
_list.clearSelection();
_tree.clearSelection();
- /* Refresh the database config */
+ // Refresh the database config
/* NOTE: if we implement a listener mechanism for the database config,
we should modify this */
refreshDatabaseConfigAndSuffixes(/*refreshAll=*/true);
- /* Refresh the schema */
+ // Refresh the schema
setSchema(null);
_allAttrs = null;
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
- /* Refresh the vlv cache */
+ // Refresh the vlv cache
_vlvCache.clear();
- /* Refresh the activation cache */
+ // Refresh the activation cache
_activationCache.clear();
- /* Refresh the entry Editor */
+ // Refresh the entry Editor
_entryEditor.setSchema(getSchema());
- /* Refresh the menus */
+ // Refresh the menus
_menuController.recreateDynamicMenus();
- /* Execute the refresh in the tree */
+ // Execute the refresh in the tree
_tree.grabFocus();
_controller.startRefresh();
}
@@ -1317,16 +1324,16 @@ implements IPage,
private void actionRefreshNode() {
if (_lastFocusComponent == _list) {
- /* Execute the refresh for the list node */
+ // Execute the refresh for the list node
_childrenController.startRefresh(getSelectedNodeInfo());
return;
}
- /* Execute the refresh for the tree node */
+ // Execute the refresh for the tree node
_tree.grabFocus();
_controller.startRefresh(getSelectedNodeInfo());
- /* Unselect/seclect the node for the full refresh */
+ // Unselect/seclect the node for the full refresh
TreePath path = _tree.getSelectionPath();
_tree.clearSelection();
_tree.setSelectionPath(path);
@@ -1418,7 +1425,7 @@ implements IPage,
controllerLdc.getSearchConstraints().setServerControls(newCtls);
}
- /* Update the tree */
+ // Update the tree
String selectedSuffix = _databaseConfig.getSuffixForDatabase(partition);
_controller.removeAllSuffixes();
_controller.addSuffix(selectedSuffix, null);
@@ -1439,7 +1446,7 @@ implements IPage,
controllerLdc.getSearchConstraints().setServerControls(newCtls);
}
- /* Update the tree */
+ // Update the tree
_controller.removeAllSuffixes();
Vector vSuffixes = _databaseConfig.getRootSuffixesWithEntry();
// We populate the browser controller
@@ -1455,7 +1462,7 @@ implements IPage,
getFollowReferrals()) {
actionFollowReferrals();
} else {
- /* Follow referrals clears selection: do the same thing */
+ // Follow referrals clears selection: do the same thing
_tree.clearSelection();
}
}
@@ -1613,7 +1620,7 @@ implements IPage,
}
if (ldc != null) {
String dn = Helper.getNodeInfoDN(node);
- /* Do the copy */
+ // Do the copy
LDAPConnection ldcNr = prepareReferralConnection(ldc);
/* For the copy we need to not limit the number of results in the
search constraints */
@@ -1629,14 +1636,14 @@ implements IPage,
ldcNr.disconnect(); // prepareReferralConnection clones
connection
} catch (Exception ignore) {}
_connectionPool.releaseConnection(ldc);
- /* In order to update the Paste menu */
+ // In order to update the Paste menu
_menuController.updateMenuState();
}
}
}
}
- private void actionCopyDN() {
+ private void actionCopyDN(boolean move) {
IBrowserNodeInfo node = getSelectedNodeInfo();
if (node != null) {
if (continueOperation(node)) {
@@ -1645,6 +1652,9 @@ implements IPage,
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
ss,
ss );
+ if (move) {
+ _clipboard.putDn(dn);
+ }
}
}
}
@@ -1659,6 +1669,11 @@ implements IPage,
}
}
+ private void actionMove() {
+ actionCopyDN(true);
+ _menuController.updateMenuState();
+ }
+
private void actionPaste() {
IBrowserNodeInfo node = getSelectedNodeInfo();
if (node != null) {
@@ -1671,12 +1686,12 @@ implements IPage,
}
if (ldc != null) {
String dn = Helper.getNodeInfoDN(node);
- /* Do the paste */
+ // Do the paste
LDAPConnection ldcNr = prepareReferralConnection(ldc);
Paster paster = new Paster(ldcNr, dn, _framework, _clipboard);
paster.execute();
- /* Update the tree */
+ // Update the tree
Vector addedRootEntries = paster.getPastedRootEntries();
if (addedRootEntries != null) {
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
@@ -1709,6 +1724,57 @@ implements IPage,
}
}
+ private void actionMovePaste() {
+ Debug.println("DSContentPage.actionMovePaste()");
+ IBrowserNodeInfo node = getSelectedNodeInfo();
+ if (node != null) {
+ if (continueOperation(node)) {
+ LDAPConnection ldc = null;
+ try {
+ ldc = getConnectionForNode(node);
+ } catch (LDAPException e) {
+ displayConnectionError(e, node);
+ }
+ if (ldc != null) {
+ String dn = Helper.getNodeInfoDN(node);
+ // Do the paste
+ LDAPConnection ldcNr = prepareReferralConnection(ldc);
+ MovePaster movePaster = new MovePaster(ldcNr, dn, _framework,
_clipboard);
+ movePaster.execute();
+
+ // Update the tree
+ Vector addedRootEntries = movePaster.getMovedRootEntries();
+ if (addedRootEntries != null) {
+ if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
+ (_lastFocusComponent == _tree)) {
+ Enumeration e = addedRootEntries.elements();
+ while (e.hasMoreElements()) {
+ String pastedDn = (String)e.nextElement();
+ _controller.notifyEntryAdded(node, pastedDn);
+ if
(_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT)) {
+ _childrenController.notifyEntryAdded(pastedDn);
+ }
+ }
+ } else if (_lastFocusComponent == _list) {
+ _childrenController.notifyEntryChanged(node);
+ TreePath path = getLastSelectedPath();
+ if (path != null) {
+ IBrowserNodeInfo treeNode =
_controller.getNodeInfoFromPath(path);
+ if (treeNode != null) {
+ _controller.notifyChildEntryChanged(treeNode, dn);
+ }
+ }
+ }
+ }
+ try {
+ ldcNr.disconnect(); // prepareReferralConnection clones
connection
+ } catch (Exception ignore) {}
+ _connectionPool.releaseConnection(ldc);
+ }
+ }
+ }
+ }
+
private void actionCut() {
IBrowserNodeInfo node = getSelectedNodeInfo();
if (node != null) {
@@ -1721,7 +1787,7 @@ implements IPage,
}
if (ldc != null) {
String dn = Helper.getNodeInfoDN(node);
- /* Do the cut */
+ // Do the cut
LDAPConnection ldcNr = prepareReferralConnection(ldc);
/* For the cut we need to not limit the number of results in the
search constraints */
@@ -1732,12 +1798,12 @@ implements IPage,
CutDeleter cutter = new CutDeleter(ldcNr, dn, _framework, _clipboard,
true);
cutter.execute();
- /* In order to update the Paste menu */
+ // In order to update the Paste menu
_menuController.updateMenuState();
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
(_lastFocusComponent == _tree)) {
- /* Select the parent of the entry we tried to delete */
+ // Select the parent of the entry we tried to delete
TreePath parentPath = getLastSelectedPath().getParentPath();
_tree.setSelectionPath(parentPath);
}
@@ -1745,7 +1811,7 @@ implements IPage,
if (cutter.isWholeTreeDeleted()) {
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
(_lastFocusComponent == _tree)) {
- /* If everything deleted, just inform the browser controller
*/
+ // If everything deleted, just inform the browser controller
_controller.notifyEntryDeleted(node);
} else if (_lastFocusComponent == _list) {
_childrenController.notifyEntryDeleted(node);
@@ -1761,7 +1827,7 @@ implements IPage,
} else {
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
(_lastFocusComponent == _tree)) {
- /* If not, refresh it */
+ // If not, refresh it
_controller.startRefresh(node);
} else if (_lastFocusComponent == _list) {
_childrenController.notifyEntryChanged(node);
@@ -1796,7 +1862,7 @@ implements IPage,
if (ldc != null) {
String dn = Helper.getNodeInfoDN(node);
- /* Do the delete */
+ // Do the delete
LDAPConnection ldcNr = prepareReferralConnection(ldc);
/* For the delete we need to not limit the number of results in the
search constraints */
@@ -1810,7 +1876,7 @@ implements IPage,
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
(_lastFocusComponent == _tree)) {
- /* Select the parent of the entry we tried to delete */
+ // Select the parent of the entry we tried to delete
TreePath parentPath = getLastSelectedPath().getParentPath();
_tree.setSelectionPath(parentPath);
}
@@ -1818,7 +1884,7 @@ implements IPage,
if (deleter.isWholeTreeDeleted()) {
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
(_lastFocusComponent == _tree)) {
- /* If everything deleted, just inform the browser controller
*/
+ // If everything deleted, just inform the browser controller
_controller.notifyEntryDeleted(node);
} else if (_lastFocusComponent == _list) {
_childrenController.notifyEntryDeleted(node);
@@ -1834,7 +1900,7 @@ implements IPage,
} else {
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
(_lastFocusComponent == _tree)) {
- /* If not, refresh it */
+ // If not, refresh it
_controller.startRefresh(node);
} else if (_lastFocusComponent == _list) {
_childrenController.notifyEntryChanged(node);
@@ -1856,17 +1922,16 @@ implements IPage,
}
}
- /**
- * This method is called after we delete a WHOLE subtree
- *
- * It checks if the 'New Root Entry' menu has to be updated or not.
- *
- * @returns true if the DatabaseConfig has been updated. false otherwise.
- *
- */
+ /**
+ * This method is called after we delete a WHOLE subtree
+ *
+ * It checks if the 'New Root Entry' menu has to be updated or not.
+ *
+ * @returns true if the DatabaseConfig has been updated. false otherwise.
+ */
private boolean checkObjectDeleted(String deletedObjectDn, LDAPConnection ldc) {
boolean databaseConfigUpdated = false;
- /* We see if we deleted one of the root suffixes, and if so, tell to update the
menu */
+ // We see if we deleted one of the root suffixes, and if so, tell to update the
menu
DN dn1 = new DN (deletedObjectDn);
Vector rootSuffixesWithEntry = _databaseConfig.getRootSuffixesWithEntry();
for (int i=0; (i< rootSuffixesWithEntry.size()) &&
!databaseConfigUpdated; i++) {
@@ -1878,7 +1943,7 @@ implements IPage,
}
}
if (databaseConfigUpdated) {
- /* Update the new root entry menu items */
+ // Update the new root entry menu items
_menuController.recreateNewRootEntryMenus();
}
return databaseConfigUpdated;
@@ -1915,14 +1980,14 @@ implements IPage,
String ugDn;
if (ugLdc.getHost().equals(aciLdc.getHost()) &&
(ugLdc.getPort() == aciLdc.getPort())) {
- Debug.println("ContentModel.actionACL: ACI and users are on
the same directory");
+ Debug.println("ContentPage.actionACL: ACI and users are on
the same directory");
ugDn = Console.getConsoleInfo().getUserBaseDN();
}
else {
- Debug.println("ContentModel.actionACL: ACI and users are on
different directories");
+ Debug.println("ContentPage.actionACL: ACI and users are on
different directories");
ugDn = _databaseConfig.getRootSuffixForEntry(dn);
}
- Debug.println("ContentModel.actionACL: users will be search from
" + ugDn);
+ Debug.println("ContentPage.actionACL: users will be search from
" + ugDn);
ACIManager acm = new ACIManager(_framework, dn, aciLdc, dn, aciLdc,
ugDn);
acm.show();
try {
@@ -1942,7 +2007,7 @@ implements IPage,
}
}
}
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
}
}
@@ -1952,7 +2017,7 @@ implements IPage,
private void actionRoles() {
IBrowserNodeInfo node = getSelectedNodeInfo();
if ( node != null ) {
- /* Only allow to set roles of the entries in the server */
+ // Only allow to set roles of the entries in the server
if (!node.isRemote()) {
String dn = Helper.getNodeInfoDN(node);
@@ -1982,7 +2047,7 @@ implements IPage,
}
}
}
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
try {
ldc.disconnect(); // prepareReferralConnection clones connection
@@ -2031,7 +2096,7 @@ implements IPage,
if (ed.isAuthModified()) {
_controller.notifyAuthDataChanged(null);
}
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
}
}
@@ -2145,7 +2210,7 @@ implements IPage,
task.getLockingInfrastructureDNs());
}
});
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
_activationCache.remove(Helper.getNodeInfoDN(node));
_menuController.updateMenuState();
@@ -2180,7 +2245,7 @@ implements IPage,
IBrowserNodeInfo suffixNode =
_controller.getNodeInfoFromPath(parentPath);
String nextEntry;
- /* If the selected node in the tree is the suffix node we have to
update the children panel*/
+ // If the selected node in the tree is the suffix node we have to
update the children panel.
boolean updateChildrenPanel = false;
if (_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT)) {
TreePath path = getLastSelectedPath();
@@ -2276,7 +2341,7 @@ implements IPage,
try {
ldc.disconnect(); // prepareReferralConnection clones connection
} catch (Exception ignore) {}
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
_activationCache.remove(Helper.getNodeInfoDN(node));
_menuController.updateMenuState();
@@ -2440,7 +2505,7 @@ implements IPage,
// is not returned a referral exception (in the case of node
// is a referral).
LDAPConnection editLdc = prepareReferralConnection(ldc);
- /* We are editing a role: we need to not limit the number of results in
the search constraints */
+ // We are editing a role: we need to not limit the number of results in
the search constraints
LDAPSearchConstraints cons =
editLdc.getSearchConstraints();
cons.setMaxResults(0);
@@ -2576,21 +2641,21 @@ implements IPage,
}
}
- /**
- * Method called after editing an entry. It assumes that the entry has been
- * modified. It updates consequently the tree (or the children list) and the
- * entry cache of the attribute controller.
- */
+ /**
+ * Method called after editing an entry. It assumes that the entry has been
+ * modified. It updates consequently the tree (or the children list) and the
+ * entry cache of the attribute controller.
+ */
private void updateAfterModify(IBrowserNodeInfo node, String editedObjectDn,
LDAPConnection editLdc) {
String oldDn = Helper.getNodeInfoDN(node);
DN oldDN = new DN(oldDn);
DN newDN = new DN(editedObjectDn);
if (!oldDN.equals(newDN)) {
- /* We modified the rdn, have to check the new root menu items */
+ // We modified the rdn, have to check the new root menu items
checkObjectAdded(editedObjectDn, editLdc);
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
(_lastFocusComponent == _tree)) {
- /* Update the tree */
+ // Update the tree
TreePath parentPath = _controller.notifyEntryDeleted(node);
IBrowserNodeInfo parentNode =
_controller.getNodeInfoFromPath(parentPath);
TreePath newPath = _controller.notifyEntryAdded(parentNode,
@@ -2598,7 +2663,7 @@ implements IPage,
_tree.setSelectionPath(newPath);
_selectedDnLabel.setText(editedObjectDn);
} else if (_lastFocusComponent == _list) {
- /* Update the list */
+ // Update the list
_childrenController.notifyEntryDNChanged(node, editedObjectDn);
TreePath path = getLastSelectedPath();
@@ -2626,22 +2691,22 @@ implements IPage,
}
}
}
- /* Refresh the attribute table */
+ // Refresh the attribute table
_attributeController.reset();
}
- /**
- * This method is called after we add an entry or we modify an rdn.
- *
- * It checks if the 'New Root Entry' menu has to be udpated or not.
- * It checks if the user can see the added entry or not and if he/she can't
- * display an information dialog giving the reason
- *
- * @returns true if the DatabaseConfig has been updated. false otherwise.
- */
+ /**
+ * This method is called after we add an entry or we modify an rdn.
+ *
+ * It checks if the 'New Root Entry' menu has to be udpated or not.
+ * It checks if the user can see the added entry or not and if he/she can't
+ * display an information dialog giving the reason
+ *
+ * @returns true if the DatabaseConfig has been updated. false otherwise.
+ */
private boolean checkObjectAdded(String newObjectDn, LDAPConnection ldc) {
boolean databaseConfigUpdated = false;
- /* We see if we added one of the root suffixes, and if so, tell to update the
menu */
+ // We see if we added one of the root suffixes, and if so, tell to update the
menu
DN dn1 = new DN (newObjectDn);
Vector rootSuffixesWithoutEntry = _databaseConfig.getRootSuffixesWithoutEntry();
for (int i=0; (i< rootSuffixesWithoutEntry.size()) &&
!databaseConfigUpdated; i++) {
@@ -2654,7 +2719,7 @@ implements IPage,
}
if (databaseConfigUpdated) {
- /* Update the new root entry menu items */
+ // Update the new root entry menu items
_menuController.recreateNewRootEntryMenus();
}
@@ -2690,12 +2755,12 @@ implements IPage,
return databaseConfigUpdated;
}
- /**
- * Method called after added an entry. It updates properly the tree and (if
visible)
- * the list of children.
- *
- * It assumes that the parentNode corresponds to the selection done by the user
- */
+ /**
+ * Method called after added an entry. It updates properly the tree and (if
visible)
+ * the list of children.
+ *
+ * It assumes that the parentNode corresponds to the selection done by the user
+ */
private void updateViewAfterAdd(LDAPEntry newObject, IBrowserNodeInfo parentNode) {
String newObjectDn = newObject.getDN();
if (!_layout.equals(ContentMenuController.NODE_LEAF_LAYOUT) ||
@@ -2706,7 +2771,7 @@ implements IPage,
_controller.notifyEntryAdded(parentNode, newObjectDn);
}
} else {
- /* We show everything in the tree in this case */
+ // We show everything in the tree in this case
_controller.notifyEntryAdded(parentNode, newObjectDn);
}
} else if (_lastFocusComponent == _list) {
@@ -2741,12 +2806,12 @@ implements IPage,
private void actionAuthenticate() {
boolean status = getNewAuthentication();
- /* If everything went OK, refresh the tree... */
+ // If everything went OK, refresh the tree...
if ( status ) {
_controller.setLDAPConnection(_framework.getServerObject().getServerInfo().getLDAPConnection());
actionRefreshTree();
} else {
- Debug.println("ContentModel.actionAuthenticate(): could not
reauthenticate");
+ Debug.println("ContentPage.actionAuthenticate(): could not
reauthenticate");
}
}
@@ -2770,7 +2835,7 @@ implements IPage,
- /* Fast method to detect if an entry has children or not */
+ // Fast method to detect if an entry has children or not
protected boolean entryHasChildren(LDAPEntry entry) {
boolean hasChildren = false;
LDAPAttribute attr = entry.getAttribute("numsubordinates");
@@ -2988,10 +3053,10 @@ implements IPage,
private Clipboard _clipboard = new Clipboard();
- /* Objects interested in authentication changes */
+ // Objects interested in authentication changes
private Vector _authListeners = new Vector();
- /* List of all the attributesfor the property editor */
+ // List of all the attributesfor the property editor
private String[] _allAttrs = null;
}
@@ -3087,7 +3152,7 @@ class SearchUG implements IRPCallBack, MouseListener {
public void mousePressed(MouseEvent e) {
}
- /**
+ /**
* MouseListener implementation
* ====================================
*
@@ -3103,7 +3168,7 @@ class SearchUG implements IRPCallBack, MouseListener {
public void mouseEntered(MouseEvent e) {
}
- /**
+ /**
* MouseListener implementation
* ====================================
*
@@ -3111,7 +3176,7 @@ class SearchUG implements IRPCallBack, MouseListener {
public void mouseExited(MouseEvent e) {
}
- /**
+ /**
* MouseListener implementation
* ====================================
*
@@ -3139,7 +3204,7 @@ class SearchUG implements IRPCallBack, MouseListener {
private CustomNode createNode(LDAPEntry entry) {
CustomNode node = new CustomNode(entry.getDN());
- /* Get the objectclass */
+ // Get the objectclass
LDAPAttribute objectClass = entry.getAttribute("objectclass");
Icon icon = _iconPool.getIcon(objectClass, 0);
@@ -3480,7 +3545,7 @@ class Inactivator implements ActionListener, Runnable {
"accountinactivation-inactivate", "cannotinactivate",
abreviatedDN)+"\n");
break;
case AccountInactivation.ROOT_OR_CONFIG_ENTRY:
- /* Assume we could not find the suffixes because the entry is in the
config, is cn=config, is cn=schema, cn=monitor... */
+ // Assume we could not find the suffixes because the entry is in the
config, is cn=config, is cn=schema, cn=monitor...
_dlg.appendTextToTextArea(DSUtil._resource.getString(
"accountinactivation-inactivate", "rootorconfigentry",
abreviatedDN)+"\n");
break;
@@ -3556,11 +3621,11 @@ class UserGroupAdapter implements IResEditorAdvancedOpt {
LDAPEntry entry;
DSEntryDialog dlg;
if ( observableentry.isNewUser() ) {
- /* Preliminary DN - null from Kingpin */
+ // Preliminary DN - null from Kingpin
String dn = observableentry.getDN();
Debug.println( "UserGroupAdapter.run: DN = " +
dn );
- /* Get all attributes set by the custom editor */
+ // Get all attributes set by the custom editor
LDAPAttributeSet set = new LDAPAttributeSet();
Enumeration en = observableentry.getAttributesList();
if ( en != null ) {
@@ -3573,7 +3638,7 @@ class UserGroupAdapter implements IResEditorAdvancedOpt {
v.removeAllElements();
}
}
- /* Get all required attributes for the object classes */
+ // Get all required attributes for the object classes
String key = "cn";
Vector v = observableentry.get( "objectclass" );
LDAPSchema schema = _page.getSchema();
@@ -3598,7 +3663,7 @@ class UserGroupAdapter implements IResEditorAdvancedOpt {
Debug.println( "UserGroupAdapter.run: " +
"key = " + key );
if ( dn == null ) {
- /* Get rdn */
+ // Get rdn
String rdn = getFirstStringValue( set, key );
if ( (rdn == null) || (rdn.length() < 1) ) {
rdn = DSContentPage.DEFAULT_NEW;
@@ -3617,7 +3682,7 @@ class UserGroupAdapter implements IResEditorAdvancedOpt {
dlg = _page.editGeneric(false, false, entry, _ldc );
} else {
- /* Get all attributes set by the custom editor */
+ // Get all attributes set by the custom editor
LDAPAttributeSet set = new LDAPAttributeSet();
Enumeration en = observableentry.getAttributesList();
if ( en != null ) {
@@ -3637,7 +3702,7 @@ class UserGroupAdapter implements IResEditorAdvancedOpt {
}
if ( dlg != null ) {
- /* Notify the observable from the kingpin editor */
+ // Notify the observable from the kingpin editor
LDAPModificationSet mods = dlg.getChanges();
String[] rdnAttrs = dlg.getNamingAttributes();
@@ -3830,13 +3895,13 @@ class Copier implements Runnable, ActionListener {
boolean _isCancelled = false;
JFrame _frame;
- GenericProgressDialog _progressDialog;
+ GenericProgressDialog _progressDialog;
- int _numberCopiedObjects = 0;
+ int _numberCopiedObjects = 0;
String _startDn;
- LDAPConnection _ldc;
+ LDAPConnection _ldc;
String[] COPY_ATTRS = { "*", "numsubordinates" }; // To be in
sync with the CUT_ATTRS
Clipboard _clipboard;
@@ -3864,15 +3929,14 @@ class Copier implements Runnable, ActionListener {
}
}
- public void execute() {
+ public void execute() {
if (_startDn.equals("")) {
- /* If the user chose to copy the root entry we
- display an error message */
+ // If the user chose to copy the root entry we display an error message
DSUtil.showErrorDialog( _frame,
"copy-root-error-title",
"copy-root-error-msg",
(String[]) null,
- "browser" );
+ "browser" );
} else {
createCopyProgressDialog();
Thread thread = new Thread(Copier.this);
@@ -3883,26 +3947,26 @@ class Copier implements Runnable, ActionListener {
}
public void run() {
- try {
- copyTree(_ldc, _startDn);
- updateProgressDialogForEnd();
+ try {
+ copyTree(_ldc, _startDn);
+ updateProgressDialogForEnd();
} catch (LDAPException lde) {
/* If something went wrong display an error message and enable
the close button of the progress dialog */
String[] arg = {Helper.getLDAPErrorMessage(lde)};
- String msg = DSUtil._resource.getString("browser",
+ String msg = DSUtil._resource.getString("browser",
"copying-error-label",
arg);
- _progressDialog.setTextInLabel(msg);
- _progressDialog.waitForClose();
+ _progressDialog.setTextInLabel(msg);
+ _progressDialog.waitForClose();
}
}
- private void copyTree (LDAPConnection ldc, String baseDn) throws LDAPException {
- boolean copyOk = true;
+ private void copyTree (LDAPConnection ldc, String baseDn) throws LDAPException {
+ boolean copyOk = true;
LDAPEntry baseEntry = ldc.read(baseDn,
COPY_ATTRS);
- recursiveCopy(baseEntry, ldc);
+ recursiveCopy(baseEntry, ldc);
}
private void recursiveCopy(LDAPEntry baseEntry, LDAPConnection ldc) throws
LDAPException {
@@ -3920,10 +3984,10 @@ class Copier implements Runnable, ActionListener {
CHILDREN_FILTER,
COPY_ATTRS,
false);
- /* Copy each child found, recursively */
+ // Copy each child found, recursively
while ( search_results.hasMoreElements() &&
!_isCancelled) {
- /* Get the next child */
+ // Get the next child
Object nextElement = search_results.nextElement();
LDAPEntry entry = null;
if (nextElement instanceof LDAPEntry) {
@@ -3951,11 +4015,11 @@ class Copier implements Runnable, ActionListener {
} else if (nextElement instanceof LDAPException) {
LDAPException ex = (LDAPException)nextElement;
ldc.abandon(search_results);
- /* The entry has been deleted */
+ // The entry has been deleted
if (ex.getLDAPResultCode() == 32) {
containerChildren.clear();
} else {
- /* Don't know what to do */
+ // Don't know what to do
throw ex;
}
}
@@ -3964,25 +4028,24 @@ class Copier implements Runnable, ActionListener {
if (_isCancelled) {
ldc.abandon(search_results);
} else {
- /* Recursively copy container entries bellow this entry...*/
+ // Recursively copy container entries bellow this entry...
for (int i=0;
(i<containerChildren.size()) && !_isCancelled;
- i++) {
- recursiveCopy((LDAPEntry)containerChildren.elementAt(i),
- ldc);
+ i++) {
+ recursiveCopy((LDAPEntry)containerChildren.elementAt(i), ldc);
}
}
}
- /* Copy this container object */
- if (!_isCancelled) {
+ // Copy this container object
+ if (!_isCancelled) {
String[] arg = {DSUtil.abreviateString(baseDN, 45)};
String msg = DSUtil._resource.getString("browser",
"copying-object-label",
arg);
_progressDialog.setTextInLabel(msg);
- _numberCopiedObjects++;
+ _numberCopiedObjects++;
- _clipboard.putEntry(baseEntry);
+ _clipboard.putEntry(baseEntry);
}
}
@@ -3990,8 +4053,8 @@ class Copier implements Runnable, ActionListener {
if (_isCancelled ||
(_numberCopiedObjects < 2)) {
_progressDialog.closeCallBack();
- } else {
- String[] arg = {String.valueOf(_numberCopiedObjects)};
+ } else {
+ String[] arg = {String.valueOf(_numberCopiedObjects)};
_progressDialog.setTextInLabel(DSUtil._resource.getString("browser",
"copied-objects-label",
arg));
@@ -4007,7 +4070,7 @@ class Copier implements Runnable, ActionListener {
GenericProgressDialog.ONLY_CANCEL_BUTTON_OPTION,
title,
null,
- null);
+ null);
_progressDialog.setLabelColumns(50);
_progressDialog.addActionListener(Copier.this);
}
@@ -4020,9 +4083,9 @@ class CutDeleter implements Runnable, ActionListener {
boolean _isCancelled = false;
JFrame _frame;
- GenericProgressDialog _progressDialog;
+ GenericProgressDialog _progressDialog;
- int _numberDeletedObjects = 0;
+ int _numberDeletedObjects = 0;
boolean _isWholeTreeDeleted = false;
@@ -4071,8 +4134,7 @@ class CutDeleter implements Runnable, ActionListener {
public void execute() {
if (_startDn.equals("")) {
- /* If the user chose to copy the root entry we
- display an error message */
+ // If the user chose to copy the root entry we display an error message
DSUtil.showErrorDialog( _frame,
"delete-root-error-title",
"delete-root-error-msg",
@@ -4083,11 +4145,11 @@ class CutDeleter implements Runnable, ActionListener {
try {
_baseEntry = _ldc.read(_startDn, _attrs);
manyEntries = DSContentModel.entryHasChildren(_baseEntry);
- } catch (LDAPException lde) {
+ } catch (LDAPException lde) {
}
- boolean doDelete = confirmDelete(manyEntries);
+ boolean doDelete = confirmDelete(manyEntries);
- if (doDelete) {
+ if (doDelete) {
createDeleteProgressDialog(manyEntries);
Thread thread = new Thread(CutDeleter.this);
thread.start();
@@ -4100,22 +4162,20 @@ class CutDeleter implements Runnable, ActionListener {
return _isWholeTreeDeleted;
}
- public void run() {
- boolean deleteOK = deleteTree(_ldc, _startDn);
+ public void run() {
+ boolean deleteOK = deleteTree(_ldc, _startDn);
_isWholeTreeDeleted = !entryExists(_ldc, _startDn);
- updateProgressDialogForEnd(deleteOK);
+ updateProgressDialogForEnd(deleteOK);
}
private boolean confirmDelete(boolean manyEntries) {
- boolean confirmDelete = true;
+ boolean confirmDelete = true;
boolean requiresConfirmation = false;
String[] args = new String[1];
- args[0] = DSUtil.abreviateString(
- _startDn,
- 30);
+ args[0] = DSUtil.abreviateString(_startDn, 30);
String msg = null;
- if (manyEntries) {
+ if (manyEntries) {
msg = "confirmDeleteTree";
} else {
msg = "confirmDeleteObject";
@@ -4171,10 +4231,10 @@ class CutDeleter implements Runnable, ActionListener {
CHILDREN_FILTER,
_attrs,
false);
- /* Delete each child found, recursively */
+ // Delete each child found, recursively
while ( search_results.hasMoreElements() &&
!_isCancelled) {
- /* Get the next child */
+ // Get the next child
Object nextElement = search_results.nextElement();
LDAPEntry entry = null;
try {
@@ -4212,7 +4272,7 @@ class CutDeleter implements Runnable, ActionListener {
":" + ldapError);
_progressDialog.appendTextToTextArea(entry.getDN()+":
"+ldapError+"\n");
} else {
- /* Case where we got an exception */
+ // Case where we got an exception
Debug.println("CutDeleter.recursiveDelete: " +
"error deleting "+ ldapError);
_progressDialog.appendTextToTextArea(ldapError+"\n");
@@ -4226,7 +4286,7 @@ class CutDeleter implements Runnable, ActionListener {
if (_isCancelled) {
ldc.abandon(search_results);
} else {
- /* Recursively delete container entries bellow this entry...*/
+ // Recursively delete container entries bellow this entry...
for (int i=0;
(i<containerChildren.size()) && !_isCancelled;
i++) {
@@ -4235,15 +4295,15 @@ class CutDeleter implements Runnable, ActionListener {
}
}
- /* Finally delete the entry */
+ // Finally delete the entry
if (!_isCancelled) {
try {
ldc.delete( baseDN );
String[] arg = {DSUtil.abreviateString(baseDN, 45)};
String msg = DSUtil._resource.getString("browser",
"deleting-object-label",
- arg);
- _progressDialog.setTextInLabel(msg);
+ arg);
+ _progressDialog.setTextInLabel(msg);
_numberDeletedObjects++;
if (_cut) {
_clipboard.putEntry(baseEntry);
@@ -4264,14 +4324,14 @@ class CutDeleter implements Runnable, ActionListener {
if (_isCancelled ||
((_numberDeletedObjects < 2) && deleteOk)) {
_progressDialog.closeCallBack();
- } else {
- String[] arg = {String.valueOf(_numberDeletedObjects)};
+ } else {
+ String[] arg = {String.valueOf(_numberDeletedObjects)};
_progressDialog.setTextInLabel(DSUtil._resource.getString("browser",
"deleted-objects-label",
arg));
_progressDialog.waitForClose();
- }
- }
+ }
+ }
private void createDeleteProgressDialog(boolean many) {
String title;
@@ -4287,13 +4347,13 @@ class CutDeleter implements Runnable, ActionListener {
null,
null);
_progressDialog.setTextInTextAreaLabel(
DSUtil._resource.getString("browser", "non-deleted-objects-label"));
- _progressDialog.setTextAreaRows(3);
+ _progressDialog.setTextAreaRows(3);
_progressDialog.setLabelColumns(50);
_progressDialog.addActionListener(CutDeleter.this);
}
private boolean entryExists(LDAPConnection ldc, String dn) {
- boolean entryExists = false;
+ boolean entryExists = false;
try {
LDAPEntry entry = ldc.read(dn,
NOT_CUT_ATTRS );
@@ -4312,7 +4372,7 @@ class Paster implements Runnable, ActionListener {
boolean _isCancelled = false;
JFrame _frame;
- GenericProgressDialog _progressDialog;
+ GenericProgressDialog _progressDialog;
Clipboard _clipboard;
@@ -4322,7 +4382,7 @@ class Paster implements Runnable, ActionListener {
String _startDn;
- LDAPConnection _ldc;
+ LDAPConnection _ldc;
public Paster(LDAPConnection ldc, String startDn, JFrame frame, Clipboard clipboard)
{
_frame = frame;
@@ -4343,12 +4403,12 @@ class Paster implements Runnable, ActionListener {
public void execute() {
if (_startDn.equals("") &&
(_clipboard.getSize() > 0)) {
- /* Can't paste in the root */
+ // Can't paste in the root
DSUtil.showErrorDialog( _frame,
"paste-in-root-error-title",
"paste-in-root-error-msg",
(String[]) null,
- "browser" );
+ "browser" );
} else {
createPasteProgressDialog();
Thread thread = new Thread(Paster.this);
@@ -4360,21 +4420,21 @@ class Paster implements Runnable, ActionListener {
public void run() {
_pastedRootEntries = new Vector();
boolean pasteOk = pasteTree(_ldc, _startDn, _pastedRootEntries);
- updateProgressDialogForEnd(pasteOk);
+ updateProgressDialogForEnd(pasteOk);
}
public Vector getPastedRootEntries() {
return _pastedRootEntries;
}
- /* We make the assumption that the clipboard is a LIFO list */
+ // We make the assumption that the clipboard is a LIFO list.
private boolean pasteTree(LDAPConnection ldc,
String baseDN,
Vector pastedRootEntries) {
Vector triedToPasteRootEntries = new Vector();
- boolean pasteOk = true;
- for (int i=0 ; (i< _clipboard.getSize())&& !_isCancelled; i++) {
+ boolean pasteOk = true;
+ for (int i=0 ; (i< _clipboard.getSize())&& !_isCancelled; i++) {
LDAPEntry currentEntry = _clipboard.getEntryAt(i);
LDAPEntry entryToPaste = getEntryToPaste(currentEntry, baseDN,
triedToPasteRootEntries);
try {
@@ -4388,7 +4448,7 @@ class Paster implements Runnable, ActionListener {
_progressDialog.setTextInLabel(msg);
}
- _numberPastedObjects++;
+ _numberPastedObjects++;
DN lastTriedDN =
(DN)triedToPasteRootEntries.elementAt(triedToPasteRootEntries.size() - 1);
DN currentPastedDN = new DN(currentEntry.getDN());
if (lastTriedDN.equals(currentPastedDN)) {
@@ -4400,25 +4460,25 @@ class Paster implements Runnable, ActionListener {
"error pasting entry=" +
entryToPaste.getDN()+
":" + lde);
- _progressDialog.appendTextToTextArea(entryToPaste.getDN()+":
"+lde+"\n");
+ _progressDialog.appendTextToTextArea(entryToPaste.getDN()+":
"+lde+"\n");
}
- }
+ }
return pasteOk;
- }
+ }
private LDAPEntry getEntryToPaste(LDAPEntry entry, String baseDn, Vector
triedToPasteRootEntries) {
- /* We calculate the new dn of the entry, and we take into account that we may be
adding
- a tree, so we check if we have added the parent entry for this entry to
calculate the
- new dn. This dn is composed of the rdn of the entry relative to the old
parent and the dn of the new
- parent (baseDn).
- This method updates the list of subtree roots that have been added. The last
added root is put
- at the end of the list.
- */
- DN entryDN = new DN(entry.getDN());
- String[] rdns = LDAPDN.explodeDN( entry.getDN(),
- false );
+ /*
+ * We calculate the new dn of the entry, and we take into account that we may be
adding
+ * a tree, so we check if we have added the parent entry for this entry to
calculate the
+ * new dn. This dn is composed of the rdn of the entry relative to the old
parent and
+ * the dn of the new parent (baseDn).
+ * This method updates the list of subtree roots that have been added. The last
added
+ * root is put at the end of the list.
+ */
+ DN entryDN = new DN(entry.getDN());
+ String[] rdns = LDAPDN.explodeDN( entry.getDN(), false );
String newDn = "";
- boolean pastedRootFound = false;
+ boolean pastedRootFound = false;
for (int i=0; (i<triedToPasteRootEntries.size()) && !pastedRootFound;
i++) {
if (entryDN.isDescendantOf((DN)triedToPasteRootEntries.elementAt(i))) {
pastedRootFound = true;
@@ -4429,7 +4489,7 @@ class Paster implements Runnable, ActionListener {
for (int j=0; j <= entryRDNCount - rootRDNCount; j++) {
newDn += rdns[j]+", ";
}
- newDn += baseDn;
+ newDn += baseDn;
}
}
if (!pastedRootFound) {
@@ -4448,8 +4508,175 @@ class Paster implements Runnable, ActionListener {
if (_isCancelled ||
((_numberPastedObjects < 2) && pasteOk)) {
_progressDialog.closeCallBack();
- } else {
- String[] arg = {String.valueOf(_numberPastedObjects)};
+ } else {
+ String[] arg = {String.valueOf(_numberPastedObjects)};
+
_progressDialog.setTextInLabel(DSUtil._resource.getString("browser",
+
"pasted-objects-label",
+ arg));
+ _progressDialog.waitForClose();
+ }
+ }
+
+ private void createPasteProgressDialog() {
+ String title = DSUtil._resource.getString("browser",
"paste-objects-title");
+
+ _progressDialog = new GenericProgressDialog(_frame,
+ true,
+
GenericProgressDialog.TEXT_FIELD_AND_CANCEL_BUTTON_OPTION,
+ title,
+ null,
+ null);
+ _progressDialog.setTextInTextAreaLabel(
DSUtil._resource.getString("browser", "non-pasted-objects-label"));
+ _progressDialog.setTextAreaRows(3);
+ _progressDialog.setLabelColumns(50);
+ _progressDialog.addActionListener(Paster.this);
+ }
+}
+
+class MovePaster implements Runnable, ActionListener {
+ boolean _isCancelled = false;
+
+ JFrame _frame;
+ GenericProgressDialog _progressDialog;
+
+ Clipboard _clipboard;
+
+ Vector _pastedRootEntries;
+
+ int _numberMovedObjects = 0;
+
+ String _startDn;
+
+ LDAPConnection _ldc;
+
+ public MovePaster(LDAPConnection ldc, String startDn, JFrame frame, Clipboard
clipboard) {
+ _frame = frame;
+ _ldc = ldc;
+ _startDn = startDn;
+ _clipboard = clipboard;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals(GenericProgressDialog.CANCEL)) {
+ _isCancelled = true;
+ _progressDialog.disableCancelButton();
+ } else if (e.getActionCommand().equals(GenericProgressDialog.CLOSE)) {
+ _progressDialog.closeCallBack();
+ }
+ }
+
+ public void execute() {
+ if (_startDn.equals("") &&
+ (_clipboard.getSize() > 0)) {
+ // Can't paste in the root
+ DSUtil.showErrorDialog( _frame,
+ "paste-in-root-error-title",
+ "paste-in-root-error-msg",
+ (String[]) null,
+ "browser" );
+ } else {
+ createPasteProgressDialog();
+ Thread thread = new Thread(MovePaster.this);
+ thread.start();
+ _progressDialog.packAndShow();
+ }
+ }
+
+ public void run() {
+ _pastedRootEntries = new Vector();
+ boolean pasteOk = movePasteObjs(_ldc, _startDn, _pastedRootEntries);
+ updateProgressDialogForEnd(pasteOk);
+ }
+
+ public Vector getMovedRootEntries() {
+ return _pastedRootEntries;
+ }
+
+ // We make the assumption that the clipboard is a LIFO list.
+ // If pastedRootEntries has elements, the moved entreis are refreshed on the console
page.
+ private boolean movePasteObjs(LDAPConnection ldc,
+ String baseDN,
+ Vector pastedRootEntries) {
+ Vector triedToPasteRootEntries = new Vector();
+ boolean pasteOk = true;
+ for (int i = 0 ; (i < _clipboard.getDnSize()) && !_isCancelled; i++)
{
+ String currentDn = _clipboard.getDnAt(i);
+ String movedDn = getDnToMove(currentDn, baseDN, triedToPasteRootEntries);
+ if ((null == movedDn) || movedDn.equals("")) {
+ continue;
+ }
+ try {
+ // rdn remains the same, just move to the new parent.
+ String[] rdns = LDAPDN.explodeDN(currentDn, false);
+ Debug.println("MovePaster.rename " + currentDn + " newrdn:
" + rdns[0] + " to " + baseDN);
+ ldc.rename(currentDn, rdns[0], baseDN, false);
+
+ if ((_numberMovedObjects % 5) == 0) {
+ String[] arg = {DSUtil.abreviateString(currentDn, 45)};
+ String msg = DSUtil._resource.getString("browser",
+
"pasting-object-label",
+ arg);
+ _progressDialog.setTextInLabel(msg);
+ }
+
+ _numberMovedObjects++;
+ DN lastTriedDN =
(DN)triedToPasteRootEntries.elementAt(triedToPasteRootEntries.size() - 1);
+ DN movedDN = new DN(movedDn);
+ if (lastTriedDN.equals(movedDN)) {
+ pastedRootEntries.addElement(movedDn);
+ }
+ } catch (LDAPException lde) {
+ pasteOk = false;
+ Debug.println("MovePaster.movePasteObjs: " + "error
pasting entry=" + movedDn +
+ ":" + lde);
+ _progressDialog.appendTextToTextArea(movedDn+":
"+lde+"\n");
+ }
+ }
+ _clipboard.cleanDn();
+
+ return pasteOk;
+ }
+
+ private String getDnToMove(String dn, String baseDn, Vector triedToPasteRootEntries)
{
+ /*
+ * We calculate the new dn of the entry, and we take into account that we may be
adding
+ * a tree, so we check if we have added the parent entry for this entry to
calculate the
+ * new dn. This dn is composed of the rdn of the entry relative to the old
parent and
+ * the dn of the new parent (baseDn).
+ * This method updates the list of subtree roots that have been added. The last
added
+ * root is put at the end of the list.
+ */
+ DN entryDN = new DN(dn);
+ String[] rdns = LDAPDN.explodeDN( dn, false );
+ String newDn = "";
+ boolean pastedRootFound = false;
+ for (int i=0; (i<triedToPasteRootEntries.size()) && !pastedRootFound;
i++) {
+ if (entryDN.isDescendantOf((DN)triedToPasteRootEntries.elementAt(i))) {
+ pastedRootFound = true;
+ DN rootDN = (DN)triedToPasteRootEntries.elementAt(i);
+ int rootRDNCount = rootDN.countRDNs();
+ int entryRDNCount = entryDN.countRDNs();
+
+ for (int j=0; j <= entryRDNCount - rootRDNCount; j++) {
+ newDn += rdns[j]+", ";
+ }
+ newDn += baseDn;
+ }
+ }
+ if (!pastedRootFound) {
+ newDn = rdns[0] + ", " + baseDn;
+ DN newDN = new DN(newDn);
+ triedToPasteRootEntries.addElement(newDN);
+ }
+
+ return newDn;
+ }
+
+ private void updateProgressDialogForEnd(boolean pasteOk) {
+ if (_isCancelled || ((_numberMovedObjects < 8) && pasteOk)) {
+ _progressDialog.closeCallBack();
+ } else {
+ String[] arg = {String.valueOf(_numberMovedObjects)};
_progressDialog.setTextInLabel(DSUtil._resource.getString("browser",
"pasted-objects-label",
arg));
@@ -4469,15 +4696,16 @@ class Paster implements Runnable, ActionListener {
_progressDialog.setTextInTextAreaLabel(
DSUtil._resource.getString("browser", "non-pasted-objects-label"));
_progressDialog.setTextAreaRows(3);
_progressDialog.setLabelColumns(50);
- _progressDialog.addActionListener(Paster.this);
+ _progressDialog.addActionListener(MovePaster.this);
}
}
-
class Clipboard {
Vector _container;
+ Vector _dncontainer;
Clipboard() {
_container = new Vector();
+ _dncontainer = new Vector();
}
public boolean isEmpty() {
@@ -4488,10 +4716,10 @@ class Clipboard {
return (LDAPEntry)_container.elementAt(index);
}
- /* The clipboard is supposed to be a LIFO list...*/
+ // The clipboard is supposed to be a LIFO list...
public void putEntry(LDAPEntry entry) {
_container.insertElementAt(entry, 0);
- }
+ }
public void clean() {
_container.clear();
@@ -4499,7 +4727,28 @@ class Clipboard {
public int getSize() {
return _container.size();
- }
+ }
+
+ public boolean isDnEmpty() {
+ return (_dncontainer.size() == 0);
+ }
+
+ public String getDnAt(int index) {
+ return (String)_dncontainer.elementAt(index);
+ }
+
+ // The clipboard is supposed to be a LIFO list...
+ public void putDn(String dn) {
+ _dncontainer.insertElementAt(dn, 0);
+ }
+
+ public void cleanDn() {
+ _dncontainer.clear();
+ }
+
+ public int getDnSize() {
+ return _dncontainer.size();
+ }
}
class EntryEditor implements IAdapterInfo {
@@ -4511,7 +4760,7 @@ class EntryEditor implements IAdapterInfo {
_databaseConfig = databaseConfig;
}
- /* Returns true if the entry was created, false otherwise */
+ // Returns true if the entry was created, false otherwise
public boolean createUser(String parentDn,
LDAPConnection ldc) {
_createdObject = null;
@@ -4520,7 +4769,7 @@ class EntryEditor implements IAdapterInfo {
return newPredefinedObject( objectClass, parentDn );
}
- /* Returns true if the entry was created, false otherwise */
+ // Returns true if the entry was created, false otherwise
public boolean createGroup(String parentDn,
LDAPConnection ldc) {
_createdObject = null;
@@ -4529,7 +4778,7 @@ class EntryEditor implements IAdapterInfo {
return newPredefinedObject( objectClass, parentDn );
}
- /* Returns true if the entry was created, false otherwise */
+ // Returns true if the entry was created, false otherwise
public boolean createOrganizationalUnit(String parentDn,
LDAPConnection ldc) {
_createdObject = null;
@@ -4538,7 +4787,7 @@ class EntryEditor implements IAdapterInfo {
return newPredefinedObject( objectClass, parentDn );
}
- /* Returns true if the entry was created, false otherwise */
+ // Returns true if the entry was created, false otherwise
public boolean createCos(String parentDn,
LDAPConnection ldc) {
_createdObject = null;
@@ -4550,7 +4799,7 @@ class EntryEditor implements IAdapterInfo {
return newPredefinedObject( objectClass, parentDn );
}
- /* Returns true if the entry was created, false otherwise */
+ // Returns true if the entry was created, false otherwise
public boolean createRole(String parentDn,
LDAPConnection ldc) {
_createdObject = null;
@@ -4562,7 +4811,7 @@ class EntryEditor implements IAdapterInfo {
return newPredefinedObject( objectClass, parentDn );
}
- /* Returns true if the entry was created, false otherwise */
+ // Returns true if the entry was created, false otherwise
public boolean createObject(String parentDn,
LDAPConnection ldc) {
_createdObject = null;
@@ -4579,13 +4828,13 @@ class EntryEditor implements IAdapterInfo {
Vector v = DSSchemaHelper.getObjectClassVector( selectedObjectClass, _schema
);
if ( isStandardObjectClass( v.elements() ) ) {
- /* Yes, it is. So call the UserGroup editor. */
+ // Yes, it is. So call the UserGroup editor.
objectCreated = newPredefinedObject( v, parentDn );
return objectCreated;
}
- /* Not a standard object class, so do it ourselves */
- /* Get all required attributes */
+ // Not a standard object class, so do it ourselves
+ // Get all required attributes
Hashtable ht = new Hashtable();
DSSchemaHelper.allRequiredAttributes(selectedObjectClass, _schema, ht);
Enumeration e = ht.elements();
@@ -4596,15 +4845,14 @@ class EntryEditor implements IAdapterInfo {
String name = (String)e.nextElement();
LDAPAttribute attr = new LDAPAttribute( name );
- /* Initialize the objectclass attribute with the
- chain of superiors */
+ // Initialize the objectclass attribute with the chain of superiors
if ( name.equalsIgnoreCase( "objectclass" ) ) {
v = DSSchemaHelper.getObjectClassVector( selectedObjectClass, _schema
);
for( int i = v.size() - 1; i >= 0; i-- ) {
attr.addValue( (String)v.elementAt( i ) );
}
} else {
- /* Not objectclass, initialize with the empty string */
+ // Not objectclass, initialize with the empty string
attr.addValue( "" );
if ( (prefix == null) && !name.equalsIgnoreCase(
"aci" ) ) {
prefix = name;
@@ -4613,7 +4861,7 @@ class EntryEditor implements IAdapterInfo {
set.add( attr );
}
- /* Last resort, first optional attribute */
+ // Last resort, first optional attribute
if ( prefix == null ) {
ht = new Hashtable();
DSSchemaHelper.allOptionalAttributes(selectedObjectClass, _schema, ht);
@@ -4621,7 +4869,7 @@ class EntryEditor implements IAdapterInfo {
if ( e.hasMoreElements() ) {
prefix = (String)e.nextElement();
- /* aci is not valid for use as an RDN */
+ // aci is not valid for use as an RDN
if ( prefix.equalsIgnoreCase( "aci" ) ) {
if ( e.hasMoreElements() ) {
prefix = (String)e.nextElement();
@@ -4631,14 +4879,14 @@ class EntryEditor implements IAdapterInfo {
}
}
}
- /* Can't figure out what attribute to use for RDN */
+ // Can't figure out what attribute to use for RDN
if ( prefix == null ) {
DSUtil.showErrorDialog( _frame, "noRDN", selectedObjectClass,
"EntryObject" );
return false;
}
- /* Preliminary DN ??? */
+ // Preliminary DN ???
String value = DEFAULT_NEW;
LDAPAttribute attr = set.getAttribute( prefix );
if ( attr != null ) {
@@ -4672,12 +4920,12 @@ class EntryEditor implements IAdapterInfo {
return objectCreated;
}
- /* Returns true if the entry was created, false otherwise */
+ // Returns true if the entry was created, false otherwise
public boolean createRootObject(String suffixDn, LDAPConnection ldc) {
boolean done = false;
boolean objectCreated = false;
- /* See if it has the rights (only directory manager can perform this task) */
+ // See if it has the rights (only directory manager can perform this task)
if (!DSUtil.isLocalDirectoryManager(ldc)) {
DSUtil.showInformationDialog(_frame,
"addRootEntry-needtobedirectorymanager",
@@ -4706,13 +4954,13 @@ class EntryEditor implements IAdapterInfo {
LDAPAttributeSet set = new LDAPAttributeSet();
- /* The naming attribute (obtained from the suffix) */
+ // The naming attribute (obtained from the suffix)
LDAPAttribute attr = new LDAPAttribute( namingAttribute );
attr.addValue(value);
set.add(attr);
- /* The aci attribute with the default values */
+ // The aci attribute with the default values
String[] aciValues = {"(targetattr != \"userPassword\")
(version 3.0; acl \"Anonymous access\"; allow (read, search, compare)userdn =
\"ldap:///anyone\";)",
"(targetattr !=
\"nsroledn||aci\")(version 3.0; acl \"Allow self entry modification except
for nsroledn and aci attributes\"; allow (write)userdn
=\"ldap:///self\";)",
"(targetattr = \"*\")(version 3.0;
acl \"Configuration Adminstrator\"; allow (all) userdn =
\"ldap:///"+getAdminDN(ldc)+"\";)",
@@ -4725,7 +4973,7 @@ class EntryEditor implements IAdapterInfo {
set.add(attr);
- /* The required attributes */
+ // The required attributes
Hashtable ht = new Hashtable();
DSSchemaHelper.allRequiredAttributes(selectedObjectClass, _schema, ht);
Enumeration e = ht.elements();
@@ -4734,15 +4982,14 @@ class EntryEditor implements IAdapterInfo {
if (!name.equalsIgnoreCase (namingAttribute)) {
attr = new LDAPAttribute( name );
- /* Initialize the objectclass attribute with the
- chain of superiors */
+ // Initialize the objectclass attribute with the chain of
superiors
if ( name.equalsIgnoreCase( "objectclass" ) ) {
Vector v = DSSchemaHelper.getObjectClassVector(
selectedObjectClass, _schema );
for( int i = v.size() - 1; i >= 0; i-- ) {
attr.addValue( (String)v.elementAt( i ) );
}
} else {
- /* Not objectclass nor the attribute we already added,
initialize with the empty string */
+ // Not objectclass nor the attribute we already added,
initialize with the empty string
attr.addValue( "" );
}
set.add( attr );
@@ -4758,13 +5005,13 @@ class EntryEditor implements IAdapterInfo {
if ( entryDlg != null ) {
attrs = entryDlg.getAttributes();
}
- /* The user has clicked on cancel, we return */
+ // The user has clicked on cancel, we return.
if ( attrs == null ) {
done = true;
}
if (!done) {
- /* We add the entry in the directory */
+ // We add the entry in the directory.
LDAPEntry newObject = new LDAPEntry(entryDlg.getDN(), attrs);
objectCreated = addObject( newObject, ldc );
}
@@ -4788,7 +5035,7 @@ class EntryEditor implements IAdapterInfo {
boolean objectModified = false;
_editedObjectDn = null;
_ldc = ldc;
- /* Fetch all attributes of the entry */
+ // Fetch all attributes of the entry.
if (_allAttrs == null) {
String[] editableAttributes =
DSSchemaHelper.getOperationalAttributes(_schema);
String[] allAttributes = null;
@@ -4824,7 +5071,7 @@ class EntryEditor implements IAdapterInfo {
entry = _ldc.read(entryDn, _allAttrs, searchConstraints);
} catch (LDAPException lde) {
Debug.println("DSContentPage.editObject: LDAPException [" + lde +
"]");
- /* The entry could not be read... */
+ // The entry could not be read...
String[] args = {
entryDn,
Helper.getLDAPErrorMessage(lde)};
@@ -4842,7 +5089,7 @@ class EntryEditor implements IAdapterInfo {
/* In the case we don't want to call always the generic editor, check if
this has an
objectclass known to the UserGroup editor. Get the object class to java
class association. */
if (!isAdvanced &&
isStandardObjectClass(objectclass.getStringValues())) {
- /* Yes, it is. So call the UserGroup editor. */
+ // Yes, it is. So call the UserGroup editor.
ConsoleInfo info = new ConsoleInfo();
info.setUserLDAPConnection(_ldc);
info.setUserHost(_ldc.getHost());
@@ -4859,7 +5106,7 @@ class EntryEditor implements IAdapterInfo {
String buttonText =
_resource.getString( "UserGroup",
"Advanced-label" );
- /* Install an "Advanced" button for generic editing */
+ // Install an "Advanced" button for generic editing
ed.registerAdvancedOption( new UserGroupAdapter(EntryEditor.this,
buttonText,
entry,
@@ -4939,8 +5186,7 @@ class EntryEditor implements IAdapterInfo {
} else {
while( en.hasMoreElements() &&
!isStandardObjectClass ) {
- /* Check each object class of this entry to see if
- it is one of the known ones. */
+ // Check each object class of this entry to see if it is one of the known
ones.
String name = ((String)en.nextElement()).toLowerCase();
if ( htable.get( name ) != null ) {
isStandardObjectClass = true;
@@ -4992,7 +5238,7 @@ class EntryEditor implements IAdapterInfo {
if (ed != null) {
String buttonText =
_resource.getString( "UserGroup", "Advanced-label"
);
- /* Install an "Advanced" button for generic editing */
+ // Install an "Advanced" button for generic editing
ed.registerAdvancedOption( new UserGroupAdapter(EntryEditor.this,
buttonText,
parentDn,
@@ -5030,7 +5276,7 @@ class EntryEditor implements IAdapterInfo {
}
private boolean addObject( LDAPEntry entry, LDAPConnection ldc ) {
- /* Loop here, in case reauthentication is required */
+ // Loop here, in case reauthentication is required
if ( ldc == null ) {
Debug.println( "EntryEditor.addEntry: no LDAP connection" );
return false;
@@ -5046,20 +5292,20 @@ class EntryEditor implements IAdapterInfo {
done = true;
} catch ( LDAPException e ) {
Debug.println( "EntryEditor.addObject() Adding " +
entry.getDN() + ", " + e );
- /* Allow reauthenticating on insufficient privileges */
+ // Allow reauthenticating on insufficient privileges
if ( e.getLDAPResultCode() ==
e.INSUFFICIENT_ACCESS_RIGHTS ) {
- /* Put up dialog indicating the problem */
+ // Put up dialog indicating the problem
DSUtil.showPermissionDialog( _frame, ldc );
} else if ( e.getLDAPResultCode() ==
e.NO_SUCH_OBJECT ) {
- /* Put up dialog indicating the problem */
+ // Put up dialog indicating the problem
DSUtil.showErrorDialog(_frame, "noParentForAdd",
"", "EntryObject");
result = false;
done = true;
} else {
- /* Some other error. Just show a dialog. */
+ // Some other error. Just show a dialog.
DSUtil.showLDAPErrorDialog( _frame,
e, "111-title" );
result = false;
@@ -5071,7 +5317,7 @@ class EntryEditor implements IAdapterInfo {
}
private DSEntryDialog doGenericDialog( LDAPEntry entry, int options, LDAPConnection
ldc ) {
- /* Make a list of attribute names */
+ // Make a list of attribute names
LDAPAttributeSet set = entry.getAttributeSet();
int i = 0;
LDAPSchema schema = getSchema();
@@ -5089,21 +5335,19 @@ class EntryEditor implements IAdapterInfo {
names[i] = (String)v.elementAt( i );
}
- /* Sort the attributes alphabetically by name */
+ // Sort the attributes alphabetically by name
DSUtil.trimAndBubbleSort( names, true );
for( i = 0; i < names.length; i++ ) {
labels[i] = names[i];
}
- /* Make a single page with all attributes */
- EntryPageDescription page =
- new EntryPageDescription( names, labels );
- /* Data model for property editor */
- DSPropertyModel model = new DSPropertyModel( _schema,
- entry, page );
- /* Editor window */
+ // Make a single page with all attributes
+ EntryPageDescription page = new EntryPageDescription( names, labels );
+ // Data model for property editor
+ DSPropertyModel model = new DSPropertyModel( _schema, entry, page );
+ // Editor window
DSEntryPanel child = new DSEntryPanel( model , options, ldc);
- /* Do it as a dialog */
+ // Do it as a dialog
DSEntryDialog dlg = new DSEntryDialog( _frame, child );
dlg.setTitle( _resource.getString( "EntryObject",
"property-dialog-title",
entry.getDN()) );
@@ -5211,7 +5455,7 @@ class EntryEditor implements IAdapterInfo {
if ((mods != null) && (dlg != null)) {
if (!saveChanges( mods, dlg.getAttributes(), ldc,
intermediateDn)) {
- /* try to go back to old dn */
+ // try to go back to old dn
String oldRdn = oldDN.explodeDN(false)[0];
ldc.rename( intermediateDn, oldRdn, false );
dlg = null;
@@ -5223,12 +5467,12 @@ class EntryEditor implements IAdapterInfo {
}
}
} else {
- /* Just rename the entry if no mods to do */
+ // Just rename the entry if no mods to do
ldc.rename( entry.getDN(), newrdn, false );
}
} catch ( LDAPException lde ) {
- /* Something went wrong when renaming */
- /* The entry could not be read... */
+ // Something went wrong when renaming
+ // The entry could not be read...
String[] args = {
entry.getDN(),
Helper.getLDAPErrorMessage(lde)};
@@ -5261,27 +5505,26 @@ class EntryEditor implements IAdapterInfo {
(mods.size() > 0) ) {
try {
ldc.modify( dn, mods, (LDAPConstraints)cons );
- if ( DSUtil.requiresRestart ( dn, mods )) {
- DSUtil.showInformationDialog( _frame,
- "requires-restart", (String)null );
- }
+ if ( DSUtil.requiresRestart ( dn, mods )) {
+ DSUtil.showInformationDialog( _frame, "requires-restart",
(String)null );
+ }
} catch ( LDAPException e ) {
Debug.println( "DSContentPage$EntryEditor.saveChanges Modifying
" + dn + ", " + e );
- /* Allow reauthenticating on insufficient privileges */
+ // Allow reauthenticating on insufficient privileges
if ( e.getLDAPResultCode() ==
e.INSUFFICIENT_ACCESS_RIGHTS ) {
- /* Put up dialog indicating the problem */
+ // Put up dialog indicating the problem
DSUtil.showPermissionDialog( _frame, ldc );
- /* If the user cancels reauthentication, bail */
+ // If the user cancels reauthentication, bail
saveChanges = false;
} else if ( e.getLDAPResultCode() ==
e.NO_SUCH_OBJECT ) {
- /* Entry doesn't exist, try adding it */
+ // Entry doesn't exist, try adding it
LDAPEntry entry = new LDAPEntry(dn, set);
saveChanges = addObject( entry, ldc );
} else {
- /* Some other error. Just show a dialog. */
+ // Some other error. Just show a dialog.
DSUtil.showLDAPErrorDialog( _frame,
e, "111-title" );
saveChanges = false;
@@ -5315,6 +5558,7 @@ interface IContentPageInfo {
public boolean isSelectedNodeRemote();
public boolean isSelectedNodeSuffix();
public boolean isClipboardEmpty();
+ public boolean isDnInClipboardEmpty();
public boolean isSorted();
public Integer getSelectionActivationState();
public Integer getSelectionVlvState();
@@ -5547,7 +5791,7 @@ class AttributeController implements Runnable {
String longestValue = null;
int longestValueRow = 0;
- /* In order to sort the attributes */
+ // In order to sort the attributes
String[] attributeNames = new String[numberAttributes];
for (int i=0; i<numberAttributes; i++) {
LDAPAttribute attr = set.elementAt(i);
@@ -5555,10 +5799,10 @@ class AttributeController implements Runnable {
attributeNames[i] = attributeName;
}
- /* Sort the attributes */
+ // Sort the attributes
DSUtil.bubbleSort(attributeNames, true);
- /* Populate the table and calculate the preferred size */
+ // Populate the table and calculate the preferred size
for (int i=0; i<numberAttributes; i++) {
LDAPAttribute attr = set.getAttribute(attributeNames[i]);
String attributeName = attributeNames[i];
@@ -5619,7 +5863,7 @@ class AttributeController implements Runnable {
}
}
-/* Our particular table model, conceived to display attributes */
+// Our particular table model, conceived to display attributes
class AttributeTableModel extends AbstractTableModel {
public AttributeTableModel() {
@@ -5672,7 +5916,7 @@ class RemoteNodeInformationDialog extends AbstractDialog {
String _section = "RemoteNodeInformationDialog";
static ResourceSet _resource = DSUtil._resource;
- /* We assume that the node is a valid node with a non null URL */
+ // We assume that the node is a valid node with a non null URL.
public RemoteNodeInformationDialog(JFrame frame,
IBrowserNodeInfo node) {
super( frame, "", true, OK | CANCEL);
@@ -5741,7 +5985,7 @@ class DisplayedChildrenLimitExceededDialog extends AbstractDialog {
String _section = "DisplayedChildrenLimitExceededDialog";
static ResourceSet _resource = DSUtil._resource;
- /* We assume that the node is a valid node with a non null URL */
+ // We assume that the node is a valid node with a non null URL.
public DisplayedChildrenLimitExceededDialog(JFrame frame,
IBrowserNodeInfo node) {
super( frame, "", true, OK);
@@ -5810,7 +6054,7 @@ class SortedChildrenLimitExceededDialog extends AbstractDialog {
String _section = "SortedChildrenLimitExceededDialog";
static ResourceSet _resource = DSUtil._resource;
- /* We assume that the node is a valid node with a non null URL */
+ // We assume that the node is a valid node with a non null URL.
public SortedChildrenLimitExceededDialog(JFrame frame,
IBrowserNodeInfo node) {
super( frame, "", true, OK );
diff --git a/src/com/netscape/admin/dirserv/DSResourceModel.java
b/src/com/netscape/admin/dirserv/DSResourceModel.java
index da5358d..1b46355 100644
--- a/src/com/netscape/admin/dirserv/DSResourceModel.java
+++ b/src/com/netscape/admin/dirserv/DSResourceModel.java
@@ -130,10 +130,10 @@ public class DSResourceModel extends DSBaseModel
if (_menuEdit == null) {
_menuEdit = new IMenuItem[] {
/*
- new MenuItemText( CUT,
- _resource.getString("menu", "EditCut"),
+ new MenuItemText( MOVE,
+ _resource.getString("menu", "EditMove"),
_resource.getString("menu",
- "EditCut-description")),
+ "EditMove-description")),
new MenuItemText( COPY,
_resource.getString("menu", "EditCopy"),
_resource.getString("menu",
diff --git a/src/com/netscape/admin/dirserv/dirserv.properties
b/src/com/netscape/admin/dirserv/dirserv.properties
index 2cfcdf1..65b6f17 100644
--- a/src/com/netscape/admin/dirserv/dirserv.properties
+++ b/src/com/netscape/admin/dirserv/dirserv.properties
@@ -47,6 +47,8 @@ menu-EditUndo=&Undo
menu-EditUndo-description=Undo the last change
menu-EditCut=C&ut
menu-EditCut-description=Remove object and move it to the clipboard
+menu-EditMove=M&ove
+menu-EditMove-description=Move it to the clipboard
menu-EditCopy=Cop&y
menu-EditCopy-description=Copy object to the clipboard
menu-EditCopyDN=Copy D&N
@@ -55,6 +57,8 @@ menu-EditCopyLDAPURL=Copy &LDAP URL
menu-EditCopyLDAPURL-description=Copy LDAP URL of object to the clipboard
menu-EditPaste=Pas&te
menu-EditPaste-description=Paste object from clipboard
+menu-EditMovePaste=MovePas&te
+menu-EditMovePaste-description=Move object from clipboard
menu-EditDelete=&Delete
menu-EditDelete-description=Delete object
menu-EditNew=&New