fjtirado commented on code in PR #3358:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3358#discussion_r1457250914
##########
api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java:
##########
@@ -88,9 +98,16 @@ private Function<Process<?>, ProcessDefinitionDataEvent>
mapProcessDefinition(Se
.setNodes(getNodesDefinitions(p))
.setAnnotations(annotations)
.setDescription(description)
- .setMetadata(metadata)
- .build());
- return definitionDataEvent;
+ .setMetadata(metadata);
+ sourceFilesProvider.flatMap(provider ->
provider.getProcessSourceFile(p.id())).map(s -> {
+ try {
+ return new String(s.readContents());
+ } catch (IOException e) {
+ LOGGER.warn("Error reading source for process {}", p.id(),
e);
+ return null;
+ }
+ }).ifPresentOrElse(s -> builder.setSource(s), () ->
LOGGER.warn("Not source found for process id {}", p.id()));
Review Comment:
if source (in case the addon is not in the set of dependencies) is not
there, getSource() will return null, and we will be setting source to null in
the builder when it is not really needed.
However, I agree that this can be done more readable, please check the new
version
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]