URI generateUrl ( InitializrServiceMetadata metadata ) { try { URIBuilder builder = new URIBuilder ( this . serviceUrl ) ; StringBuilder sb = new StringBuilder ( ) ; if ( builder . getPath ( ) != null ) { sb . append ( builder . getPath ( ) ) ; } ProjectType projectType = determineProjectType ( metadata ) ; this . type = projectType . getId ( ) ; sb . append ( projectType . getAction ( ) ) ; builder . setPath ( sb . toString ( ) ) ; if ( ! this . dependencies . isEmpty ( ) ) { builder . setParameter ( "dependencies" , StringUtils . collectionToCommaDelimitedString ( this . dependencies ) ) ; } if ( this . groupId != null ) { builder . setParameter ( "groupId" , this . groupId ) ; } String resolvedArtifactId = resolveArtifactId ( ) ; if ( resolvedArtifactId != null ) { builder . setParameter ( "artifactId" , resolvedArtifactId ) ; } if ( this . version != null ) { builder . setParameter ( "version" , this . version ) ; } if ( this . name != null ) { builder . setParameter ( "name" , this . name ) ; } if ( this . description != null ) { builder . setParameter ( "description" , this . description ) ; } if ( this . packageName != null ) { builder . setParameter ( "packageName" , this . packageName ) ; } if ( this . type != null ) { builder . setParameter ( "type" , projectType . getId ( ) ) ; } if ( this . packaging != null ) { builder . setParameter ( "packaging" , this . packaging ) ; } if ( this . javaVersion != null ) { builder . setParameter ( "javaVersion" , this . javaVersion ) ; } if ( this . language != null ) { builder . setParameter ( "language" , this . language ) ; } if ( this . bootVersion != null ) { builder . setParameter ( "bootVersion" , this . bootVersion ) ; } return builder . build ( ) ; } catch ( URISyntaxException ex ) { throw new ReportableException ( "Invalid service URL (" + ex . getMessage ( ) + ")" ) ; } }
Generates the URI to use to generate a project represented by this request .