How to capture Bulk image upload event in cq 5.6 | Community
Skip to main content
Level 2
October 16, 2015
Solved

How to capture Bulk image upload event in cq 5.6

  • October 16, 2015
  • 7 replies
  • 2076 views

Hi,

 
I have a requirement to upload bulk images through web dav and after the images got uploaded i need to send one email with all the images links.for this one i am planning to write listener for bulk image upload and i will write my logic in that listener.
 
but the problem is how to capture bulk image upload event? 
 
at least if i know the last uploaded image event that is useful for me.
 
Generally each image upload is one event in CQ,but i don't know is there any event for all the images.
 
 
Please suggest me if you have any thoughts or any approaches on this.
 
Regards,
Sainath
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

There is a community article that shows how to upload bulk images to the AEM DAM:

http://scottsdigitalcommunity.blogspot.ca/2013/10/automating-process-of-uploading-digital.html

7 replies

smacdonald2008
Level 10
October 16, 2015

I assume you are uploading to the DAM. Look at this Java class:

http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/dam/api/DamEvent.Type.html


 

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

There is a community article that shows how to upload bulk images to the AEM DAM:

http://scottsdigitalcommunity.blogspot.ca/2013/10/automating-process-of-uploading-digital.html

Level 2
October 16, 2015

Hi,

Thanks for your response.yes  i am uploading images into dam only and i know for each image we can capture the upload event. but for me i want to know is there any event for bulk upload ?  for example,assume author uploaded 10 images at a time i need to capture that as one event

because my job is to send a email immediately with all the images link after they got uploaded into dam.so if any event like above exist i can write listener for that.

 

Regards,

Sainath

Level 6
October 16, 2015

The key word here is "immediately", that we all know to be highly relative. ;)

I have done similar functionality for other systems where they want to get notification when all the reports have been imported to the system. The trick here is to observe the behaviour pattern of the usage. In my case, we could see that whenever a new report and settlement collection was uploaded, it never took more than 1 second beteween the uploads and they alway shared the same parent. Yes, most of the time, multiple source systems started to upload at the same time, but to different targets.

This is what I would do in your case: Implement the listener as you have started in the last post. In that, make sure that you have a class that you can access using a key. I would use the path or maybe the parent path as a "collector identfication". Then you can implement different strategies. Say that you want to send a mail every 10:th upload in on the path /content/dam/secure-images/. That could be one strategy that just counts the number of times that collection has had a file added to it.

In your case, the strategy you should implement is the "WaitAndSee"-strategy. Well... I know that if one of the kids starts to yell, I can either run there imediatelly... or just wait and see if the other one starts to before I take action. Same with your uploads. If you wait until the bulk upload in the DAM (most likely over WebDav) is silent for 10 seconds and then send the mail, in my world, that would cound as "immediately".

/Ove

Sham_HC
Level 10
October 16, 2015

AFAIK there is no event for bulk upload.

New Member
October 16, 2015

Hi Sainath and Other,

Would you please share your code to capture the upload event for the  each image?

I need help your help to customize image upload event for CQ 5.6.1

Thanks

Shovon

Level 2
October 16, 2015

Hi Shovonz,

I did not understand what do you mean by "customize image upload event for CQ 5.6.1". but if you are requirement is to do some processing based on each image upload then the solution is to write  Event Handler. The sample code for event handler is

 

@Component @Service @Property(name="event.topics",value= {Event.NODE_ADDED},path="/content/dam") public class ExampleEventHandler implements EventHandler {  Logger log = LoggerFactory.getLogger(this.getClass());  public void handleEvent(Event event) { // write your logic here  } }

 

Regards,

Sainath Appam