diff --git a/CHANGELOG.md b/CHANGELOG.md index 3903447f3..6c4f7c78b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ============= diff --git a/README.md b/README.md index 1893558fb..6a14bce1c 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The mifos-platform (project named 'Mifos X') has reached public release versi That means there is a published and stable API. This API is documented in the api-docs under Full API Matrix. -Latest stable release: mifosplatform-1.0.0 +Latest stable release: mifosplatform-1.0.1 License ============= diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index e74043965..3c9d70e19 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -90,7 +90,7 @@
- +

Overview

diff --git a/mifosng-provider/gradle.properties b/mifosng-provider/gradle.properties index 336cbc3e6..094c9a7fb 100644 --- a/mifosng-provider/gradle.properties +++ b/mifosng-provider/gradle.properties @@ -1 +1 @@ -releaseVersion=1.1.0.RELEASE \ No newline at end of file +releaseVersion=1.1.0.RELEASE diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java index 19ed21204..0d81aac5a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java @@ -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>() {}.getType(); + final Map 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; }