Skip to content

Commit 1112801

Browse files
committed
Merge branch 'dev' of github.com:jembi/JeMPI into dev_split_stream_processor
2 parents ceb0603 + b5183ea commit 1112801

File tree

6 files changed

+514
-317
lines changed

6 files changed

+514
-317
lines changed

JeMPI_Apps/JeMPI_API_KC/src/main/java/org/jembi/jempi/api/httpServer/httpServerRoutes/routes/UserRoutes.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ private Route routeLoginWithKeycloakRequest(final CheckHeader<UserSession> check
4343
return complete(StatusCodes.FORBIDDEN);
4444
}
4545
} else {
46-
return complete(StatusCodes.IM_A_TEAPOT);
46+
LOGGER.warn("IM_A_TEAPOT");
47+
return complete(GlobalConstants.IM_A_TEA_POT);
4748
}
4849
}));
4950
}

JeMPI_Apps/JeMPI_Controller/src/main/java/org/jembi/jempi/controller/HttpServer.java

+45-26
Original file line numberDiff line numberDiff line change
@@ -76,26 +76,28 @@ private CompletionStage<HttpResponse> getMU() {
7676
}
7777

7878
private Route onNotificationResolution(
79-
final ActorSystem<Void> actorSystem,
80-
final ActorRef<BackEnd.Event> backEnd) {
79+
final ActorSystem<Void> actorSystem,
80+
final ActorRef<BackEnd.Event> backEnd) {
8181
return entity(Jackson.unmarshaller(NotificationResolutionProcessorData.class),
82-
obj -> onComplete(BackEnd.askOnNotificationResolution(actorSystem, backEnd, obj), response -> {
83-
if (response.isSuccess() && Boolean.TRUE.equals(response.get().updated())) {
84-
return complete(StatusCodes.OK);
85-
} else {
86-
return complete(StatusCodes.IM_A_TEAPOT);
87-
}
88-
}));
82+
obj -> onComplete(BackEnd.askOnNotificationResolution(actorSystem, backEnd, obj), response -> {
83+
if (response.isSuccess() && Boolean.TRUE.equals(response.get().updated())) {
84+
return complete(StatusCodes.OK);
85+
} else {
86+
LOGGER.warn("IM_A_TEAPOT");
87+
return complete(GlobalConstants.IM_A_TEA_POT);
88+
}
89+
}));
8990
}
9091

9192
private Route routeDashboardData(
92-
final ActorSystem<Void> actorSystem,
93-
final ActorRef<BackEnd.Event> backEnd) {
93+
final ActorSystem<Void> actorSystem,
94+
final ActorRef<BackEnd.Event> backEnd) {
9495
return onComplete(BackEnd.askGetDashboardData(actorSystem, backEnd), response -> {
9596
if (response.isSuccess()) {
9697
return complete(StatusCodes.OK, response.get(), Jackson.marshaller());
9798
} else {
98-
return complete(StatusCodes.IM_A_TEAPOT);
99+
LOGGER.warn("IM_A_TEAPOT");
100+
return complete(GlobalConstants.IM_A_TEA_POT);
99101
}
100102
});
101103
}
@@ -105,12 +107,18 @@ private Route routeLinkInteraction() {
105107
try {
106108
LOGGER.debug("{}", obj);
107109
return onComplete(postLinkInteraction(obj),
108-
response -> response.isSuccess()
109-
? complete(response.get())
110-
: complete(StatusCodes.IM_A_TEAPOT));
110+
response -> {
111+
if (!response.isSuccess()) {
112+
LOGGER.warn("IM_A_TEAPOT");
113+
}
114+
return response.isSuccess()
115+
? complete(response.get())
116+
: complete(GlobalConstants.IM_A_TEA_POT);
117+
});
111118
} catch (JsonProcessingException e) {
119+
LOGGER.warn("IM_A_TEAPOT");
112120
LOGGER.error(e.getLocalizedMessage(), e);
113-
return complete(StatusCodes.IM_A_TEAPOT);
121+
return complete(GlobalConstants.IM_A_TEA_POT);
114122
}
115123
});
116124
}
@@ -119,21 +127,32 @@ private Route routeLinkInteractionToGid() {
119127
return entity(Jackson.unmarshaller(ApiModels.LinkInteractionToGidSyncBody.class), obj -> {
120128
try {
121129
return onComplete(postLinkInteractionToGid(obj),
122-
response -> response.isSuccess()
123-
? complete(response.get())
124-
: complete(ApiModels.getHttpErrorResponse(StatusCodes.IM_A_TEAPOT)));
130+
response -> {
131+
if (!response.isSuccess()) {
132+
LOGGER.warn("IM_A_TEAPOT");
133+
}
134+
return response.isSuccess()
135+
? complete(response.get())
136+
: complete(ApiModels.getHttpErrorResponse(GlobalConstants.IM_A_TEA_POT));
137+
});
125138
} catch (JsonProcessingException e) {
126139
LOGGER.error(e.getLocalizedMessage(), e);
127140
}
128-
return complete(ApiModels.getHttpErrorResponse(StatusCodes.IM_A_TEAPOT));
141+
LOGGER.warn("IM_A_TEAPOT");
142+
return complete(ApiModels.getHttpErrorResponse(GlobalConstants.IM_A_TEA_POT));
129143
});
130144
}
131145

132146
private Route routeMU() {
133147
return onComplete(getMU(),
134-
response -> response.isSuccess()
135-
? complete(response.get())
136-
: complete(StatusCodes.IM_A_TEAPOT));
148+
response -> {
149+
if (!response.isSuccess()) {
150+
LOGGER.warn("IM_A_TEAPOT");
151+
}
152+
return response.isSuccess()
153+
? complete(response.get())
154+
: complete(GlobalConstants.IM_A_TEA_POT);
155+
});
137156
}
138157

139158
private Route createRoute(
@@ -144,11 +163,11 @@ private Route createRoute(
144163
this::routeLinkInteraction),
145164
path(GlobalConstants.SEGMENT_PROXY_POST_LINK_INTERACTION_TO_GID,
146165
this::routeLinkInteractionToGid),
147-
path(GlobalConstants.SEGMENT_PROXY_ON_NOTIFICATION_RESOLUTION,
148-
() -> onNotificationResolution(actorSystem, backEnd)))),
166+
path(GlobalConstants.SEGMENT_PROXY_ON_NOTIFICATION_RESOLUTION,
167+
() -> onNotificationResolution(actorSystem, backEnd)))),
149168
get(() -> concat(path("mu", this::routeMU),
150169
path(GlobalConstants.SEGMENT_PROXY_GET_DASHBOARD_DATA,
151-
() -> routeDashboardData(actorSystem, backEnd))
170+
() -> routeDashboardData(actorSystem, backEnd))
152171
))));
153172
}
154173

0 commit comments

Comments
 (0)