Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

how to activate page with out create version in author instance

Avatar

Level 2

when we do modifications in page activate page it will be creating version.

Is it possible disable version when we activate page.

To configure the Version Manager PID com.day.cq.wcm.core.impl.VersionManagerImpl

versionmanager.createVersionOnActivation (Boolean, default: false)

if we click uncheckbox, when activate page i am able to disable versions. but above one will be affect all projects.

Any other way do disable versions for specific Project?

below thing also creating versions

by programatically

replicator.replicate(session, ReplicationActionType.ACTIVATE,pagepath);

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

As eduby mentioned, use an instance of the class ReplicationOptions[1] as parameter to Replicator.replicate(...), and call

setSuppressVersions(true).

Jörg

[1] ReplicationOptions ("The Adobe AEM Quickstart and Web Application.")

View solution in original post

14 Replies

Avatar

Level 2

Thank for reply Scoot,

     I don't want create versions when page activate through Siteadmin or Activation page Workflow.

I am  Using Out-of-the-Box (OOB)  create version workflow i need to create versions.

/jcr:system/jcr:versionStorage/d1/11/0d/d1110d19-3387-47bb-a9ca-86a58978239c/1.0

Avatar

Level 10

So you want to write code that is invoked from a custom WF step that actives a page without creating a version on that page?

Avatar

Level 2

replicator.replicate(session, ReplicationActionType.ACTIVATE,pagepath);

i  write this in my workflow Processs step ,but version generated.

how i need to activate only page?

Avatar

Level 10

We do not have a HELPX article on this. It would make a good article however.

Looking at community articles on this subject -- like this

How to programmatically activate CQ Page - Sothea Nim

and the Javadocs - like here Replicator (Adobe CQ 5.6.1 Java Documentation 5.6.1 API)

I am not seeing an option to turn off version when you replicate a page via code.

If other community members have - please post here.

Avatar

Level 2

thanks scoot

if any update please let me know

Avatar

Level 10

This thread has brought to my attention that we need a HELPX article on How To replicate AEM pages via code. Thanks!

Avatar

Level 10

Hi,

You can configure versioning from Day CQ WCM Version Manager
I haven't used it but this is what i found, give it a try

By looking at API docs, you see setSuppressVersions(boolean suppressVersions) , try to set it with true

Create a new ReplicationOptions and set this in replicate(Session session, ReplicationActionType type, String path, ReplicationOptions options) .

Thanks

Avatar

Correct answer by
Employee Advisor

As eduby mentioned, use an instance of the class ReplicationOptions[1] as parameter to Replicator.replicate(...), and call

setSuppressVersions(true).

Jörg

[1] ReplicationOptions ("The Adobe AEM Quickstart and Web Application.")

Avatar

Level 1

You have to create your Own replication options. Then you can use the Replicator for replication .

Sample code.

Step 1 -  Prepare the Replication option to send without version

ReplicationOptions opts = new ReplicationOptions();

AgentIdFilter filter = new AgentIdFilter(PROMOTE_AGENT);

opts.setFilter(filter);

opts.setSuppressVersions(true);

Step 2 -  Use the replicate method for replication

replicate(Session session, ReplicationActionType type, String path, ReplicationOptions options)

 

Avatar

Employee

Just curious, but why do you want to disable versions for this project?

Avatar

Level 2

already i created version's  by using Create version Model in My workflow.

Avatar

Employee

ok, good you got it working. But my question was more around the business need for such a change, are you creating so many versions that it is becoming an issue? I often feel it is better not to keep on adding custom code unless there is a real need. If you are already doing version purging, perhaps that is enough.