Skip to content

Commit

Permalink
Merge pull request #3837 from DamnClin/slug-factories
Browse files Browse the repository at this point in the history
Factories for slugs
  • Loading branch information
DamnClin authored Oct 7, 2022
2 parents 1df6cff + e5ca909 commit 9a2802b
Show file tree
Hide file tree
Showing 80 changed files with 610 additions and 254 deletions.
2 changes: 1 addition & 1 deletion documentation/module-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MyModuleModuleConfiguration {
) {
return JHipsterModuleResource
.builder()
.slug("my-module")
.slug(JHLiteModuleSlug.MY_MODULE)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().build())
.apiDoc("Group", "This is my module")
.standalone()
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/tech/jhipster/lite/generator/JHLiteFeatureSlug.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package tech.jhipster.lite.generator;

import tech.jhipster.lite.module.domain.resource.JHipsterFeatureSlugFactory;

public enum JHLiteFeatureSlug implements JHipsterFeatureSlugFactory {
ANGULAR_AUTHENTICATION("angular-authentication"),
AUTHENTICATION("authentication"),
BANNER("banner"),
CACHE("cache"),
CLIENT_CORE("client-core"),
CUCUMBER_AUTHENTICATION("cucumber-authentication"),
DATABASE_MIGRATION("database-migration"),
DUMMY_PERSISTENCE("dummy-persistence"),
DUMMY_SCHEMA("dummy-schema"),
FRONT_BROWSER_TEST("front-browser-test"),
JAVA_BUILD_TOOL("java-build-tool"),
JPA_PERSISTENCE("jpa-persistence"),
SERVICE_DISCOVERY("service-discovery"),
SPRING_SERVER("spring-server"),
SPRINGDOC("springdoc"),
WEB_ERROR_MANAGEMENT("web-error-management");

private final String slug;

JHLiteFeatureSlug(String slug) {
this.slug = slug;
}

@Override
public String get() {
return slug;
}
}
108 changes: 108 additions & 0 deletions src/main/java/tech/jhipster/lite/generator/JHLiteModuleSlug.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package tech.jhipster.lite.generator;

import tech.jhipster.lite.module.domain.resource.JHipsterModuleSlugFactory;

public enum JHLiteModuleSlug implements JHipsterModuleSlugFactory {
ANGULAR_CORE("angular-core"),
ANGULAR_HEALTH("angular-health"),
ANGULAR_JWT("angular-jwt"),
ANGULAR_OAUTH_2("angular-oauth2"),
APPLICATION_SERVICE_HEXAGONAL_ARCHITECTURE_DOCUMENTATION("application-service-hexagonal-architecture-documentation"),
BANNER_JHIPSTER_V2("banner-jhipster-v2"),
BANNER_JHIPSTER_V3("banner-jhipster-v3"),
BANNER_JHIPSTER_V7("banner-jhipster-v7"),
BANNER_JHIPSTER_V7_REACT("banner-jhipster-v7-react"),
BANNER_JHIPSTER_V7_VUE("banner-jhipster-v7-vue"),
CONSUL("consul"),
CUSTOM_JHLITE("custom-jhlite"),
CYPRESS("cypress"),
DOCKERFILE("dockerfile"),
DUMMY_FEATURE("dummy-feature"),
DUMMY_JPA_PERSISTENCE("dummy-jpa-persistence"),
DUMMY_LIQUIBASE_CHANGELOG("dummy-liquibase-changelog"),
DUMMY_MONGODB_PERSITENCE("dummy-mongodb-persistence"),
DUMMY_NOT_POSTGRESQL_FLYWAY_CHANGELOG("dummy-not-postgresql-flyway-changelog"),
DUMMY_POSTGRESQL_FLYWAY_CHANGELOG("dummy-postgresql-flyway-changelog"),
EHCACHE_JAVA_CONFIG("ehcache-java-config"),
EHCACHE_XML_CONFIG("ehcache-xml-config"),
EUREKA_CLIENT("eureka-client"),
FLYWAY("flyway"),
FLYWAY_MYSQL("flyway-mysql"),
FRONTEND_MAVEN_PLUGIN("frontend-maven-plugin"),
GATEWAY("gateway"),
GITHUB_ACTIONS("github-actions"),
GITHUB_CODESPACES("github-codespaces"),
GITLAB_CI("gitlab-ci"),
GITPOD("gitpod"),
INFINITEST_FILTERS("infinitest-filters"),
INIT("init"),
JACOCO_CHECK_MIN_COVERAGE("jacoco-check-min-coverage"),
JAVA_ARCHUNIT("java-archunit"),
JAVA_BASE("java-base"),
JAVA_MEMOIZERS("java-memoizers"),
JIB("jib"),
JPA_PAGINATION("jpa-pagination"),
LIQUIBASE("liquibase"),
LOGSTASH("logstash"),
MARIADB("mariadb"),
MAVEN_JAVA("maven-java"),
MAVEN_WRAPPER("maven-wrapper"),
MONGOCK("mongock"),
MONGODB("mongodb"),
MSSQL("mssql"),
MYSQL("mysql"),
PAGINATION_DOMAIN("pagination-domain"),
PLAYWRIGHT("playwright"),
POSTGRESQL("postgresql"),
PRETTIER("prettier"),
REACT_CORE("react-core"),
REACT_JWT("react-jwt"),
REST_PAGINATION("rest-pagination"),
SONAR_JAVA_BACKEND("sonar-java-backend"),
SONAR_JAVA_BACKEND_AND_FRONTEND("sonar-java-backend-and-frontend"),
SPRING_BOOT("spring-boot"),
SPRING_BOOT_ACTUATOR("spring-boot-actuator"),
SPRING_BOOT_ASYNC("spring-boot-async"),
SPRING_BOOT_CACHE("spring-boot-cache"),
SPRING_BOOT_CUCUMBER("spring-boot-cucumber"),
SPRING_BOOT_CUCUMBER_JPA_RESET("spring-boot-cucumber-jpa-reset"),
SPRING_BOOT_CUCUMBER_JWT_AUTHENTICATION("spring-boot-cucumber-jwt-authentication"),
SPRING_BOOT_CUCUMBER_OAUTH_2_AUTHENTICATION("spring-boot-cucumber-oauth2-authentication"),
SPRING_BOOT_DEVTOOLS("spring-boot-devtools"),
SPRING_BOOT_JWT("spring-boot-jwt"),
SPRING_BOOT_JWT_BASIC_AUTH("spring-boot-jwt-basic-auth"),
SPRING_BOOT_KAFKA("spring-boot-kafka"),
SPRING_BOOT_KAFKA_AKHQ("spring-boot-kafka-akhq"),
SPRING_BOOT_KAFKA_DUMMY_PRODUCER_CONSUMER("spring-boot-kafka-dummy-producer-consumer"),
SPRING_BOOT_OAUTH_2("spring-boot-oauth2"),
SPRING_BOOT_OAUTH_2_ACCOUNT("spring-boot-oauth2-account"),
SPRING_BOOT_OAUTH_2_AUTH_0("spring-boot-oauth2-auth0"),
SPRING_BOOT_OAUTH_2_OKTA("spring-boot-oauth2-okta"),
SPRING_BOOT_PULSAR("spring-boot-pulsar"),
SPRING_BOOT_TOMCAT("spring-boot-tomcat"),
SPRING_BOOT_UNDERTOW("spring-boot-undertow"),
SPRING_BOOT_WEBFLUX_NETTY("spring-boot-webflux-netty"),
SPRING_CLOUD("spring-cloud"),
SPRINGDOC_JWT("springdoc-jwt"),
SPRINGDOC_MVC_OPENAPI("springdoc-mvc-openapi"),
SPRINGDOC_OAUTH_2("springdoc-oauth2"),
SPRINGDOC_OAUTH_2_AUTH_0("springdoc-oauth2-auth0"),
SPRINGDOC_OAUTH_2_OKTA("springdoc-oauth2-okta"),
SPRINGDOC_WEBFLUX_OPENAPI("springdoc-webflux-openapi"),
SVELTE("svelte"),
TYPESCRIPT("typescript"),
VUE_CORE("vue-core"),
VUE_PINIA("vue-pinia"),
ZALANDO_PROBLEMS("zalando-problems");

private final String slug;

JHLiteModuleSlug(String slug) {
this.slug = slug;
}

@Override
public String get() {
return slug;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tech.jhipster.lite.generator.buildtool.maven.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteFeatureSlug.*;
import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.buildtool.maven.application.MavenApplicationService;
Expand All @@ -14,10 +17,10 @@ class MavenModuleConfiguration {
JHipsterModuleResource mavenModule(MavenApplicationService maven) {
return JHipsterModuleResource
.builder()
.slug("maven-java")
.slug(MAVEN_JAVA)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().addProjectBaseName().addProjectName().build())
.apiDoc("Build Tool", "Init Maven project with pom.xml and wrapper")
.organization(JHipsterModuleOrganization.builder().feature("java-build-tool").addModuleDependency("init").build())
.organization(JHipsterModuleOrganization.builder().feature(JAVA_BUILD_TOOL).addDependency(INIT).build())
.tags("buildtool", "test")
.factory(maven::buildMavenModule);
}
Expand All @@ -26,7 +29,7 @@ JHipsterModuleResource mavenModule(MavenApplicationService maven) {
JHipsterModuleResource mavenWrapperModule(MavenApplicationService maven) {
return JHipsterModuleResource
.builder()
.slug("maven-wrapper")
.slug(MAVEN_WRAPPER)
.withoutProperties()
.apiDoc("Build Tool", "Add maven wrapper")
.standalone()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tech.jhipster.lite.generator.ci.github.actions.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.ci.github.actions.application.GitHubActionsApplicationService;
Expand All @@ -13,10 +15,10 @@ class GitHubActionsModuleConfiguration {
JHipsterModuleResource gutHubActionsModule(GitHubActionsApplicationService gitHubActions) {
return JHipsterModuleResource
.builder()
.slug("github-actions")
.slug(GITHUB_ACTIONS)
.withoutProperties()
.apiDoc("Continuous Integration", "Add GitHub Actions for Maven Build")
.organization(JHipsterModuleOrganization.builder().addModuleDependency("maven-java").build())
.organization(JHipsterModuleOrganization.builder().addDependency(MAVEN_JAVA).build())
.tags("ci", "github")
.factory(gitHubActions::buildModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tech.jhipster.lite.generator.ci.gitlab.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.ci.gitlab.application.GitLabCiApplicationService;
Expand All @@ -13,10 +15,10 @@ class GitLabCiModuleConfiguration {
JHipsterModuleResource gitlabCiModule(GitLabCiApplicationService gitlabCi) {
return JHipsterModuleResource
.builder()
.slug("gitlab-ci")
.slug(GITLAB_CI)
.withoutProperties()
.apiDoc("Continuous Integration", "Add GitLab CI for Maven Build")
.organization(JHipsterModuleOrganization.builder().addModuleDependency("maven-java").build())
.organization(JHipsterModuleOrganization.builder().addDependency(MAVEN_JAVA).build())
.tags("ci", "gitlab")
.factory(gitlabCi::buildModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tech.jhipster.lite.generator.client.angular.admin.health.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.client.angular.admin.health.application.AngularHealthApplicationService;
Expand All @@ -13,10 +15,10 @@ class AngularhealthModuleConfiguration {
JHipsterModuleResource angularHealthModule(AngularHealthApplicationService angularHealth) {
return JHipsterModuleResource
.builder()
.slug("angular-health")
.slug(ANGULAR_HEALTH)
.withoutProperties()
.apiDoc("Angular", "Angular Health")
.organization(JHipsterModuleOrganization.builder().addModuleDependency("angular-core").build())
.organization(JHipsterModuleOrganization.builder().addDependency(ANGULAR_CORE).build())
.tags("client", "angular", "health")
.factory(angularHealth::buildModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tech.jhipster.lite.generator.client.angular.core.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteFeatureSlug.*;
import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.client.angular.core.application.AngularApplicationService;
Expand All @@ -14,12 +17,10 @@ class AngularCoreModuleConfiguration {
JHipsterModuleResource angularModule(AngularApplicationService angular) {
return JHipsterModuleResource
.builder()
.slug("angular-core")
.slug(ANGULAR_CORE)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().addProjectBaseName().addProjectName().build())
.apiDoc("Angular", "Add Angular + Angular CLI")
.organization(
JHipsterModuleOrganization.builder().feature("client-core").addModuleDependency("init").addModuleDependency("prettier").build()
)
.organization(JHipsterModuleOrganization.builder().feature(CLIENT_CORE).addDependency(INIT).addDependency(PRETTIER).build())
.tags("client", "angular")
.factory(angular::buildInitModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tech.jhipster.lite.generator.client.angular.security.jwt.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteFeatureSlug.*;
import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.client.angular.security.jwt.application.AngularJwtApplicationService;
Expand All @@ -14,10 +17,10 @@ class AngularJwtModuleConfiguration {
JHipsterModuleResource angularJwtModule(AngularJwtApplicationService angularJwt) {
return JHipsterModuleResource
.builder()
.slug("angular-jwt")
.slug(ANGULAR_JWT)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addProjectBaseName().addIndentation().build())
.apiDoc("Angular", "Add Angular with authentication JWT")
.organization(JHipsterModuleOrganization.builder().feature("angular-authentication").addModuleDependency("angular-core").build())
.organization(JHipsterModuleOrganization.builder().feature(ANGULAR_AUTHENTICATION).addDependency(ANGULAR_CORE).build())
.tags("client", "angular")
.factory(angularJwt::buildModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tech.jhipster.lite.generator.client.angular.security.oauth2.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteFeatureSlug.*;
import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.client.angular.security.oauth2.application.AngularOauth2ApplicationService;
Expand All @@ -14,10 +17,10 @@ class AngularOAuth2ModuleConfiguration {
JHipsterModuleResource angularOAuth2Module(AngularOauth2ApplicationService angularOAuth2) {
return JHipsterModuleResource
.builder()
.slug("angular-oauth2")
.slug(ANGULAR_OAUTH_2)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addIndentation().build())
.apiDoc("Angular", "Add OAuth2 authentication")
.organization(JHipsterModuleOrganization.builder().feature("angular-authentication").addModuleDependency("angular-core").build())
.organization(JHipsterModuleOrganization.builder().feature(ANGULAR_AUTHENTICATION).addDependency(ANGULAR_CORE).build())
.tags("client", "angular")
.factory(angularOAuth2::buildModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tech.jhipster.lite.generator.client.react.core.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteFeatureSlug.*;
import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.client.react.core.application.ReactCoreApplicationService;
Expand All @@ -16,12 +19,10 @@ class ReactCoreModulesConfiguration {
JHipsterModuleResource reactCoreModule(ReactCoreApplicationService react) {
return JHipsterModuleResource
.builder()
.slug("react-core")
.slug(REACT_CORE)
.propertiesDefinition(properties())
.apiDoc("React", "Add React+Vite with minimal CSS")
.organization(
JHipsterModuleOrganization.builder().feature("client-core").addModuleDependency("init").addModuleDependency("prettier").build()
)
.organization(JHipsterModuleOrganization.builder().feature(CLIENT_CORE).addDependency(INIT).addDependency(PRETTIER).build())
.tags("client", REACT)
.factory(react::buildModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tech.jhipster.lite.generator.client.react.security.jwt.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.client.react.security.jwt.application.ReactJwtApplicationService;
Expand All @@ -14,10 +16,10 @@ class ReactJwtModuleConfiguration {
JHipsterModuleResource reactJwtModule(ReactJwtApplicationService reactJwt) {
return JHipsterModuleResource
.builder()
.slug("react-jwt")
.slug(REACT_JWT)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addIndentation().build())
.apiDoc("React", "Add JWT Login React")
.organization(JHipsterModuleOrganization.builder().addModuleDependency("react-core").build())
.organization(JHipsterModuleOrganization.builder().addDependency(REACT_CORE).build())
.tags("client", "react", "jwt")
.factory(reactJwt::buildModule);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tech.jhipster.lite.generator.client.svelte.core.infrastructure.primary;

import static tech.jhipster.lite.generator.JHLiteFeatureSlug.*;
import static tech.jhipster.lite.generator.JHLiteModuleSlug.*;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.client.svelte.core.application.SvelteApplicationService;
Expand All @@ -13,12 +16,10 @@ public class SvelteModuleConfiguration {
JHipsterModuleResource svelteModule(SvelteApplicationService svelteApplicationService) {
return JHipsterModuleResource
.builder()
.slug("svelte")
.slug(SVELTE)
.withoutProperties()
.apiDoc("Svelte", "Add Svelte")
.organization(
JHipsterModuleOrganization.builder().feature("client-core").addModuleDependency("init").addModuleDependency("prettier").build()
)
.organization(JHipsterModuleOrganization.builder().feature(CLIENT_CORE).addDependency(INIT).addDependency(PRETTIER).build())
.tags("client", "svelte")
.factory(svelteApplicationService::buildModule);
}
Expand Down
Loading

0 comments on commit 9a2802b

Please sign in to comment.