Commit fe29f268 authored by Ate Douma's avatar Ate Douma

CMS-11050 [UpdateEditor Backport 11.2] Provide support for custom node selection/navigation

This provides the CMS UI support for REPO-1923 [UpdaterExecutor]

(cherry picked from commit 4f93842d)
parent 68e1bb96
<!DOCTYPE html>
<!--
Copyright 2012-2015 Hippo B.V. (http://www.onehippo.com)
Copyright 2012-2018 Hippo B.V. (http://www.onehippo.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -93,6 +93,7 @@
</tr>
<wicket:container wicket:id="path"/>
<wicket:container wicket:id="query"/>
<wicket:container wicket:id="custom"/>
<wicket:container wicket:id="parameters"/>
<wicket:container wicket:id="batch-size"/>
<wicket:container wicket:id="throttle"/>
......
......@@ -291,6 +291,27 @@ public class UpdaterEditor extends Panel {
};
radios.add(queryField);
final RadioLabelledInputFieldTableRow customField = new RadioLabelledInputFieldTableRow("custom", radios,
new Model<>("Updater"), new Model<>("")) {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return isCustomFieldEnabled();
}
@Override
public boolean isVisible() {
return isCustomFieldVisible();
}
@Override
protected boolean isRadioVisible() {
return UpdaterEditor.this.isRadioVisible();
}
};
customField.input.setVisible(false);
radios.add(customField);
final LabelledTextAreaTableRow parametersField = new LabelledTextAreaTableRow("parameters", new Model<>("Parameters"), new PropertyModel<>(this, "parameters")) {
private static final long serialVersionUID = 1L;
@Override
......@@ -392,8 +413,10 @@ public class UpdaterEditor extends Panel {
if (visitorQuery != null) {
method = "query";
}
if (visitorPath != null) {
else if (visitorPath != null) {
method = "path";
} else {
method = "custom";
}
dryRun = getBooleanProperty(HippoNodeType.HIPPOSYS_DRYRUN, false);
}
......@@ -476,7 +499,11 @@ public class UpdaterEditor extends Panel {
if (!validateParameters()) {
return false;
}
if (isPathMethod()) {
if (isCustomMethod()) {
node.setProperty(HippoNodeType.HIPPOSYS_PATH, (String) null);
node.setProperty(HippoNodeType.HIPPOSYS_QUERY, (String) null);
}
else if (isPathMethod()) {
if (!validateVisitorPath()) {
return false;
}
......@@ -601,6 +628,10 @@ public class UpdaterEditor extends Panel {
return true;
}
private boolean isCustomMethod() {
return method == null || method.equals("custom");
}
private boolean isPathMethod() {
return method != null && method.equals("path");
}
......@@ -768,6 +799,14 @@ public class UpdaterEditor extends Panel {
return true;
}
protected boolean isCustomFieldEnabled() {
return true;
}
protected boolean isCustomFieldVisible() {
return true;
}
protected boolean isQueryFieldVisible() {
return true;
}
......
/**
* Copyright 2012-2015 Hippo B.V. (http://www.onehippo.com)
* Copyright 2012-2018 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -91,6 +91,11 @@ public class UpdaterHistoryEditor extends UpdaterEditor {
return false;
}
@Override
protected boolean isCustomFieldEnabled() {
return false;
}
@Override
protected boolean isParametersFieldEnabled() {
return false;
......@@ -108,7 +113,7 @@ public class UpdaterHistoryEditor extends UpdaterEditor {
@Override
protected boolean isRadioVisible() {
return false;
return true;
}
@Override
......@@ -122,6 +127,10 @@ public class UpdaterHistoryEditor extends UpdaterEditor {
}
@Override
protected boolean isCustomFieldVisible() {
return "custom".equals(method);
}
protected boolean isScriptEditorReadOnly() {
return true;
}
......
/**
* Copyright 2012-2015 Hippo B.V. (http://www.onehippo.com)
* Copyright 2012-2018 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -79,6 +79,11 @@ public class UpdaterQueueEditor extends UpdaterEditor {
return false;
}
@Override
protected boolean isCustomFieldEnabled() {
return false;
}
@Override
protected boolean isParametersFieldEnabled() {
return false;
......@@ -96,7 +101,7 @@ public class UpdaterQueueEditor extends UpdaterEditor {
@Override
protected boolean isRadioVisible() {
return false;
return true;
}
@Override
......@@ -109,6 +114,11 @@ public class UpdaterQueueEditor extends UpdaterEditor {
return "query".equals(method);
}
@Override
protected boolean isCustomFieldVisible() {
return "custom".equals(method);
}
@Override
protected boolean isScriptEditorReadOnly() {
return true;
......
......@@ -2,9 +2,27 @@ package org.hippoecm.frontend.plugins.cms.admin.updater
import org.onehippo.repository.update.BaseNodeUpdateVisitor
import javax.jcr.Node
import javax.jcr.RepositoryException
import javax.jcr.Session
class UpdaterTemplate extends BaseNodeUpdateVisitor {
boolean logSkippedNodePaths() {
return false // don't log skipped node paths
}
boolean skipCheckoutNodes() {
return false // return true for readonly visitors and/or updates unrelated to versioned content
}
Node firstNode(final Session session) throws RepositoryException {
return null // implement when using custom node selection/navigation
}
Node nextNode() throws RepositoryException {
return null // implement when using custom node selection/navigation
}
boolean doUpdate(Node node) {
log.debug "Updating node ${node.path}"
return false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment