icfnext / aem-groovy-extension

OSGi bundle containing Groovy builders and metaclasses for Adobe Experience Manager.
http://icfnext.github.io/aem-groovy-extension/groovydocs/index.html
Other
4 stars 10 forks source link

Do not save session on builder complete #8

Open marcinus opened 4 years ago

marcinus commented 4 years ago

In Cognifide, we usually have our groovy scripts controlled by DRY_RUN flag. When set to true, changes are not persisted by calling session.refresh(false), otherwise session.save() is called.

However, nodeCompleted function explicitely saves the session (see in code):

@Override
void nodeCompleted(parent, node) {
    session.save()

    currentNode = currentNode.parent
}

It would be great if this behaviour could be controlled (saving prevented), either by some global flag, or in builder's constructor.