mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged V2.2 to HEAD
10951: Merged V2.1 to V2.2 10473: Fixed for ETWOONE-114 and ETWOONE-125 10873: Added missing SQL patch reference for post-schema-update tasks: patch.db-V2.1-AuditPathIndex Build label changed to 3.0.0c Labs git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11200 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,12 @@
|
|||||||
<property name="transactionService">
|
<property name="transactionService">
|
||||||
<ref bean="transactionService"/>
|
<ref bean="transactionService"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="nodeService">
|
||||||
|
<ref bean="nodeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="namespacePrefixResolver">
|
||||||
|
<ref bean="namespaceService"/>
|
||||||
|
</property>
|
||||||
<property name="auditConfiguration">
|
<property name="auditConfiguration">
|
||||||
<ref bean="auditConfiguration"/>
|
<ref bean="auditConfiguration"/>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
<list>
|
<list>
|
||||||
<value>classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/AlfrescoPostCreate-2.2-MappedFKIndexes.sql</value>
|
<value>classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/AlfrescoPostCreate-2.2-MappedFKIndexes.sql</value>
|
||||||
<value>classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/AlfrescoPostCreate-2.2-Extra.sql</value>
|
<value>classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/AlfrescoPostCreate-2.2-Extra.sql</value>
|
||||||
|
<value>classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/post-create-indexes-04.sql</value>
|
||||||
<value>classpath:alfresco/dbscripts/create/3.0/${db.script.dialect}/create-activities-extras.sql</value>
|
<value>classpath:alfresco/dbscripts/create/3.0/${db.script.dialect}/create-activities-extras.sql</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
@@ -78,6 +79,7 @@
|
|||||||
<ref bean="patch.db-V2.1-VersionColumns2" />
|
<ref bean="patch.db-V2.1-VersionColumns2" />
|
||||||
<ref bean="patch.db-V2.1-JBPMProcessKey" />
|
<ref bean="patch.db-V2.1-JBPMProcessKey" />
|
||||||
<ref bean="patch.db-V2.1-RemoveWcmSubmittedAspect" />
|
<ref bean="patch.db-V2.1-RemoveWcmSubmittedAspect" />
|
||||||
|
<ref bean="patch.db-V2.1-AuditPathIndex" />
|
||||||
<ref bean="patch.db-V3.0-0-CreateActivitiesExtras" />
|
<ref bean="patch.db-V3.0-0-CreateActivitiesExtras" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -0,0 +1,12 @@
|
|||||||
|
--
|
||||||
|
-- Title: Audit Path index
|
||||||
|
-- Database: Generic
|
||||||
|
-- Since: V2.1 Schema 81
|
||||||
|
-- Author: Andy Hind
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
-- Audit path index
|
||||||
|
|
||||||
|
|
||||||
|
CREATE INDEX idx_alf_adtf_pth ON alf_audit_fact (path);
|
@@ -0,0 +1,12 @@
|
|||||||
|
--
|
||||||
|
-- Title: Audit Path index
|
||||||
|
-- Database: Generic
|
||||||
|
-- Since: V2.1 Schema 81
|
||||||
|
-- Author: Andy Hind
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
-- Audit path index
|
||||||
|
|
||||||
|
|
||||||
|
CREATE INDEX idx_alf_adtf_pth ON alf_audit_fact (path(128));
|
@@ -0,0 +1,23 @@
|
|||||||
|
--
|
||||||
|
-- Title: Ensure the audit table path column is indexed
|
||||||
|
-- Database: Generic
|
||||||
|
-- Since: V2.1 Schema 82
|
||||||
|
-- Author: Andy Hind
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
-- Path was previously unused and unindex - new we use it the index is required.
|
||||||
|
|
||||||
|
CREATE INDEX idx_alf_adtf_pth ON alf_audit_fact (path);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.1-AuditPathIndex';
|
||||||
|
INSERT INTO alf_applied_patch
|
||||||
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'patch.db-V2.1-AuditPathIndex', 'Manually executed script upgrade V2.1: Ensure existence of audit path index',
|
||||||
|
0, 81, -1, 82, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -0,0 +1,23 @@
|
|||||||
|
--
|
||||||
|
-- Title: Ensure the audit table path column is indexed
|
||||||
|
-- Database: Generic
|
||||||
|
-- Since: V2.1 Schema 82
|
||||||
|
-- Author: Andy Hind
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
-- Path was previously unused and unindex - new we use it the index is required.
|
||||||
|
|
||||||
|
CREATE INDEX idx_alf_adtf_pth ON alf_audit_fact (path(128));
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.1-AuditPathIndex';
|
||||||
|
INSERT INTO alf_applied_patch
|
||||||
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'patch.db-V2.1-AuditPathIndex', 'Manually executed script upgrade V2.1: Ensure existence of audit path index',
|
||||||
|
0, 81, -1, 82, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -1410,6 +1410,17 @@
|
|||||||
<ref bean="aclDaoComponent" />
|
<ref bean="aclDaoComponent" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.db-V2.1-AuditPathIndex" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.db-V2.1-AuditPathIndex</value></property>
|
||||||
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>132</value></property>
|
||||||
|
<property name="targetSchema"><value>133</value></property>
|
||||||
|
<property name="scriptUrl">
|
||||||
|
<value>classpath:alfresco/dbscripts/upgrade/2.2/${db.script.dialect}/AlfrescoSchemaUpdate-2.1-AuditPathIndex.sql</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="patch.db-V3.0-0-CreateActivitiesExtras" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V3.0-0-CreateActivitiesExtras" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V3.0-0-CreateActivitiesExtras</value></property>
|
<property name="id"><value>patch.db-V3.0-0-CreateActivitiesExtras</value></property>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
version.major=3
|
version.major=3
|
||||||
version.minor=0
|
version.minor=0
|
||||||
version.revision=0
|
version.revision=0
|
||||||
version.label=b
|
version.label=c
|
||||||
|
|
||||||
# Edition label
|
# Edition label
|
||||||
|
|
||||||
@@ -19,4 +19,5 @@ version.build=@build-number@
|
|||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
|
|
||||||
version.schema=132
|
<<<<<<< .working
|
||||||
|
version.schema=133
|
||||||
|
@@ -35,6 +35,7 @@ import org.alfresco.repo.audit.model.AuditEntry;
|
|||||||
import org.alfresco.repo.audit.model.TrueFalseUnset;
|
import org.alfresco.repo.audit.model.TrueFalseUnset;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||||
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.Auditable;
|
import org.alfresco.service.Auditable;
|
||||||
import org.alfresco.service.NotAuditable;
|
import org.alfresco.service.NotAuditable;
|
||||||
@@ -42,8 +43,11 @@ import org.alfresco.service.PublicService;
|
|||||||
import org.alfresco.service.cmr.audit.AuditInfo;
|
import org.alfresco.service.cmr.audit.AuditInfo;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.repository.Path;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@@ -51,7 +55,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The default audit component implementation. TODO: Implement before, after and exception filtering. At the moment
|
* The default audit component implementation. TODO: Implement before, after and exception filtering. At the moment
|
||||||
* these filters are ignired. TODO: Respect audit internal - at the moment audit internal is fixed to false.
|
* these filters are ignored. TODO: Respect audit internal - at the moment audit internal is fixed to false.
|
||||||
*
|
*
|
||||||
* @author Andy Hind
|
* @author Andy Hind
|
||||||
*/
|
*/
|
||||||
@@ -82,7 +86,11 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
private AuditDAO auditDAO;
|
private AuditDAO auditDAO;
|
||||||
|
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
|
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
private NamespacePrefixResolver namespacePrefixResolver;
|
||||||
|
|
||||||
private AuditModel auditModel;
|
private AuditModel auditModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,6 +99,8 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
|
|
||||||
private InetAddress auditHost;
|
private InetAddress auditHost;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
*/
|
*/
|
||||||
@@ -131,6 +141,16 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
{
|
{
|
||||||
this.transactionService = transactionService;
|
this.transactionService = transactionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the NodeService for path extracting.
|
||||||
|
*
|
||||||
|
* @param nodeService
|
||||||
|
*/
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the audit configuration.
|
* Set the audit configuration.
|
||||||
@@ -162,6 +182,16 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
this.auditModel = auditModel;
|
this.auditModel = auditModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the namespacePrefixResolver.
|
||||||
|
* @param namespacePrefixResolver
|
||||||
|
*/
|
||||||
|
public void setNamespacePrefixResolver(NamespacePrefixResolver namespacePrefixResolver)
|
||||||
|
{
|
||||||
|
this.namespacePrefixResolver = namespacePrefixResolver;
|
||||||
|
}
|
||||||
|
|
||||||
public Object audit(MethodInvocation mi) throws Throwable
|
public Object audit(MethodInvocation mi) throws Throwable
|
||||||
{
|
{
|
||||||
if ((auditFlag.get() == null) || (!auditFlag.get().booleanValue()))
|
if ((auditFlag.get() == null) || (!auditFlag.get().booleanValue()))
|
||||||
@@ -280,7 +310,8 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
transactionService.getRetryingTransactionHelper().doInTransaction(cb, false, false);
|
boolean requiresNew = (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_READ_WRITE);
|
||||||
|
transactionService.getRetryingTransactionHelper().doInTransaction(cb, false, requiresNew);
|
||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
@@ -367,6 +398,11 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
NodeRef key = (NodeRef) returnObject;
|
NodeRef key = (NodeRef) returnObject;
|
||||||
auditInfo.setKeyStore(key.getStoreRef());
|
auditInfo.setKeyStore(key.getStoreRef());
|
||||||
auditInfo.setKeyGUID(key.getId());
|
auditInfo.setKeyGUID(key.getId());
|
||||||
|
RecordOptions recordOptions = auditModel.getAuditRecordOptions(mi);
|
||||||
|
if (recordOptions != null && recordOptions.getRecordPath() == TrueFalseUnset.TRUE)
|
||||||
|
{
|
||||||
|
auditInfo.setPath(getNodePath(key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (returnObject instanceof StoreRef)
|
else if (returnObject instanceof StoreRef)
|
||||||
{
|
{
|
||||||
@@ -377,6 +413,11 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
ChildAssociationRef car = (ChildAssociationRef) returnObject;
|
ChildAssociationRef car = (ChildAssociationRef) returnObject;
|
||||||
auditInfo.setKeyStore(car.getChildRef().getStoreRef());
|
auditInfo.setKeyStore(car.getChildRef().getStoreRef());
|
||||||
auditInfo.setKeyGUID(car.getChildRef().getId());
|
auditInfo.setKeyGUID(car.getChildRef().getId());
|
||||||
|
RecordOptions recordOptions = auditModel.getAuditRecordOptions(mi);
|
||||||
|
if (recordOptions != null && recordOptions.getRecordPath() == TrueFalseUnset.TRUE)
|
||||||
|
{
|
||||||
|
auditInfo.setPath(nodeService.getPath(car.getChildRef()).toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -423,6 +464,9 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
auditInfo.setFail(false);
|
auditInfo.setFail(false);
|
||||||
auditInfo.setFiltered(false);
|
auditInfo.setFiltered(false);
|
||||||
auditInfo.setHostAddress(auditHost);
|
auditInfo.setHostAddress(auditHost);
|
||||||
|
|
||||||
|
auditInfo.setPath(null);
|
||||||
|
|
||||||
Auditable auditable = mi.getMethod().getAnnotation(Auditable.class);
|
Auditable auditable = mi.getMethod().getAnnotation(Auditable.class);
|
||||||
Object key = null;
|
Object key = null;
|
||||||
switch (auditable.key())
|
switch (auditable.key())
|
||||||
@@ -473,10 +517,15 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
if (key != null)
|
if (key != null)
|
||||||
{
|
{
|
||||||
|
RecordOptions recordOptions = auditModel.getAuditRecordOptions(mi);
|
||||||
if (key instanceof NodeRef)
|
if (key instanceof NodeRef)
|
||||||
{
|
{
|
||||||
auditInfo.setKeyStore(((NodeRef) key).getStoreRef());
|
auditInfo.setKeyStore(((NodeRef) key).getStoreRef());
|
||||||
auditInfo.setKeyGUID(((NodeRef) key).getId());
|
auditInfo.setKeyGUID(((NodeRef) key).getId());
|
||||||
|
if (recordOptions != null && recordOptions.getRecordPath() == TrueFalseUnset.TRUE)
|
||||||
|
{
|
||||||
|
auditInfo.setPath(getNodePath((NodeRef) key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (key instanceof StoreRef)
|
else if (key instanceof StoreRef)
|
||||||
{
|
{
|
||||||
@@ -487,6 +536,10 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
ChildAssociationRef car = (ChildAssociationRef) key;
|
ChildAssociationRef car = (ChildAssociationRef) key;
|
||||||
auditInfo.setKeyStore(car.getParentRef().getStoreRef());
|
auditInfo.setKeyStore(car.getParentRef().getStoreRef());
|
||||||
auditInfo.setKeyGUID(car.getParentRef().getId());
|
auditInfo.setKeyGUID(car.getParentRef().getId());
|
||||||
|
if (recordOptions != null && recordOptions.getRecordPath() == TrueFalseUnset.TRUE)
|
||||||
|
{
|
||||||
|
auditInfo.setPath(getNodePath(car.getParentRef()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (key instanceof SearchParameters)
|
else if (key instanceof SearchParameters)
|
||||||
{
|
{
|
||||||
@@ -532,7 +585,6 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
auditInfo.setMethodArguments(serArgs);
|
auditInfo.setMethodArguments(serArgs);
|
||||||
}
|
}
|
||||||
auditInfo.setPath(null);
|
|
||||||
auditInfo.setReturnObject(null);
|
auditInfo.setReturnObject(null);
|
||||||
auditInfo.setSessionId(null);
|
auditInfo.setSessionId(null);
|
||||||
auditInfo.setThrowable(null);
|
auditInfo.setThrowable(null);
|
||||||
@@ -557,7 +609,6 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
public void audit(String source, String description, NodeRef key, Object... args)
|
public void audit(String source, String description, NodeRef key, Object... args)
|
||||||
{
|
{
|
||||||
final AuditState auditInfo = new AuditState(auditConfiguration);
|
final AuditState auditInfo = new AuditState(auditConfiguration);
|
||||||
// RecordOptions recordOptions = auditModel.getAuditRecordOptions(mi);
|
|
||||||
AuditMode auditMode = AuditMode.UNSET;
|
AuditMode auditMode = AuditMode.UNSET;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -610,7 +661,7 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
private AuditMode onApplicationAudit(AuditMode auditMode, AuditState auditInfo, String source, String description, NodeRef key, Object... args)
|
private AuditMode onApplicationAudit(AuditMode auditMode, AuditState auditInfo, String source, String description, NodeRef key, Object... args)
|
||||||
{
|
{
|
||||||
AuditMode effectiveAuditMode = auditModel.beforeExecution(auditMode, source, description, key, args);
|
AuditMode effectiveAuditMode = auditModel.beforeExecution(auditMode, source, description, key, args);
|
||||||
|
auditModel.getAuditRecordOptions(source);
|
||||||
if (auditMode != AuditMode.NONE)
|
if (auditMode != AuditMode.NONE)
|
||||||
{
|
{
|
||||||
if (source.equals(SYSTEM_APPLICATION))
|
if (source.equals(SYSTEM_APPLICATION))
|
||||||
@@ -627,10 +678,16 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
auditInfo.setFail(false);
|
auditInfo.setFail(false);
|
||||||
auditInfo.setFiltered(false);
|
auditInfo.setFiltered(false);
|
||||||
auditInfo.setHostAddress(auditHost);
|
auditInfo.setHostAddress(auditHost);
|
||||||
|
auditInfo.setPath(null);
|
||||||
if (key != null)
|
if (key != null)
|
||||||
{
|
{
|
||||||
auditInfo.setKeyStore(key.getStoreRef());
|
auditInfo.setKeyStore(key.getStoreRef());
|
||||||
auditInfo.setKeyGUID(key.getId());
|
auditInfo.setKeyGUID(key.getId());
|
||||||
|
RecordOptions recordOptions = auditModel.getAuditRecordOptions(source);
|
||||||
|
if (recordOptions != null && recordOptions.getRecordPath() == TrueFalseUnset.TRUE)
|
||||||
|
{
|
||||||
|
auditInfo.setPath(getNodePath(key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
auditInfo.setKeyPropertiesAfter(null);
|
auditInfo.setKeyPropertiesAfter(null);
|
||||||
auditInfo.setKeyPropertiesBefore(null);
|
auditInfo.setKeyPropertiesBefore(null);
|
||||||
@@ -655,7 +712,6 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
auditInfo.setMethodArguments(serArgs);
|
auditInfo.setMethodArguments(serArgs);
|
||||||
}
|
}
|
||||||
auditInfo.setPath(null);
|
|
||||||
auditInfo.setReturnObject(null);
|
auditInfo.setReturnObject(null);
|
||||||
auditInfo.setSessionId(null);
|
auditInfo.setSessionId(null);
|
||||||
auditInfo.setThrowable(null);
|
auditInfo.setThrowable(null);
|
||||||
@@ -677,4 +733,23 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
return auditMode;
|
return auditMode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns human readable path for node.
|
||||||
|
* To improve performance may return simple toString() method of the path.
|
||||||
|
*
|
||||||
|
* @param nodeRef
|
||||||
|
* @return Human readable path for node
|
||||||
|
*/
|
||||||
|
private String getNodePath(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
String result = null;
|
||||||
|
if (nodeService.exists(nodeRef))
|
||||||
|
{
|
||||||
|
Path path = nodeService.getPath(nodeRef);
|
||||||
|
return path.toPrefixString(namespacePrefixResolver);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@ package org.alfresco.repo.audit.model;
|
|||||||
import org.alfresco.repo.audit.AuditMode;
|
import org.alfresco.repo.audit.AuditMode;
|
||||||
import org.alfresco.repo.audit.AuditModel;
|
import org.alfresco.repo.audit.AuditModel;
|
||||||
import org.alfresco.repo.audit.PublicServiceIdentifier;
|
import org.alfresco.repo.audit.PublicServiceIdentifier;
|
||||||
|
import org.alfresco.repo.audit.RecordOptions;
|
||||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -240,6 +241,51 @@ public abstract class AbstractAuditEntry
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected RecordOptions getEffectiveRecordOptions()
|
||||||
|
{
|
||||||
|
RecordOptions recordOptions;
|
||||||
|
if (checkEnabled() == TrueFalseUnset.TRUE)
|
||||||
|
{
|
||||||
|
recordOptions = getRecordOptionsOrParentRecordOptions();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
recordOptions = null;
|
||||||
|
}
|
||||||
|
if(s_logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
s_logger.debug("...Record Options = "+recordOptions);
|
||||||
|
}
|
||||||
|
return recordOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RecordOptions getRecordOptionsOrParentRecordOptions()
|
||||||
|
{
|
||||||
|
RecordOptions recordOptions = getRecordOptions();
|
||||||
|
if(s_logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
s_logger.debug("... ... record options = "+recordOptions);
|
||||||
|
}
|
||||||
|
if (recordOptions == null)
|
||||||
|
{
|
||||||
|
if (getParent() == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return getParent().getRecordOptionsOrParentRecordOptions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return recordOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private TrueFalseUnset checkEnabled()
|
private TrueFalseUnset checkEnabled()
|
||||||
{
|
{
|
||||||
TrueFalseUnset effective = getEnabled();
|
TrueFalseUnset effective = getEnabled();
|
||||||
|
@@ -61,7 +61,7 @@ public class ApplicationAuditEntry extends AbstractNamedAuditEntry implements Ap
|
|||||||
|
|
||||||
public RecordOptions getAuditRecordOptions(String application)
|
public RecordOptions getAuditRecordOptions(String application)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
return getEffectiveRecordOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ import org.springframework.beans.factory.InitializingBean;
|
|||||||
public class AuditEntry extends AbstractAuditEntry implements InitializingBean, AuditModel
|
public class AuditEntry extends AbstractAuditEntry implements InitializingBean, AuditModel
|
||||||
{
|
{
|
||||||
private static Log s_logger = LogFactory.getLog(AuditEntry.class);
|
private static Log s_logger = LogFactory.getLog(AuditEntry.class);
|
||||||
|
|
||||||
private Map<String, ServiceAuditEntry> services = new HashMap<String, ServiceAuditEntry>();
|
private Map<String, ServiceAuditEntry> services = new HashMap<String, ServiceAuditEntry>();
|
||||||
|
|
||||||
private Map<String, ApplicationAuditEntry> applications = new HashMap<String, ApplicationAuditEntry>();
|
private Map<String, ApplicationAuditEntry> applications = new HashMap<String, ApplicationAuditEntry>();
|
||||||
@@ -85,8 +85,6 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
configure(null, root, namespacePrefixResolver);
|
configure(null, root, namespacePrefixResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void configure(AbstractAuditEntry parent, Element element, NamespacePrefixResolver namespacePrefixResolver)
|
void configure(AbstractAuditEntry parent, Element element, NamespacePrefixResolver namespacePrefixResolver)
|
||||||
{
|
{
|
||||||
@@ -98,7 +96,7 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
{
|
{
|
||||||
throw new AuditModelException("Audit model has incorrect root node");
|
throw new AuditModelException("Audit model has incorrect root node");
|
||||||
}
|
}
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("Audit configuration");
|
s_logger.debug("Audit configuration");
|
||||||
}
|
}
|
||||||
@@ -106,7 +104,7 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
|
|
||||||
// Add services
|
// Add services
|
||||||
|
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("Adding services ...");
|
s_logger.debug("Adding services ...");
|
||||||
}
|
}
|
||||||
@@ -120,7 +118,7 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
|
|
||||||
// Add Applications
|
// Add Applications
|
||||||
|
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("Adding applications ...");
|
s_logger.debug("Adding applications ...");
|
||||||
}
|
}
|
||||||
@@ -137,21 +135,29 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
{
|
{
|
||||||
String serviceName = getPublicServiceIdentifier().getPublicServiceName(mi);
|
String serviceName = getPublicServiceIdentifier().getPublicServiceName(mi);
|
||||||
ServiceAuditEntry service = services.get(serviceName);
|
ServiceAuditEntry service = services.get(serviceName);
|
||||||
if(service != null)
|
if (service != null)
|
||||||
{
|
{
|
||||||
return service.beforeExecution(auditMode, mi);
|
MethodAuditEntry method = service.getMethodAuditEntry(mi.getMethod().getName());
|
||||||
|
if (method != null)
|
||||||
|
{
|
||||||
|
return method.beforeExecution(auditMode, mi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return service.beforeExecution(auditMode, mi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("No specific audit entry for service "+serviceName);
|
s_logger.debug("No specific audit entry for service " + serviceName);
|
||||||
}
|
}
|
||||||
return getEffectiveAuditMode();
|
return getEffectiveAuditMode();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuditMode afterExecution(AuditMode auditMode, MethodInvocation mi)
|
public AuditMode afterExecution(AuditMode auditMode, MethodInvocation mi)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
@@ -159,7 +165,29 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
|
|
||||||
public RecordOptions getAuditRecordOptions(MethodInvocation mi)
|
public RecordOptions getAuditRecordOptions(MethodInvocation mi)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
String serviceName = getPublicServiceIdentifier().getPublicServiceName(mi);
|
||||||
|
ServiceAuditEntry service = services.get(serviceName);
|
||||||
|
if (service != null)
|
||||||
|
{
|
||||||
|
MethodAuditEntry method = service.getMethodAuditEntry(mi.getMethod().getName());
|
||||||
|
if (method != null)
|
||||||
|
{
|
||||||
|
return method.getAuditRecordOptions(mi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return service.getAuditRecordOptions(mi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (s_logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
s_logger.debug("No specific audit entry for service " + serviceName);
|
||||||
|
}
|
||||||
|
return getEffectiveRecordOptions();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuditMode onError(AuditMode auditMode, MethodInvocation mi)
|
public AuditMode onError(AuditMode auditMode, MethodInvocation mi)
|
||||||
@@ -195,18 +223,18 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
public AuditMode beforeExecution(AuditMode auditMode, String application, String description, NodeRef key, Object... args)
|
public AuditMode beforeExecution(AuditMode auditMode, String application, String description, NodeRef key, Object... args)
|
||||||
{
|
{
|
||||||
ApplicationAuditEntry aae = applications.get(application);
|
ApplicationAuditEntry aae = applications.get(application);
|
||||||
if(aae != null)
|
if (aae != null)
|
||||||
{
|
{
|
||||||
return aae.beforeExecution(auditMode, application, description, key, args);
|
return aae.beforeExecution(auditMode, application, description, key, args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("No specific audit entry for application "+application);
|
s_logger.debug("No specific audit entry for application " + application);
|
||||||
}
|
}
|
||||||
return getEffectiveAuditMode();
|
return getEffectiveAuditMode();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,25 +250,46 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
|
|||||||
|
|
||||||
public RecordOptions getAuditRecordOptions(String application)
|
public RecordOptions getAuditRecordOptions(String application)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
ApplicationAuditEntry aae = applications.get(application);
|
||||||
}
|
if (aae != null)
|
||||||
|
|
||||||
public TrueFalseUnset getAuditInternalServiceMethods( MethodInvocation mi)
|
|
||||||
{
|
|
||||||
String serviceName = getPublicServiceIdentifier().getPublicServiceName(mi);
|
|
||||||
ServiceAuditEntry service = services.get(serviceName);
|
|
||||||
if(service != null)
|
|
||||||
{
|
{
|
||||||
return service.getAuditInternalServiceMethods( mi);
|
return aae.getAuditRecordOptions(application);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("No specific audit entry for service "+serviceName);
|
s_logger.debug("No specific audit entry for application " + application);
|
||||||
|
}
|
||||||
|
return getEffectiveRecordOptions();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi)
|
||||||
|
{
|
||||||
|
String serviceName = getPublicServiceIdentifier().getPublicServiceName(mi);
|
||||||
|
ServiceAuditEntry service = services.get(serviceName);
|
||||||
|
if (service != null)
|
||||||
|
{
|
||||||
|
MethodAuditEntry method = service.getMethodAuditEntry(mi.getMethod().getName());
|
||||||
|
if (method != null)
|
||||||
|
{
|
||||||
|
return method.getAuditInternalServiceMethods(mi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return service.getAuditInternalServiceMethods(mi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (s_logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
s_logger.debug("No specific audit entry for service " + serviceName);
|
||||||
}
|
}
|
||||||
return getEffectiveAuditInternal();
|
return getEffectiveAuditInternal();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ package org.alfresco.repo.audit.model;
|
|||||||
|
|
||||||
import org.alfresco.repo.audit.AuditMode;
|
import org.alfresco.repo.audit.AuditMode;
|
||||||
import org.alfresco.repo.audit.MethodAuditModel;
|
import org.alfresco.repo.audit.MethodAuditModel;
|
||||||
|
import org.alfresco.repo.audit.RecordOptions;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -59,9 +60,9 @@ public class MethodAuditEntry extends AbstractNamedAuditEntry implements MethodA
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordOptionsImpl getAuditRecordOptions(MethodInvocation mi)
|
public RecordOptions getAuditRecordOptions(MethodInvocation mi)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
return getEffectiveRecordOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi)
|
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi)
|
||||||
|
@@ -31,6 +31,7 @@ import java.util.Map;
|
|||||||
import org.alfresco.repo.audit.AuditMode;
|
import org.alfresco.repo.audit.AuditMode;
|
||||||
import org.alfresco.repo.audit.AuditModel;
|
import org.alfresco.repo.audit.AuditModel;
|
||||||
import org.alfresco.repo.audit.MethodAuditModel;
|
import org.alfresco.repo.audit.MethodAuditModel;
|
||||||
|
import org.alfresco.repo.audit.RecordOptions;
|
||||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@@ -40,7 +41,7 @@ import org.dom4j.Element;
|
|||||||
public class ServiceAuditEntry extends AbstractNamedAuditEntry implements MethodAuditModel
|
public class ServiceAuditEntry extends AbstractNamedAuditEntry implements MethodAuditModel
|
||||||
{
|
{
|
||||||
private static Log s_logger = LogFactory.getLog(ServiceAuditEntry.class);
|
private static Log s_logger = LogFactory.getLog(ServiceAuditEntry.class);
|
||||||
|
|
||||||
private Map<String, MethodAuditEntry> methods = new HashMap<String, MethodAuditEntry>();
|
private Map<String, MethodAuditEntry> methods = new HashMap<String, MethodAuditEntry>();
|
||||||
|
|
||||||
public ServiceAuditEntry()
|
public ServiceAuditEntry()
|
||||||
@@ -55,9 +56,9 @@ public class ServiceAuditEntry extends AbstractNamedAuditEntry implements Method
|
|||||||
|
|
||||||
// Add Methods
|
// Add Methods
|
||||||
|
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("Adding methods to service "+getName());
|
s_logger.debug("Adding methods to service " + getName());
|
||||||
}
|
}
|
||||||
for (Iterator nsit = element.elementIterator(AuditModel.EL_METHOD); nsit.hasNext(); /**/)
|
for (Iterator nsit = element.elementIterator(AuditModel.EL_METHOD); nsit.hasNext(); /**/)
|
||||||
{
|
{
|
||||||
@@ -66,9 +67,9 @@ public class ServiceAuditEntry extends AbstractNamedAuditEntry implements Method
|
|||||||
method.configure(this, methodElement, namespacePrefixResolver);
|
method.configure(this, methodElement, namespacePrefixResolver);
|
||||||
methods.put(method.getName(), method);
|
methods.put(method.getName(), method);
|
||||||
}
|
}
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("...added methods for service "+getName());
|
s_logger.debug("...added methods for service " + getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,9 +83,9 @@ public class ServiceAuditEntry extends AbstractNamedAuditEntry implements Method
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("Evaluating if service is audited (no specific setting) for "+getName()+"."+methodName);
|
s_logger.debug("Evaluating if service is audited (no specific setting) for " + getName() + "." + methodName);
|
||||||
}
|
}
|
||||||
return getEffectiveAuditMode();
|
return getEffectiveAuditMode();
|
||||||
}
|
}
|
||||||
@@ -100,9 +101,9 @@ public class ServiceAuditEntry extends AbstractNamedAuditEntry implements Method
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordOptionsImpl getAuditRecordOptions(MethodInvocation mi)
|
public RecordOptions getAuditRecordOptions(MethodInvocation mi)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
return getEffectiveRecordOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi)
|
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi)
|
||||||
@@ -115,12 +116,17 @@ public class ServiceAuditEntry extends AbstractNamedAuditEntry implements Method
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("Evaluating if service is internally audited (no specific setting) for "+getName()+"."+methodName);
|
s_logger.debug("Evaluating if service is internally audited (no specific setting) for " + getName() + "." + methodName);
|
||||||
}
|
}
|
||||||
return getEffectiveAuditInternal();
|
return getEffectiveAuditInternal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MethodAuditEntry getMethodAuditEntry(String name)
|
||||||
|
{
|
||||||
|
return methods.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user