mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-853: File Record audit event is absent
* file, move, copy and link are all now present in the event drop down * they are all audited as separate events git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@54738 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -10,8 +10,8 @@ alfrescoEnterpriseMavenUrl=https://artifacts.alfresco.com/nexus/content/groups/i
|
|||||||
|
|
||||||
# set credentials for protected maven repo or pass on command line:
|
# set credentials for protected maven repo or pass on command line:
|
||||||
# -PalfrescoEnterpriseMavenUser=userName -PalfrescoEnterpriseMavenPwd=password
|
# -PalfrescoEnterpriseMavenUser=userName -PalfrescoEnterpriseMavenPwd=password
|
||||||
alfrescoEnterpriseMavenUser=
|
alfrescoEnterpriseMavenUser=rwetherall
|
||||||
alfrescoEnterpriseMavenPwd=
|
alfrescoEnterpriseMavenPwd=m1ch3113
|
||||||
|
|
||||||
# set to org.alfresco.enterprise when enterprise version required
|
# set to org.alfresco.enterprise when enterprise version required
|
||||||
alfrescoGroupId=org.alfresco
|
alfrescoGroupId=org.alfresco
|
||||||
|
@@ -3,4 +3,8 @@ rm.audit.created-object=Created Object
|
|||||||
rm.audit.delte-object=Delete Object
|
rm.audit.delte-object=Delete Object
|
||||||
rm.audit.login-succeeded=Login Succeeded
|
rm.audit.login-succeeded=Login Succeeded
|
||||||
rm.audit.login-failed=Login Failed
|
rm.audit.login-failed=Login Failed
|
||||||
rm.audit.create-person=Create Person
|
rm.audit.create-person=Create Person
|
||||||
|
rm.audit.link=Link
|
||||||
|
rm.audit.move=Move
|
||||||
|
rm.audit.copy=Copy
|
||||||
|
rm.audit.file=File
|
@@ -65,5 +65,25 @@
|
|||||||
<property name="name" value="Login.Failure"/>
|
<property name="name" value="Login.Failure"/>
|
||||||
<property name="label" value="rm.audit.login-failed"/>
|
<property name="label" value="rm.audit.login-failed"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="audit-event.link" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.LinkAuditEvent">
|
||||||
|
<property name="name" value="link"/>
|
||||||
|
<property name="label" value="rm.audit.link"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="audit-event.move" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.MoveAuditEvent">
|
||||||
|
<property name="name" value="move"/>
|
||||||
|
<property name="label" value="rm.audit.move"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="audit-event.copy" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.CopyAuditEvent">
|
||||||
|
<property name="name" value="copy"/>
|
||||||
|
<property name="label" value="rm.audit.copy"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="audit-event.file" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.FileAuditEvent">
|
||||||
|
<property name="name" value="file"/>
|
||||||
|
<property name="label" value="rm.audit.file"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -73,7 +73,10 @@ public interface RecordsManagementAuditService extends RecordsManagementAuditSer
|
|||||||
List<AuditEvent> getAuditEvents();
|
List<AuditEvent> getAuditEvents();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register audit event
|
* Register audit event.
|
||||||
|
* <p>
|
||||||
|
* Creates an instance of a simple audit event and registers it with
|
||||||
|
* the service.
|
||||||
*
|
*
|
||||||
* @param name name of audit event
|
* @param name name of audit event
|
||||||
* @param label display label of audit event
|
* @param label display label of audit event
|
||||||
@@ -81,25 +84,29 @@ public interface RecordsManagementAuditService extends RecordsManagementAuditSer
|
|||||||
void registerAuditEvent(String name, String label);
|
void registerAuditEvent(String name, String label);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Register audit event.
|
||||||
*
|
*
|
||||||
* @param auditEvent
|
* @param auditEvent audit event
|
||||||
*/
|
*/
|
||||||
void registerAuditEvent(AuditEvent auditEvent);
|
void registerAuditEvent(AuditEvent auditEvent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Audits an event, assumes no properties where modified and that the event should not be audited
|
||||||
* @param nodeRef
|
* immediately.
|
||||||
* @param eventName
|
*
|
||||||
|
* @param nodeRef node reference
|
||||||
|
* @param eventName event name
|
||||||
*/
|
*/
|
||||||
void auditEvent(NodeRef nodeRef,
|
void auditEvent(NodeRef nodeRef,
|
||||||
String eventName);
|
String eventName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Audits an event, assumes that the event should not be audited immediately.
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* @param eventName
|
* @param eventName event name
|
||||||
* @param before
|
* @param before property values before event
|
||||||
* @param after
|
* @param after property values after event
|
||||||
*/
|
*/
|
||||||
void auditEvent(NodeRef nodeRef,
|
void auditEvent(NodeRef nodeRef,
|
||||||
String eventName,
|
String eventName,
|
||||||
@@ -107,12 +114,13 @@ public interface RecordsManagementAuditService extends RecordsManagementAuditSer
|
|||||||
Map<QName, Serializable> after);
|
Map<QName, Serializable> after);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Audit event.
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* @param eventName
|
* @param eventName event name
|
||||||
* @param before
|
* @param before property values before event
|
||||||
* @param after
|
* @param after property values after event
|
||||||
* @param immediate
|
* @param immediate true if event is to be audited immediately, false otherwise
|
||||||
*/
|
*/
|
||||||
void auditEvent(NodeRef nodeRef,
|
void auditEvent(NodeRef nodeRef,
|
||||||
String eventName,
|
String eventName,
|
||||||
|
@@ -200,12 +200,18 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
this.filePlanService = filePlanService;
|
this.filePlanService = filePlanService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void registerAuditEvent(String name, String label)
|
public void registerAuditEvent(String name, String label)
|
||||||
{
|
{
|
||||||
registerAuditEvent(new AuditEvent(name, label));
|
registerAuditEvent(new AuditEvent(name, label));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void registerAuditEvent(AuditEvent auditEvent)
|
public void registerAuditEvent(AuditEvent auditEvent)
|
||||||
{
|
{
|
||||||
@@ -234,43 +240,24 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
PropertyCheck.mandatory(this, "filePlanService", filePlanService);
|
PropertyCheck.mandatory(this, "filePlanService", filePlanService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onBootstrap(ApplicationEvent event)
|
protected void onBootstrap(ApplicationEvent event)
|
||||||
{
|
{
|
||||||
shutdown = false;
|
shutdown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onShutdown(ApplicationEvent event)
|
protected void onShutdown(ApplicationEvent event)
|
||||||
{
|
{
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to get the default file plan
|
|
||||||
*
|
|
||||||
* @return NodRef default file plan
|
|
||||||
*/
|
|
||||||
private NodeRef getDefaultFilePlan()
|
|
||||||
{
|
|
||||||
NodeRef defaultFilePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
|
||||||
if (defaultFilePlan == null)
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Default file plan could not be found.");
|
|
||||||
}
|
|
||||||
return defaultFilePlan;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean isEnabled()
|
|
||||||
{
|
|
||||||
return isAuditLogEnabled(getDefaultFilePlan());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@@ -284,15 +271,6 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
RecordsManagementAuditService.RM_AUDIT_PATH_ROOT);
|
RecordsManagementAuditService.RM_AUDIT_PATH_ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void start()
|
|
||||||
{
|
|
||||||
startAuditLog(getDefaultFilePlan());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@@ -311,15 +289,6 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void stop()
|
|
||||||
{
|
|
||||||
stopAuditLog(getDefaultFilePlan());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@@ -335,15 +304,6 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
logger.info("Stopped Records Management auditing");
|
logger.info("Stopped Records Management auditing");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void clear()
|
|
||||||
{
|
|
||||||
clearAuditLog(getDefaultFilePlan());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@@ -355,16 +315,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
auditService.clearAudit(RecordsManagementAuditService.RM_AUDIT_APPLICATION_NAME, null, null);
|
auditService.clearAudit(RecordsManagementAuditService.RM_AUDIT_APPLICATION_NAME, null, null);
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
logger.debug("Records Management audit log has been cleared");
|
logger.debug("Records Management audit log has been cleared");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Date getDateLastStarted()
|
|
||||||
{
|
|
||||||
return getDateAuditLogLastStarted(getDefaultFilePlan());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
@@ -378,15 +329,6 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
return getStartOfDay(new Date());
|
return getStartOfDay(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Date getDateLastStopped()
|
|
||||||
{
|
|
||||||
return getDateAuditLogLastStopped(getDefaultFilePlan());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@@ -444,17 +386,12 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 3.2
|
|
||||||
* @deprecated since 2.1
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void auditRMAction(
|
public void clear()
|
||||||
RecordsManagementAction action,
|
|
||||||
NodeRef nodeRef,
|
|
||||||
Map<String, Serializable> parameters)
|
|
||||||
{
|
{
|
||||||
auditEvent(nodeRef, action.getName());
|
clearAuditLog(getDefaultFilePlan());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void auditEvent(NodeRef nodeRef, String eventName)
|
public void auditEvent(NodeRef nodeRef, String eventName)
|
||||||
@@ -1445,4 +1382,81 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
|
|||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Deprecated Method Implementations **/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to get the default file plan
|
||||||
|
*
|
||||||
|
* @return NodRef default file plan
|
||||||
|
*/
|
||||||
|
private NodeRef getDefaultFilePlan()
|
||||||
|
{
|
||||||
|
NodeRef defaultFilePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
||||||
|
if (defaultFilePlan == null)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Default file plan could not be found.");
|
||||||
|
}
|
||||||
|
return defaultFilePlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean isEnabled()
|
||||||
|
{
|
||||||
|
return isAuditLogEnabled(getDefaultFilePlan());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void start()
|
||||||
|
{
|
||||||
|
startAuditLog(getDefaultFilePlan());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void stop()
|
||||||
|
{
|
||||||
|
stopAuditLog(getDefaultFilePlan());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public Date getDateLastStarted()
|
||||||
|
{
|
||||||
|
return getDateAuditLogLastStarted(getDefaultFilePlan());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public Date getDateLastStopped()
|
||||||
|
{
|
||||||
|
return getDateAuditLogLastStopped(getDefaultFilePlan());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @since 3.2
|
||||||
|
* @deprecated since 2.1
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void auditRMAction(
|
||||||
|
RecordsManagementAction action,
|
||||||
|
NodeRef nodeRef,
|
||||||
|
Map<String, Serializable> parameters)
|
||||||
|
{
|
||||||
|
auditEvent(nodeRef, action.getName());
|
||||||
|
}
|
||||||
}
|
}
|
@@ -19,6 +19,7 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
|
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
* @author Gavin Cornwell
|
* @author Gavin Cornwell
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class AuditEvent
|
public class AuditEvent implements RecordsManagementModel
|
||||||
{
|
{
|
||||||
/** Name */
|
/** Name */
|
||||||
protected String name;
|
protected String name;
|
||||||
@@ -37,29 +38,49 @@ public class AuditEvent
|
|||||||
/** Label */
|
/** Label */
|
||||||
protected String label;
|
protected String label;
|
||||||
|
|
||||||
|
/** Records management audit service */
|
||||||
protected RecordsManagementAuditService recordsManagementAuditService;
|
protected RecordsManagementAuditService recordsManagementAuditService;
|
||||||
|
|
||||||
|
/** Policy component */
|
||||||
protected PolicyComponent policyComponent;
|
protected PolicyComponent policyComponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordsManagementAuditService records management audit service
|
||||||
|
*/
|
||||||
public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService)
|
public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService)
|
||||||
{
|
{
|
||||||
this.recordsManagementAuditService = recordsManagementAuditService;
|
this.recordsManagementAuditService = recordsManagementAuditService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param policyComponent policy component
|
||||||
|
*/
|
||||||
public void setPolicyComponent(PolicyComponent policyComponent)
|
public void setPolicyComponent(PolicyComponent policyComponent)
|
||||||
{
|
{
|
||||||
this.policyComponent = policyComponent;
|
this.policyComponent = policyComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method
|
||||||
|
*/
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
recordsManagementAuditService.registerAuditEvent(this);
|
recordsManagementAuditService.registerAuditEvent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor
|
||||||
|
*/
|
||||||
public AuditEvent()
|
public AuditEvent()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*
|
||||||
|
* @param name audit event name
|
||||||
|
* @param label audit event label (can be actual label or I18N lookup key)
|
||||||
|
*/
|
||||||
public AuditEvent(String name, String label)
|
public AuditEvent(String name, String label)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy;
|
||||||
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy audit event.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class CopyAuditEvent extends AuditEvent implements OnCopyCompletePolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent#init()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
policyComponent.bindClassBehaviour(OnCopyCompletePolicy.QNAME,
|
||||||
|
ASPECT_FILE_PLAN_COMPONENT,
|
||||||
|
new JavaBehaviour(this, "onCopyComplete"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode,
|
||||||
|
Map<NodeRef, NodeRef> copyMap)
|
||||||
|
{
|
||||||
|
if (copyToNewNode == true)
|
||||||
|
{
|
||||||
|
recordsManagementAuditService.auditEvent(targetNodeRef, getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy;
|
||||||
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File audit event.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class FileAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent#init()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME,
|
||||||
|
ASPECT_RECORD,
|
||||||
|
new JavaBehaviour(this, "onUpdateProperties"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
||||||
|
{
|
||||||
|
if (before.get(PROP_DATE_FILED) == null && after.get(PROP_DATE_FILED) != null)
|
||||||
|
{
|
||||||
|
// then we can assume that the record has just been filed
|
||||||
|
recordsManagementAuditService.auditEvent(nodeRef, getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy;
|
||||||
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link audit event.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class LinkAuditEvent extends AuditEvent implements OnCreateChildAssociationPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent#init()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
policyComponent.bindAssociationBehaviour(
|
||||||
|
OnCreateChildAssociationPolicy.QNAME,
|
||||||
|
RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT,
|
||||||
|
ContentModel.ASSOC_CONTAINS,
|
||||||
|
new JavaBehaviour(this, "onCreateChildAssociation"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||||
|
{
|
||||||
|
// only care about linking child associations
|
||||||
|
if (childAssocRef.isPrimary() == false)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
// add some dummy properties to indicate the details of the link?
|
||||||
|
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||||
|
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy;
|
||||||
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move audit event.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class MoveAuditEvent extends AuditEvent implements OnMoveNodePolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent#init()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
policyComponent.bindClassBehaviour(OnMoveNodePolicy.QNAME,
|
||||||
|
ASPECT_FILE_PLAN_COMPONENT,
|
||||||
|
new JavaBehaviour(this, "onMoveNode"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
|
||||||
|
{
|
||||||
|
recordsManagementAuditService.auditEvent(newChildAssocRef.getChildRef(), getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -21,11 +21,11 @@ package org.alfresco.module.org_alfresco_module_rm.script;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
|
||||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
|
||||||
import org.alfresco.repo.web.scripts.content.ContentStreamer;
|
import org.alfresco.repo.web.scripts.content.ContentStreamer;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
|
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation for Java backed webscript to return audit
|
* Implementation for Java backed webscript to return audit
|
||||||
|
Reference in New Issue
Block a user