Saturday, October 15, 2011

How to find all the pages modified or activated after certain time

Use Case: You want to create package of all the nodes modified after certain date and time. This can be use ful in Migration Projects. If you have problem with one of the activation agent and you want to activate pages / Asset to that agent based on time.

Solution: You can use following packages to achieve this use case



You can also refer code form Here

1) Install attached package using package manager
2) Go to http://<host>:<port>/apps/tools/components/listPage.html
3) Select Date and time
4) Then click on submit
5) You can click on create package of modified pages to create package


Feel free to change the code based on your requirement

12 comments:

  1. Hi Yogesh!

    I recently work on a module that check the contents of CQ5 packages:
    The logical is:
    - when user go to CQ5 package page for example
    http://localhost:4502/etc/packages/my_packages/abc.zip.html, we need
    to show all which content has status is "changed", "deleted", "new"
    and "ok" since the last built of this package.
    - Assume that abc package has contents as below and the file contentpage.jsp is modified from last built package so status must be "changed"
    ----- Content ---------- status ---
    - jcr_root/apps/cq5tool/components/page/
    contentpage/ ok
    - jcr_root/apps/cq5tool/components/page/
    contentpage/.content.xml ok
    - jcr_root/apps/cq5tool/components/page/contentpage/contentpage.jsp
    changed
    - jcr_root/apps/cq5tool/components/page/contentpage/header.jsp
    - jcr_root/apps/cq5tool/components/page/contentpage/content.jsp
    - jcr_root/apps/cq5tool/components/page/contentpage/headlibs.jsp
    - jcr_root/apps/cq5tool/components/page/contentpage/body.jsp
    - jcr_root/apps/cq5tool/components/page/contentpage/footer.jsp

    I was stuck on how to chechk the content status b/w package's contents and repository's contents

    Have any idea for this case?
    Great thanks,
    Son N
    P/S: I used 'last updated' info to check but it seem not good solution.

    ReplyDelete
  2. @Son,

    For that you have to compare following property
    JcrConstants.JCR_DATA
    JcrConstants.JCR_LASTMODIFIED

    If you see, Install package already uses that logic to decide what is new or deleted. Symbol mean following
    A: Add
    D: Delete
    U: Updated
    -:Nothing is changed
    R:Replace
    M:Missing
    E:Error

    ReplyDelete
  3. Hi Yogesh,

    Thanks for your reply,

    In CQ5 we can get the lastmodified info
    like this node.getProperty(JcrConstants.JCR_LASTMODIFIED)

    I have a question that how can we get all nodes of package (note that these nodes will be difference from CRX reposity)

    I try to get nodes of package
    pack.getNode().nodes();

    /etc/packages/my_packages/cq5tool.zip
    /etc/packages/my_packages/cq5tool.zip/jcr:content
    /etc/packages/my_packages/cq5tool.zip/jcr:content/vlt:definition
    /etc/packages/my_packages/cq5tool.zip/jcr:content/vlt:definition/filter
    /etc/packages/my_packages/cq5tool.zip/jcr:content/vlt:definition/filter/f0
    /etc/packages/my_packages/cq5tool.zip/jcr:content/vlt:definition/filter/f1

    But only get at filter level.

    Do you have any advice?

    Thanks,

    Son N

    ReplyDelete
    Replies
    1. @Son,

      I knew you will ask this question :) .. But answer is not simple, This information in API you get get from Artifact.

      You need to check following classes for more detail

      com.day.jcr.vault.fs.impl.ArtifactSetImpl
      com.day.jcr.vault.fs.impl.io.FileArtifactHandler

      Don't ask me where is documentation :) feel free to decompile vault-fs.jar to get more info :)

      Delete
  4. Hi Yoghesh,

    I have another question:
    I want to change the template of the list of package on page http://localhost:4502/crx/packmgr/index.jsp
    So I changed the template file in /docroot/js/CRX/packmgr/package.tpl

    But it seems not work for me!

    Do you have any idea?

    Great thanks,

    Son N

    ReplyDelete
  5. Son,

    I am not sure. But I don't recommend to do that as with CQ5.5 there won't be separate war file for CRX. Also try deleting cache from /server/tmp/0/_crx before trying.

    Yogesh

    ReplyDelete
  6. It works for me! (CQ5.5)

    Thanks

    ReplyDelete
  7. Hi Yogesh,

    when i trying to download that packages i am get "file not available" can you pls advise

    thanks,
    Antony

    ReplyDelete
    Replies
    1. Antony,

      I can download document without any problem. If download not working, you can checkout code as well and create package by your self.

      Yogesh

      Delete
  8. HI Yogesh ,
    is there is any way i can know what property a user has changed for an assets in dam. so that i can track the changed property for a particular dam assets

    ReplyDelete
    Replies
    1. Amit you can check my reply http://forums.adobe.com/thread/1256578

      Yogesh

      Delete