Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate ImportContentletsProcessor to Use New Import Result Format While Maintaining Legacy Support #31339

Open
6 tasks
Tracked by #30882
jgambarios opened this issue Feb 11, 2025 · 2 comments · Fixed by #31407
Open
6 tasks
Tracked by #30882

Comments

@jgambarios
Copy link
Contributor

jgambarios commented Feb 11, 2025

Parent Issue

#30882

Task

Implement structured import results in the ImportContentletsProcessor while maintaining backward compatibility with the legacy HashMap format for the existing admin UI.

Current Situation

  • The ImportUtil has been refactored to support a new structured format for import results
  • The legacy format (HashMap<String, List>) is still required by the admin UI
  • ImportContentletsProcessor currently uses the legacy format directly

Objective

Enhance ImportContentletsProcessor to:

  1. Use the new structured format internally for better type safety and maintainability
  2. Convert results to legacy format only when needed for backward compatibility
  3. Maintain existing functionality without breaking changes

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

Acceptance Criteria

  • ImportContentletsProcessor uses structured format
  • Legacy format support maintained for admin UI
  • No changes required in existing UI code
  • All existing functionality preserved
  • Unit tests pass and maintain coverage
  • No regression in error handling or reporting

Related issues

#31236
#31237

@jgambarios jgambarios self-assigned this Feb 11, 2025
@jgambarios jgambarios moved this from New to In Progress in dotCMS - Product Planning Feb 11, 2025
jgambarios added a commit that referenced this issue Feb 17, 2025
Updated import-related classes to enhance JSON serialization/deserialization, removed unused enums, added new validation codes, and streamlined legacy format conversion in `ImportResultConverter`. These changes improve code maintainability and align with new API requirements.
Copy link

jgambarios added a commit that referenced this issue Feb 18, 2025
Introduced a boolean parameter to determine whether counters should be updated in the parseLineResults method, ensuring flexibility for error handling scenarios. Removed redundant @NotNull annotations to simplify code. These changes improve clarity and functionality of the import utility.
jgambarios added a commit that referenced this issue Feb 18, 2025
This update introduces logic to track the last inode during imports and makes it accessible as an optional value. Adjustments include storing, retrieving, and converting the last inode to maintain consistency across processes. This enhances import result tracking and improves data handling.
jgambarios added a commit that referenced this issue Feb 18, 2025
Adjusted validation parameters to align with updated requirements and fixed assertion to correctly reflect the expected error count. This ensures tests accurately validate warnings and errors, improving code reliability.
jgambarios added a commit that referenced this issue Feb 18, 2025
jgambarios added a commit that referenced this issue Feb 18, 2025
Replaced JSONObject-based map transformation with ObjectMapper for better consistency and reduced dependency. Simplified `transformToMap` method implementation and updated the documentation accordingly. Additionally, minor code formatting improvements were made in ImportContentletsProcessor.
@nollymar nollymar moved this from In Progress to In Review in dotCMS - Product Planning Feb 19, 2025
jgambarios added a commit that referenced this issue Feb 19, 2025
Replaced manual iteration and filtering with stream-based processing to retrieve unique fields. This improves readability and maintains the same functionality with cleaner code.
jgambarios added a commit that referenced this issue Feb 20, 2025
Replaced repetitive calls to 'result.data()' with the 'data' variable to improve code readability and maintainability. This change reduces redundancy and ensures consistent access to the processed data throughout the affected methods.
github-merge-queue bot pushed a commit that referenced this issue Feb 20, 2025
This PR represents the final stage of the Import Content response
improvements, where the `ImportContentletsProcessor` now leverages the
new structured response format while maintaining full backward
compatibility with existing Struts implementations.

### Changes Overview

* Updated `ImportContentletsProcessor` to use new response format 
* Added converter to maintain backward compatibility with Struts actions
* Improved error handling and validation message organization
* Enhanced documentation and code organization

### What's Not Changed

We intentionally kept several aspects unchanged to ensure stability:
* Core import logic remains untouched
* Legacy response format is still fully supported
* Existing workflow processing behavior
* Current transaction handling
* Permission checking mechanisms

While working on this code, we identified several potential improvements
that were intentionally left for future iterations to keep the scope
focused on the immediate needs.

This PR is related to: #30882
This PR fixes: #31339
@github-project-automation github-project-automation bot moved this from In Review to Done in dotCMS - Product Planning Feb 20, 2025
@jgambarios jgambarios moved this from Done to QA in dotCMS - Product Planning Feb 20, 2025
@jgambarios jgambarios reopened this Feb 20, 2025
@github-project-automation github-project-automation bot moved this from QA to Current Sprint Backlog in dotCMS - Product Planning Feb 20, 2025
@jgambarios jgambarios moved this from Current Sprint Backlog to QA in dotCMS - Product Planning Feb 20, 2025
@jgambarios
Copy link
Contributor Author

Note to QA: Here we need to test 2 things:

  1. The existing import functionality in the Admin UI, should continue working as has been always working, not changes should be visible there.
  2. The new format available when the import is called from the new jobs.

@jgambarios jgambarios removed their assignment Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: QA
Development

Successfully merging a pull request may close this issue.

2 participants