@ -25,12 +25,14 @@ import java.util.List;
import java.util.Map ;
import org.apache.http.client.utils.URIBuilder ;
import org.springframework.util.StringUtils ;
/ * *
* Represent the settings to apply to generating the project .
*
* @author Stephane Nicoll
* @author Edd ú Mel é ndez
* @since 1.2 .0
* /
class ProjectGenerationRequest {
@ -43,33 +45,33 @@ class ProjectGenerationRequest {
private boolean extract ;
private String bootVersion ;
private String groupId ;
private List< String > dependencies = new ArrayList < String > ( ) ;
private String artifactId ;
private String javaVersion ;
private String version ;
private String name ;
private String description ;
private String packaging ;
private String type ;
private String build ;
private String format ;
private boolean detectType ;
private String type ;
private String javaVersion ;
private String language ;
private String groupId ;
private String artifactId ;
private String name ;
private String version ;
private String bootVersion ;
private String description ;
private List < String > dependencies = new ArrayList < String > ( ) ;
/ * *
* The URL of the service to use .
@ -117,35 +119,63 @@ class ProjectGenerationRequest {
}
/ * *
* The Spring Boot version to use or { @code null } if it should not be customized .
* @return the Spring Boot version of { @code null }
* The groupId to use or { @code null } if it should not be customized .
* @return the groupId or { @code null }
* /
public String get BootVersion ( ) {
return this . bootVersion ;
public String get GroupId ( ) {
return this . groupId ;
}
public void set BootVersion( String bootVersion ) {
this . bootVersion = bootVersion ;
public void set GroupId( String groupId ) {
this . groupId = groupId ;
}
/ * *
* The identifiers of the dependencies to include in the project .
* @return the dependency identifiers
* The artifactId to use or { @code null } if it should not be customized .
* @return the artifactId or { @code null }
* /
public List < String > getDependencies ( ) {
return this . dependencies ;
public String getArtifactId ( ) {
return this . artifactId ;
}
public void setArtifactId ( String artifactId ) {
this . artifactId = artifactId ;
}
/ * *
* The Java version to use or { @code null } if it should not be customized .
* @return the Java version or { @code null }
* The artifact version to use or { @code null } if it should not be customized .
* @return the artifact version or { @code null }
* /
public String get Java Version( ) {
return this . ja vaV ersion;
public String get Version( ) {
return this . version;
}
public void setJavaVersion ( String javaVersion ) {
this . javaVersion = javaVersion ;
public void setVersion ( String version ) {
this . version = version ;
}
/ * *
* The name to use or { @code null } if it should not be customized .
* @return the name or { @code null }
* /
public String getName ( ) {
return this . name ;
}
public void setName ( String name ) {
this . name = name ;
}
/ * *
* The description to use or { @code null } if it should not be customized .
* @return the description or { @code null }
* /
public String getDescription ( ) {
return this . description ;
}
public void setDescription ( String description ) {
this . description = description ;
}
/ * *
@ -160,6 +190,19 @@ class ProjectGenerationRequest {
this . packaging = packaging ;
}
/ * *
* The type of project to generate . Should match one of the advertized type that the
* service supports . If not set , the default is retrieved from the service metadata .
* @return the project type
* /
public String getType ( ) {
return this . type ;
}
public void setType ( String type ) {
this . type = type ;
}
/ * *
* The build type to use . Ignored if a type is set . Can be used alongside the
* { @link # getFormat ( ) format } to identify the type to use .
@ -199,20 +242,20 @@ class ProjectGenerationRequest {
}
/ * *
* The type of project to generate . Should match one of the advertized type that the
* service supports . If not set , the default is retrieved from the service metadata .
* @return the project type
* The Java version to use or { @code null } if it should not be customized .
* @return the Java version or { @code null }
* /
public String get Type ( ) {
return this . type ;
public String get JavaVersion ( ) {
return this . javaVersion ;
}
public void set Type( String type ) {
this . type = type ;
public void set JavaVersion( String javaVersion ) {
this . javaVersion = javaVersion ;
}
/ * *
* The programming language to use or { @code null } if it should not be customized .
* @return the programming language or { @code null }
* /
public String getLanguage ( ) {
return this . language ;
@ -223,58 +266,23 @@ class ProjectGenerationRequest {
}
/ * *
* The groupId to use or { @code null } if it should not be customized .
* /
public String getGroupId ( ) {
return this . groupId ;
}
public void setGroupId ( String groupId ) {
this . groupId = groupId ;
}
/ * *
* The artifactId to use or { @code null } if it should not be customized .
* /
public String getArtifactId ( ) {
return this . artifactId ;
}
public void setArtifactId ( String artifactId ) {
this . artifactId = artifactId ;
}
/ * *
* The name to use or { @code null } if it should not be customized .
* /
public String getName ( ) {
return this . name ;
}
public void setName ( String name ) {
this . name = name ;
}
/ * *
* The artifact version to use or { @code null } if it should not be customized .
* The Spring Boot version to use or { @code null } if it should not be customized .
* @return the Spring Boot version or { @code null }
* /
public String get Version( ) {
return this . v ersion;
public String getBootVersion ( ) {
return this . bootVersion ;
}
public void set Version( String v ersion) {
this . version = v ersion;
public void setBootVersion ( String bootVersion ) {
this . bootVersion = bootVersion ;
}
/ * *
*
* The identifiers of the dependencies to include in the project .
* @return the dependency identifiers
* /
public String getDescription ( ) {
return this . description ;
}
public void setDescription ( String description ) {
this . description = description ;
public List < String > getDependencies ( ) {
return this . dependencies ;
}
/ * *
@ -295,40 +303,40 @@ class ProjectGenerationRequest {
sb . append ( projectType . getAction ( ) ) ;
builder . setPath ( sb . toString ( ) ) ;
if ( this . artifactId ! = null ) {
builder . setParameter ( "artifactId" , this . artifactId ) ;
}
if ( this . bootVersion ! = null ) {
builder . setParameter ( "bootVersion" , this . bootVersion ) ;
}
if ( ! this . dependencies . isEmpty ( ) ) {
builder . setParameter ( "dependencies" ,
StringUtils . collectionToCommaDelimitedString ( this . dependencies ) ) ;
}
if ( this . description ! = null ) {
builder . setParameter ( "description" , this . description ) ;
}
if ( this . groupId ! = null ) {
builder . setParameter ( "groupId" , this . groupId ) ;
}
if ( this . javaVersion ! = null ) {
builder . setParameter ( " javaVersion", this . javaVersion ) ;
if ( this . artifactId ! = null ) {
builder . setParameter ( " artifactId", this . artifactId ) ;
}
if ( this . language ! = null ) {
builder . setParameter ( " language", this . language ) ;
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 . packaging ! = null ) {
builder . setParameter ( "packaging" , this . packaging ) ;
}
if ( this . type ! = null ) {
builder . setParameter ( "type" , projectType . getId ( ) ) ;
}
if ( this . version ! = null ) {
builder . setParameter ( "version" , this . version ) ;
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 ( ) ;
@ -384,7 +392,7 @@ class ProjectGenerationRequest {
private static void filter ( Map < String , ProjectType > projects , String tag ,
String tagValue ) {
for ( Iterator < Map . Entry < String , ProjectType > > it = projects . entrySet ( ) . iterator ( ) ; it
. hasNext ( ) ; ) {
. hasNext ( ) ; ) {
Map . Entry < String , ProjectType > entry = it . next ( ) ;
String value = entry . getValue ( ) . getTags ( ) . get ( tag ) ;
if ( ! tagValue . equals ( value ) ) {