diff --git a/accesscontroltool-apps-package/pom.xml b/accesscontroltool-apps-package/pom.xml index 0227e3fc..a1bfa2c6 100644 --- a/accesscontroltool-apps-package/pom.xml +++ b/accesscontroltool-apps-package/pom.xml @@ -15,7 +15,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT diff --git a/accesscontroltool-bundle/pom.xml b/accesscontroltool-bundle/pom.xml index d9f55403..4da50b6f 100644 --- a/accesscontroltool-bundle/pom.xml +++ b/accesscontroltool-bundle/pom.xml @@ -11,7 +11,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluator.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluator.java index df194b6d..15524d9d 100644 --- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluator.java +++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluator.java @@ -136,6 +136,9 @@ public ElFunctionMapper() { StringUtils.class.getMethod("replace", new Class[] { String.class, String.class, String.class }), StringUtils.class.getMethod("length", new Class[] { CharSequence.class }), StringUtils.class.getMethod("defaultIfEmpty", new Class[] { CharSequence.class, CharSequence.class }), + StringUtils.class.getMethod("defaultIfBlank", new Class[] { CharSequence.class, CharSequence.class }), + StringUtils.class.getMethod("isEmpty", new Class[] { CharSequence.class }), + StringUtils.class.getMethod("isBlank", new Class[] { CharSequence.class }), YamlMacroElEvaluator.ElFunctionMapper.class.getMethod("containsItem", new Class[] { List.class, String.class }), YamlMacroElEvaluator.ElFunctionMapper.class.getMethod("containsAllItems", new Class[] { List.class, List.class }), diff --git a/accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluatorTest.java b/accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluatorTest.java index e44a37e4..aa67359b 100644 --- a/accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluatorTest.java +++ b/accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroElEvaluatorTest.java @@ -34,9 +34,15 @@ public void setUp() { @Test void testFunctions() { + assertEquals(true, evaluateSimpleExpression("isBlank(\"\")")); + assertEquals(true, evaluateSimpleExpression("isBlank(\" \")")); + assertEquals(true, evaluateSimpleExpression("isEmpty(\"\")")); + assertEquals(false, evaluateSimpleExpression("isEmpty(\" \")")); assertEquals("bread&butter", evaluateSimpleExpression("escapeXml(\"bread&butter\")")); assertEquals("Test", evaluateSimpleExpression("capitalize(\"test\")")); assertEquals("item1,item2", evaluateSimpleExpression("join(var1, \",\")", Collections.singletonMap("var1", new Object[] {"item1", "item2"}))); + assertEquals("foo", evaluateSimpleExpression("defaultIfBlank(\" \",\"foo\")")); + assertEquals("bar", evaluateSimpleExpression("defaultIfBlank(\"bar\",\"foo\")")); } @Test diff --git a/accesscontroltool-content-package/pom.xml b/accesscontroltool-content-package/pom.xml index 62801e63..639aae44 100644 --- a/accesscontroltool-content-package/pom.xml +++ b/accesscontroltool-content-package/pom.xml @@ -15,7 +15,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT diff --git a/accesscontroltool-exampleconfig-package/pom.xml b/accesscontroltool-exampleconfig-package/pom.xml index 5a879442..b8092967 100644 --- a/accesscontroltool-exampleconfig-package/pom.xml +++ b/accesscontroltool-exampleconfig-package/pom.xml @@ -15,7 +15,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT diff --git a/accesscontroltool-oakindex-package/pom.xml b/accesscontroltool-oakindex-package/pom.xml index c304779b..7cf2cc86 100644 --- a/accesscontroltool-oakindex-package/pom.xml +++ b/accesscontroltool-oakindex-package/pom.xml @@ -15,7 +15,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT diff --git a/accesscontroltool-package/pom.xml b/accesscontroltool-package/pom.xml index 8dcb20ce..27e4e532 100644 --- a/accesscontroltool-package/pom.xml +++ b/accesscontroltool-package/pom.xml @@ -15,7 +15,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT diff --git a/accesscontroltool-startuphook-bundle/pom.xml b/accesscontroltool-startuphook-bundle/pom.xml index 06c44ebd..10034be1 100644 --- a/accesscontroltool-startuphook-bundle/pom.xml +++ b/accesscontroltool-startuphook-bundle/pom.xml @@ -11,7 +11,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT diff --git a/docs/AdvancedFeatures.md b/docs/AdvancedFeatures.md index 657e3bf3..0dd06d71 100644 --- a/docs/AdvancedFeatures.md +++ b/docs/AdvancedFeatures.md @@ -7,31 +7,33 @@ Expressions are evaluated using the [Jakarta Expression Language 4.0](https://ja The following utility functions are made available to any EL expression used in YAML. They can either be used standalone or combined with the [default EL operators](https://docs.oracle.com/javaee/6/tutorial/doc/bnaik.html). -Function Signature | Description ----|--- -`split(String str, String separator)`|[`StringUtils.split(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#split(java.lang.String,%20java.lang.String)) -`join(Object[] array, String separator)`|[`StringUtils.join(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#join(java.lang.Object[],%20java.lang.String)) -`subarray(String array, startIndexInclusive,endIndexExclusive)`| [`ArrayUtils.subarray(...)`](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/ArrayUtils.html#subarray-T:A-int-int-) -`upperCase(String str)`|[`StringUtils.upperCase(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#upperCase(java.lang.String)) -`lowerCase(String str)`|[`StringUtils.lowerCase(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#lowerCase(java.lang.String)) -`capitalize(String str)`|[`StringUtils.capitalize(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#capitalize(java.lang.String)) -`replace(String text, String searchString, String replacement)`|[`StringUtils.replace(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#replace(java.lang.String,%20java.lang.String,%20java.lang.String)) -`substringAfter(String str, String separator)`|[`StringUtils.substringAfter(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringAfter(java.lang.String,%20java.lang.String)) -`substringBefore(String str, String separator)`|[`StringUtils.substringBefore(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringBefore(java.lang.String,%20java.lang.String)) -`substringAfterLast(String str, String separator)`|[`StringUtils.substringAfterLast(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringAfterLast(java.lang.String,%20java.lang.String)) -`substringBeforeLast(String str, String separator)`|[`StringUtils.substringBeforeLast(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringBeforeLast(java.lang.String,%20java.lang.String)) -`contains(String str, String fragmentStr)`|[`StringUtils.contains(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#contains(java.lang.CharSequence,%20java.lang.CharSequence)) -`endsWith(String str, String suffix)`|[`StringUtils.endsWith(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#endsWith(java.lang.CharSequence,%20java.lang.CharSequence)) -`startsWith(String str, String prefix)`| [`StringUtils.startsWith(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#startsWith(java.lang.CharSequence,%20java.lang.CharSequence)) -`length(String string)`| [`StringUtils.length(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#length(java.lang.CharSequence)) -`defaultIfEmpty(String str, String default)` | [`StringUtils.defaultIfEmpty(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#defaultIfEmpty(T,%20T)) -`escapeXml(String str)` | [`StringEscapeUtils.escapeXml10(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringEscapeUtils.html#escapeXml10(java.lang.String)), useful for escaping values within `initialContent` which uses [enhanced JCR DocView syntax (an XML 1.0 language)](https://jackrabbit.apache.org/filevault/docview.html). -`containsItem(List list, String item)`| Returns `true` if the item is contained in the given list. -`containsAnyItem(List list, List items)`| Returns `true` if any of the items is contained in the given list. -`containsAllItems(List list, List items)`| Returns `true` if all of the items are contained in the given list (independent of their order). -`keys(Map map)`| Returns the list of keys for the given map. The order is non-predictable. -`values(Map map)`| Returns all values for the given map. The order is non-predictable. - +Function Signature | Description | Since +---|---|--- +`capitalize(String str)`| [`StringUtils.capitalize(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#capitalize(java.lang.String)) | 3.1.0 +`contains(String str, String fragmentStr)`| [`StringUtils.contains(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#contains(java.lang.CharSequence,%20java.lang.CharSequence)) | 1.8.0 +`containsAllItems(List list, List items)`| Returns `true` if all of the items are contained in the given list (independent of their order). | 2.6.1 +`containsAnyItem(List list, List items)`| Returns `true` if any of the items is contained in the given list. | 2.6.1 +`containsItem(List list, String item)`| Returns `true` if the item is contained in the given list. | 2.2.0 +`defaultIfBlank(String str, String default)` | [`StringUtils.defaultIfBlank(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#defaultIfBlank(T,%20T)) | 3.3.0 +`defaultIfEmpty(String str, String default)` | [`StringUtils.defaultIfEmpty(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#defaultIfEmpty(T,%20T)) | 2.5.0 +`endsWith(String str, String suffix)`| [`StringUtils.endsWith(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#endsWith(java.lang.CharSequence,%20java.lang.CharSequence)) | 1.8.0 +`escapeXml(String str)` | [`StringEscapeUtils.escapeXml10(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringEscapeUtils.html#escapeXml10(java.lang.String)), useful for escaping values within `initialContent` which uses [enhanced JCR DocView syntax (an XML 1.0 language)](https://jackrabbit.apache.org/filevault/docview.html) | 3.1.0 +`isBlank(String str)` | [`StringUtils.isBlank(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#isBlank(java.lang.CharSequence)) | 3.3.0 +`isEmpty(String str)` | [`StringUtils.isEmpty(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#isEmpty(java.lang.CharSequence)) | 3.3.0 +`join(Object[] array, String separator)`| [`StringUtils.join(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#join(java.lang.Object[],%20java.lang.String)) | 1.8.0 +`keys(Map map)`| Returns the list of keys for the given map. The order is non-predictable. | 2.6.0 +`length(String string)`| [`StringUtils.length(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#length(java.lang.CharSequence)) | 2.0.6 +`lowerCase(String str)`| [`StringUtils.lowerCase(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#lowerCase(java.lang.String)) | 1.8.0 +`upperCase(String str)`| [`StringUtils.upperCase(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#upperCase(java.lang.String)) | 1.8.0 +`replace(String text, String searchString, String replacement)`| [`StringUtils.replace(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#replace(java.lang.String,%20java.lang.String,%20java.lang.String)) | 1.9.3 +`split(String str, String separator)`| [`StringUtils.split(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#split(java.lang.String,%20java.lang.String)) | 1.8.0 +`subarray(String array, startIndexInclusive,endIndexExclusive)`| [`ArrayUtils.subarray(...)`](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/ArrayUtils.html#subarray-T:A-int-int-) | 1.8.0 +`substringAfter(String str, String separator)`| [`StringUtils.substringAfter(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringAfter(java.lang.String,%20java.lang.String)) | 1.8.0 +`substringAfterLast(String str, String separator)`| [`StringUtils.substringAfterLast(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringAfterLast(java.lang.String,%20java.lang.String)) | 1.8.0 +`substringBefore(String str, String separator)`| [`StringUtils.substringBefore(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringBefore(java.lang.String,%20java.lang.String)) | 1.8.0 +`substringBeforeLast(String str, String separator)`| [`StringUtils.substringBeforeLast(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#substringBeforeLast(java.lang.String,%20java.lang.String)) | 1.8.0 +`startsWith(String str, String prefix)`| [`StringUtils.startsWith(...)`](https://commons.apache.org/proper/commons-lang/javadocs/api-3.3/org/apache/commons/lang3/StringUtils.html#startsWith(java.lang.CharSequence,%20java.lang.CharSequence)) | 1.8.0 +`values(Map map)`| Returns all values for the given map. The order is non-predictable. | 2.6.0 ## Variables diff --git a/pom.xml b/pom.xml index 8af73737..b2187a9a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT pom Access Control Tool diff --git a/target-osgi-environment/maximum-environment/pom.xml b/target-osgi-environment/maximum-environment/pom.xml index 3038923c..9c4e20e8 100644 --- a/target-osgi-environment/maximum-environment/pom.xml +++ b/target-osgi-environment/maximum-environment/pom.xml @@ -21,7 +21,7 @@ biz.netcentric.cq.tools.accesscontroltool target-osgi-environment ../pom.xml - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT maximum-environment diff --git a/target-osgi-environment/minimum-environment/pom.xml b/target-osgi-environment/minimum-environment/pom.xml index db51064c..49d2ea68 100644 --- a/target-osgi-environment/minimum-environment/pom.xml +++ b/target-osgi-environment/minimum-environment/pom.xml @@ -21,7 +21,7 @@ biz.netcentric.cq.tools.accesscontroltool target-osgi-environment ../pom.xml - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT minimum-environment diff --git a/target-osgi-environment/pom.xml b/target-osgi-environment/pom.xml index 68c6433f..38284c91 100644 --- a/target-osgi-environment/pom.xml +++ b/target-osgi-environment/pom.xml @@ -20,7 +20,7 @@ biz.netcentric.cq.tools.accesscontroltool accesscontroltool ../pom.xml - 3.2.1-SNAPSHOT + 3.3.0-SNAPSHOT target-osgi-environment