@ JavaScriptMethod @ SuppressWarnings ( { "UnusedDeclaration" } ) public LoadBuildsResponse loadBuild ( String buildId ) { LoadBuildsResponse response = new LoadBuildsResponse ( ) ; // When we load a new build we need also to reset the promotion plugin. // The null plugin is related to 'None' plugin. setPromotionPlugin ( null ) ; try { this . currentPromotionCandidate = promotionCandidates . get ( buildId ) ; if ( this . currentPromotionCandidate == null ) { throw new IllegalArgumentException ( "Can't find build by ID: " + buildId ) ; } List < String > repositoryKeys = getRepositoryKeys ( ) ; List < UserPluginInfo > plugins = getPromotionsUserPluginInfo ( ) ; PromotionConfig promotionConfig = getPromotionConfig ( ) ; String defaultTargetRepository = getDefaultPromotionTargetRepository ( ) ; if ( StringUtils . isNotBlank ( defaultTargetRepository ) && repositoryKeys . contains ( defaultTargetRepository ) ) { promotionConfig . setTargetRepo ( defaultTargetRepository ) ; } response . addRepositories ( repositoryKeys ) ; response . setPlugins ( plugins ) ; response . setPromotionConfig ( promotionConfig ) ; response . setSuccess ( true ) ; } catch ( Exception e ) { response . setResponseMessage ( e . getMessage ( ) ) ; } return response ; }
Load the related repositories plugins and a promotion config associated to the buildId . Called from the UI .