-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency to commons.lang for Cloud Service (#3422)
This fixes #3421 --------- Co-authored-by: david g. <[email protected]> Co-authored-by: Konrad Windszus <[email protected]>
- Loading branch information
1 parent
7727fe1
commit 2bb97f0
Showing
11 changed files
with
199 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
bundle-cloud/src/main/java/com/adobe/acs/commons/email/impl/MailTemplateManagerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* #%L | ||
* ACS AEM Commons Bundle | ||
* %% | ||
* 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. | ||
* #L% | ||
*/ | ||
package com.adobe.acs.commons.email.impl; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import javax.mail.MessagingException; | ||
|
||
import org.apache.commons.mail.Email; | ||
import org.apache.commons.mail.EmailException; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
import com.day.cq.commons.mail.MailTemplate; | ||
|
||
@Component(service = MailTemplateManager.class) | ||
public class MailTemplateManagerImpl implements MailTemplateManager { | ||
|
||
@Override | ||
public <T extends Email> T getEmail(final MailTemplate template, | ||
final Map<String, String> params, | ||
final Class<T> mailType) | ||
throws IOException, EmailException, MessagingException { | ||
return template.getEmail(params, mailType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
bundle-onprem/src/main/java/com/adobe/acs/commons/email/impl/MailTemplateManagerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* #%L | ||
* ACS AEM Commons Bundle | ||
* %% | ||
* 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. | ||
* #L% | ||
*/ | ||
package com.adobe.acs.commons.email.impl; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import javax.mail.MessagingException; | ||
|
||
import org.apache.commons.lang.text.StrLookup; | ||
import org.apache.commons.mail.Email; | ||
import org.apache.commons.mail.EmailException; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
import com.day.cq.commons.mail.MailTemplate; | ||
|
||
@Component(service = MailTemplateManager.class) | ||
public class MailTemplateManagerImpl implements MailTemplateManager { | ||
|
||
@Override | ||
public <T extends Email> T getEmail(final MailTemplate template, | ||
final Map<String, String> params, | ||
final Class<T> mailType) | ||
throws IOException, EmailException, MessagingException { | ||
return template.getEmail(StrLookup.mapLookup(params), mailType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
bundle/src/main/java/com/adobe/acs/commons/email/impl/MailTemplateManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/*- | ||
* #%L | ||
* ACS AEM Commons Bundle | ||
* %% | ||
* 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. | ||
* #L% | ||
*/ | ||
package com.adobe.acs.commons.email.impl; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import javax.mail.MessagingException; | ||
|
||
import org.apache.commons.mail.Email; | ||
import org.apache.commons.mail.EmailException; | ||
|
||
import com.day.cq.commons.mail.MailTemplate; | ||
|
||
/** | ||
* Abstraction to allow different methods to be used between Cloud Service and on prem. | ||
*/ | ||
public interface MailTemplateManager { | ||
|
||
/** | ||
* Get the email from the template | ||
* @param <T> The email type | ||
* @param template The email template | ||
* @param params Optional parameters used inside the template | ||
* @param mailType The email type | ||
* @return The email object | ||
* @throws IOException If an error occurs handling the text template. | ||
* @throws MessagingException If an error occurs during building the email message. | ||
* @throws EmailException If an error occurs during building the email. | ||
*/ | ||
<T extends Email> T getEmail(MailTemplate template, final Map<String, String> params, Class<T> mailType) | ||
throws IOException, EmailException, MessagingException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters