From 0524464df7b86a94dbb36333c2718c2b3bef0cc7 Mon Sep 17 00:00:00 2001 From: Nizamul Kazi Date: Mon, 20 Nov 2023 22:11:22 -0400 Subject: [PATCH 1/7] refactor: "rename variable" refactoring sonar fix : https://sonarcloud.io/project/issues?resolved=false&id=jhipster_jhipster-online&open=AYqxq8ho8OMF9QyE-Uh6 --- .../jhipster/online/web/rest/GitResource.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/github/jhipster/online/web/rest/GitResource.java b/src/main/java/io/github/jhipster/online/web/rest/GitResource.java index afe90a33..fd27292d 100644 --- a/src/main/java/io/github/jhipster/online/web/rest/GitResource.java +++ b/src/main/java/io/github/jhipster/online/web/rest/GitResource.java @@ -154,7 +154,7 @@ public RedirectView callback(@PathVariable String gitProvider, String code) { String jsonResponse = response.thenApply(HttpResponse::body).get(5, TimeUnit.SECONDS); GitAccessTokenResponse accessTokenResponse = objectMapper.readValue(jsonResponse, GitAccessTokenResponse.class); - this.userService.saveToken(accessTokenResponse.getAccess_token(), gitProviderEnum); + this.userService.saveToken(accessTokenResponse.getAccessToken(), gitProviderEnum); } catch (InterruptedException e) { log.warn("Interrupted!", e); // Restore interrupted state... @@ -258,14 +258,14 @@ public String toString() { @JsonIgnoreProperties(ignoreUnknown = true) public static class GitAccessTokenResponse { - private String access_token; + private String accessToken; - public String getAccess_token() { - return access_token; + public String getAccessToken() { + return accessToken; } - public void setAccess_token(String access_token) { - this.access_token = access_token; + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; } } @@ -333,8 +333,8 @@ public void setAccess_token(String access_token) { ) { Optional maybeGitProvider = GitProvider.getGitProviderByValue(gitProvider); return maybeGitProvider - .map( - gitProvider1 -> new ResponseEntity<>(this.userService.getProjects(companyName, gitProvider1), HttpStatus.OK) + .map(gitProvider1 -> + new ResponseEntity<>(this.userService.getProjects(companyName, gitProvider1), HttpStatus.OK) ) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } @@ -358,4 +358,4 @@ public void setAccess_token(String access_token) { return new ResponseEntity<>(result, HttpStatus.OK); } -} +} \ No newline at end of file From 6b074be6f92c656fd66db142a5389db5fce05c69 Mon Sep 17 00:00:00 2001 From: Nizamul Kazi Date: Mon, 20 Nov 2023 22:12:17 -0400 Subject: [PATCH 2/7] refactor: "extract method" refactoring for maintainance --- .../io/github/jhipster/online/domain/Jdl.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/jhipster/online/domain/Jdl.java b/src/main/java/io/github/jhipster/online/domain/Jdl.java index 1d67e9c9..6b33436d 100644 --- a/src/main/java/io/github/jhipster/online/domain/Jdl.java +++ b/src/main/java/io/github/jhipster/online/domain/Jdl.java @@ -80,16 +80,36 @@ public void setJdlMetadata(JdlMetadata jdlMetadata) { @Override public boolean equals(Object o) { - if (this == o) { + if (isSameObject(o)) { return true; } - if (o == null || getClass() != o.getClass()) { + + if (isNotSameType(o)) { return false; } + Jdl jdlMetadataObject = (Jdl) o; - if (jdlMetadataObject.getId() == null || getId() == null) { + + if (areIdsNull(jdlMetadataObject)) { return false; } + + return isSameId(jdlMetadataObject); + } + + private boolean isSameObject(Object o) { + return this == o; + } + + private boolean isNotSameType(Object o) { + return o == null || getClass() != o.getClass(); + } + + private boolean areIdsNull(Jdl jdlMetadataObject) { + return jdlMetadataObject.getId() == null || getId() == null; + } + + private boolean isSameId(Jdl jdlMetadataObject) { return Objects.equals(getId(), jdlMetadataObject.getId()); } @@ -102,4 +122,4 @@ public int hashCode() { public String toString() { return "JdlMetadata{" + "id=" + getId() + "}"; } -} +} \ No newline at end of file From 7a08e9185a08d0cf7b4a0bb4d9f847e36de421d3 Mon Sep 17 00:00:00 2001 From: Nizamul Kazi Date: Mon, 20 Nov 2023 22:12:52 -0400 Subject: [PATCH 3/7] refactor: introduced "explaining variables" for extremely lengthy string --- .../github/jhipster/online/domain/YoRC.java | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/main/java/io/github/jhipster/online/domain/YoRC.java b/src/main/java/io/github/jhipster/online/domain/YoRC.java index 34b4702e..598c93ed 100644 --- a/src/main/java/io/github/jhipster/online/domain/YoRC.java +++ b/src/main/java/io/github/jhipster/online/domain/YoRC.java @@ -748,7 +748,7 @@ public int hashCode() { @Override public String toString() { - return ( + String basicInfo = "YoRC{" + "id=" + getId() + @@ -781,17 +781,12 @@ public String toString() { "'" + ", userLanguage='" + getUserLanguage() + - "'" + - ", year=" + - getYear() + - ", month=" + - getMonth() + - ", week=" + - getWeek() + - ", day=" + - getDay() + - ", hour=" + - getHour() + + "'"; + + String dateTimeInfo = + ", year=" + getYear() + ", month=" + getMonth() + ", week=" + getWeek() + ", day=" + getDay() + ", hour=" + getHour(); + + String serverInfo = ", serverPort='" + getServerPort() + "'" + @@ -806,7 +801,9 @@ public String toString() { "'" + ", websocket='" + isWebsocket() + - "'" + + "'"; + + String databaseInfo = ", databaseType='" + getDatabaseType() + "'" + @@ -815,7 +812,9 @@ public String toString() { "'" + ", prodDatabaseType='" + getProdDatabaseType() + - "'" + + "'"; + + String serviceInfo = ", searchEngine='" + isSearchEngine() + "'" + @@ -830,7 +829,9 @@ public String toString() { "'" + ", enableSwaggerCodegen='" + isEnableSwaggerCodegen() + - "'" + + "'"; + + String clientInfo = ", clientFramework='" + getClientFramework() + "'" + @@ -842,7 +843,9 @@ public String toString() { "'" + ", clientPackageManager='" + getClientPackageManager() + - "'" + + "'"; + + String applicationInfo = ", applicationType='" + getApplicationType() + "'" + @@ -854,7 +857,9 @@ public String toString() { "'" + ", nativeLanguage='" + getNativeLanguage() + - "'" + + "'"; + + String testingInfo = ", hasProtractor='" + isHasProtractor() + "'" + @@ -863,8 +868,8 @@ public String toString() { "'" + ", hasCucumber='" + isHasCucumber() + - "'" + - "}" - ); + "'}"; + + return basicInfo + dateTimeInfo + serverInfo + databaseInfo + serviceInfo + clientInfo + applicationInfo + testingInfo; } -} +} \ No newline at end of file From 7006e1e4965286cc4cb84f567cec4fc07fd1144d Mon Sep 17 00:00:00 2001 From: Nizamul Kazi Date: Mon, 20 Nov 2023 22:13:17 -0400 Subject: [PATCH 4/7] refactor: "pulled up" a common variable --- .../github/jhipster/online/service/EntityStatsService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/jhipster/online/service/EntityStatsService.java b/src/main/java/io/github/jhipster/online/service/EntityStatsService.java index e2e9e02d..b8c195b6 100644 --- a/src/main/java/io/github/jhipster/online/service/EntityStatsService.java +++ b/src/main/java/io/github/jhipster/online/service/EntityStatsService.java @@ -56,6 +56,8 @@ public class EntityStatsService { private final EntityStatsMapper entityStatsMapper; + private final CriteriaBuilder builder; + public EntityStatsService( EntityStatsRepository entityStatsRepository, EntityManager entityManager, @@ -64,6 +66,7 @@ public EntityStatsService( this.entityStatsRepository = entityStatsRepository; this.entityManager = entityManager; this.entityStatsMapper = entityStatsMapper; + this.builder = entityManager.getCriteriaBuilder(); } /** @@ -118,7 +121,6 @@ public void deleteByOwner(GeneratorIdentity owner) { } public List getCount(Instant after, TemporalValueType dbTemporalFunction) { - CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery query = builder.createQuery(RawSQL.class); Root root = query.from(EntityStats.class); ParameterExpression parameter = builder.parameter(Instant.class, QueryUtil.DATE); @@ -132,7 +134,6 @@ public List getCount(Instant after, TemporalValueType dbTempor } public List getFieldCount(Instant after, EntityStatColumn field, TemporalValueType dbTemporalFunction) { - CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery query = builder.createQuery(RawSQLField.class); Root root = query.from(EntityStats.class); ParameterExpression parameter = builder.parameter(Instant.class, QueryUtil.DATE); @@ -151,4 +152,4 @@ public List getFieldCount(Instant after, EntityStatColu return QueryUtil.createDistributionQueryAndCollectData(after, dbTemporalFunction, query, entityManager); } -} +} \ No newline at end of file From 07b81d250498fe93ac98ffa26a5a3c68620c6ec5 Mon Sep 17 00:00:00 2001 From: Nizamul Kazi Date: Mon, 20 Nov 2023 22:13:45 -0400 Subject: [PATCH 5/7] refactor: "pushed down" a local variable --- .../jhipster/online/service/GitService.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/jhipster/online/service/GitService.java b/src/main/java/io/github/jhipster/online/service/GitService.java index 0e4beb35..7d2a7674 100644 --- a/src/main/java/io/github/jhipster/online/service/GitService.java +++ b/src/main/java/io/github/jhipster/online/service/GitService.java @@ -57,17 +57,18 @@ public void pushNewApplicationToGit(User user, File workingDir, String organizat commit(git, workingDir, "Initial application generation by JHipster"); log.debug("Adding remote repository {} / {}", organization, applicationName); - URIish urIish = null; + + RemoteAddCommand remoteAddCommand = git.remoteAdd(); + remoteAddCommand.setName("origin"); + if (gitProvider.equals(GitProvider.GITHUB)) { - urIish = new URIish(applicationProperties.getGithub().getHost() + "/" + organization + "/" + applicationName + ".git"); + URIish urIish = new URIish(applicationProperties.getGithub().getHost() + "/" + organization + "/" + applicationName + ".git"); + remoteAddCommand.setUri(urIish); } else if (gitProvider.equals(GitProvider.GITLAB)) { - urIish = - new URIish(applicationProperties.getGitlab().getHost() + "/" + organization + "/" + applicationName + ".git") + URIish urIish = new URIish(applicationProperties.getGitlab().getHost() + "/" + organization + "/" + applicationName + ".git") .setPass(user.getGitlabOAuthToken()); + remoteAddCommand.setUri(urIish); } - RemoteAddCommand remoteAddCommand = git.remoteAdd(); - remoteAddCommand.setName("origin"); - remoteAddCommand.setUri(urIish); remoteAddCommand.call(); String currentBranch = git.getRepository().getFullBranch(); @@ -161,4 +162,4 @@ private CredentialsProvider getCredentialProvider(User user, GitProvider gitProv } return null; } -} +} \ No newline at end of file From cae435b846ad393d893c552919e6e35c2529fac0 Mon Sep 17 00:00:00 2001 From: Nizamul Kazi Date: Mon, 20 Nov 2023 22:14:09 -0400 Subject: [PATCH 6/7] refactor: "extracted class" for encapsulation --- .../online/service/SubGenEventService.java | 84 ++----------- .../util/SubGenEventStatisticsService.java | 112 ++++++++++++++++++ 2 files changed, 121 insertions(+), 75 deletions(-) create mode 100644 src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java diff --git a/src/main/java/io/github/jhipster/online/service/SubGenEventService.java b/src/main/java/io/github/jhipster/online/service/SubGenEventService.java index 1d2633e4..f6e63157 100644 --- a/src/main/java/io/github/jhipster/online/service/SubGenEventService.java +++ b/src/main/java/io/github/jhipster/online/service/SubGenEventService.java @@ -21,24 +21,16 @@ import io.github.jhipster.online.domain.GeneratorIdentity; import io.github.jhipster.online.domain.SubGenEvent; -import io.github.jhipster.online.domain.SubGenEvent_; import io.github.jhipster.online.domain.enums.SubGenEventType; import io.github.jhipster.online.repository.SubGenEventRepository; -import io.github.jhipster.online.service.dto.RawSQLField; import io.github.jhipster.online.service.dto.SubGenEventDTO; import io.github.jhipster.online.service.dto.TemporalCountDTO; import io.github.jhipster.online.service.dto.TemporalDistributionDTO; import io.github.jhipster.online.service.enums.TemporalValueType; import io.github.jhipster.online.service.mapper.SubGenEventMapper; -import io.github.jhipster.online.service.util.QueryUtil; +import io.github.jhipster.online.service.util.SubGenEventStatisticsService; import java.time.Instant; import java.util.*; -import java.util.stream.Collectors; -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.ParameterExpression; -import javax.persistence.criteria.Root; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -55,18 +47,18 @@ public class SubGenEventService { private final SubGenEventRepository subGenEventRepository; - private final EntityManager entityManager; - private final SubGenEventMapper subGenEventMapper; + private final SubGenEventStatisticsService subGenEventStatisticsService; + public SubGenEventService( SubGenEventRepository subGenEventRepository, - EntityManager entityManager, - SubGenEventMapper subGenEventMapper + SubGenEventMapper subGenEventMapper, + SubGenEventStatisticsService subGenEventStatisticsService ) { this.subGenEventRepository = subGenEventRepository; - this.entityManager = entityManager; this.subGenEventMapper = subGenEventMapper; + this.subGenEventStatisticsService = subGenEventStatisticsService; } /** @@ -121,68 +113,10 @@ public void deleteByOwner(GeneratorIdentity owner) { } public List getFieldCount(Instant after, SubGenEventType field, TemporalValueType dbTemporalFunction) { - CriteriaBuilder builder = entityManager.getCriteriaBuilder(); - CriteriaQuery query = builder.createQuery(RawSQLField.class); - Root root = query.from(SubGenEvent.class); - ParameterExpression dateParameter = builder.parameter(Instant.class, QueryUtil.DATE); - ParameterExpression typeParameter = builder.parameter(String.class, QueryUtil.TYPE); - - query - .select( - builder.construct( - RawSQLField.class, - root.get(dbTemporalFunction.getFieldName()), - root.get(SubGenEvent_.type), - builder.count(root) - ) - ) - .where( - builder.greaterThan(root.get(SubGenEvent_.date).as(Instant.class), dateParameter), - builder.equal(root.get(SubGenEvent_.type), typeParameter) - ) - .groupBy(root.get(SubGenEvent_.type), root.get(dbTemporalFunction.getFieldName())); - - return entityManager - .createQuery(query) - .setParameter(QueryUtil.DATE, after) - .setParameter(QueryUtil.TYPE, field.getDatabaseValue()) - .getResultList() - .stream() - .map( - entry -> - new TemporalCountDTO( - TemporalValueType.absoluteMomentToInstant(entry.getMoment().longValue(), dbTemporalFunction), - entry.getCount() - ) - ) - .collect(Collectors.toList()); + return subGenEventStatisticsService.getFieldCount(after, field, dbTemporalFunction); } public List getDeploymentToolDistribution(Instant after, TemporalValueType dbTemporalFunction) { - Map> entries = Arrays - .stream(SubGenEventType.getDeploymentTools()) - .map(deploymentTool -> new AbstractMap.SimpleEntry<>(deploymentTool, getFieldCount(after, deploymentTool, dbTemporalFunction))) - .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue)); - - List result = new ArrayList<>(); - for (Map.Entry> entry : entries.entrySet()) { - for (TemporalCountDTO count : entry.getValue()) { - Optional maybeDistribution = result - .stream() - .filter(td -> td.getDate().equals(count.getDate())) - .findFirst(); - TemporalDistributionDTO distributionDTO; - if (maybeDistribution.isPresent()) { - distributionDTO = maybeDistribution.get(); - } else { - distributionDTO = new TemporalDistributionDTO(count.getDate()); - result.add(distributionDTO); - } - - distributionDTO.getValues().put(entry.getKey().getDatabaseValue(), count.getCount()); - } - } - - return result; + return subGenEventStatisticsService.getDeploymentToolDistribution(after, dbTemporalFunction); } -} +} \ No newline at end of file diff --git a/src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java b/src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java new file mode 100644 index 00000000..5948b2c4 --- /dev/null +++ b/src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java @@ -0,0 +1,112 @@ +/** + * Copyright 2017-2023 the original author or authors from the JHipster project. + * + * This file is part of the JHipster Online project, see https://github.com/jhipster/jhipster-online + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.github.jhipster.online.service.util; + +import io.github.jhipster.online.domain.SubGenEvent; +import io.github.jhipster.online.domain.SubGenEvent_; +import io.github.jhipster.online.domain.enums.SubGenEventType; +import io.github.jhipster.online.service.dto.RawSQLField; +import io.github.jhipster.online.service.dto.TemporalCountDTO; +import io.github.jhipster.online.service.dto.TemporalDistributionDTO; +import io.github.jhipster.online.service.enums.TemporalValueType; +import java.time.Instant; +import java.util.*; +import java.util.stream.Collectors; +import javax.persistence.EntityManager; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.ParameterExpression; +import javax.persistence.criteria.Root; +import org.springframework.stereotype.Service; + +@Service +public class SubGenEventStatisticsService { + + private final EntityManager entityManager; + + public SubGenEventStatisticsService(EntityManager entityManager) { + this.entityManager = entityManager; + } + + public List getFieldCount(Instant after, SubGenEventType field, TemporalValueType dbTemporalFunction) { + CriteriaBuilder builder = entityManager.getCriteriaBuilder(); + CriteriaQuery query = builder.createQuery(RawSQLField.class); + Root root = query.from(SubGenEvent.class); + ParameterExpression dateParameter = builder.parameter(Instant.class, QueryUtil.DATE); + ParameterExpression typeParameter = builder.parameter(String.class, QueryUtil.TYPE); + + query + .select( + builder.construct( + RawSQLField.class, + root.get(dbTemporalFunction.getFieldName()), + root.get(SubGenEvent_.type), + builder.count(root) + ) + ) + .where( + builder.greaterThan(root.get(SubGenEvent_.date).as(Instant.class), dateParameter), + builder.equal(root.get(SubGenEvent_.type), typeParameter) + ) + .groupBy(root.get(SubGenEvent_.type), root.get(dbTemporalFunction.getFieldName())); + + return entityManager + .createQuery(query) + .setParameter(QueryUtil.DATE, after) + .setParameter(QueryUtil.TYPE, field.getDatabaseValue()) + .getResultList() + .stream() + .map(entry -> + new TemporalCountDTO( + TemporalValueType.absoluteMomentToInstant(entry.getMoment().longValue(), dbTemporalFunction), + entry.getCount() + ) + ) + .collect(Collectors.toList()); + } + + public List getDeploymentToolDistribution(Instant after, TemporalValueType dbTemporalFunction) { + Map> entries = Arrays + .stream(SubGenEventType.getDeploymentTools()) + .map(deploymentTool -> new AbstractMap.SimpleEntry<>(deploymentTool, getFieldCount(after, deploymentTool, dbTemporalFunction))) + .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue)); + + List result = new ArrayList<>(); + for (Map.Entry> entry : entries.entrySet()) { + for (TemporalCountDTO count : entry.getValue()) { + Optional maybeDistribution = result + .stream() + .filter(td -> td.getDate().equals(count.getDate())) + .findFirst(); + TemporalDistributionDTO distributionDTO; + if (maybeDistribution.isPresent()) { + distributionDTO = maybeDistribution.get(); + } else { + distributionDTO = new TemporalDistributionDTO(count.getDate()); + result.add(distributionDTO); + } + + distributionDTO.getValues().put(entry.getKey().getDatabaseValue(), count.getCount()); + } + } + + return result; + } +} \ No newline at end of file From 7c8e54b21ba025879c55f3742874b1802728a62c Mon Sep 17 00:00:00 2001 From: Nizamul Kazi Date: Tue, 21 Nov 2023 10:20:44 -0400 Subject: [PATCH 7/7] fix: prettier issues --- .../io/github/jhipster/online/domain/Jdl.java | 5 +++-- .../io/github/jhipster/online/domain/YoRC.java | 2 +- .../online/service/EntityStatsService.java | 2 +- .../jhipster/online/service/GitService.java | 4 ++-- .../online/service/SubGenEventService.java | 2 +- .../util/SubGenEventStatisticsService.java | 15 ++++++++------- .../jhipster/online/web/rest/GitResource.java | 6 +++--- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/java/io/github/jhipster/online/domain/Jdl.java b/src/main/java/io/github/jhipster/online/domain/Jdl.java index 6b33436d..2dedaa00 100644 --- a/src/main/java/io/github/jhipster/online/domain/Jdl.java +++ b/src/main/java/io/github/jhipster/online/domain/Jdl.java @@ -48,7 +48,8 @@ public class Jdl implements Serializable { @JsonIgnore private JdlMetadata jdlMetadata; - // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove + // jhipster-needle-entity-add-field - Jhipster will add fields here, do not + // remove public Long getId() { return id; } @@ -122,4 +123,4 @@ public int hashCode() { public String toString() { return "JdlMetadata{" + "id=" + getId() + "}"; } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/jhipster/online/domain/YoRC.java b/src/main/java/io/github/jhipster/online/domain/YoRC.java index 598c93ed..10a39fa7 100644 --- a/src/main/java/io/github/jhipster/online/domain/YoRC.java +++ b/src/main/java/io/github/jhipster/online/domain/YoRC.java @@ -872,4 +872,4 @@ public String toString() { return basicInfo + dateTimeInfo + serverInfo + databaseInfo + serviceInfo + clientInfo + applicationInfo + testingInfo; } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/jhipster/online/service/EntityStatsService.java b/src/main/java/io/github/jhipster/online/service/EntityStatsService.java index b8c195b6..4a27d8fb 100644 --- a/src/main/java/io/github/jhipster/online/service/EntityStatsService.java +++ b/src/main/java/io/github/jhipster/online/service/EntityStatsService.java @@ -152,4 +152,4 @@ public List getFieldCount(Instant after, EntityStatColu return QueryUtil.createDistributionQueryAndCollectData(after, dbTemporalFunction, query, entityManager); } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/jhipster/online/service/GitService.java b/src/main/java/io/github/jhipster/online/service/GitService.java index 7d2a7674..1e09910b 100644 --- a/src/main/java/io/github/jhipster/online/service/GitService.java +++ b/src/main/java/io/github/jhipster/online/service/GitService.java @@ -66,7 +66,7 @@ public void pushNewApplicationToGit(User user, File workingDir, String organizat remoteAddCommand.setUri(urIish); } else if (gitProvider.equals(GitProvider.GITLAB)) { URIish urIish = new URIish(applicationProperties.getGitlab().getHost() + "/" + organization + "/" + applicationName + ".git") - .setPass(user.getGitlabOAuthToken()); + .setPass(user.getGitlabOAuthToken()); remoteAddCommand.setUri(urIish); } remoteAddCommand.call(); @@ -162,4 +162,4 @@ private CredentialsProvider getCredentialProvider(User user, GitProvider gitProv } return null; } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/jhipster/online/service/SubGenEventService.java b/src/main/java/io/github/jhipster/online/service/SubGenEventService.java index f6e63157..5b025788 100644 --- a/src/main/java/io/github/jhipster/online/service/SubGenEventService.java +++ b/src/main/java/io/github/jhipster/online/service/SubGenEventService.java @@ -119,4 +119,4 @@ public List getFieldCount(Instant after, SubGenEventType field public List getDeploymentToolDistribution(Instant after, TemporalValueType dbTemporalFunction) { return subGenEventStatisticsService.getDeploymentToolDistribution(after, dbTemporalFunction); } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java b/src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java index 5948b2c4..46fe5f1e 100644 --- a/src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java +++ b/src/main/java/io/github/jhipster/online/service/util/SubGenEventStatisticsService.java @@ -17,7 +17,7 @@ * limitations under the License. */ - package io.github.jhipster.online.service.util; +package io.github.jhipster.online.service.util; import io.github.jhipster.online.domain.SubGenEvent; import io.github.jhipster.online.domain.SubGenEvent_; @@ -73,11 +73,12 @@ public List getFieldCount(Instant after, SubGenEventType field .setParameter(QueryUtil.TYPE, field.getDatabaseValue()) .getResultList() .stream() - .map(entry -> - new TemporalCountDTO( - TemporalValueType.absoluteMomentToInstant(entry.getMoment().longValue(), dbTemporalFunction), - entry.getCount() - ) + .map( + entry -> + new TemporalCountDTO( + TemporalValueType.absoluteMomentToInstant(entry.getMoment().longValue(), dbTemporalFunction), + entry.getCount() + ) ) .collect(Collectors.toList()); } @@ -109,4 +110,4 @@ public List getDeploymentToolDistribution(Instant after return result; } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/jhipster/online/web/rest/GitResource.java b/src/main/java/io/github/jhipster/online/web/rest/GitResource.java index fd27292d..dc644f37 100644 --- a/src/main/java/io/github/jhipster/online/web/rest/GitResource.java +++ b/src/main/java/io/github/jhipster/online/web/rest/GitResource.java @@ -333,8 +333,8 @@ public void setAccessToken(String accessToken) { ) { Optional maybeGitProvider = GitProvider.getGitProviderByValue(gitProvider); return maybeGitProvider - .map(gitProvider1 -> - new ResponseEntity<>(this.userService.getProjects(companyName, gitProvider1), HttpStatus.OK) + .map( + gitProvider1 -> new ResponseEntity<>(this.userService.getProjects(companyName, gitProvider1), HttpStatus.OK) ) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } @@ -358,4 +358,4 @@ public void setAccessToken(String accessToken) { return new ResponseEntity<>(result, HttpStatus.OK); } -} \ No newline at end of file +}