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

Export LinkWrapper and LinkHtmlAttributesSerializer via OSGi to make them reusable in project code #15

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Map<String, String>> {
public final class LinkHtmlAttributesSerializer extends StdSerializer<Map<String, String>> {
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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%
*/
/**
* Bridges wcm.io Link to Core Components Link.
*/
@org.osgi.annotation.versioning.Version("1.0.0")
package io.wcm.wcm.core.components.commons.link;
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<action type="update" dev="sseifert" issue="14">
Update to AEM WCM Core Components 2.23.2.
</action>
<action type="update" dev="sseifert" issue="15">
Export LinkWrapper and LinkHtmlAttributesSerializer via OSGi to make them reusable in project code.
</action>
<action type="fix" dev="sseifert">
ComponentFeatureImageResolver: Switch to image from page by default if no image reference is given in image/teaser resource.
</action>
Expand Down