Skip to content

Commit 7e48b68

Browse files
Apply feedback
Co-authored-by: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com>
1 parent 14cd1e0 commit 7e48b68

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

jbpm/process-serialization-protobuf/src/main/java/org/jbpm/flow/serialization/impl/ProtobufProcessInstanceReader.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ private RuleFlowProcessInstance buildWorkflow(KogitoProcessInstanceProtobuf.Proc
177177

178178
if (processInstanceProtobuf.getHeadersList() != null) {
179179
processInstance.setHeaders(processInstanceProtobuf.getHeadersList().stream().collect(Collectors.toMap(HeaderEntry::getKey, HeaderEntry::getValueList)));
180-
processInstance.getHeaders().forEach((key, values) -> {
181-
LOGGER.info("Header {} restored for process instance {}", key, processInstance.getId());
182-
});
180+
LOGGER.debug("Headers {} restored for process instance {}", processInstance.getHeaders().keySet(), processInstance.getId()));
181+
}
183182
}
184183

185184
WorkflowContext workflowContext = processInstanceProtobuf.getContext();

jbpm/process-serialization-protobuf/src/main/java/org/jbpm/flow/serialization/impl/ProtobufProcessInstanceWriter.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,19 @@ public void writeProcessInstance(WorkflowProcessInstanceImpl workFlow, OutputStr
143143

144144
HeadersPersistentConfig headersConfig = context.get(MARSHALLER_HEADERS_CONFIG);
145145
if (workFlow.getHeaders() != null && headersConfig != null && headersConfig.enabled()) {
146-
Stream<Entry<String, List<String>>> headersStream = getHeadersStream(workFlow, headersConfig);
147-
instance.addAllHeaders(headersStream.map(e -> HeaderEntry.newBuilder().setKey(e.getKey()).addAllValue(e.getValue()).build()).collect(Collectors.toList()));
146+
147+
if (LOGGER.isDebugEnabled()) {
148+
LOGGER.debug("Headers {} are associated to process instance {}", workFlow.getHeaders().keySet(), workFlow.getId());
149+
}
150+
Stream<Entry<String, List<String>>> stream = workFlow.getHeaders().entrySet().stream();
151+
if (headersConfig.excluded() != null && !headersConfig.excluded().isEmpty()) {
152+
stream = stream.filter(e -> !headersConfig.excluded().contains(e.getKey()));
153+
}
154+
instance.addAllHeaders(stream.map(e -> HeaderEntry.newBuilder().setKey(e.getKey()).addAllValue(e.getValue()).build()).collect(Collectors.toList()));
155+
if (LOGGER.isDebugEnabled()) {
156+
LOGGER.debug("Headers {} are stored for process instance {}", instance.getHeadersList().stream().map(HeaderEntry::getKey).collect(Collectors.joining()), workFlow.getId());
157+
}
158+
148159
}
149160

150161
instance.addAllSwimlaneContext(buildSwimlaneContexts((SwimlaneContextInstance) workFlow.getContextInstance(SwimlaneContext.SWIMLANE_SCOPE)));

0 commit comments

Comments
 (0)