mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Expose audit service as public service and in freemarker.
Tests git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3683 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
package org.alfresco.repo.audit.hibernate;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.Session;
|
||||
|
||||
/**
|
||||
* An Audit fact Rely on standard equals and hash code as they should all be unique.
|
||||
@@ -575,4 +580,16 @@ public class AuditFactImpl implements AuditFact
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to get all the audit entries for a node.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<AuditFact> getAuditTrail(Session session, NodeRef nodeRef)
|
||||
{
|
||||
Query query = session.getNamedQuery(HibernateAuditDAO.QUERY_AUDIT_TRAIL);
|
||||
query.setParameter(HibernateAuditDAO.QUERY_AUDIT_PROTOCOL, nodeRef.getStoreRef().getProtocol());
|
||||
query.setParameter(HibernateAuditDAO.QUERY_AUDIT_STORE_ID, nodeRef.getStoreRef().getIdentifier());
|
||||
query.setParameter(HibernateAuditDAO.QUERY_AUDIT_NODE_ID, nodeRef.getId());
|
||||
return (List<AuditFact>) query.list();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user