use of org.mifos.framework.components.audit.persistence.LegacyAuditDao in project head by mifos.
the class AuditBusinessService method getAuditLogRecords.
public List<AuditLogView> getAuditLogRecords(Short entityType, Integer entityId) throws ServiceException {
try {
LegacyAuditDao auditPersistence = ApplicationContextProvider.getBean(LegacyAuditDao.class);
PersonnelBusinessService personnelService = new PersonnelBusinessService();
List<AuditLog> auditLogRecords = auditPersistence.getAuditLogRecords(entityType, entityId);
List<AuditLogView> auditLogViewList = new ArrayList<AuditLogView>();
for (AuditLog auditLog : auditLogRecords) {
for (AuditLogRecord auditLogRecord : auditLog.getAuditLogRecords()) {
AuditLogView auditLogView = new AuditLogView();
auditLogView.setDate(auditLog.getUpdatedDate().toString());
Short userId = auditLog.getUpdatedBy();
PersonnelBO personnel = personnelService.getPersonnel(userId);
auditLogView.setUser(personnel.getUserName());
auditLogView.setField(auditLogRecord.getFieldName());
String encryptedPasswordAuditFieldName = AuditConfiguration.getColumnNameForPropertyName(AuditConstants.PERSONNEL, AuditConstants.Audit_PASSWORD);
if ((null != encryptedPasswordAuditFieldName) && (auditLogRecord.getFieldName().equals(encryptedPasswordAuditFieldName.trim()))) {
auditLogView.setOldValue(AuditConstants.HIDDEN_PASSWORD);
auditLogView.setNewValue(AuditConstants.HIDDEN_PASSWORD);
} else {
auditLogView.setOldValue(auditLogRecord.getOldValue());
auditLogView.setNewValue(auditLogRecord.getNewValue());
}
auditLogViewList.add(auditLogView);
}
}
return auditLogViewList;
} catch (PersistenceException e) {
throw new ServiceException(e);
}
}
Aggregations