Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberrolandvaltech committed Aug 7, 2018
2 parents b74885f + abf06f4 commit 0037f47
Show file tree
Hide file tree
Showing 69 changed files with 1,084 additions and 227 deletions.
5 changes: 5 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2018-08-07 1.2.0
- Updated API
- AEM 6.4 fix
- GUI fixes

2018-07-25 1.1.0
- Design improvements
- AEM 6.4 support
Expand Down
10 changes: 5 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ In the collect phase you define which nodes should be checked for a migration.

* forResources(String[] paths): use the given paths without any subnodes
* forChildResourcesOf(String path): use all direct childs of the given path (but no grandchilds)
* forDescendantResourcesOf(String path): use the whole subtree under this path
* forDescendantResourcesOf(String path, boolean includeRootResource): use the whole subtree under this path including or not including the parent root node

You can call these methods multiple times and combine them. They will be merged together.

Expand All @@ -152,7 +152,7 @@ Example:
println aecu.contentUpgradeBuilder()
.forResources((String[])["/content/we-retail/ca/en"])
.forChildResourcesOf("/content/we-retail/us/en")
.forDescendantResourcesOf("/content/we-retail/us/en/experience")
.forDescendantResourcesOf("/content/we-retail/us/en/experience", false)
.doSetProperty("name", "value")
.run()
```
Expand Down Expand Up @@ -220,7 +220,7 @@ def complexFilter = new ORFilter(
])

println aecu.contentUpgradeBuilder()
.forDescendantResourcesOf("/content/we-retail/ca/en")
.forDescendantResourcesOf("/content/we-retail/ca/en", false)
.filterWith(complexFilter)
.doSetProperty("name", "value")
.run()
Expand Down Expand Up @@ -380,7 +380,7 @@ You can access our AECU service (AecuService class) in case you have special req

# License

The AC Tool is licensed under the [MIT LICENSE](LICENSE).
The AECU tool is licensed under the [MIT LICENSE](LICENSE).

<a name="changelog"></a>

Expand All @@ -392,4 +392,4 @@ Please see our [history file](HISTORY).

# Developers

See our [developer zone](docs/developers.md).
See our [developer zone](docs/developers.md).
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>

<artifactId>aecu.api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2018 Valtech GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package de.valtech.aecu.api.groovy.console.bindings;

/**
* Groovy Console Bindings for AEM Simple Content Update. This provides the "aecu" binding variable.
*
* @author Roxana Muresan
*/
public interface AecuBinding {

/**
* Returns a content upgrade builder. This is the starting point for the migrations.
*
* @return builder
*/
ContentUpgrade contentUpgradeBuilder();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
/*
* Copyright 2018 Valtech GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package de.valtech.aecu.api.groovy.console.bindings;

import de.valtech.aecu.api.groovy.console.bindings.filters.FilterBy;

import org.apache.sling.api.resource.PersistenceException;

import java.util.Map;

/**
* This class provides the builder methods to perform a content upgrade.
*
* @author Roxana Muresan
*/
public interface ContentUpgrade {

/**
* Loops for given list of resources.
*
* @param paths list of paths
* @return upgrade object
**/
ContentUpgrade forResources(String[] paths);

/**
* Loops for all child resources of the given path. The path itself is not included.
*
* @param path path
* @return upgrade object
**/
ContentUpgrade forChildResourcesOf(String path);

/**
* Loops recursive for all child resources of the given path. The path itself is not included.
*
* @param path path
* @return upgrade object
**/
ContentUpgrade forDescendantResourcesOf(String path);


/**
* Loops recursive over all resources contained in the subtree at the given path.
*
* @param path path
* @return upgrade object
*/
ContentUpgrade forResourcesInSubtree(String path);

/**
* Filters by properties. Can be used also for Multi-value properties.
*
* @param conditionProperties properties to filter
* @return upgrade object
**/
ContentUpgrade filterByProperties(Map<String, Object> conditionProperties);

/**
* Filters by multi-value with the given name containing the given conditionValues
*
* @param name name of the multi-value property
* @param conditionValues values to search for
* @return upgrade object
*/
ContentUpgrade filterByMultiValuePropContains(String name, Object[] conditionValues);

/**
* Filters by node name exact match.
*
* @param nodeName node name
* @return upgrade object
*/
ContentUpgrade filterByNodeName(String nodeName);

/**
* Filters by node name using regular expression.
*
* @param regex regular expression (Java standard pattern)
* @return upgrade object
*/
ContentUpgrade filterByNodeNameRegex(String regex);

/**
* Filters by using the given filter.
*
* @param filter filter
* @return upgrade object
*/
ContentUpgrade filterWith(FilterBy filter);

/**
* Sets a property value.
*
* @param name property name
* @param value property value
* @return upgrade object
**/
ContentUpgrade doSetProperty(String name, Object value);

/**
* Deletes a property if existing.
*
* @param name property name
* @return upgrade object
*/
ContentUpgrade doDeleteProperty(String name);

/**
* Renames a property if existing.
*
* @param oldName old property name
* @param newName new property name
* @return upgrade object
*/
ContentUpgrade doRenameProperty(String oldName, String newName);

/**
* Copies a property to a relative path.
*
* @param name property name
* @param newName new property name
* @param relativeResourcePath relative path
* @return upgrade object
*/
ContentUpgrade doCopyPropertyToRelativePath(String name, String newName, String relativeResourcePath);

/**
* Moves a property to a relative path.
*
* @param name property name
* @param newName new property name
* @param relativeResourcePath relative path
* @return upgrade object
*/
ContentUpgrade doMovePropertyToRelativePath(String name, String newName, String relativeResourcePath);

/**
* Adds values to a multivalue property.
*
* @param name property name
* @param values values
* @return upgrade object
*/
ContentUpgrade doAddValuesToMultiValueProperty(String name, String[] values);

/**
* Removes values of a multivalue property.
*
* @param name property name
* @param values values to remove
* @return upgrade object
*/
ContentUpgrade doRemoveValuesOfMultiValueProperty(String name, String[] values);

/**
* Replaces values in a multivalue property.
*
* @param name property name
* @param oldValues values to remove
* @param newValues values to add
* @return upgrade object
*/
ContentUpgrade doReplaceValuesOfMultiValueProperty(String name, String[] oldValues, String[] newValues);

/**
* Copies a resource to a relative path.
*
* @param relativePath path
* @return upgrade object
*/
ContentUpgrade doCopyResourceToRelativePath(String relativePath);

/**
* Moves a resource to a relative path.
*
* @param relativePath path
* @return upgrade object
*/
ContentUpgrade doMoveResourceToRelativePath(String relativePath);

/**
* Deletes the resource.
*
* @return upgrade object
*/
ContentUpgrade doDeleteResource();

/**
* Print path
*
* @return upgrade object
*/
ContentUpgrade printPath();

/**
* Saves all changes to repository.
*
* @return output
* @throws PersistenceException error during execution
*/
StringBuffer run() throws PersistenceException;

/**
* Performs a dry-run. No changes are written to CRX.
*
* @return output
* @throws PersistenceException error doing dry-run
*/
StringBuffer dryRun() throws PersistenceException;

/**
* Executes a run or a dryRun depending on the dryRun parameter value.
*
* @param dryRun dryRun option
* @return output
* @throws PersistenceException error during execution
*/
StringBuffer run(boolean dryRun) throws PersistenceException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,28 @@
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package de.valtech.aecu.core.groovy.console.bindings.filters;

import org.apache.sling.api.resource.Resource;
package de.valtech.aecu.api.groovy.console.bindings.filters;

import java.util.List;

import javax.annotation.Nonnull;

import org.apache.sling.api.resource.Resource;

/**
* Combines multiple filters with AND.
*
* @author Roxana Muresan
*/
public class ANDFilter implements FilterBy {

private List<FilterBy> filters;


/**
* Constructor
*
* @param filters list of filters that should be chained with AND
*/
public ANDFilter(@Nonnull List<FilterBy> filters) {
this.filters = filters;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,25 @@
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package de.valtech.aecu.core.groovy.console.bindings.filters;
package de.valtech.aecu.api.groovy.console.bindings.filters;

import javax.annotation.Nonnull;

import org.apache.sling.api.resource.Resource;

/**
* Interface for AECU binding filters.
*
* @author Roxana Muresan
*/
public interface FilterBy {

/**
* Checks if the given resource matches the filter criteria.
*
* @param resource resource
* @return matches
*/
boolean filter(@Nonnull Resource resource);

}
Loading

0 comments on commit 0037f47

Please sign in to comment.