Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Mar 13, 2024
2 parents 8efd7c5 + f0c34fe commit 746c3a6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
git config --global user.name "${{ secrets.GH_SITE_DEPLOY_NAME }}"
- name: Setup JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
Expand Down
9 changes: 9 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.7.4" date="2024-03-13">
<action type="update" dev="sseifert">
Switch to AEM 6.5.17 as minimum version.
</action>
<action type="fix" dev="sseifert" issue="2">
Ignore child resources of parsys without assigned resource type (returning nt:unstructured as resource type).
</action>
</release>

<release version="1.7.2" date="2023-12-18">
<action type="update" dev="sseifert" issue="1">
Eliminate usage of org.apache.sling.commons.json
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.parent_toplevel</artifactId>
<version>2.2.8</version>
<version>2.3.0</version>
<relativePath/>
</parent>

<groupId>io.wcm</groupId>
<artifactId>io.wcm.wcm.parsys</artifactId>
<version>1.7.2</version>
<version>1.7.4</version>
<packaging>jar</packaging>

<name>WCM Parsys</name>
Expand All @@ -49,7 +49,7 @@
<site.url.module.prefix>wcm/parsys</site.url.module.prefix>

<!-- Enable reproducible builds -->
<project.build.outputTimestamp>2023-12-18T11:38:00Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2024-03-13T09:44:25Z</project.build.outputTimestamp>
</properties>

<dependencies>
Expand Down Expand Up @@ -109,7 +109,7 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
<version>5.4.2</version>
<version>5.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/io/wcm/wcm/parsys/controller/Parsys.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static io.wcm.wcm.parsys.ParsysNameConstants.PN_PARSYS_PARAGRAPH_VALIDATE;
import static io.wcm.wcm.parsys.ParsysNameConstants.PN_PARSYS_WRAPPER_CSS;
import static io.wcm.wcm.parsys.ParsysNameConstants.PN_PARSYS_WRAPPER_ELEMENT;
import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -157,6 +158,9 @@ private void activate() {
parsysParentResource = currentResource;
}
for (Resource childResource : parsysParentResource.getChildren()) {
if (!acceptResource(childResource)) {
continue;
}
Item item = createResourceItem(childResource);
if (wcmMode != WCMMode.DISABLED || item.isValid()) {
items.add(item);
Expand All @@ -167,6 +171,11 @@ private void activate() {
}
}

private static boolean acceptResource(Resource resource) {
// skip resources without assigned resource type
return !StringUtils.equals(resource.getResourceType(), NT_UNSTRUCTURED);
}

private static boolean getDecoration(String[] paragraphNoDecorationWcmMode, WCMMode wcmMode) {
if (paragraphNoDecorationWcmMode != null && paragraphNoDecorationWcmMode.length > 0) {
for (String wcmModeItem : paragraphNoDecorationWcmMode) {
Expand Down Expand Up @@ -364,6 +373,9 @@ public boolean isWrapperElement() {
private <T> Map<String, T> getChildModels(@NotNull Class<T> modelClass) {
Map<String, T> models = new LinkedHashMap<>();
for (Resource child : slingModelFilter.filterChildResources(currentResource.getChildren())) {
if (!acceptResource(child)) {
continue;
}
T model = modelFactory.getModelFromWrappedRequest(request, child, modelClass);
if (model != null) {
models.put(child.getName(), model);
Expand Down
3 changes: 2 additions & 1 deletion src/site/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Differences to the AEM-builtin paragraph system:

|WCM Parsys version |AEM version supported
|-------------------|----------------------
|1.7.x or higher |AEM 6.5.7+, AEMaaCS
|1.7.4 or higher |AEM 6.5.17+, AEMaaCS
|1.7.0 - 1.7.2 |AEM 6.5.7+, AEMaaCS
|1.6.x |AEM 6.4.5+, AEMaaCS
|1.4.x - 1.5.x |AEM 6.3.3+, AEM 6.4.5+
|1.2.x - 1.3.x |AEM 6.2+
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/io/wcm/wcm/parsys/controller/ParsysTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ public Iterable<Resource> answer(InvocationOnMock invocation) throws Throwable {
par2Resource = context.create().resource(parsysResource.getPath() + "/par2",
"sling:resourceType", COMPONENT_PATH_2,
"valid", false);
// this should be always ignored as it does not contain a resource type
context.create().resource(parsysResource.getPath() + "/ignore1",
"valid", true);

context.currentResource(parsysResource);
}
Expand Down Expand Up @@ -315,7 +318,8 @@ void testNewAreaResourceTypeFromSuperComponent() {
void testOtherParentParsysResource() {
context.create().resource("/apps/" + RESOURCE_TYPE_SAMPLE);
parsysResource = context.create().resource(page.getContentResource().getPath() + "/parsysOther");
par1Resource = context.create().resource(parsysResource.getPath() + "/par1");
par1Resource = context.create().resource(parsysResource.getPath() + "/par1",
"sling:resourceType", RESOURCE_TYPE_SAMPLE);

context.request().setAttribute(RA_PARSYS_PARENT_RESOURCE, parsysResource);

Expand Down

0 comments on commit 746c3a6

Please sign in to comment.