merge in 1.0.1 branch

This commit is contained in:
Keith Woodlock
2013-05-08 13:12:17 +01:00
5 changed files with 38 additions and 27 deletions
+6
View File
@@ -6,6 +6,7 @@ See VERSIONING (https://github.com/openMF/mifosx/blob/master/VERSIONING.md) for
Releases
===============
1. 08 May 2013 - 1.0.1.RELEASE
1. 07 May 2013 - 1.0.0.RELEASE
1. 30 April 2013 - 0.12.1.beta
2. 30 April 2013 - 0.11.4.beta
@@ -15,6 +16,11 @@ Releases
1. 05 April 2013 - 0.11.1.beta
1. 05 April 2013 - 0.11.0.beta
1.0.1.RELEASE
=============
Bug Release
- MIFOSX-343 - When viewing Audit details, integer values (rather than string values) for officeId and clientId cause exception
1.0.0.RELEASE
=============
+1 -1
View File
@@ -26,7 +26,7 @@ The mifos-platform (project named 'Mifos X') has reached <b>public release versi
That means there is a published and stable API. This API is documented in the api-docs under <b>Full API Matrix</b>.
Latest stable release: <a target="_blank" href="https://github.com/openMF/mifosx/tree/mifosplatform-1.0.0" title="mifosplatform-1.0.0">mifosplatform-1.0.0</a>
Latest stable release: <a target="_blank" href="https://github.com/openMF/mifosx/tree/mifosplatform-1.0.1" title="mifosplatform-1.0.1">mifosplatform-1.0.1</a>
License
=============
+1 -1
View File
@@ -90,7 +90,7 @@
<body>
<div id="page-wrapper">
<div id="flybar">
<div id="nav-logo">1.0.0.RELEASE API</div>
<div id="nav-logo">1.0.1.RELEASE API</div>
<div class="flybar-nav">
<h2 class="flybar-button">Overview</h2>
<div class="flybar-menu-overview">
+1 -1
View File
@@ -1 +1 @@
releaseVersion=1.1.0.RELEASE
releaseVersion=1.1.0.RELEASE
@@ -36,7 +36,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import com.google.gson.reflect.TypeToken;
import com.google.common.reflect.TypeToken;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@Service
public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
@@ -182,51 +184,54 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
@Override
public AuditData retrieveAuditEntry(final Long auditId) {
AppUser currentUser = context.authenticatedUser();
String hierarchy = currentUser.getOffice().getHierarchy();
final AppUser currentUser = context.authenticatedUser();
final String hierarchy = currentUser.getOffice().getHierarchy();
final AuditMapper rm = new AuditMapper();
String sql = "select " + rm.schema(true, hierarchy);
sql += " where aud.id = " + auditId;
final String sql = "select " + rm.schema(true, hierarchy) + " where aud.id = " + auditId;
AuditData auditResult = this.jdbcTemplate.queryForObject(sql, rm, new Object[] {});
final AuditData auditResult = this.jdbcTemplate.queryForObject(sql, rm, new Object[] {});
return replaceIdsOnAuditData(auditResult);
}
private AuditData replaceIdsOnAuditData(final AuditData auditResult) {
final String auditAsJson = auditResult.getCommandAsJson();
String auditAsJson = auditResult.getCommandAsJson();
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
final Map<String, Object> commandAsJsonMap = this.fromApiJsonHelper.extractObjectMap(typeOfMap, auditAsJson);
final JsonElement auditJsonFragment = this.fromApiJsonHelper.parse(auditAsJson);
final JsonObject auditObject = auditJsonFragment.getAsJsonObject();
if (commandAsJsonMap.containsKey("officeId")) {
commandAsJsonMap.remove("officeId");
final Object officeIdObj = commandAsJsonMap.get("officeId");
if (officeIdObj != null && StringUtils.isNotBlank(officeIdObj.toString())) {
final Long officeId = Long.valueOf(officeIdObj.toString());
final Long officeId = auditObject.get("officeId").getAsLong();
if (officeId != null) {
OfficeData office = this.officeReadPlatformService.retrieveOffice(officeId);
commandAsJsonMap.remove("officeId");
commandAsJsonMap.put("officeName", office.name());
auditAsJson = this.fromApiJsonHelper.toJson(commandAsJsonMap);
} else {
commandAsJsonMap.put("officeName", "");
}
}
if (commandAsJsonMap.containsKey("clientId")) {
commandAsJsonMap.remove("clientId");
final Object clientIdObj = commandAsJsonMap.get("clientId");
if (clientIdObj != null && StringUtils.isNotBlank(clientIdObj.toString())) {
final Long clientId = Long.valueOf(clientIdObj.toString());
final Long clientId = auditObject.get("officeId").getAsLong();
if (clientId != null) {
ClientData client = this.clientReadPlatformService.retrieveOne(clientId);
commandAsJsonMap.remove("clientId");
commandAsJsonMap.put("clientName", client.displayName());
auditAsJson = this.fromApiJsonHelper.toJson(commandAsJsonMap);
} else {
commandAsJsonMap.put("clientName", "");
}
}
auditResult.setCommandAsJson(auditAsJson);
final String newAuditAsJson = this.fromApiJsonHelper.toJson(commandAsJsonMap);
auditResult.setCommandAsJson(newAuditAsJson);
return auditResult;
}