Hi All ,
I have a requirement where i want to programatically activate the pages. I need a program which will parse through the pages and check for "replicated" property. If the property is available the pages should get activated after 30 mins automatically. Can you please please tell me how this can be achieved ??
Awaiting your positive response
Regards
Solved! Go to Solution.
Views
Replies
Total Likes
This would need a custom implementation. I would look at using workflows as part of this solution.
Write code that iterates through pages using JCR API or QueryBuilder API. The when you find a page that meets you criteria, invoke a workflow (that activates the page) using an API. You can invoke workflows programmatically. See:
http://scottsdigitalcommunity.blogspot.ca/2013/09/creating-workflows-for-adobe-experience.html
You may need to write a custom workflow step as well to perform time operations (if you want to wait 30 mins for example)\. However AEM is very flexable in letting you write custom workflow steps. TO learn how to write a custom workflow step that implements , WorkflowProcess see:
https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html
This would need a custom implementation. I would look at using workflows as part of this solution.
Write code that iterates through pages using JCR API or QueryBuilder API. The when you find a page that meets you criteria, invoke a workflow (that activates the page) using an API. You can invoke workflows programmatically. See:
http://scottsdigitalcommunity.blogspot.ca/2013/09/creating-workflows-for-adobe-experience.html
You may need to write a custom workflow step as well to perform time operations (if you want to wait 30 mins for example)\. However AEM is very flexable in letting you write custom workflow steps. TO learn how to write a custom workflow step that implements , WorkflowProcess see:
https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html
Thanks,
Can't this be achieved through schedulers? , can you please elaborate on the procedure ..
Views
Replies
Total Likes
The Scheduler is a service that uses a cron expression to schedule other services/jobs. Here is an example [2].
You could run code that runs on a schedule to check for the replicated property, but depending on how many pages you have and how often the job is run, this could place a load on the system.
Regards,
Opkar
[0]https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html
[1] https://helpx.adobe.com/experience-manager/using/aem-first-components1.html
Views
Replies
Total Likes
R.K,
What would be the frequency to look for page property?. And If property
--
Views
Replies
Total Likes
Hi
Apart form above mentioned, please find few reference link to help you achieve the needful.
Link:- https://helpx.adobe.com/experience-manager/kb/CQ5ReplicateToSpecificAgents.html
//How to activate to a specific replication agent.
Link:- http://www.sotheanim.com/21-how-to-programmatically-activate-cq-page
//How to programmatically activate CQ Page
Link:- http://stackoverflow.com/questions/18955982/how-to-activate-programmatically-a-page-in-cq5-workflow
//
Use Replicator OSGi service:
@Component
public class MyComponent {
@Reference
private Replicator replicator;
private void activatePage(Session session) {
//...
replicator.replicate(session, ReplicationActionType.ACTIVATE, pathToPage);
//...
}
}
The above stated option is based on Scott's reply another way to do is as mentioned by Opkar Gill,
I hope this would help you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Thanks all for your valuable responses.
Basically if replicatedBy property is set , page should get activated after a specific time.
Views
Replies
Total Likes
I have one more query , for "import com.day.cq.replication.Replicator;" which dependency should be added to pom.xml ?? As i am getting package not found error. I have included many dependencies it is not at all taking..
Views
Replies
Total Likes
Use AEM dependency finder to locate POM dependencies you need to reference.
http://blog.behrang.org/blog/2014/03/11/aem-dependency-finder/
Views
Replies
Total Likes
Add this, it will work
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-replication</artifactId>
<version>5.4.2</version>
<scope>provided</scope>
</dependency>
Views
Replies
Total Likes
Hi
Please refer to this link:- https://maven-repository.com/artifact/com.day.cq/cq-replication
Click to the specific version that you would want, you would get the dependency code there.
Link:- https://maven-repository.com/artifact/com.day.cq/cq-replication/5.4.2
<dependency><groupId>com.day.cq</groupId><artifactId>cq-replication</artifactId><version>5.4.2</version></dependency>
I hope this would help you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Hi can you tell how I can replicate an asset from one path to different path with using
getReplicator().replicate(workflowSession.getSession(), ReplicationActionType.ACTIVATE,
payload, opts);
Views
Replies
Total Likes
Views
Likes
Replies