Expand my Community achievements bar.

SOLVED

How can I retrieve activity for a DAM asset for a specific user?

Avatar

Level 2

The main requirement is to identify all transitive dependencies on a page and disallow the authors of those dependencies from reviewing the page.

I have broken the requirement into smaller parts and trying to the do the following

1) Get a list of all the links on a page (can be links to assets/pages) - How to get this list? I tried using AssetReference API but it does not give list of associated pages on a page, also it does not give list of any asset that you might have set using a composite field
2) Determine who all have worked on all those related assets/pages - Using audit log I can determine the data for a page but not for an asset. For asset I am trying to use activity manager, but the activity manager is not providing the data for activities of user other than admin. For a user I can see activity folder created and see all the activities from CRXDE but I am unable to retrieve the data for that user.
3) Accordingly apply business rule to see if the same person can review the workflow payload or not - have created a process step in the workflow to do the same.

Appreciate help and direction anyone can provide.

Thanks and regards,
AJ

1 Accepted Solution

Avatar

Correct answer by
Level 10

Amit Jain wrote...

Hi Sham,

Thanks for the response. 

1. 

I am trying to get the links that are available on a page in a JAVA class.so not sure how will I use rewriter for the same. Can you provide more information around it?

2.

I have enabled DAM event recorder and I can see the activities getting generated under the users. However, using the granite activity stream APIs I am unable to get the activities of any user other than admin

  1. ActivityManager mgr = sling.getService(ActivityManager.class);
  2. String userId = request.getParameter("userId");
  3. ActivityCollection coll = mgr.getActivities(resourceResolver, userId);

Above code is what i am using but the collection size is always 0 for user other than admin (I am using 5.6.1 CQ version)

I tried using ActivityService but it looks like it has been deprecated in favor of ActivityManager. The activity service is returning me the required activity. I would have expected ActivityManager to do the same as well, but it doesn't seem to be working.

Below is the activity service code that I am using:

 
  1. ActivityService activityService = sling.getService(ActivityService.class);
  2. Resource userResource = null;
  3. final UserPropertiesManager upm = resourceResolver.adaptTo(UserPropertiesManager.class);
  4. String authorizableId = resourceResolver.getUserID();
  5.  
  6. UserProperties userProperties = upm.getUserProperties(authorizableId, "profile");
  7. userResource = resourceResolver.getResource(userProperties.getNode().getPath());
  8. Collection<Activity> activities = java.util.Collections.EMPTY_LIST;
  9. activities = activityService.readActivities(userResource, "dam", -1L);

Any clues regarding the same would be helpful.

 

Appreciate your help.

Thanks

AJ

 

1)   Look example at [1]. when the request is placed to render a page in java class you get all the link, asset urls.

2)    I have never tried personally from your description looks like a bug please file a daycare. As a workaround temporarily go with deprecated ActivityService.   Alternatively you can use JCR observation and log the audit events accordingly.

[1]  http://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html

View solution in original post

4 Replies

Avatar

Level 2

Hi Sham,

Thanks for the response. 

1. 

I am trying to get the links that are available on a page in a JAVA class.so not sure how will I use rewriter for the same. Can you provide more information around it?

2.

I have enabled DAM event recorder and I can see the activities getting generated under the users. However, using the granite activity stream APIs I am unable to get the activities of any user other than admin

ActivityManager mgr = sling.getService(ActivityManager.class); String userId = request.getParameter("userId"); ActivityCollection coll = mgr.getActivities(resourceResolver, userId);

Above code is what i am using but the collection size is always 0 for user other than admin (I am using 5.6.1 CQ version)

I tried using ActivityService but it looks like it has been deprecated in favor of ActivityManager. The activity service is returning me the required activity. I would have expected ActivityManager to do the same as well, but it doesn't seem to be working.

Below is the activity service code that I am using:

ActivityService activityService = sling.getService(ActivityService.class); Resource userResource = null; final UserPropertiesManager upm = resourceResolver.adaptTo(UserPropertiesManager.class); String authorizableId = resourceResolver.getUserID(); UserProperties userProperties = upm.getUserProperties(authorizableId, "profile"); userResource = resourceResolver.getResource(userProperties.getNode().getPath()); Collection<Activity> activities = java.util.Collections.EMPTY_LIST; activities = activityService.readActivities(userResource, "dam", -1L);

Any clues regarding the same would be helpful.

 

Appreciate your help.

Thanks

AJ

Avatar

Correct answer by
Level 10

Amit Jain wrote...

Hi Sham,

Thanks for the response. 

1. 

I am trying to get the links that are available on a page in a JAVA class.so not sure how will I use rewriter for the same. Can you provide more information around it?

2.

I have enabled DAM event recorder and I can see the activities getting generated under the users. However, using the granite activity stream APIs I am unable to get the activities of any user other than admin

  1. ActivityManager mgr = sling.getService(ActivityManager.class);
  2. String userId = request.getParameter("userId");
  3. ActivityCollection coll = mgr.getActivities(resourceResolver, userId);

Above code is what i am using but the collection size is always 0 for user other than admin (I am using 5.6.1 CQ version)

I tried using ActivityService but it looks like it has been deprecated in favor of ActivityManager. The activity service is returning me the required activity. I would have expected ActivityManager to do the same as well, but it doesn't seem to be working.

Below is the activity service code that I am using:

 
  1. ActivityService activityService = sling.getService(ActivityService.class);
  2. Resource userResource = null;
  3. final UserPropertiesManager upm = resourceResolver.adaptTo(UserPropertiesManager.class);
  4. String authorizableId = resourceResolver.getUserID();
  5.  
  6. UserProperties userProperties = upm.getUserProperties(authorizableId, "profile");
  7. userResource = resourceResolver.getResource(userProperties.getNode().getPath());
  8. Collection<Activity> activities = java.util.Collections.EMPTY_LIST;
  9. activities = activityService.readActivities(userResource, "dam", -1L);

Any clues regarding the same would be helpful.

 

Appreciate your help.

Thanks

AJ

 

1)   Look example at [1]. when the request is placed to render a page in java class you get all the link, asset urls.

2)    I have never tried personally from your description looks like a bug please file a daycare. As a workaround temporarily go with deprecated ActivityService.   Alternatively you can use JCR observation and log the audit events accordingly.

[1]  http://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html

Avatar

Level 2

Thanks a lot Sham for all the help.