protected Collection<String> getModifiedParents(ModeledAuthenticatedUser user,
            String identifier, ModelType model) throws GuacamoleException {

        // Get old parent identifier
        String oldParentIdentifier = null;
        if (identifier != null) {
            ModelType current = retrieveObject(user, identifier).getModel();
            oldParentIdentifier = current.getParentIdentifier();
        }

        // Get new parent identifier
        String parentIdentifier = null;
        if (model != null) {

            parentIdentifier = model.getParentIdentifier();

            // If both parents have the same identifier, nothing has changed
            if (parentIdentifier != null && parentIdentifier.equals(oldParentIdentifier))
                return Collections.<String>emptyList();

        }

        // Return collection of all non-root parents involved
        Collection<String> parents = new ArrayList<String>(2);
        if (oldParentIdentifier != null) parents.add(oldParentIdentifier);
        if (parentIdentifier    != null) parents.add(parentIdentifier);
        return parents;

    }
protected Collection < String > getModifiedParents ( ModeledAuthenticatedUser user , String identifier , ModelType model ) throws GuacamoleException { String oldParentIdentifier = null ; if ( identifier != null ) { ModelType current = retrieveObject ( user , identifier ) . getModel ( ) ; oldParentIdentifier = current . getParentIdentifier ( ) ; } String parentIdentifier = null ; if ( model != null ) { parentIdentifier = model . getParentIdentifier ( ) ; if ( parentIdentifier != null && parentIdentifier . equals ( oldParentIdentifier ) ) return Collections . < String > emptyList ( ) ; } Collection < String > parents = new ArrayList < String > ( 2 ) ; if ( oldParentIdentifier != null ) parents . add ( oldParentIdentifier ) ; if ( parentIdentifier != null ) parents . add ( parentIdentifier ) ; return parents ; }
Returns the set of parent objects that are modified by the given model
object (by virtue of the object changing parents). If the model is not
changing parents, the resulting collection will be empty.

@param user
The user making the given changes to the model.

@param identifier
The identifier of the object that has been modified, if it exists.
If the object is being created, this will be null.

@param model
The model that has been modified, if any. If the object is being
deleted, this will be null.

@return
A collection of the identifiers of all parents that will be affected
(updated) by the change.

@throws GuacamoleException
If an error occurs while determining which parents are affected.