Skip to content

Commit

Permalink
Merge pull request #1070 from adobe/develop
Browse files Browse the repository at this point in the history
v3.8.0
  • Loading branch information
davidjgonzalez authored Jan 4, 2024
2 parents f17e6d4 + e6cac5c commit 5596740
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 24 deletions.
2 changes: 1 addition & 1 deletion all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core.cloud/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.adobe.aem.commons.assetshare.content.AssetModel;
import com.adobe.aem.commons.assetshare.content.renditions.AssetRenditionParameters;
import com.adobe.aem.commons.assetshare.content.renditions.AssetRenditions;
import com.adobe.aem.commons.assetshare.util.AdobePdfEmbedApi;
import com.adobe.aem.commons.assetshare.util.RequireAem;
import com.adobe.aem.commons.assetshare.util.UrlUtil;
import com.adobe.cq.export.json.ComponentExporter;
Expand All @@ -13,10 +14,7 @@
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.api.wrappers.ValueMapDecorator;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Required;
import org.apache.sling.models.annotations.*;
import org.apache.sling.models.annotations.injectorspecific.OSGiService;
import org.apache.sling.models.annotations.injectorspecific.ScriptVariable;
import org.apache.sling.models.annotations.injectorspecific.Self;
Expand Down Expand Up @@ -58,6 +56,10 @@ public class PdfImpl extends AbstractEmptyTextComponent implements Pdf {
@Required
private RequireAem requireAem;

@OSGiService
@Optional
private AdobePdfEmbedApi adobePdfEmbedApi;

@ValueMapValue
private String renditionName;

Expand All @@ -68,6 +70,8 @@ public class PdfImpl extends AbstractEmptyTextComponent implements Pdf {

private String viewerId = null;

private String clientId = null;

private ValueMap properties = new ValueMapDecorator(new HashMap<>());

@PostConstruct
Expand Down Expand Up @@ -109,12 +113,22 @@ public String getFileName() {

@Override
public String getClientId() {
// "clientId" property is the legacy value before we added support for author and publish clientIds.
if (RequireAem.ServiceType.AUTHOR.equals(requireAem.getServiceType())) {
return currentStyle.get("authorClientId", currentStyle.get("clientId", String.class));
} else {
return currentStyle.get("publishClientId", currentStyle.get("clientId", String.class));

if (clientId == null) {
// "clientId" property is the legacy value before we added support for author and publish clientIds.
if (RequireAem.ServiceType.AUTHOR.equals(requireAem.getServiceType())) {
clientId = currentStyle.get("authorClientId", currentStyle.get("clientId", String.class));
} else {
clientId = currentStyle.get("publishClientId", currentStyle.get("clientId", String.class));
}

// Fallback to the AdobePdfEmbedApi OSGi service defined Adobe PDF Embed API Client ID
if (StringUtils.isBlank(clientId) && adobePdfEmbedApi != null) {
clientId = adobePdfEmbedApi.getClientId();
}
}

return clientId;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Asset Share Commons
*
* Copyright (C) 2024 Adobe
*
* 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.
*
*/

package com.adobe.aem.commons.assetshare.util;

import org.osgi.annotation.versioning.ProviderType;

@ProviderType
public interface AdobePdfEmbedApi {

/**
* @return the Adobe PDF Embed API Client ID.
*/
String getClientId();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Asset Share Commons
*
* Copyright (C) 2024 Adobe
*
* 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.
*
*/

package com.adobe.aem.commons.assetshare.util.impl;

import com.adobe.aem.commons.assetshare.util.AdobePdfEmbedApi;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Modified;
import org.osgi.service.metatype.annotations.Designate;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.osgi.service.metatype.annotations.Option;

/**
* Allows for Git-based managed Adobe PDF Embed API Client ID used for the Asset Share Commons PDF details.
*
* https://acrobatservices.adobe.com/dc-integration-creation-app-cdn/main.html?api=pdf-embed-api
*/
@Component(
configurationPolicy = ConfigurationPolicy.REQUIRE
)
@Designate(ocd = AdobePdfEmbedApiImpl.Config.class)
public class AdobePdfEmbedApiImpl implements AdobePdfEmbedApi {
private Config cfg;

@Override
public String getClientId() {
return cfg.client_id();
}

@ObjectClassDefinition(
name = "Asset Share Commons - Adobe PDF Embed API Configuration",
description = "Configuration for the Adobe PDF Embed API. Each domain requires a unique Client ID."
)
@interface Config {
@AttributeDefinition(
name = "Adobe PDF Embed API Client ID",
description = "Get free Adobe PDF Embed API Client ID from: https://acrobatservices.adobe.com/dc-integration-creation-app-cdn/main.html?api=pdf-embed-api"
)
String client_id();
}

@Activate
@Modified
protected void activate(Config cfg) {
this.cfg = cfg;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

@Version("1.15.0")
@Version("1.16.0")
package com.adobe.aem.commons.assetshare.util;

import org.osgi.annotation.versioning.Version;
Expand Down
2 changes: 1 addition & 1 deletion dispatcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<packaging>pom</packaging>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>

<name>Asset Share Commons - Reactor Project</name>
<description>asset-share-commons</description>
Expand Down
2 changes: 1 addition & 1 deletion ui.apps.structure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ui.apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
emptyText="Enter your Adobe Document Cloud client ID."
fieldDescription="Enter the client ID for your Adobe Document Cloud account registered with your Adobe Acrobat Viewer."
fieldDescription="Enter the client ID for your Adobe Document Cloud account registered with your Adobe Acrobat Viewer. This supersedes the any client ID defined in the Adobe PDF Embed API client ID via OSGi configuration."
fieldLabel="Client ID for AEM Publish domain"
name="./publishClientId"/>

<author-client-id
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
emptyText="Enter your Adobe Document Cloud client ID."
fieldDescription="Enter the client ID for your Adobe Document Cloud account registered with your Adobe Acrobat Viewer."
fieldDescription="Enter the client ID for your Adobe Document Cloud account registered with your Adobe Acrobat Viewer. This supersedes the any client ID defined in the Adobe PDF Embed API client ID via OSGi configuration."
fieldLabel="Client ID for AEM Author domain"
name="./authorClientId"/>
</items>
Expand Down
2 changes: 1 addition & 1 deletion ui.config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ui.content.sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ui.content/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ui.frontend.theme.dark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ui.frontend.theme.light/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.adobe.aem.commons</groupId>
<artifactId>assetshare</artifactId>
<version>3.7.3-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down

0 comments on commit 5596740

Please sign in to comment.