public void associateTarget ( AbstractApplication app , String instancePathOrComponentName , String targetId , boolean bind ) throws TargetWsException { if ( bind ) this . logger . finer ( "Associating " + app + " :: " + instancePathOrComponentName + " with " + targetId ) ; else this . logger . finer ( "Dissociating " + app + " :: " + instancePathOrComponentName + " from " + targetId ) ; WebResource path = this . resource . path ( UrlConstants . TARGETS ) . path ( targetId ) . path ( "associations" ) . queryParam ( "bind" , Boolean . toString ( bind ) ) . queryParam ( "name" , app . getName ( ) ) ; if ( instancePathOrComponentName != null ) path = path . queryParam ( "elt" , instancePathOrComponentName ) ; if ( app instanceof ApplicationTemplate ) path = path . queryParam ( "qualifier" , ( ( ApplicationTemplate ) app ) . getVersion ( ) ) ; ClientResponse response = this . wsClient . createBuilder ( path ) . accept ( MediaType . APPLICATION_JSON ) . post ( ClientResponse . class ) ; handleResponse ( response ) ; }
Associates or dissociates an application and a target .