Copilot commented on code in PR #3312:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3312#discussion_r2435447041


##########
packages/stunner-editors/kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-marshalling/src/main/java/org/kie/workbench/common/stunner/bpmn/client/marshall/service/BPMNClientDiagramService.java:
##########
@@ -96,20 +97,26 @@ public BPMNClientDiagramService(final DefinitionManager 
definitionManager,
     @Override
     public void transform(final String xml,
                           final ServiceCallback<Diagram> callback) {
-        doTransform(DEFAULT_DIAGRAM_ID, xml, callback);
+        doTransform(DEFAULT_DIAGRAM_ID, DEFAULT_DIAGRAM_ID, xml, callback);
     }
 
     @Override
     public void transform(final String fileName,
                           final String xml,
                           final ServiceCallback<Diagram> callback) {
-        doTransform(createDiagramTitleFromFilePath(fileName), xml, callback);
+        LOGGER.severe("Transform" + fileName);
+        doTransform(createDiagramTitleFromFilePath(fileName), fileName, xml, 
callback);
     }
 
     private void doTransform(final String fileName,
+                             final String fileRelativePath,
                              final String xml,
                              final ServiceCallback<Diagram> callback) {
-        final Metadata metadata = createMetadata();
+        final Metadata metadata = createMetadata();        
+        metadata.setPath(PathFactory.newPath(fileName, fileRelativePath));
+        LOGGER.severe("[METADATA 2]");
+        LOGGER.severe(fileName);
+        LOGGER.severe(metadata.getPath() + "----!");

Review Comment:
   Debug logging statements should be removed or changed to more appropriate 
log levels for production code.
   ```suggestion
           LOGGER.fine(metadata.getPath() + "----!");
   ```



##########
packages/stunner-editors/kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-marshalling/src/main/java/org/kie/workbench/common/stunner/bpmn/client/marshall/service/BPMNClientDiagramService.java:
##########
@@ -96,20 +97,26 @@ public BPMNClientDiagramService(final DefinitionManager 
definitionManager,
     @Override
     public void transform(final String xml,
                           final ServiceCallback<Diagram> callback) {
-        doTransform(DEFAULT_DIAGRAM_ID, xml, callback);
+        doTransform(DEFAULT_DIAGRAM_ID, DEFAULT_DIAGRAM_ID, xml, callback);
     }
 
     @Override
     public void transform(final String fileName,
                           final String xml,
                           final ServiceCallback<Diagram> callback) {
-        doTransform(createDiagramTitleFromFilePath(fileName), xml, callback);
+        LOGGER.severe("Transform" + fileName);

Review Comment:
   Debug logging statement should be removed or changed to a more appropriate 
log level (e.g., LOGGER.fine()) for production code.
   ```suggestion
           LOGGER.info("Transform " + fileName);
   ```



##########
packages/stunner-editors/kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-kogito-runtime/src/main/java/org/kie/workbench/common/stunner/kogito/client/services/WorkItemDefinitionStandaloneClientService.java:
##########
@@ -159,6 +173,8 @@ private Promise<Collection<WorkItemDefinition>> 
workItemsLoader(final String pat
                                                                     final 
Collection<WorkItemDefinition> loaded) {
         int lastDirIndex = path.lastIndexOf('/');
         final String directory = (lastDirIndex >= 0) ? path.substring(0, 
lastDirIndex) + "/" : path;
+        LOGGER.severe("workItemsLoader directory:" + directory);
+        LOGGER.severe("workItemsLoader path:" + path);

Review Comment:
   Debug logging statements should be removed or changed to more appropriate 
log levels for production code.
   ```suggestion
           LOGGER.fine("workItemsLoader path:" + path);
   ```



##########
packages/stunner-editors/kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-kogito-runtime/src/main/java/org/kie/workbench/common/stunner/kogito/client/services/WorkItemDefinitionStandaloneClientService.java:
##########
@@ -93,26 +97,36 @@ public WorkItemDefinitionRegistry getRegistry() {
 
     @Override
     public Promise<Collection<WorkItemDefinition>> call(final Metadata input) {
-        return loader;
+        return allWorkItemsLoader(input.getPath());
     }
 
     @PreDestroy
     public void destroy() {
         registry.clear();
-        loader = null;
+        // loader = null;
     }
 
-    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader() {
+
+    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader(Path 
openedDiagramPath) {
+
+        int lastSlashIndex = openedDiagramPath != null ? 
openedDiagramPath.toURI().lastIndexOf('/') : -1;
+        String directoryPath = (lastSlashIndex != -1) 
+            ? openedDiagramPath.toURI().substring(0, lastSlashIndex) 
+            : ""; 
+
+        String widPattern = openedDiagramPath == null ?  
RESOURCE_ALL_WID_PATTERN : directoryPath + "/" + RESOURCE_ALL_WID_PATTERN;
+        LOGGER.severe("widPattern: " + widPattern);
         return promises.create((success, failure) -> {
             registry.clear();
             final List<WorkItemDefinition> loaded = new LinkedList<>();
             resourceContentService
-                    .list(RESOURCE_GLOBAL_DIRECTORY_WID_PATTERN, 
ResourceListOptions.traversal())
+                    .list(RESOURCE_GLOBAL_DIRECTORY_WID_PATTERN, 
ResourceListOptions.assetFolder())
                     .then(paths1 -> {
                         resourceContentService
-                                .list(RESOURCE_ALL_WID_PATTERN, 
ResourceListOptions.assetFolder())
+                                .list(widPattern, 
ResourceListOptions.assetFolder())
                                 .then(paths2 -> {
                                     String[] paths = mergeTwoArrays(paths1, 
paths2);
+                                    LOGGER.severe("Paths" + paths);

Review Comment:
   Debug logging statement should be removed or changed to a more appropriate 
log level for production code.



##########
packages/stunner-editors/kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-kogito-runtime/src/main/java/org/kie/workbench/common/stunner/kogito/client/services/WorkItemDefinitionStandaloneClientService.java:
##########
@@ -93,26 +97,36 @@ public WorkItemDefinitionRegistry getRegistry() {
 
     @Override
     public Promise<Collection<WorkItemDefinition>> call(final Metadata input) {
-        return loader;
+        return allWorkItemsLoader(input.getPath());
     }
 
     @PreDestroy
     public void destroy() {
         registry.clear();
-        loader = null;
+        // loader = null;
     }
 
-    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader() {
+
+    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader(Path 
openedDiagramPath) {
+
+        int lastSlashIndex = openedDiagramPath != null ? 
openedDiagramPath.toURI().lastIndexOf('/') : -1;
+        String directoryPath = (lastSlashIndex != -1) 
+            ? openedDiagramPath.toURI().substring(0, lastSlashIndex) 
+            : ""; 
+
+        String widPattern = openedDiagramPath == null ?  
RESOURCE_ALL_WID_PATTERN : directoryPath + "/" + RESOURCE_ALL_WID_PATTERN;
+        LOGGER.severe("widPattern: " + widPattern);

Review Comment:
   Debug logging statement should be removed or changed to a more appropriate 
log level for production code.
   ```suggestion
           LOGGER.fine("widPattern: " + widPattern);
   ```



-- 
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]

Reply via email to