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

Page resolving: add flag to resolve empty regions in Content API #10214

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

ashklianko
Copy link
Member

@ashklianko ashklianko commented Jul 18, 2023

  • Introduced xp.content config variable resolveEmptyRegions (set to 'false' by default) that allows to switch between previous content page resolving behavior that forces injection of all descriptor's regions into page/layout and new one where content's page object is returned as it is
  • Updated core-content classes to read config variable and build page object according to it
  • Updated portal-impl classes to read descriptor and inject empty regions into page if it is not being made by content api, and not to read and inject regions if it is done by content api

@@ -4,6 +4,7 @@

import com.enonic.xp.content.ImportContentParams;
import com.enonic.xp.content.ImportContentResult;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
@@ -9,6 +9,7 @@
import com.enonic.xp.content.Content;
import com.enonic.xp.content.CreateContentParams;
import com.enonic.xp.content.CreateMediaParams;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
@@ -24,6 +24,7 @@
import com.enonic.xp.content.processor.ProcessCreateParams;
import com.enonic.xp.content.processor.ProcessCreateResult;
import com.enonic.xp.context.ContextAccessor;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
@@ -7,6 +7,7 @@
import com.enonic.xp.content.RenameContentParams;
import com.enonic.xp.content.UpdateContentParams;
import com.enonic.xp.content.ValidationErrors;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
import com.enonic.xp.project.ProjectService;
import com.enonic.xp.region.LayoutDescriptorService;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.region.LayoutDescriptorService. Note

Unused import - com.enonic.xp.region.LayoutDescriptorService.
import com.enonic.xp.project.ProjectService;
import com.enonic.xp.region.LayoutDescriptorService;
import com.enonic.xp.region.PartDescriptorService;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.region.PartDescriptorService. Note

Unused import - com.enonic.xp.region.PartDescriptorService.
import com.enonic.xp.event.EventPublisher;
import com.enonic.xp.node.NodeService;
import com.enonic.xp.page.PageDescriptorService;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.page.PageDescriptorService. Note

Unused import - com.enonic.xp.page.PageDescriptorService.
@@ -8,9 +8,13 @@
import com.enonic.xp.content.ProjectSyncParams;
import com.enonic.xp.content.ResetContentInheritParams;
import com.enonic.xp.content.SyncContentService;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
@@ -10,6 +10,7 @@
import com.enonic.xp.content.Media;
import com.enonic.xp.content.ReprocessContentParams;
import com.enonic.xp.content.UpdateMediaParams;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
@@ -34,6 +34,7 @@
import com.enonic.xp.content.processor.ContentProcessor;
import com.enonic.xp.content.processor.ProcessUpdateParams;
import com.enonic.xp.content.processor.ProcessUpdateResult;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Patch coverage: 90.00% and project coverage change: +0.07 🎉

Comparison is base (d739f41) 84.34% compared to head (e97b555) 84.41%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #10214      +/-   ##
============================================
+ Coverage     84.34%   84.41%   +0.07%     
- Complexity    19418    19450      +32     
============================================
  Files          2595     2598       +3     
  Lines         67678    67720      +42     
  Branches       5390     5394       +4     
============================================
+ Hits          57083    57166      +83     
+ Misses         7982     7936      -46     
- Partials       2613     2618       +5     
Impacted Files Coverage Δ
...ontent/ContentOutboundDependenciesIdsResolver.java 85.18% <0.00%> (-0.53%) ⬇️
...nic/xp/core/impl/content/RenameContentCommand.java 100.00% <ø> (ø)
.../xp/core/impl/content/ReprocessContentCommand.java 0.00% <ø> (ø)
...nonic/xp/core/impl/content/UpdateMediaCommand.java 86.56% <ø> (-1.60%) ⬇️
...tent/serializer/LayoutComponentDataSerializer.java 92.30% <ø> (ø)
...nonic/xp/core/impl/content/ContentServiceImpl.java 77.01% <28.57%> (-0.63%) ⬇️
...re/impl/content/serializer/PageDataSerializer.java 96.10% <77.77%> (-1.08%) ⬇️
...nic/xp/portal/impl/rendering/FragmentRenderer.java 89.23% <81.81%> (+89.23%) ⬆️
.../serializer/FullLayoutComponentDataSerializer.java 88.88% <88.88%> (ø)
...tent/AbstractCreatingOrUpdatingContentCommand.java 91.80% <100.00%> (+2.00%) ⬆️
... and 14 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ashklianko ashklianko linked an issue Jul 18, 2023 that may be closed by this pull request
@ashklianko ashklianko requested a review from rymsha July 18, 2023 19:42
@ashklianko ashklianko changed the title Rollback Page object resolving: inject empty regions to the page obje… Page resolving: add flag to resolve empty regions in Content API #10209 Jul 19, 2023
@ashklianko ashklianko changed the title Page resolving: add flag to resolve empty regions in Content API #10209 Page resolving: add flag to resolve empty regions in Content API Jul 19, 2023

private PageDescriptorService pageDescriptorService;

private LayoutDescriptorService layoutDescriptorService;

Check warning

Code scanning / Pmd (reported by Codacy)

Perhaps 'layoutDescriptorService' could be replaced by a local variable. Warning test

Perhaps 'layoutDescriptorService' could be replaced by a local variable.

private FullLayoutComponentDataSerializer componentDataSerializer;

private RegionDataSerializer regionDataSerializer;

Check warning

Code scanning / Pmd (reported by Codacy)

Perhaps 'regionDataSerializer' could be replaced by a local variable. Warning test

Perhaps 'regionDataSerializer' could be replaced by a local variable.

import static com.enonic.xp.content.ContentPropertyNames.PAGE;
import static com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.COMPONENTS;
import static com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.PATH;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.PATH. Note test

Unused import - com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.PATH.
import static com.enonic.xp.content.ContentPropertyNames.PAGE;
import static com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.COMPONENTS;
import static com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.PATH;
import static com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.TYPE;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.TYPE. Note test

Unused import - com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.TYPE.
import com.enonic.xp.region.RegionDescriptors;

import static com.enonic.xp.content.ContentPropertyNames.PAGE;
import static com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.COMPONENTS;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.COMPONENTS. Note test

Unused import - com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.COMPONENTS.
import com.enonic.xp.data.PropertyTree;
import com.enonic.xp.form.Form;
import com.enonic.xp.page.DescriptorKey;
import com.enonic.xp.region.ComponentPath;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.region.ComponentPath. Note test

Unused import - com.enonic.xp.region.ComponentPath.
import static com.enonic.xp.core.impl.content.serializer.ComponentDataSerializer.TYPE;
import static com.enonic.xp.core.impl.content.serializer.DescriptorBasedComponentDataSerializer.DESCRIPTOR;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - org.junit.jupiter.api.Assertions.assertTrue. Note test

Unused import - org.junit.jupiter.api.Assertions.assertTrue.
import com.enonic.xp.region.RegionDescriptor;
import com.enonic.xp.region.RegionDescriptors;

import static com.enonic.xp.content.ContentPropertyNames.PAGE;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.content.ContentPropertyNames.PAGE. Note test

Unused import - com.enonic.xp.content.ContentPropertyNames.PAGE.
@@ -14,6 +14,7 @@
import com.enonic.xp.content.Contents;
import com.enonic.xp.content.ExtraData;
import com.enonic.xp.content.ExtraDatas;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer. Note test

Unused import - com.enonic.xp.core.impl.content.serializer.ContentDataSerializer.
@ashklianko ashklianko force-pushed the issue-10209 branch 2 times, most recently from 30d9382 to 513f6e5 Compare July 20, 2023 21:51
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;

Check notice

Code scanning / Checkstyle (reported by Codacy)

Unused import - org.mockito.ArgumentMatchers.any. Note test

Unused import - org.mockito.ArgumentMatchers.any.
- Introduced xp.content config variable resolveEmptyRegions (set to 'false' by default) that
allows to switch between previous content page resolving behavior that forces injection of all descriptor's regions into page/layout and new one where content's page object is returned as it is
- Updated core-content classes to read config variable and build page object according to it
- Updated portal-impl classes to read descriptor and inject empty regions into page if it is not being made by content api, and not to read and inject regions if it is done by content api
@rymsha rymsha merged commit c4b556f into master Jul 21, 2023
22 checks passed
@rymsha rymsha deleted the issue-10209 branch July 21, 2023 08:49
rymsha pushed a commit that referenced this pull request Jul 24, 2023
… (#10214)

- Introduced xp.content config variable resolveEmptyRegions (set to 'false' by default) that
allows to switch between previous content page resolving behavior that forces injection of all descriptor's regions into page/layout and new one where content's page object is returned as it is
- Updated core-content classes to read config variable and build page object according to it
- Updated portal-impl classes to read descriptor and inject empty regions into page if it is not being made by content api, and not to read and inject regions if it is done by content api

(cherry picked from commit c4b556f)
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.

Support resolution of empty regions in Content API
2 participants