Skip to content

Commit 5ff75d5

Browse files
Merge pull request #182 from PublicisSapient/feature/formatting-changes-15-1-0
formatting chnages
2 parents 686aca3 + 348c0e4 commit 5ff75d5

File tree

788 files changed

+50406
-40926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

788 files changed

+50406
-40926
lines changed

ai-data-processor/pom.xml

Lines changed: 237 additions & 252 deletions
Large diffs are not rendered by default.

ai-data-processor/src/main/java/com/publicissapient/kpidashboard/AiDataProcessorApplication.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99
import org.springframework.scheduling.annotation.EnableScheduling;
1010

1111
@SpringBootApplication
12-
@ComponentScan(basePackages = { "com.publicissapient", "com.knowhow.retro.notifications",
13-
"com.knowhow.retro.aigatewayclient" })
14-
@EnableMongoRepositories(basePackages = { "com.publicissapient.**.repository" })
12+
@ComponentScan(
13+
basePackages = {
14+
"com.publicissapient",
15+
"com.knowhow.retro.notifications",
16+
"com.knowhow.retro.aigatewayclient"
17+
})
18+
@EnableMongoRepositories(basePackages = {"com.publicissapient.**.repository"})
1519
@EnableBatchProcessing
1620
@EnableAsync
1721
@EnableScheduling
1822
public class AiDataProcessorApplication {
1923

20-
public static void main(String[] args) {
21-
SpringApplication.run(AiDataProcessorApplication.class, args);
22-
}
23-
}
24+
public static void main(String[] args) {
25+
SpringApplication.run(AiDataProcessorApplication.class, args);
26+
}
27+
}

ai-data-processor/src/main/java/com/publicissapient/kpidashboard/client/customapi/KnowHOWClient.java

Lines changed: 104 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,39 @@ public class KnowHOWClient {
4949

5050
private final WebClient knowHOWWebClient;
5151

52-
public KnowHOWClient(WebClient.Builder webClientBuilder, KnowHOWApiClientConfig knowHOWApiClientConfig) {
52+
public KnowHOWClient(
53+
WebClient.Builder webClientBuilder, KnowHOWApiClientConfig knowHOWApiClientConfig) {
5354
this.knowHOWApiClientConfig = knowHOWApiClientConfig;
5455

55-
this.knowHOWWebClient = webClientBuilder.defaultHeader("X-Api-Key", knowHOWApiClientConfig.getApiKey())
56-
.codecs(clientCodecConfigurer -> clientCodecConfigurer.defaultCodecs()
57-
.maxInMemorySize(MAX_IN_MEMORY_SIZE_BYTE_COUNT))
58-
.baseUrl(knowHOWApiClientConfig.getBaseUrl()).build();
59-
60-
this.semaphore = new Semaphore(knowHOWApiClientConfig.getRateLimiting().getMaxConcurrentCalls());
56+
this.knowHOWWebClient =
57+
webClientBuilder
58+
.defaultHeader("X-Api-Key", knowHOWApiClientConfig.getApiKey())
59+
.codecs(
60+
clientCodecConfigurer ->
61+
clientCodecConfigurer
62+
.defaultCodecs()
63+
.maxInMemorySize(MAX_IN_MEMORY_SIZE_BYTE_COUNT))
64+
.baseUrl(knowHOWApiClientConfig.getBaseUrl())
65+
.build();
66+
67+
this.semaphore =
68+
new Semaphore(knowHOWApiClientConfig.getRateLimiting().getMaxConcurrentCalls());
6169
}
6270

6371
public List<KpiElement> getKpiIntegrationValuesSync(Iterable<KpiRequest> kpiRequests) {
6472
List<KpiElement> allResults = new ArrayList<>();
6573

6674
for (KpiRequest kpiRequest : kpiRequests) {
67-
List<KpiElement> results = this.knowHOWWebClient.post()
68-
.uri(this.knowHOWApiClientConfig.getKpiIntegrationValuesEndpointConfig().getPath())
69-
.bodyValue(kpiRequest).retrieve().bodyToFlux(KpiElement.class).retryWhen(retrySpec()).collectList()
70-
.block();
75+
List<KpiElement> results =
76+
this.knowHOWWebClient
77+
.post()
78+
.uri(this.knowHOWApiClientConfig.getKpiIntegrationValuesEndpointConfig().getPath())
79+
.bodyValue(kpiRequest)
80+
.retrieve()
81+
.bodyToFlux(KpiElement.class)
82+
.retryWhen(retrySpec())
83+
.collectList()
84+
.block();
7185

7286
if (CollectionUtils.isNotEmpty(results)) {
7387
allResults.addAll(results);
@@ -81,10 +95,19 @@ public List<KpiElement> getKpiIntegrationValuesKanbanSync(Iterable<KpiRequest> k
8195
List<KpiElement> allResults = new ArrayList<>();
8296

8397
for (KpiRequest kpiRequest : kpiRequests) {
84-
List<KpiElement> results = this.knowHOWWebClient.post()
85-
.uri(this.knowHOWApiClientConfig.getKpiIntegrationValuesKanbanEndpointConfig().getPath())
86-
.bodyValue(kpiRequest).retrieve().bodyToFlux(KpiElement.class).retryWhen(retrySpec()).collectList()
87-
.block();
98+
List<KpiElement> results =
99+
this.knowHOWWebClient
100+
.post()
101+
.uri(
102+
this.knowHOWApiClientConfig
103+
.getKpiIntegrationValuesKanbanEndpointConfig()
104+
.getPath())
105+
.bodyValue(kpiRequest)
106+
.retrieve()
107+
.bodyToFlux(KpiElement.class)
108+
.retryWhen(retrySpec())
109+
.collectList()
110+
.block();
88111

89112
if (CollectionUtils.isNotEmpty(results)) {
90113
allResults.addAll(results);
@@ -95,44 +118,79 @@ public List<KpiElement> getKpiIntegrationValuesKanbanSync(Iterable<KpiRequest> k
95118
}
96119

97120
public List<KpiElement> getKpiIntegrationValuesAsync(List<KpiRequest> kpiRequests) {
98-
return Flux.fromIterable(kpiRequests).publishOn(Schedulers.boundedElastic()).flatMap(kpiRequest -> {
99-
try {
100-
semaphore.acquire();
101-
return this.knowHOWWebClient.post()
102-
.uri(this.knowHOWApiClientConfig.getKpiIntegrationValuesEndpointConfig().getPath())
103-
.bodyValue(kpiRequest).retrieve().bodyToFlux(KpiElement.class).retryWhen(retrySpec())
104-
.collectList().doFinally(signalType -> semaphore.release());
105-
} catch (InterruptedException e) {
106-
log.error("Could not get kpi integration values for kpiRequest {}", kpiRequest);
107-
Thread.currentThread().interrupt();
108-
return Flux.error(e);
109-
}
110-
}).flatMapIterable(list -> list).collectList().block();
121+
return Flux.fromIterable(kpiRequests)
122+
.publishOn(Schedulers.boundedElastic())
123+
.flatMap(
124+
kpiRequest -> {
125+
try {
126+
semaphore.acquire();
127+
return this.knowHOWWebClient
128+
.post()
129+
.uri(
130+
this.knowHOWApiClientConfig
131+
.getKpiIntegrationValuesEndpointConfig()
132+
.getPath())
133+
.bodyValue(kpiRequest)
134+
.retrieve()
135+
.bodyToFlux(KpiElement.class)
136+
.retryWhen(retrySpec())
137+
.collectList()
138+
.doFinally(signalType -> semaphore.release());
139+
} catch (InterruptedException e) {
140+
log.error("Could not get kpi integration values for kpiRequest {}", kpiRequest);
141+
Thread.currentThread().interrupt();
142+
return Flux.error(e);
143+
}
144+
})
145+
.flatMapIterable(list -> list)
146+
.collectList()
147+
.block();
111148
}
112149

113150
public List<KpiElement> getKpiIntegrationValuesKanbanAsync(List<KpiRequest> kpiRequests) {
114-
return Flux.fromIterable(kpiRequests).publishOn(Schedulers.boundedElastic()).flatMap(kpiRequest -> {
115-
try {
116-
semaphore.acquire();
117-
return this.knowHOWWebClient.post()
118-
.uri(this.knowHOWApiClientConfig.getKpiIntegrationValuesKanbanEndpointConfig().getPath())
119-
.bodyValue(kpiRequest).retrieve().bodyToFlux(KpiElement.class).retryWhen(retrySpec())
120-
.collectList().doFinally(signalType -> semaphore.release());
121-
} catch (InterruptedException e) {
122-
log.error("Could not get kpi integration values kanban for kpiRequest {}", kpiRequest);
123-
Thread.currentThread().interrupt();
124-
return Flux.error(e);
125-
}
126-
}).flatMapIterable(list -> list).collectList().block();
151+
return Flux.fromIterable(kpiRequests)
152+
.publishOn(Schedulers.boundedElastic())
153+
.flatMap(
154+
kpiRequest -> {
155+
try {
156+
semaphore.acquire();
157+
return this.knowHOWWebClient
158+
.post()
159+
.uri(
160+
this.knowHOWApiClientConfig
161+
.getKpiIntegrationValuesKanbanEndpointConfig()
162+
.getPath())
163+
.bodyValue(kpiRequest)
164+
.retrieve()
165+
.bodyToFlux(KpiElement.class)
166+
.retryWhen(retrySpec())
167+
.collectList()
168+
.doFinally(signalType -> semaphore.release());
169+
} catch (InterruptedException e) {
170+
log.error(
171+
"Could not get kpi integration values kanban for kpiRequest {}", kpiRequest);
172+
Thread.currentThread().interrupt();
173+
return Flux.error(e);
174+
}
175+
})
176+
.flatMapIterable(list -> list)
177+
.collectList()
178+
.block();
127179
}
128180

129181
private RetryBackoffSpec retrySpec() {
130-
return Retry
131-
.backoff(knowHOWApiClientConfig.getRetryPolicy().getMaxAttempts(),
132-
Duration.of(knowHOWApiClientConfig.getRetryPolicy().getMinBackoffDuration(),
182+
return Retry.backoff(
183+
knowHOWApiClientConfig.getRetryPolicy().getMaxAttempts(),
184+
Duration.of(
185+
knowHOWApiClientConfig.getRetryPolicy().getMinBackoffDuration(),
133186
knowHOWApiClientConfig.getRetryPolicy().getMinBackoffTimeUnit().toChronoUnit()))
134-
.filter(KnowHOWClient::shouldRetry).doBeforeRetry(retrySignal -> log.info("Retry #{} due to {}",
135-
retrySignal.totalRetries(), retrySignal.failure().toString()));
187+
.filter(KnowHOWClient::shouldRetry)
188+
.doBeforeRetry(
189+
retrySignal ->
190+
log.info(
191+
"Retry #{} due to {}",
192+
retrySignal.totalRetries(),
193+
retrySignal.failure().toString()));
136194
}
137195

138196
private static boolean shouldRetry(Throwable throwable) {

ai-data-processor/src/main/java/com/publicissapient/kpidashboard/client/customapi/config/KnowHOWApiClientConfig.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,30 @@
2828
@Configuration
2929
@ConfigurationProperties(prefix = "knowhow-api-config")
3030
public class KnowHOWApiClientConfig {
31-
private String baseUrl;
32-
private String apiKey;
31+
private String baseUrl;
32+
private String apiKey;
3333

34-
private final RateLimiting rateLimiting = new RateLimiting();
34+
private final RateLimiting rateLimiting = new RateLimiting();
3535

36-
private final RetryPolicy retryPolicy = new RetryPolicy();
36+
private final RetryPolicy retryPolicy = new RetryPolicy();
3737

38-
private final Map<String, EndpointConfig> endpoints = new HashMap<>();
38+
private final Map<String, EndpointConfig> endpoints = new HashMap<>();
3939

40-
@Data
41-
public static class RateLimiting {
42-
private int maxConcurrentCalls;
43-
}
40+
@Data
41+
public static class RateLimiting {
42+
private int maxConcurrentCalls;
43+
}
4444

45-
@Data
46-
public static class EndpointConfig {
47-
private String path;
48-
}
45+
@Data
46+
public static class EndpointConfig {
47+
private String path;
48+
}
4949

50-
public EndpointConfig getKpiIntegrationValuesEndpointConfig() {
51-
return this.endpoints.get("kpi-integration-values");
52-
}
50+
public EndpointConfig getKpiIntegrationValuesEndpointConfig() {
51+
return this.endpoints.get("kpi-integration-values");
52+
}
5353

54-
public EndpointConfig getKpiIntegrationValuesKanbanEndpointConfig() {
55-
return this.endpoints.get("kpi-integration-values-kanban");
56-
}
57-
}
54+
public EndpointConfig getKpiIntegrationValuesKanbanEndpointConfig() {
55+
return this.endpoints.get("kpi-integration-values-kanban");
56+
}
57+
}

ai-data-processor/src/main/java/com/publicissapient/kpidashboard/client/customapi/config/RetryPolicy.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
package com.publicissapient.kpidashboard.client.customapi.config;
1818

19-
import lombok.Data;
20-
2119
import java.util.concurrent.TimeUnit;
2220

21+
import lombok.Data;
22+
2323
@Data
2424
public class RetryPolicy {
25-
private int maxAttempts;
26-
private int minBackoffDuration;
27-
private TimeUnit minBackoffTimeUnit;
25+
private int maxAttempts;
26+
private int minBackoffDuration;
27+
private TimeUnit minBackoffTimeUnit;
2828
}

ai-data-processor/src/main/java/com/publicissapient/kpidashboard/client/customapi/deserializer/TrendValuesListDeserializer.java

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,37 @@
3737
@Slf4j
3838
public class TrendValuesListDeserializer extends JsonDeserializer<Object> {
3939

40-
private final ObjectMapper objectMapper = JsonMapper.builder()
41-
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).build();
40+
private final ObjectMapper objectMapper =
41+
JsonMapper.builder()
42+
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
43+
.build();
4244

4345
@Override
44-
public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
46+
public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
47+
throws IOException {
4548
List<?> trendValuesList = jsonParser.readValueAs(List.class);
4649

4750
List<DataCount> dataCountList = new ArrayList<>();
4851
List<DataCountGroup> dataCountGroupList = new ArrayList<>();
4952

5053
if (CollectionUtils.isNotEmpty(trendValuesList)) {
5154
LinkedHashMap<?, ?> linkedHashMap = (LinkedHashMap<?, ?>) trendValuesList.get(0);
52-
if (linkedHashMap.containsKey("filter") || linkedHashMap.containsKey("filter1")
55+
if (linkedHashMap.containsKey("filter")
56+
|| linkedHashMap.containsKey("filter1")
5357
|| linkedHashMap.containsKey("filter2")) {
54-
dataCountGroupList = trendValuesList.stream().map(trendValue -> {
55-
DataCountGroup dataCountGroup = objectMapper.convertValue(trendValue, DataCountGroup.class);
56-
List<?> dataCountGroupValues = dataCountGroup.getValue();
57-
if (CollectionUtils.isNotEmpty(dataCountGroupValues)) {
58-
dataCountGroup.setValue(convertToDataCountList(dataCountGroupValues));
59-
}
60-
return dataCountGroup;
61-
}).toList();
58+
dataCountGroupList =
59+
trendValuesList.stream()
60+
.map(
61+
trendValue -> {
62+
DataCountGroup dataCountGroup =
63+
objectMapper.convertValue(trendValue, DataCountGroup.class);
64+
List<?> dataCountGroupValues = dataCountGroup.getValue();
65+
if (CollectionUtils.isNotEmpty(dataCountGroupValues)) {
66+
dataCountGroup.setValue(convertToDataCountList(dataCountGroupValues));
67+
}
68+
return dataCountGroup;
69+
})
70+
.toList();
6271
} else {
6372
dataCountList = convertToDataCountList(trendValuesList);
6473
}
@@ -73,14 +82,21 @@ public Object deserialize(JsonParser jsonParser, DeserializationContext deserial
7382
}
7483

7584
private List<DataCount> convertToDataCountList(List<?> trendValuesList) {
76-
return trendValuesList.stream().map(trendValue -> {
77-
DataCount dataCount = objectMapper.convertValue(trendValue, DataCount.class);
78-
List<?> dataCountValues = (List<?>) dataCount.getValue();
79-
if (CollectionUtils.isNotEmpty(dataCountValues)) {
80-
dataCount.setValue(dataCountValues.stream()
81-
.map(dataCountValue -> objectMapper.convertValue(dataCountValue, DataCount.class)).toList());
82-
}
83-
return dataCount;
84-
}).toList();
85+
return trendValuesList.stream()
86+
.map(
87+
trendValue -> {
88+
DataCount dataCount = objectMapper.convertValue(trendValue, DataCount.class);
89+
List<?> dataCountValues = (List<?>) dataCount.getValue();
90+
if (CollectionUtils.isNotEmpty(dataCountValues)) {
91+
dataCount.setValue(
92+
dataCountValues.stream()
93+
.map(
94+
dataCountValue ->
95+
objectMapper.convertValue(dataCountValue, DataCount.class))
96+
.toList());
97+
}
98+
return dataCount;
99+
})
100+
.toList();
85101
}
86102
}

ai-data-processor/src/main/java/com/publicissapient/kpidashboard/client/customapi/dto/IssueKpiModalValue.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
@JsonIgnoreProperties(ignoreUnknown = true)
2828
public class IssueKpiModalValue {
2929

30-
@JsonProperty("Issue Id")
31-
private String issueId;
30+
@JsonProperty("Issue Id")
31+
private String issueId;
3232

33-
private Integer issueBlockedTime;
34-
private Integer issueWaitTime;
33+
private Integer issueBlockedTime;
34+
private Integer issueWaitTime;
3535

36-
private Map<String, Integer> categoryWiseDelay;
36+
private Map<String, Integer> categoryWiseDelay;
3737
}

0 commit comments

Comments
 (0)