diff --git a/all/pom.xml b/all/pom.xml index 97bd5f079..2eb80e9ea 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -7,7 +7,7 @@ com.exadel.etoolbox etoolbox-authoring-kit - 2.5.0 + 2.5.1 etoolbox-authoring-kit-all @@ -66,13 +66,13 @@ true - ${basedir}/src/main/content/jcr_root/etc/packages/${project.groupId}/${project.parent.artifactId} + ${basedir}/src/main/content/jcr_root/etc/packages/${project.groupId} ** - .snapshot - .snapshot/.keep + ${project.parent.artifactId}/.snapshot + ${project.parent.artifactId}/.snapshot/.keep diff --git a/all/src/main/content/META-INF/vault/filter.xml b/all/src/main/content/META-INF/vault/filter.xml index 4786d31c8..def2eadb6 100644 --- a/all/src/main/content/META-INF/vault/filter.xml +++ b/all/src/main/content/META-INF/vault/filter.xml @@ -1,6 +1,5 @@ - - - + + diff --git a/core/pom.xml b/core/pom.xml index fb3e981d5..0b950ce59 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -7,7 +7,7 @@ com.exadel.etoolbox etoolbox-authoring-kit - 2.5.0 + 2.5.1 etoolbox-authoring-kit-core diff --git a/core/src/main/java/com/exadel/aem/toolkit/api/annotations/editconfig/DropTargetConfig.java b/core/src/main/java/com/exadel/aem/toolkit/api/annotations/editconfig/DropTargetConfig.java index 899dbe255..db3317ec7 100644 --- a/core/src/main/java/com/exadel/aem/toolkit/api/annotations/editconfig/DropTargetConfig.java +++ b/core/src/main/java/com/exadel/aem/toolkit/api/annotations/editconfig/DropTargetConfig.java @@ -18,6 +18,8 @@ import java.lang.annotation.Target; import com.exadel.aem.toolkit.api.annotations.meta.AnnotationRendering; +import com.exadel.aem.toolkit.api.annotations.meta.ValueRestriction; +import com.exadel.aem.toolkit.api.annotations.meta.ValueRestrictions; /** * Defines a target for a drag-and-drop operation in Granite UI. Upon processing this annotation, a {@code @@ -46,11 +48,13 @@ * Maps to the {@code propertyName} attribute of {@code cq:editConfig/cq:dropTargets/} node * @return Non-blank string */ + @ValueRestriction(ValueRestrictions.NOT_BLANK) String propertyName(); /** * Used to specify tag name of the current {@code cq:editConfig/cq:dropTargets} subnode * @return Non-blank string */ + @ValueRestriction(ValueRestrictions.NOT_BLANK) String nodeName(); } diff --git a/docs/content/getting-started/installation.md b/docs/content/getting-started/installation.md index 9d82cf39d..93fd92c1e 100644 --- a/docs/content/getting-started/installation.md +++ b/docs/content/getting-started/installation.md @@ -11,7 +11,7 @@ seoTitle: Installation - Exadel Authoring Kit com.exadel.etoolbox etoolbox-authoring-kit-core - 2.5.0 + 2.5.1 provided ``` @@ -21,7 +21,7 @@ seoTitle: Installation - Exadel Authoring Kit com.exadel.etoolbox etoolbox-authoring-kit-plugin - 2.5.0 + 2.5.1 @@ -32,7 +32,7 @@ seoTitle: Installation - Exadel Authoring Kit jcr_root/apps/acme/components - + com.acme.project.components.* ALL @@ -79,7 +79,7 @@ You need to do two steps. com.exadel.etoolbox etoolbox-authoring-kit-all - 2.5.0 + 2.5.1 content-package ``` diff --git a/docs/website/package-lock.json b/docs/website/package-lock.json index 2fe18898c..39d2586ca 100644 --- a/docs/website/package-lock.json +++ b/docs/website/package-lock.json @@ -1,12 +1,12 @@ { "name": "eak-website", - "version": "2.5.0", + "version": "2.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "eak-website", - "version": "2.5.0", + "version": "2.5.1", "license": "ISC", "dependencies": { "@exadel/esl": "^4.9.4", diff --git a/it.tests/pom.xml b/it.tests/pom.xml index a5c907a05..e43d155a1 100644 --- a/it.tests/pom.xml +++ b/it.tests/pom.xml @@ -20,7 +20,7 @@ com.exadel.etoolbox etoolbox-authoring-kit - 2.5.0 + 2.5.1 etoolbox-authoring-kit-it.tests diff --git a/plugin/pom.xml b/plugin/pom.xml index cad8a2fa8..9a5a48c15 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -7,7 +7,7 @@ com.exadel.etoolbox etoolbox-authoring-kit - 2.5.0 + 2.5.1 etoolbox-authoring-kit-plugin diff --git a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/handlers/editconfig/DropTargetsHandler.java b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/handlers/editconfig/DropTargetsHandler.java index 671238fb5..422ab1209 100644 --- a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/handlers/editconfig/DropTargetsHandler.java +++ b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/handlers/editconfig/DropTargetsHandler.java @@ -17,10 +17,14 @@ import java.util.function.BiConsumer; import java.util.stream.Collectors; +import org.apache.commons.lang3.StringUtils; + import com.exadel.aem.toolkit.api.annotations.editconfig.DropTargetConfig; import com.exadel.aem.toolkit.api.annotations.editconfig.EditConfig; import com.exadel.aem.toolkit.api.handlers.Source; import com.exadel.aem.toolkit.api.handlers.Target; +import com.exadel.aem.toolkit.plugin.exceptions.ValidationException; +import com.exadel.aem.toolkit.plugin.maven.PluginRuntime; import com.exadel.aem.toolkit.plugin.metadata.RenderingFilter; import com.exadel.aem.toolkit.plugin.utils.DialogConstants; @@ -31,6 +35,8 @@ */ public class DropTargetsHandler implements BiConsumer { + private static final String INVALID_NAME_MESSAGE = "Invalid drop target node name"; + /** * Processes data that can be extracted from the given {@code Source} and stores it into the provided {@code Target} * @param source {@code Source} object used for data retrieval @@ -45,6 +51,9 @@ public void accept(Source source, Target target) { Target dropTargetsElement = target.getOrCreateTarget(DialogConstants.NN_DROP_TARGETS); for (int i = 0; i < editConfig.dropTargets().length; i++) { DropTargetConfig dropTargetConfig = editConfig.dropTargets()[i]; + if (StringUtils.isBlank(dropTargetConfig.nodeName())) { + PluginRuntime.context().getExceptionHandler().handle(new ValidationException(INVALID_NAME_MESSAGE)); + } dropTargetsElement.getOrCreateTarget(dropTargetConfig.nodeName()) .attribute(DialogConstants.PN_PRIMARY_TYPE, DialogConstants.NT_DROP_TARGET_CONFIG) .attributes(dropTargetConfig, new RenderingFilter(dropTargetConfig)) diff --git a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/ReflectionContextHelper.java b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/ReflectionContextHelper.java index a8971c9cc..c6513597a 100644 --- a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/ReflectionContextHelper.java +++ b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/ReflectionContextHelper.java @@ -59,6 +59,7 @@ */ public class ReflectionContextHelper { + private static final char SEPARATOR_COMMA = ','; private Reflections reflections; private ClassLoader classLoader; @@ -101,9 +102,10 @@ public ClassLoader getClassLoader() { * @return A non-null list of {@code ComponentSource} objects; can be empty */ public List getComponents(String packageBase) { + String[] packageRoots = StringUtils.split(packageBase, SEPARATOR_COMMA); return getComponents() .stream() - .filter(comp -> StringUtils.isEmpty(packageBase) || ClassUtil.matchesReference(comp.adaptTo(Class.class), packageBase)) + .filter(comp -> StringUtils.isEmpty(packageBase) || ClassUtil.matchesReference(comp.adaptTo(Class.class), packageRoots)) .collect(Collectors.toList()); } diff --git a/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/ValidatorsTest.java b/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/ValidatorsTest.java index 4d0b38226..3479c8485 100644 --- a/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/ValidatorsTest.java +++ b/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/ValidatorsTest.java @@ -128,4 +128,20 @@ public void testDialogTitleMissing() { ValidationException.class, "Title property is missing for dialog"); } + + @Test + public void testWrongDropTarget() { + pluginContext.testThrows( + ValidatorTestCases.InvalidDropTargetConfig.class, + ValidationException.class, + "Invalid drop target"); + } + + @Test + public void testWrongDropTarget2() { + pluginContext.testThrows( + ValidatorTestCases.InvalidDropTargetConfig2.class, + ValidationException.class, + "' ' provided"); + } } diff --git a/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/cases/ValidatorTestCases.java b/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/cases/ValidatorTestCases.java index 09dca8ce0..0f9952db1 100644 --- a/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/cases/ValidatorTestCases.java +++ b/plugin/src/test/com/exadel/aem/toolkit/plugin/validators/cases/ValidatorTestCases.java @@ -16,6 +16,8 @@ import static com.exadel.aem.toolkit.plugin.maven.TestConstants.DEFAULT_COMPONENT_NAME; import static com.exadel.aem.toolkit.plugin.maven.TestConstants.DEFAULT_COMPONENT_TITLE; +import com.exadel.aem.toolkit.api.annotations.editconfig.DropTargetConfig; +import com.exadel.aem.toolkit.api.annotations.editconfig.EditConfig; import com.exadel.aem.toolkit.api.annotations.main.AemComponent; import com.exadel.aem.toolkit.api.annotations.main.Dialog; import com.exadel.aem.toolkit.api.annotations.main.HtmlTag; @@ -114,4 +116,22 @@ public static class ComponentWithWrongHtmlTag1 {} @Dialog @HtmlTag(className = " ") public static class ComponentWithWrongHtmlTag2 {} + + @AemComponent(path = DEFAULT_COMPONENT_NAME, title = DEFAULT_COMPONENT_TITLE) + @EditConfig( + dropTargets = @DropTargetConfig( + nodeName = " ", + accept = {"image/*"}, + groups = {"media"}, + propertyName = "")) + public static class InvalidDropTargetConfig {} + + @AemComponent(path = DEFAULT_COMPONENT_NAME, title = DEFAULT_COMPONENT_TITLE) + @EditConfig( + dropTargets = @DropTargetConfig( + nodeName = "image", + accept = {"image/*"}, + groups = {"media"}, + propertyName = " ")) + public static class InvalidDropTargetConfig2 {} } diff --git a/pom.xml b/pom.xml index 36cabfc66..3ac2a6ad8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.exadel.etoolbox etoolbox-authoring-kit - 2.5.0 + 2.5.1 Exadel Toolbox Authoring Kit Automates generating and managing rich and responsive authoring interfaces for Adobe Experience Manager diff --git a/ui.apps/package-lock.json b/ui.apps/package-lock.json index 7f2dc9cf9..b84c9babb 100644 --- a/ui.apps/package-lock.json +++ b/ui.apps/package-lock.json @@ -1,12 +1,12 @@ { "name": "depends-on", - "version": "2.5.0", + "version": "2.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "depends-on", - "version": "2.5.0", + "version": "2.5.1", "license": "Apache-2.0", "devDependencies": { "eslint": "^8.45.0", diff --git a/ui.apps/package.json b/ui.apps/package.json index 2cffeb37e..fa2db7fc6 100644 --- a/ui.apps/package.json +++ b/ui.apps/package.json @@ -1,7 +1,7 @@ { "name": "depends-on", "description": "A clientlib that executes defined action on dependent fields", - "version": "2.5.0", + "version": "2.5.1", "private": true, "devDependencies": { "eslint": "^8.45.0", diff --git a/ui.apps/pom.xml b/ui.apps/pom.xml index aad38f657..a09d86326 100644 --- a/ui.apps/pom.xml +++ b/ui.apps/pom.xml @@ -7,7 +7,7 @@ com.exadel.etoolbox etoolbox-authoring-kit - 2.5.0 + 2.5.1 etoolbox-authoring-kit-ui.apps diff --git a/ui.apps/src/main/content/META-INF/vault/filter.xml b/ui.apps/src/main/content/META-INF/vault/filter.xml index 9ec4f568e..f93c58fcd 100644 --- a/ui.apps/src/main/content/META-INF/vault/filter.xml +++ b/ui.apps/src/main/content/META-INF/vault/filter.xml @@ -7,8 +7,4 @@ - - - - diff --git a/ui.apps/src/main/content/jcr_root/apps/etoolbox-authoring-kit/config/.content.xml b/ui.apps/src/main/content/jcr_root/apps/etoolbox-authoring-kit/config/.content.xml new file mode 100644 index 000000000..491392d53 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/etoolbox-authoring-kit/config/.content.xml @@ -0,0 +1,3 @@ + + diff --git a/ui.apps/src/main/content/jcr_root/apps/etoolbox-authoring-kit/config/org.apache.sling.commons.log.LogManager.factory.config-eak.xml b/ui.apps/src/main/content/jcr_root/apps/etoolbox-authoring-kit/config/org.apache.sling.commons.log.LogManager.factory.config-eak.xml new file mode 100644 index 000000000..dbb7e1e23 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/etoolbox-authoring-kit/config/org.apache.sling.commons.log.LogManager.factory.config-eak.xml @@ -0,0 +1,7 @@ + + diff --git a/ui.content/pom.xml b/ui.content/pom.xml index 210f4be63..ee95ef29f 100644 --- a/ui.content/pom.xml +++ b/ui.content/pom.xml @@ -8,7 +8,7 @@ com.exadel.etoolbox etoolbox-authoring-kit - 2.5.0 + 2.5.1 etoolbox-authoring-kit-ui.content diff --git a/ui.content/src/main/content/META-INF/vault/filter.xml b/ui.content/src/main/content/META-INF/vault/filter.xml index b66a2eb17..e42007fb4 100644 --- a/ui.content/src/main/content/META-INF/vault/filter.xml +++ b/ui.content/src/main/content/META-INF/vault/filter.xml @@ -1,7 +1,4 @@ - - -