Full resultset audit queries

- Use RollupRowHandler and nested ResultMap
 - Audit Map values are pulled back with entries


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16130 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-07 15:48:00 +00:00
parent a6eb590cc9
commit fadc101ce4
6 changed files with 87 additions and 49 deletions

View File

@@ -38,6 +38,7 @@ import org.alfresco.repo.audit.AuditState;
import org.alfresco.repo.audit.hibernate.HibernateAuditDAO;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.domain.contentdata.ContentDataDAO;
import org.alfresco.repo.domain.propval.PropertyIdSearchRow;
import org.alfresco.repo.domain.propval.PropertyValueDAO;
import org.alfresco.service.cmr.audit.AuditInfo;
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
@@ -298,15 +299,39 @@ public abstract class AbstractAuditDAOImpl implements AuditDAO
return;
}
// Get the value map
// TODO: Should be done with a nested resultmapping
Long auditValuesId = row.getAuditValuesId();
Pair<Long, Serializable> auditValuesPair = propertyValueDAO.getPropertyValueById(auditValuesId);
if (auditValuesPair == null)
Map<String, Serializable> auditValues;
List<PropertyIdSearchRow> propMapRows = row.getAuditValues();
if (propMapRows == null)
{
// Ignore
return;
// Use the audit values ID
Long auditValuesId = row.getAuditValuesId();
Pair<Long, Serializable> auditValuesPair = propertyValueDAO.getPropertyValueById(auditValuesId);
if (auditValuesPair == null)
{
// Ignore
logger.warn("Audit entry not joined to audit properties: " + row);
return;
}
auditValues = (Map<String, Serializable>) auditValuesPair.getSecond();
}
else
{
// Resolve the map
try
{
auditValues = (Map<String, Serializable>) propertyValueDAO.convertPropertyIdSearchRows(propMapRows);
}
catch (ClassCastException e)
{
logger.warn("Audit entry not linked to a Map<String, Serializable> value: " + row);
return;
}
if (auditValues == null)
{
logger.warn("Audit entry incompletely joined to audit properties: " + row);
return;
}
}
Map<String, Serializable> auditValues = (Map<String, Serializable>) auditValuesPair.getSecond();
more = callback.handleAuditEntry(
row.getAuditEntryId(),
row.getAuditAppName(),