AnsweredAssumed Answered

Executing database queries

Question asked by marcelogodois on Dec 9, 2010
Hi all,

I've been using Auditing in the Alfresco 3.2 and it works very well.  But in the old fashion way (I know it will be deprecated in the 3.4):

audit.useNewConfig=false

I'd like to know how to execute the queries exemples showed up in the http://wiki.alfresco.com/wiki/Auditing_%28Up_to_V3.2%29#MYSQL_audit_queries_1.4.x_to_3.3.x
So, to show the results in a custom dialog. Which service should I use? Should I change the hibernate mappings? Can someone give me a piece of code?

Example:

select fact.timestamp, convert(prop.string_value using utf8)
from alf_audit_fact fact
   join alf_audit_source source
      on fact.audit_source_id = source.id
         and (
                  (source.service = 'ContentService' and source.method = 'getReader')
               or (source.service = 'FileFolderService' and source.method = 'getReader')
             )
   join alf_node_status ns on ns.guid = fact.node_uuid
   join alf_node_properties prop
      on ns.node_id = prop.node_id
         and prop.qname = '{http://www.alfresco.org/model/content/1.0}name'
   where
         fact.user_id = 'admin'
     and fact.timestamp > ADDDATE(now(), -7)

tks,
Marcelo

Outcomes