diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/link/LinkHtmlAttributesSerializer.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/LinkHtmlAttributesSerializer.java similarity index 90% rename from bundles/core/src/main/java/io/wcm/wcm/core/components/impl/link/LinkHtmlAttributesSerializer.java rename to bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/LinkHtmlAttributesSerializer.java index 737dca49..e8bd4097 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/link/LinkHtmlAttributesSerializer.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/LinkHtmlAttributesSerializer.java @@ -17,7 +17,7 @@ * limitations under the License. * #L% */ -package io.wcm.wcm.core.components.impl.link; +package io.wcm.wcm.core.components.commons.link; import java.io.IOException; import java.util.Map; @@ -31,9 +31,9 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; /** - * Serialized map of link attributes, omitting the "href" property. + * Serializes a map of link attributes, omitting the "href" property. */ -public class LinkHtmlAttributesSerializer extends StdSerializer> { +public final class LinkHtmlAttributesSerializer extends StdSerializer> { private static final long serialVersionUID = 1L; /** diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/link/LinkWrapper.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/LinkWrapper.java similarity index 93% rename from bundles/core/src/main/java/io/wcm/wcm/core/components/impl/link/LinkWrapper.java rename to bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/LinkWrapper.java index 695a1f03..d1cf7cf3 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/link/LinkWrapper.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/LinkWrapper.java @@ -17,7 +17,7 @@ * limitations under the License. * #L% */ -package io.wcm.wcm.core.components.impl.link; +package io.wcm.wcm.core.components.commons.link; import java.util.Map; @@ -34,8 +34,9 @@ import io.wcm.handler.link.Link; /** - * Link wrapper around wcm.io Link. + * Wraps a wcm.io Link object into a Core Components Link. */ +@SuppressWarnings("java:S3740") // unable to provide generic for Core Component Link here public final class LinkWrapper implements com.adobe.cq.wcm.core.components.commons.link.Link { private final Link link; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/package-info.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/package-info.java new file mode 100644 index 00000000..a21de3d1 --- /dev/null +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/package-info.java @@ -0,0 +1,24 @@ +/* + * #%L + * wcm.io + * %% + * Copyright (C) 2023 wcm.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +/** + * Interfaces for wcm.io Core Component models. + */ +@org.osgi.annotation.versioning.Version("1.0.0") +package io.wcm.wcm.core.components.commons.link; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/ImageAreaV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/ImageAreaV2Impl.java index dd80c7a3..3e4beba6 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/ImageAreaV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/ImageAreaV2Impl.java @@ -31,7 +31,7 @@ import com.adobe.cq.wcm.core.components.models.ImageArea; import io.wcm.handler.media.imagemap.ImageMapArea; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; /** * Implementation of {@link ImageArea}. diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java index 60869e4e..25c74afa 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import io.wcm.handler.link.Link; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.models.mixin.LinkMixin; /** diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java index 91ca987f..4c5ede18 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java @@ -31,7 +31,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import io.wcm.handler.link.SyntheticLinkResource; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; /** * {@link ListItem} implementation for any links. diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java index 4f105fbf..5d0fd5b6 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java @@ -48,7 +48,7 @@ import io.wcm.handler.link.Link; import io.wcm.handler.link.type.InternalLinkType; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.impl.util.CoreResourceWrapper; /** diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java index 5b97ea40..7afbd93a 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java @@ -32,7 +32,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.wcm.handler.link.Link; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.impl.models.helpers.LinkListItemV1Impl; import io.wcm.wcm.core.components.impl.models.v2.TeaserV2Impl; import io.wcm.wcm.core.components.models.mixin.LinkMixin; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java index 431ea67a..865a3e57 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java @@ -39,7 +39,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.wcm.handler.link.LinkHandler; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.impl.models.helpers.AbstractComponentImpl; import io.wcm.wcm.core.components.impl.util.HandlerUnwrapper; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java index 23c87273..8e967d68 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java @@ -55,7 +55,7 @@ import io.wcm.handler.richtext.RichTextHandler; import io.wcm.handler.richtext.TextMode; import io.wcm.sling.models.annotations.AemObject; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.impl.models.helpers.AbstractComponentImpl; import io.wcm.wcm.core.components.impl.models.helpers.LinkListItemV2Impl; import io.wcm.wcm.core.components.impl.util.ComponentFeatureImageResolver; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/ImageV3Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/ImageV3Impl.java index 51d281d3..22a10616 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/ImageV3Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/ImageV3Impl.java @@ -62,7 +62,7 @@ import io.wcm.handler.media.format.Ratio; import io.wcm.handler.url.UrlHandler; import io.wcm.sling.models.annotations.AemObject; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.impl.models.helpers.AbstractComponentImpl; import io.wcm.wcm.core.components.impl.models.helpers.ImageAreaV2Impl; import io.wcm.wcm.core.components.impl.util.ComponentFeatureImageResolver; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java index 9b2294ce..527f6cc5 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v3/TitleV3Impl.java @@ -40,7 +40,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.wcm.handler.link.LinkHandler; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.impl.models.helpers.AbstractComponentImpl; import io.wcm.wcm.core.components.impl.util.HandlerUnwrapper; diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v4/ListV4Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v4/ListV4Impl.java index 3c4269c3..fbca855f 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v4/ListV4Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v4/ListV4Impl.java @@ -52,7 +52,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.wcm.handler.link.Link; import io.wcm.handler.link.LinkHandler; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.impl.models.helpers.AbstractComponentImpl; import io.wcm.wcm.core.components.impl.models.helpers.LinkListItemV2Impl; import io.wcm.wcm.core.components.impl.models.helpers.PageListItemV4Impl; diff --git a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/link/LinkWrapperTest.java b/bundles/core/src/test/java/io/wcm/wcm/core/components/commons/link/LinkWrapperTest.java similarity index 97% rename from bundles/core/src/test/java/io/wcm/wcm/core/components/impl/link/LinkWrapperTest.java rename to bundles/core/src/test/java/io/wcm/wcm/core/components/commons/link/LinkWrapperTest.java index bddb9b21..67b5c571 100644 --- a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/link/LinkWrapperTest.java +++ b/bundles/core/src/test/java/io/wcm/wcm/core/components/commons/link/LinkWrapperTest.java @@ -17,7 +17,7 @@ * limitations under the License. * #L% */ -package io.wcm.wcm.core.components.impl.link; +package io.wcm.wcm.core.components.commons.link; import static io.wcm.handler.link.LinkNameConstants.PN_LINK_EXTERNAL_REF; import static io.wcm.handler.link.LinkNameConstants.PN_LINK_TYPE; @@ -48,6 +48,7 @@ import io.wcm.testing.mock.aem.junit5.AemContext; import io.wcm.testing.mock.aem.junit5.AemContextExtension; import io.wcm.wcm.commons.contenttype.ContentType; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.testcontext.AppAemContext; @ExtendWith(AemContextExtension.class) diff --git a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1ImplTest.java b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1ImplTest.java index 13996a3b..9a178317 100644 --- a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1ImplTest.java +++ b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1ImplTest.java @@ -36,7 +36,7 @@ import io.wcm.sling.commons.adapter.AdaptTo; import io.wcm.testing.mock.aem.junit5.AemContext; import io.wcm.testing.mock.aem.junit5.AemContextExtension; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.testcontext.AppAemContext; @ExtendWith(AemContextExtension.class) diff --git a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2ImplTest.java b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2ImplTest.java index 9b464829..8cb87da5 100644 --- a/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2ImplTest.java +++ b/bundles/core/src/test/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2ImplTest.java @@ -35,7 +35,7 @@ import io.wcm.sling.commons.adapter.AdaptTo; import io.wcm.testing.mock.aem.junit5.AemContext; import io.wcm.testing.mock.aem.junit5.AemContextExtension; -import io.wcm.wcm.core.components.impl.link.LinkWrapper; +import io.wcm.wcm.core.components.commons.link.LinkWrapper; import io.wcm.wcm.core.components.testcontext.AppAemContext; @ExtendWith(AemContextExtension.class) diff --git a/changes.xml b/changes.xml index 281213f2..a6195bd4 100644 --- a/changes.xml +++ b/changes.xml @@ -30,6 +30,9 @@ Update to AEM WCM Core Components 2.23.2. + + Export LinkWrapper and LinkHtmlAttributesSerializer via OSGi to make them reusable in project code. + ComponentFeatureImageResolver: Switch to image from page by default if no image reference is given in image/teaser resource.