cancel
Showing results for 
Search instead for 
Did you mean: 

Catch file deleting/importing

camillo
Champ in-the-making
Champ in-the-making
Hi all,

I would like catch when a file is deleted from a space or when a file is imported into a space.
I have to log the name of the deleted/imported file
Have you any idea how I can solve my problem?
I'm trying to create a rule for each space (or a rule for the parent space) but I'm having many problems because I don't know how write a similar rule.  Smiley Sad
Thanks in advance for your precious help
6 REPLIES 6

zaizi
Champ in-the-making
Champ in-the-making
This will all get recorded in Alfresco audit logs, if you turn them on for the content import and deletion. This is logged in the database and can then be reported on by running queries against those logs.

These wiki entries describe how to turn on auditing and sample queries to search the database.

http://wiki.alfresco.com/wiki/Audit_Configuration
http://wiki.alfresco.com/wiki/Audit

This will be more efficient than running a content rule to track imports / deletion.

zomurn
Champ in-the-making
Champ in-the-making
Alternatively I propose you have a look to custom behavior / policies … you can catch a lot of events done in the webclient : for example NodeServicePolicies describes all the events which can be catched over a node process.
From now, I don't know which solution is best…(the former or this one)

More information : http://ecmarchitect.com/images/articles/alfresco-behavior/behavior-article.pdf

camillo
Champ in-the-making
Champ in-the-making
thanks very much for your answers, but I need a rule  Smiley Sad
Can my problem be solved using a rule?
If yes, have you any idea about how a similar rule could be written?
Thanks again for your support

zomurn
Champ in-the-making
Champ in-the-making
I don't know if with rules "inbound" is equals to "import" and "outbound" is equals to "delete"…in case the rule is called for this two event (delete and import) then it is easy to track the document.
For this develop your custom rule with a class that extends ActionExecuterAbstractBase the you implement the method

@Override
   protected void executeImpl(Action pAction,
         final NodeRef pActionedUponNodeRef);

Which give you a reference to the node from which the rule was called : pActionedUponNodeRef

camillo
Champ in-the-making
Champ in-the-making
Thanks for your answer but I'm a very newbie. So, I need a rule written in Javascript.
Can i use any Javascript API's functions to solve my problem?

zomurn
Champ in-the-making
Champ in-the-making
You can write the rule in javascript if you want. Then the associated action to the rule is "execute a script". That's all.
You retrieve the "pActionedUponNodeRef" in java through the "document" variable in javascript I suppose.
Then you can do all what you need.