Skip to content

Commit

Permalink
Merge pull request #570 from exadel-inc/release/2.5.4
Browse files Browse the repository at this point in the history
[Tech] Merge release-2.5.4 branch to master
  • Loading branch information
smiakchilo authored Feb 24, 2025
2 parents 10bd546 + 3b3e334 commit 9dde785
Show file tree
Hide file tree
Showing 24 changed files with 83 additions and 69 deletions.
2 changes: 1 addition & 1 deletion all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
</parent>

<artifactId>etoolbox-authoring-kit-all</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
</parent>

<artifactId>etoolbox-authoring-kit-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
/**
* Defines the {@code target} attribute for a link to an internal resource
* @see LinkTarget
* @return One of {@code LinkTarget} values
* @return String value
*/
LinkTarget targetInternal() default LinkTarget.AUTO;
String targetInternal() default LinkTarget.AUTO;

/**
* Defines the {@code target} attribute for a link to an external resource
* @see LinkTarget
* @return One of {@code LinkTarget} values
* @return String value
*/
LinkTarget targetExternal() default LinkTarget.AUTO;
String targetExternal() default LinkTarget.AUTO;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@
package com.exadel.aem.toolkit.api.annotations.widgets.rte;

/**
* Contains possible values of {@link HtmlLinkRules#targetExternal()} and {@link HtmlLinkRules#targetInternal()} properties
* Enumerates values of {@link HtmlLinkRules#targetExternal()} and {@link HtmlLinkRules#targetInternal()} properties.
* These properties define the value of `target` attribute for an anchor tag
*/
public enum LinkTarget {
AUTO {
@Override
public String toString() {
return "";
}
},
MANUAL {
@Override
public String toString() {
return "manual";
}
},
BLANK {
@Override
public String toString() {
return "blank";
}
},
public class LinkTarget {

public static final String AUTO = "";

public static final String BLANK = "_blank";

@Deprecated
public static final String MANUAL = "manual";

public static final String PARENT = "_parent";

public static final String SELF = AUTO;

public static final String TOP = "_top";

/**
* Default (instantiation-preventing) constructor
*/
private LinkTarget() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public class CoreConstants {
public static final String EQUALITY_SIGN = "=";
public static final String WILDCARD = "*";

public static final String CONTENT_TYPE_JSON = "application/json;charset=utf-8";

/**
* Default (instantiation-restricting) constructor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
import com.exadel.aem.toolkit.core.lists.ListConstants;

/**
* Provides the collection of AEM resources that either represent Exadel Toolbox Lists or serve as folders for Exadel
* Toolbox Lists to be displayed in the Exadel Toolbox Lists console
* Provides the collection of AEM resources that either represent an EToolbox Lists or serve as folders for EToolbox
* Lists to be displayed in the EToolbox Lists console
* <p><u>Note</u>: This class is not a part of the public API and is subject to change. Do not use it in your own
* code</p>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import javax.annotation.Nonnull;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.sling.api.SlingHttpServletRequest;
Expand Down Expand Up @@ -59,7 +58,6 @@
"sling.servlet.methods=" + HttpConstants.METHOD_GET
})
public class OptionProviderServlet extends SlingSafeMethodsServlet {
private static final String CONTENT_TYPE_JSON = "application/json;charset=utf-8";

private static final String QUERY_KEY_OUTPUT = "output";
private static final String QUERY_VALUE_JSON = "json";
Expand All @@ -74,28 +72,28 @@ public class OptionProviderServlet extends SlingSafeMethodsServlet {
* @param response {@code SlingHttpServletResponse} instance
*/
@Override
protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) throws ServletException, IOException {
protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response)
throws ServletException, IOException {

List<Resource> options = optionProvider.getOptions(request);

if (CollectionUtils.isEmpty(options) && isJsonOutput(request)) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
if (!isJsonOutput(request)) {
DataSource ds = new SimpleDataSource(options.iterator());
request.setAttribute(DataSource.class.getName(), ds);
return;
}

if (isJsonOutput(request)) {
response.setContentType(CONTENT_TYPE_JSON);
response.setCharacterEncoding(StandardCharsets.UTF_8.toString());
try {
response.getWriter().print(getJsonOutput(options));
} catch (JSONException | NullPointerException e) {
throw new ServletException(e);
}
response.setCharacterEncoding(StandardCharsets.UTF_8.toString());
response.setContentType(CoreConstants.CONTENT_TYPE_JSON);
if (CollectionUtils.isEmpty(options)) {
response.getWriter().write(CoreConstants.ARRAY_OPENING + CoreConstants.ARRAY_CLOSING);
return;
}

DataSource ds = new SimpleDataSource(options.iterator());
request.setAttribute(DataSource.class.getName(), ds);
try {
response.getWriter().print(getJsonOutput(options));
} catch (JSONException | NullPointerException e) {
throw new ServletException(e);
}
}

/**
Expand All @@ -104,6 +102,9 @@ protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHtt
* @return True or false
*/
private static boolean isJsonOutput(SlingHttpServletRequest request) {
if (QUERY_VALUE_JSON.equalsIgnoreCase(request.getRequestPathInfo().getExtension())) {
return true;
}
RequestParameter jsonParameter = request.getRequestParameter(QUERY_KEY_OUTPUT);
if (jsonParameter == null) {
return false;
Expand Down
6 changes: 6 additions & 0 deletions docs/content/authoring-tools/etoolbox-lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@ public class MyComponent {
String optionList;
}
```

## Retrieving Lists' content via HTTP

Your website's authoring logic may require fetching the content of a list via HTTP — e.g., with an AJAX request. This can be achieved with the OptionSource / [OptionProvider](../dev-tools/option-provider.md) servlet. Make a GET request to `/apps/etoolbox-authoring-kit/datasources/option-provider.json?path=<path_to_EToolbox_list>`.

By default, the servlet returns a JSON array of objects with `text` and `value` properties matching the same-named attributes of list items. You will probably want to modify the mapping. To say, a typical EToolbox List makes use of `jcr:title` and `value` attributes. Add `&textMember=jcr:title` to expose _jcr:title_. Similarly, you can alter the `valueMember` parameter, add some `attributeMembers`, etc. Please remember that if an item doesn't have a non-blank mapping for both _text_ and _value_, it won't be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ mvn clean test -Pintegration -D"aem.host"=192.168.0.81 -D"aem.port"=8080 -D"aem.

### Doing regression testing

The ToolKit supports regression testing as well. Regression testing is done using an external AEM project. The aim is to make sure that a <newer> version of ToolKit (namely, the plugin) produces essentially the same XML markup as an <older> one. The <older> version is considered a "reference" and is used as a baseline for comparison.
The ToolKit supports regression testing as well. Regression testing is done using an external AEM project. The aim is to make sure that a _newer_ version of ToolKit (namely, the plugin) produces essentially the same XML markup as an _older_ one. The _older_ version is used as a baseline for comparison.

To run regression tests, you need to specify the dedicated Maven profile like the following:
```
Expand Down
6 changes: 3 additions & 3 deletions docs/content/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ seoTitle: Installation - Exadel Authoring Kit
<dependency>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit-core</artifactId>
<version>2.5.3</version> <!-- Prefer the latest stable version whenever possible -->
<version>2.5.4</version> <!-- Prefer the latest stable version whenever possible -->
<scope>provided</scope> <!-- Do not use compile or runtime scope!-->
</dependency>
```
Expand All @@ -21,7 +21,7 @@ seoTitle: Installation - Exadel Authoring Kit
<plugin>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit-plugin</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -79,7 +79,7 @@ You need to do two steps.
<dependency>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit-all</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
<type>content-package</type>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions docs/website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/website/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eak-website",
"version": "2.5.3",
"version": "2.5.4",
"description": "EAK website package definition",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion it.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
</parent>

<artifactId>etoolbox-authoring-kit-it.tests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
</parent>

<artifactId>etoolbox-authoring-kit-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class ScriptedComponent extends ScriptedParent {
},
maxUndoSteps = 25,
htmlLinkRules = @HtmlLinkRules(
targetInternal = LinkTarget.MANUAL,
targetInternal = LinkTarget.TOP,
targetExternal = LinkTarget.BLANK,
protocols = {"http:", "https:"},
defaultProtocol = "http:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class RichTextEditorWidget {
indentSize = 1,
maxUndoSteps = 25,
htmlLinkRules = @HtmlLinkRules(
targetInternal = LinkTarget.MANUAL,
targetInternal = LinkTarget.PARENT,
targetExternal = LinkTarget.BLANK,
protocols = {"http:", "https:"},
defaultProtocol = "http:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
protocols="[http:,https:]">
<targetConfig jcr:primaryType="nt:unstructured"
mode="auto"
targetExternal="blank"
targetInternal="manual"/>
targetExternal="_blank"
targetInternal="_top"/>
</links>
</htmlRules>
<granite:data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
</rtePlugins>
<htmlRules jcr:primaryType="nt:unstructured">
<links jcr:primaryType="nt:unstructured" defaultProtocol="http:" protocols="[http:,https:]">
<targetConfig jcr:primaryType="nt:unstructured" mode="auto" targetExternal="blank" targetInternal="manual"/>
<targetConfig jcr:primaryType="nt:unstructured" mode="auto" targetExternal="_blank" targetInternal="_parent"/>
</links>
</htmlRules>
</text>
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>

<name>Exadel Toolbox Authoring Kit</name>
<description>Automates generating and managing rich and responsive authoring interfaces for Adobe Experience Manager</description>
Expand Down Expand Up @@ -462,25 +462,25 @@
<dependency>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-anydiff-core</artifactId>
<version>1.0.0</version>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.13.4</version>
<version>2.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.4</version>
<version>2.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.2</version>
<version>2.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions ui.apps/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui.apps/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "depends-on",
"description": "A clientlib that executes defined action on dependent fields",
"version": "2.5.3",
"version": "2.5.4",
"private": true,
"devDependencies": {
"eslint": "^9.19.0",
Expand Down
2 changes: 1 addition & 1 deletion ui.apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
</parent>

<artifactId>etoolbox-authoring-kit-ui.apps</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@
return true;
}
const queryResult = ns.QueryProcessor.evaluateQuery(this.parsedQuery, this.$el);
ns.ActionRegistry.getAction(this.action).call(this, queryResult, this.data, this);
try {
ns.ActionRegistry.getAction(this.action).call(this, queryResult, this.data, this);
} catch (e) {
console.debug('[DependsOn]: Error while executing an action', e);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion ui.content/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-authoring-kit</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
</parent>

<artifactId>etoolbox-authoring-kit-ui.content</artifactId>
Expand Down

0 comments on commit 9dde785

Please sign in to comment.