private void addSharingProfiles ( Collection < SharingProfile > sharingProfiles ) throws GuacamoleException { // Add each sharing profile to the tree for ( SharingProfile sharingProfile : sharingProfiles ) { // Retrieve the sharing profile's associated connection String primaryConnectionIdentifier = sharingProfile . getPrimaryConnectionIdentifier ( ) ; APIConnection primaryConnection = retrievedConnections . get ( primaryConnectionIdentifier ) ; // Add the sharing profile as a child of the primary connection if ( primaryConnection != null ) { Collection < APISharingProfile > children = primaryConnection . getSharingProfiles ( ) ; // Create child collection if it does not yet exist if ( children == null ) { children = new ArrayList < APISharingProfile > ( ) ; primaryConnection . setSharingProfiles ( children ) ; } // Add child children . add ( new APISharingProfile ( sharingProfile ) ) ; } // Warn of internal consistency issues else logger . debug ( "Sharing profile \"{}\" cannot be added to the " + "tree: primary connection \"{}\" does not actually " + "exist." , sharingProfile . getIdentifier ( ) , primaryConnectionIdentifier ) ; } // end for each sharing profile }
Adds each of the provided sharing profiles to the current tree as children of their respective primary connections . The primary connections must already be added .