use of org.mifos.framework.components.audit.util.helpers.AuditLogView in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveChangeLogs.
@Override
public List<AuditLogDto> retrieveChangeLogs(Integer centerId) {
try {
List<AuditLogDto> auditLogs = new ArrayList<AuditLogDto>();
Short entityType = EntityType.CENTER.getValue();
AuditBusinessService auditBusinessService = new AuditBusinessService();
List<AuditLogView> centerAuditLogs = auditBusinessService.getAuditLogRecords(entityType, centerId);
for (AuditLogView auditLogView : centerAuditLogs) {
auditLogs.add(auditLogView.toDto());
}
return auditLogs;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.framework.components.audit.util.helpers.AuditLogView in project head by mifos.
the class AuditBusinessServiceIntegrationTest method testGetAuditLogRecords.
@Test
public void testGetAuditLogRecords() throws Exception {
AuditLog auditLog = new AuditLog(1, (short) 2, "Mifos", new Date(System.currentTimeMillis()), (short) 3);
Set<AuditLogRecord> auditLogRecords = new HashSet<AuditLogRecord>();
AuditLogRecord auditLogRecord = new AuditLogRecord("ColumnName_1", "test_1", "new_test_1", auditLog);
auditLogRecords.add(auditLogRecord);
auditLog.addAuditLogRecords(auditLogRecords);
legacyAuditDao.save(auditLog);
AuditBusinessService auditBusinessService = new AuditBusinessService();
List<AuditLogView> auditLogViewList = auditBusinessService.getAuditLogRecords((short) 2, 1);
Assert.assertEquals(1, auditLogViewList.size());
auditLog = getAuditLog(1, (short) 2);
}
use of org.mifos.framework.components.audit.util.helpers.AuditLogView in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveLoanProductAuditLogs.
@Override
public List<AuditLogDto> retrieveLoanProductAuditLogs(Integer productId) {
List<AuditLogDto> auditLogDtos = new ArrayList<AuditLogDto>();
AuditBusinessService auditBusinessService = new AuditBusinessService();
try {
List<AuditLogView> auditLogs = auditBusinessService.getAuditLogRecords(EntityType.LOANPRODUCT.getValue(), productId);
for (AuditLogView auditLogView : auditLogs) {
auditLogDtos.add(auditLogView.toDto());
}
return auditLogDtos;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.framework.components.audit.util.helpers.AuditLogView in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveSavingsProductAuditLogs.
@Override
public List<AuditLogDto> retrieveSavingsProductAuditLogs(Integer productId) {
List<AuditLogDto> auditLogDtos = new ArrayList<AuditLogDto>();
AuditBusinessService auditBusinessService = new AuditBusinessService();
try {
List<AuditLogView> auditLogs = auditBusinessService.getAuditLogRecords(EntityType.SAVINGSPRODUCT.getValue(), productId);
for (AuditLogView auditLogView : auditLogs) {
auditLogDtos.add(auditLogView.toDto());
}
return auditLogDtos;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.framework.components.audit.util.helpers.AuditLogView 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