Stupid coding error of using OR instead of AND.
Also Mono.zipping the update Action and update Layout instead of this.then because in some optimization done by Spring, one mono doesnt end up emitting.
This commit is contained in:
parent
01dd54eaea
commit
3692b4fa3e
|
|
@ -23,4 +23,5 @@ public interface ActionService extends CrudService<Action, String> {
|
|||
|
||||
Object variableSubstitution(Object configuration, Map<String, String> replaceParamsMap);
|
||||
|
||||
Flux<Action> findByPageId(String pageId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -464,6 +464,11 @@ public class ActionServiceImpl extends BaseService<ActionRepository, Action, Str
|
|||
return configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Action> findByPageId(String pageId) {
|
||||
return repository.findByPageId(pageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param template : This is the string which contains {{key}} which would be replaced with value
|
||||
* @param name : This is the class name of the object from which template string was created
|
||||
|
|
|
|||
|
|
@ -317,7 +317,6 @@ public class LayoutActionServiceImpl implements LayoutActionService {
|
|||
if (pageId != null) {
|
||||
params.add(FieldName.PAGE_ID, pageId);
|
||||
}
|
||||
Flux<Action> actionsInPageFlux = actionService.get(params);
|
||||
|
||||
Mono<Page> updatePageMono = pageService
|
||||
.findById(pageId)
|
||||
|
|
@ -349,7 +348,8 @@ public class LayoutActionServiceImpl implements LayoutActionService {
|
|||
return Mono.just(page);
|
||||
});
|
||||
|
||||
Mono<Set<Object>> updateActionsMono = actionsInPageFlux
|
||||
Mono<Set<String>> updateActionsMono = actionService
|
||||
.findByPageId(pageId)
|
||||
/*
|
||||
* Assuming that the datasource should not be dependent on the widget and hence not going through the same
|
||||
* to look for replacement pattern.
|
||||
|
|
@ -359,7 +359,7 @@ public class LayoutActionServiceImpl implements LayoutActionService {
|
|||
ActionConfiguration actionConfiguration = action.getActionConfiguration();
|
||||
Set<String> jsonPathKeys = action.getJsonPathKeys();
|
||||
|
||||
if (jsonPathKeys != null || !jsonPathKeys.isEmpty()) {
|
||||
if (jsonPathKeys != null && !jsonPathKeys.isEmpty()) {
|
||||
// Since json path keys actually contain the entire inline js function instead of just the widget/action
|
||||
// name, we can not simply use the set.contains(obj) function. We need to iterate over all the keys
|
||||
// in the set and see if the old name is a substring of the json path key.
|
||||
|
|
@ -387,11 +387,14 @@ public class LayoutActionServiceImpl implements LayoutActionService {
|
|||
return Mono.just(action);
|
||||
}
|
||||
})
|
||||
.map(savedAction -> savedAction.getName())
|
||||
.collect(toSet());
|
||||
|
||||
return updateActionsMono
|
||||
.then(updatePageMono)
|
||||
.flatMap(page -> {
|
||||
return Mono.zip(updateActionsMono, updatePageMono)
|
||||
.flatMap(tuple -> {
|
||||
Set<String> updatedActionNames = tuple.getT1();
|
||||
Page page = tuple.getT2();
|
||||
log.debug("Actions updated due to refactor name in page {} are : {}", pageId, updatedActionNames);
|
||||
List<Layout> layouts = page.getLayouts();
|
||||
for (Layout layout : layouts) {
|
||||
if (layout.getId().equals(layoutId)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user