? RenameAggregate.diff
? build
? dist
? docs
? src/com/redhat/rhdb/admin/.nbattrs
? src/com/redhat/rhdb/admin/resources/.nbattrs
? src/com/redhat/rhdb/admin/resources/Resources.java
? src/com/redhat/rhdb/admin/resources/Resources_ja_JP.java
? src/com/redhat/rhdb/admin/resources/Resources_ru_RU.java
Index: ChangeLog
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/ChangeLog,v
retrieving revision 1.2
diff -c -r1.2 ChangeLog
*** ChangeLog	23 Dec 2003 16:50:03 -0000	1.2
--- ChangeLog	23 Dec 2003 20:08:26 -0000
***************
*** 1,3 ****
--- 1,17 ----
+ 2003-12-23  Benjamin Mar Kuck  <binary_data@hotmail.com>
+ 
+ 	* src/com/redhat/rhdb/admin/AggregateUpdate.java (renameAggregate):
+ 	Add new function to rename aggregates.
+ 	* src/com/redhat/rhdb/admin/RenameDialog.java (doOKAction): Add
+ 	handling for renaming aggregates.
+ 	* src/com/redhat/rhdb/admin/resources/AdminResources.java: Add new
+ 	Strings.
+ 	* src/com/redhat/rhdb/admin/resources/Resources.java.in: Add new
+ 	aggregate menu string.
+ 	* src/com/redhat/rhdb/admin/tree/AggregateNode.java (doMenuAction):
+ 	Add handling for renaming of aggregates.
+ 	(getNodeMenu): Add new menu option for renaming aggregates.
+ 
  2003-12-19  Deepak Bhole  <ibetthisidisavailable@yahoo.ca>
  
  	* src/com/redhat/rhdb/admin/AdminBackendClient.java
Index: src/com/redhat/rhdb/admin/AggregateUpdate.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/AggregateUpdate.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 AggregateUpdate.java
*** src/com/redhat/rhdb/admin/AggregateUpdate.java	21 Nov 2003 18:30:20 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/AggregateUpdate.java	23 Dec 2003 20:08:26 -0000
***************
*** 179,184 ****
--- 179,212 ----
  	
  	}
  		
+    	/**
+ 	 * Renames an aggregate
+ 	 *
+ 	 * @param client The backend client.
+ 	 * @param node the invoking aggregate node.
+ 	 * @param name the new name of the aggregate.
+ 	 * @throws ObjectUpdateException if the aggregate cannot be renamed.
+ 	 */
+ 
+ 	public static void renameAggregate(AdminBackendClient client, AggregateNode node, String name) throws ObjectUpdateException {
+ 
+ 		String updateString = "ALTER AGGREGATE ";
+ 		
+ 		updateString += AdminMiscFunctions.getDoubleQuotedIdentifier(node.getParentSchemaName()) + ".";
+ 		updateString += node.getQuotedSignature();		
+ 		
+ 		updateString += " RENAME TO " + name;
+ 		
+ 		// perform the update. Any errors are passed to the parent
+ 
+ 		try {
+ 			client.performUpdate(node.getParentClusterName(), node.getParentDatabaseName(), updateString);
+ 		} catch (Exception e) {
+ 			throw new ObjectUpdateException(e.getMessage());
+ 		}	
+ 	
+ 	}
+ 
  	/**
  	 * Comments on an aggregate
  	 *
Index: src/com/redhat/rhdb/admin/RenameDialog.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/RenameDialog.java,v
retrieving revision 1.2
diff -c -r1.2 RenameDialog.java
*** src/com/redhat/rhdb/admin/RenameDialog.java	23 Dec 2003 16:50:03 -0000	1.2
--- src/com/redhat/rhdb/admin/RenameDialog.java	23 Dec 2003 20:08:27 -0000
***************
*** 232,237 ****
--- 232,239 ----
  			GroupUpdate.renameGroup(backendClient, (GroupNode) invocationNode, quotedName);
  		else if (invocationNode instanceof UserNode)
  			UserUpdate.renameUser(backendClient, (UserNode) invocationNode, quotedName);
+ 		else if (invocationNode instanceof AggregateNode)
+ 			AggregateUpdate.renameAggregate(backendClient, (AggregateNode) invocationNode, quotedName);
  
  		// Reached here => all went well
  		
Index: src/com/redhat/rhdb/admin/resources/AdminResources.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/resources/AdminResources.java,v
retrieving revision 1.2
diff -c -r1.2 AdminResources.java
*** src/com/redhat/rhdb/admin/resources/AdminResources.java	23 Dec 2003 16:50:03 -0000	1.2
--- src/com/redhat/rhdb/admin/resources/AdminResources.java	23 Dec 2003 20:08:28 -0000
***************
*** 284,289 ****
--- 284,290 ----
  	public static final String MENU_REMOVE_CLUSTER		= "remove.cluster";
  	public static final String MENU_REINDEX_INDEX = "menu.reindex.index";
  	public static final String MENU_REINDEX_TABLE = "menu.reindex.table";
+ 	public static final String MENU_RENAME_AGGREGATE = "menu.rename.aggregate";
  	public static final String MENU_RENAME_DATABASE = "menu.rename.database";
  	public static final String MENU_RENAME_COLUMN = "menu.rename.column";
  	public static final String MENU_RENAME_GROUP = "menu.rename.group";
Index: src/com/redhat/rhdb/admin/resources/Resources.java.in
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/resources/Resources.java.in,v
retrieving revision 1.2
diff -c -r1.2 Resources.java.in
*** src/com/redhat/rhdb/admin/resources/Resources.java.in	23 Dec 2003 16:50:03 -0000	1.2
--- src/com/redhat/rhdb/admin/resources/Resources.java.in	23 Dec 2003 20:08:28 -0000
***************
*** 284,289 ****
--- 284,290 ----
  		{ AdminResources.MENU_REINDEX_INDEX, "REINDEX INDEX" },
  		{ AdminResources.MENU_REINDEX_TABLE, "REINDEX TABLE..."},
  		{ AdminResources.MENU_REMOVE_CLUSTER,		"REMOVE CLUSTER" },
+ 		{ AdminResources.MENU_RENAME_AGGREGATE, "RENAME AGGREGATE..." },
  		{ AdminResources.MENU_RENAME_DATABASE, "RENAME DATABASE..." },
  		{ AdminResources.MENU_RENAME_GROUP, "RENAME GROUP..." },
  		{ AdminResources.MENU_RENAME_INDEX, "RENAME INDEX" },
Index: src/com/redhat/rhdb/admin/tree/AggregateNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/AggregateNode.java,v
retrieving revision 1.2
diff -c -r1.2 AggregateNode.java
*** src/com/redhat/rhdb/admin/tree/AggregateNode.java	23 Dec 2003 16:50:04 -0000	1.2
--- src/com/redhat/rhdb/admin/tree/AggregateNode.java	23 Dec 2003 20:08:28 -0000
***************
*** 138,143 ****
--- 138,146 ----
                  		this.sendRefreshRequest(new TreePath(path));
  				
  			}
+ 		} else if (selectedMenuCaption == AdminResources.getString(AdminResources.MENU_RENAME_AGGREGATE)) {
+ 			RenameDialog rd = new RenameDialog(dockWindow, this, client, this.getNodeType());
+ 			rd.show();
  		} else if (selectedMenuCaption == AdminResources.getString(AdminResources.MENU_COMMENT)) {
  			String[][] metaData;
  			// get the comment
***************
*** 165,170 ****
--- 168,194 ----
  
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_DROP_RESTRICT)));
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_DROP_CASCADE)));
+ 
+ 		// Menu items that vary according to backend
+ 		
+ 		JMenuItem jmiRename = new JMenuItem();
+ 		jmiRename.setText(AdminResources.getString(AdminResources.MENU_RENAME_AGGREGATE));
+ 		jmiRename.setEnabled(false);
+ 		
+ 		try {
+ 			
+ 			// For a consistent look, if item is not available on this version, 
+ 			// we will disable it, but still show it
+ 
+ 			if (client.getBackendVersion(this.getParentClusterName()) > 7.3) {
+ 				 jmiRename.setEnabled(true);
+ 			}
+ 
+ 		} catch (Exception e) {
+ 			// Nothing.. element will remain disabled
+ 		}
+                 menu.add(jmiRename);
+ 		
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_COMMENT)));
  
  		return menu;
