Skip to content

Conversation

@rishikunnath2747
Copy link
Collaborator

@rishikunnath2747 rishikunnath2747 commented Nov 18, 2025

Recently there was a fix in the plugin which allowed users to update nested entities in the application with attachments. However it was not working if the entity was defined with a namespace - this fixes that

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist before requesting a review

  • I follow Java Development Guidelines for SAP
  • I have tested the functionality on my cloud environment.
  • I have provided sufficient automated/ unit tests for the code.
  • I have increased or maintained the test coverage.
  • I have ran integration tests on my cloud environment.
  • I have validated blackduck portal for any vulnerability after my commit.

MT Tenant 1 named user
image

MT Tenant 1 technical user
image

MT Tenant 2 named user
image

MT Tenant 2 technical user
image

ST technical user
image

ST named user
image

yashmeet29
yashmeet29 previously approved these changes Nov 18, 2025
@rishikunnath2747
Copy link
Collaborator Author

hey gemini review

@github-actions
Copy link
Contributor

Gemini Automated Review
Summary of Changes
This Pull Request primarily focuses on refining and correcting path construction logic across several components. Key changes include leveraging qualified entity names to ensure unique and accurate path generation for both direct and nested compositions, preventing inadvertent overwrites in path mappings, and improving overall readability by simplifying path construction.

Best Practices Review 💡

  • Avoid Redundant String Concatenation: The original construction of directPath unnecessarily concatenated service and entity names. Utilizing entity.getQualifiedName() directly improves code clarity and eliminates redundant operations.

Potential Bugs 🐛

  • Path Mapping Overwrites (processAttachmentPaths): The original implementation in processAttachmentPaths could overwrite existing entries in pathMapping. This is critical for maintaining correct path resolution, especially when dealing with direct versus nested attachment mappings.
  • Incorrect/Non-Unique Entity Paths (buildEntityPath): The logic in buildEntityPath for constructing entity paths was flawed, relying on unqualified targetEntityName and pathParts[0] (service name). This could lead to incorrect or non-unique paths, particularly problematic for nested compositions.
  • Incorrect Actual Paths (buildActualPath): The buildActualPath method incorrectly used pathParts[0] (service name) to construct the actual path for compositions. For nested structures, the parentEntity's qualified name is essential for accurate path identification.

Recommendations & Required Changes 🛠️

  1. Simplify directPath Construction:

    • Description: Replace the manual concatenation of service and entity names with a direct call to entity.getQualifiedName(), which already provides the complete, qualified path. This simplifies the logic and enhances readability.
    • Recommended Code:
      String directPath = entity.getQualifiedName();
  2. Prevent Overwrites in pathMapping (in processAttachmentPaths):

    • Description: Introduce a conditional check before adding entries to pathMapping to ensure that existing direct attachment mappings are not inadvertently overwritten by subsequent nested composition mappings.
    • Recommended Code:
      // Assuming 'entityPath' and 'attachmentPath' are defined in the method's scope
      if (!pathMapping.containsKey(entityPath)) {
          pathMapping.put(entityPath, attachmentPath);
      }
  3. Ensure Unique and Accurate Entity Paths (in buildEntityPath):

    • Description: Refactor the buildEntityPath method to correctly utilize targetEntity.getQualifiedName() or parentEntity.getQualifiedName(). This ensures that generated entity paths are unique and accurate, particularly for distinguishing between direct and nested attachments, and avoids reliance on unqualified names or pathParts[0].
    • Recommended Code (Conceptual):
      // Example logic to ensure entity paths are based on qualified names:
      if (isDirectAttachment) {
          return targetEntity.getQualifiedName();
      } else {
          // For nested compositions, build upon the parent's qualified name.
          return parentEntity.getQualifiedName() + "/" + targetEntity.getName();
      }
      // The core change is to replace reliance on unqualified names or pathParts[0]
      // with robust usage of `getQualifiedName()` methods.
  4. Correct Actual Path Construction for Compositions (in buildActualPath):

    • Description: Modify the buildActualPath method to use parentEntity.getQualifiedName() instead of pathParts[0] when constructing paths for compositions or nested structures. This accurately identifies the path based on the parent entity's full qualified name.
    • Recommended Code:
      // Assuming 'parentEntity' is available and 'attachmentName' is the final path segment
      String actualPath = parentEntity.getQualifiedName() + "/" + attachmentName;

Quality Rating
7/10

Overall Assessment
The Pull Request addresses critical functional issues related to path generation and mapping, significantly improving the correctness and robustness of the system, especially for complex nested compositions. The proposed changes, particularly the adoption of qualified names and the overwrite prevention, are essential. Once the recommended code changes are implemented and thoroughly verified, the code will be in a much stronger position for merging.

@rishikunnath2747 rishikunnath2747 merged commit 9a1862b into develop Nov 18, 2025
9 checks passed
@rishikunnath2747 rishikunnath2747 deleted the regulationLogs branch November 18, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants