Skip to content

Commit 8dbbcba

Browse files
committed
Merge branch 'develop'
2 parents 1c9113c + 66fed3c commit 8dbbcba

File tree

26 files changed

+871
-266
lines changed

26 files changed

+871
-266
lines changed

build-deploy_aem65.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626
# install AEM 6.5 with service pack
2727
mvn --non-recursive wcmio-content-package:install \
2828
--activate-profiles=${MAVEN_PROFILES} \
29-
-Dvault.artifact=adobe.binary.aem.65.servicepack:aem-service-pkg:zip:6.5.15.0 \
29+
-Dvault.artifact=adobe.binary.aem.65.servicepack:aem-service-pkg:zip:6.5.16.0 \
3030
-Dvault.delayAfterInstallSec=30
3131

3232
if [ "$?" -ne "0" ]; then

bundles/core/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<parent>
2626
<groupId>io.wcm</groupId>
2727
<artifactId>io.wcm.wcm.core.components.parent</artifactId>
28-
<version>1.12.4-2.21.2</version>
28+
<version>1.13.0-2.22.6</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm</groupId>
3333
<artifactId>io.wcm.wcm.core.components</artifactId>
34-
<version>1.12.4-2.21.2</version>
34+
<version>1.13.0-2.22.6</version>
3535
<packaging>jar</packaging>
3636

3737
<name>WCM Core Components</name>

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV2Impl.java

+2-152
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,19 @@
1919
*/
2020
package io.wcm.wcm.core.components.impl.models.helpers;
2121

22-
import static com.adobe.cq.wcm.core.components.models.List.PN_TEASER_DELEGATE;
23-
import static com.day.cq.commons.jcr.JcrConstants.JCR_DESCRIPTION;
24-
import static com.day.cq.commons.jcr.JcrConstants.JCR_TITLE;
25-
import static io.wcm.handler.link.LinkNameConstants.PN_LINK_CONTENT_REF;
26-
import static io.wcm.handler.link.LinkNameConstants.PN_LINK_TYPE;
27-
28-
import java.util.Calendar;
29-
import java.util.HashMap;
30-
import java.util.HashSet;
31-
import java.util.Map;
32-
import java.util.Set;
33-
34-
import org.apache.commons.lang3.StringUtils;
35-
import org.apache.sling.api.resource.Resource;
3622
import org.jetbrains.annotations.NotNull;
3723
import org.jetbrains.annotations.Nullable;
38-
import org.slf4j.Logger;
39-
import org.slf4j.LoggerFactory;
4024

4125
import com.adobe.cq.wcm.core.components.models.ListItem;
42-
import com.adobe.cq.wcm.core.components.models.datalayer.PageData;
43-
import com.adobe.cq.wcm.core.components.models.datalayer.builder.DataLayerBuilder;
44-
import com.adobe.cq.wcm.core.components.util.ComponentUtils;
4526
import com.day.cq.wcm.api.Page;
4627
import com.day.cq.wcm.api.components.Component;
47-
import com.fasterxml.jackson.annotation.JsonIgnore;
4828

4929
import io.wcm.handler.link.Link;
50-
import io.wcm.handler.link.type.InternalLinkType;
51-
import io.wcm.wcm.core.components.impl.link.LinkWrapper;
52-
import io.wcm.wcm.core.components.impl.util.CoreResourceWrapper;
5330

5431
/**
5532
* {@link ListItem} implementation for page links.
5633
*/
57-
public class PageListItemV2Impl extends AbstractListItemImpl implements ListItem {
58-
59-
private final Page page;
60-
protected final LinkWrapper link;
61-
private final Component parentComponent;
62-
private final boolean showDescription;
63-
private final boolean linkItems;
64-
private Resource teaserResource;
65-
66-
private static final Logger log = LoggerFactory.getLogger(PageListItemV2Impl.class);
34+
public class PageListItemV2Impl extends PageListItemV4Impl implements ListItem {
6735

6836
/**
6937
* @param page Page
@@ -76,12 +44,7 @@ public class PageListItemV2Impl extends AbstractListItemImpl implements ListItem
7644
public PageListItemV2Impl(@NotNull Page page, @NotNull Link link,
7745
@Nullable String parentId, @Nullable Component parentComponent,
7846
boolean showDescription, boolean linkItems) {
79-
super(page.getContentResource(), parentId, parentComponent);
80-
this.page = page;
81-
this.link = new LinkWrapper(link);
82-
this.parentComponent = parentComponent;
83-
this.showDescription = showDescription;
84-
this.linkItems = linkItems;
47+
super(page, link, parentId, parentComponent, showDescription, linkItems, null);
8548
}
8649

8750
/**
@@ -95,117 +58,4 @@ public PageListItemV2Impl(@NotNull Page page, @NotNull Link link,
9558
this(page, link, parentId, parentComponent, false, false);
9659
}
9760

98-
@Override
99-
public @Nullable com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
100-
return link.orNull();
101-
}
102-
103-
/**
104-
* @deprecated Deprecated in API
105-
*/
106-
@Override
107-
@Deprecated
108-
@JsonIgnore
109-
public String getURL() {
110-
return link.getURL();
111-
}
112-
113-
@Override
114-
public String getTitle() {
115-
String title = page.getNavigationTitle();
116-
if (title == null) {
117-
title = page.getPageTitle();
118-
}
119-
if (title == null) {
120-
title = page.getTitle();
121-
}
122-
if (title == null) {
123-
title = page.getName();
124-
}
125-
return title;
126-
}
127-
128-
@Override
129-
public String getDescription() {
130-
return page.getDescription();
131-
}
132-
133-
@Override
134-
public Calendar getLastModified() {
135-
return page.getLastModified();
136-
}
137-
138-
@Override
139-
public String getPath() {
140-
return page.getPath();
141-
}
142-
143-
@Override
144-
@JsonIgnore
145-
public String getName() {
146-
return page.getName();
147-
}
148-
149-
@Override
150-
@JsonIgnore
151-
public @Nullable Resource getTeaserResource() {
152-
if (teaserResource == null && parentComponent != null) {
153-
String delegateResourceType = parentComponent.getProperties().get(PN_TEASER_DELEGATE, String.class);
154-
if (delegateResourceType == null || StringUtils.isEmpty(delegateResourceType)) {
155-
log.error("In order for list rendering delegation to work correctly you need to set up the teaserDelegate property on" +
156-
" the {} component; its value has to point to the resource type of a teaser component.", parentComponent.getPath());
157-
}
158-
else {
159-
teaserResource = buildTeaserResource(delegateResourceType);
160-
}
161-
}
162-
return teaserResource;
163-
}
164-
165-
/**
166-
* Builds a wrapped teaser resource based on the target page with title and description from this link item,
167-
* linking to the target page.
168-
* @param delegateResourceType Delegate resource type
169-
* @return Wrapped teaser resource
170-
*/
171-
private Resource buildTeaserResource(@NotNull String delegateResourceType) {
172-
Map<String, Object> overriddenProperties = new HashMap<>();
173-
Set<String> hiddenProperties = new HashSet<>();
174-
175-
Resource resourceToBeWrapped = ComponentUtils.getFeaturedImage(page);
176-
if (resourceToBeWrapped != null) {
177-
// use the page featured image and inherit properties from the page item
178-
overriddenProperties.put(JCR_TITLE, this.getTitle());
179-
if (showDescription) {
180-
overriddenProperties.put(JCR_DESCRIPTION, this.getDescription());
181-
}
182-
}
183-
else {
184-
// use the page content node and inherit properties from the page item
185-
resourceToBeWrapped = page.getContentResource();
186-
if (resourceToBeWrapped == null) {
187-
return null;
188-
}
189-
if (!showDescription) {
190-
hiddenProperties.add(JCR_DESCRIPTION);
191-
}
192-
}
193-
if (linkItems) {
194-
overriddenProperties.put(PN_LINK_TYPE, InternalLinkType.ID);
195-
overriddenProperties.put(PN_LINK_CONTENT_REF, this.getPath());
196-
}
197-
198-
return new CoreResourceWrapper(resourceToBeWrapped, delegateResourceType, overriddenProperties, hiddenProperties);
199-
}
200-
201-
// --- data layer ---
202-
203-
@Override
204-
protected @NotNull PageData getComponentData() {
205-
return DataLayerBuilder.extending(super.getComponentData()).asPage()
206-
.withTitle(this::getTitle)
207-
.withLinkUrl(link::getURL)
208-
.build();
209-
}
210-
21161
}

0 commit comments

Comments
 (0)