Merge pull request #42 from glyptodon/fix-object-move

GUAC-964: Only move connections/groups if parent identifier changes.
This commit is contained in:
James Muehlner
2015-01-02 21:00:49 -08:00
2 changed files with 14 additions and 4 deletions

View File

@@ -309,9 +309,14 @@ public class ConnectionRESTService {
existingConnection.setName(connection.getName());
connectionDirectory.update(existingConnection);
// Update connection parent
// Get old and new parents
String oldParentIdentifier = existingConnection.getParentIdentifier();
ConnectionGroup updatedParentGroup = retrievalService.retrieveConnectionGroup(userContext, connection.getParentIdentifier());
connectionDirectory.move(connectionID, updatedParentGroup.getConnectionDirectory());
// Update connection parent, if changed
if ( (oldParentIdentifier != null && !oldParentIdentifier.equals(updatedParentGroup.getParentIdentifier()))
|| (oldParentIdentifier == null && updatedParentGroup.getParentIdentifier() != null))
connectionDirectory.move(connectionID, updatedParentGroup.getConnectionDirectory());
}

View File

@@ -365,9 +365,14 @@ public class ConnectionGroupRESTService {
existingConnectionGroup.setType(connectionGroup.getType());
connectionGroupDirectory.update(existingConnectionGroup);
// Update connection group parent
// Get old and new parents
String oldParentIdentifier = existingConnectionGroup.getParentIdentifier();
ConnectionGroup updatedParentGroup = retrievalService.retrieveConnectionGroup(userContext, connectionGroup.getParentIdentifier());
connectionGroupDirectory.move(connectionGroupID, updatedParentGroup.getConnectionGroupDirectory());
// Update connection group parent, if changed
if ( (oldParentIdentifier != null && !oldParentIdentifier.equals(updatedParentGroup.getParentIdentifier()))
|| (oldParentIdentifier == null && updatedParentGroup.getParentIdentifier() != null))
connectionGroupDirectory.move(connectionGroupID, updatedParentGroup.getConnectionGroupDirectory());
}