Index: conf/log4j.xml =================================================================== --- conf/log4j.xml (revision 57135) +++ conf/log4j.xml (working copy) @@ -278,6 +278,11 @@ + + + + + Index: intranet-bootstrap/configuration/src/main/resources/configuration/update/registry/example-news-date-field-update-demo-with-manual-update-reporting.xml =================================================================== --- intranet-bootstrap/configuration/src/main/resources/configuration/update/registry/example-news-date-field-update-demo-with-manual-update-reporting.xml (revision 0) +++ intranet-bootstrap/configuration/src/main/resources/configuration/update/registry/example-news-date-field-update-demo-with-manual-update-reporting.xml (working copy) @@ -0,0 +1,67 @@ + + + + hipposys:updaterinfo + + + 10 + + + + + + false + + + + + + /jcr:root + + + /** + * ExampleNewsDocumentDateFieldUpdateDemoVisitor is a script that does manual node iteration + * in an original iteration cycle and reports updated node manually in order to be aligned + * with the built-in batch commit/revert feature of the groovy updater engine + * for demonstration purpose. + */ +package org.hippoecm.frontend.plugins.cms.admin.updater + +import org.onehippo.repository.update.BaseNodeUpdateVisitor +import java.util.* +import javax.jcr.* +import javax.jcr.query.* + +class ExampleNewsDocumentDateFieldUpdateDemoVisitor extends BaseNodeUpdateVisitor { + + boolean doUpdate(Node node) { + log.debug "Visiting node at ${node.path} just as an entry point in this demo." + + // new date field value from the current time + def now = Calendar.getInstance() + + // do manual query and node iteration + def query = node.session.workspace.queryManager.createQuery("//element(*,demosite:newsdocument)", "xpath") + def result = query.execute() + + for (NodeIterator nodeIt = result.getNodes(); nodeIt.hasNext(); ) { + def newsNode = nodeIt.nextNode() + newsNode.setProperty("demosite:date", now) + // report updated to the engine manually here. + visitorContext.reportUpdated(newsNode.path) + } + + return false + } + + boolean undoUpdate(Node node) { + throw new UnsupportedOperationException('Updater does not implement undoUpdate method') + } + +} + + + 1000 + + Property changes on: intranet-bootstrap/configuration/src/main/resources/configuration/update/registry/example-news-date-field-update-demo-with-manual-update-reporting.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: intranet-bootstrap/configuration/src/main/resources/hippoecm-extension.xml =================================================================== --- intranet-bootstrap/configuration/src/main/resources/hippoecm-extension.xml (revision 57135) +++ intranet-bootstrap/configuration/src/main/resources/hippoecm-extension.xml (working copy) @@ -928,6 +928,19 @@ + + + hippo:initializeitem + + + configuration/update/registry/example-news-date-field-update-demo-with-manual-update-reporting.xml + + + /hippo:configuration/hippo:update/hippo:registry + + + 81000 + + -