From 69bd598456c437289860d61dfa8791b0f3486de1 Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Fri, 4 Oct 2013 11:54:52 +0100 Subject: [PATCH 1/7] update version for release --- api-docs/apiLive.htm | 2 +- mifosng-provider/gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 80ebad7ea..d52b2fefc 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 9df97c7ed..c11faab33 100644 --- a/mifosng-provider/gradle.properties +++ b/mifosng-provider/gradle.properties @@ -1,2 +1,2 @@ -releaseVersion=1.10.2.RELEASE +releaseVersion=1.10.3.RELEASE From 32a8f921dd0988be23351da2afc61e4c4c1ffc51 Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Thu, 26 Sep 2013 23:52:46 +0100 Subject: [PATCH 2/7] MIFOSX-694: add missing users cache to ehcache xml file. --- .../service/OfficeReadPlatformService.java | 3 - .../OfficeReadPlatformServiceImpl.java | 55 +------------------ ...WritePlatformServiceJpaRepositoryImpl.java | 13 ++++- .../resources/META-INF/spring/ehcache.xml | 3 + 4 files changed, 14 insertions(+), 60 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformService.java index 51144ddc0..c59b34f95 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformService.java @@ -7,14 +7,11 @@ package org.mifosplatform.organisation.office.service; import java.util.Collection; -import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant; import org.mifosplatform.organisation.office.data.OfficeData; import org.mifosplatform.organisation.office.data.OfficeTransactionData; public interface OfficeReadPlatformService { - MifosPlatformTenant loadTenantById(String tenantIdentifier); - Collection retrieveAllOffices(boolean includeAllOffices); Collection retrieveAllOfficesForDropdown(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java index ef6864819..29c5c67af 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java @@ -11,13 +11,9 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; -import javax.sql.DataSource; - import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant; import org.mifosplatform.infrastructure.core.service.RoutingDataSource; -import org.mifosplatform.infrastructure.security.exception.InvalidTenantIdentiferException; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService; @@ -26,7 +22,6 @@ import org.mifosplatform.organisation.office.data.OfficeTransactionData; import org.mifosplatform.organisation.office.exception.OfficeNotFoundException; import org.mifosplatform.useradministration.domain.AppUser; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.cache.annotation.Cacheable; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -37,19 +32,16 @@ import org.springframework.stereotype.Service; public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService { private final JdbcTemplate jdbcTemplate; - private final JdbcTemplate tenantsJdbcTemplate; private final PlatformSecurityContext context; private final CurrencyReadPlatformService currencyReadPlatformService; private final static String nameDecoratedBaseOnHierarchy = "concat(substring('........................................', 1, ((LENGTH(o.hierarchy) - LENGTH(REPLACE(o.hierarchy, '.', '')) - 1) * 4)), o.name)"; @Autowired public OfficeReadPlatformServiceImpl(final PlatformSecurityContext context, - final CurrencyReadPlatformService currencyReadPlatformService, final RoutingDataSource dataSource, - @Qualifier("tenantDataSourceJndi") final DataSource tenantsJndiDataSource) { + final CurrencyReadPlatformService currencyReadPlatformService, final RoutingDataSource dataSource) { this.context = context; this.currencyReadPlatformService = currencyReadPlatformService; this.jdbcTemplate = new JdbcTemplate(dataSource); - this.tenantsJdbcTemplate = new JdbcTemplate(tenantsJndiDataSource); } private static final class OfficeMapper implements RowMapper { @@ -134,7 +126,6 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService } } - /** TODO: Vishwas This change breaks caching, need to have a relook **/ @Override @Cacheable(value = "offices", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy()+'of')") public Collection retrieveAllOffices(final boolean includeAllOffices) { @@ -243,48 +234,4 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService public PlatformSecurityContext getContext() { return this.context; } - - @Override - @Cacheable(value = "tenantsById", key = "#tenantIdentifier") - public MifosPlatformTenant loadTenantById(final String tenantIdentifier) { - - try { - final TenantMapper rm = new TenantMapper(); - final String sql = "select " + rm.schema() + " where t.identifier like ?"; - - return this.tenantsJdbcTemplate.queryForObject(sql, rm, new Object[] { tenantIdentifier }); - } catch (final EmptyResultDataAccessException e) { - throw new InvalidTenantIdentiferException("The tenant identifier: " + tenantIdentifier + " is not valid."); - } - } - - private static final class TenantMapper implements RowMapper { - - private final StringBuilder sqlBuilder = new StringBuilder( - "id, name,identifier, schema_name as schemaName, schema_server as schemaServer, schema_server_port as schemaServerPort, auto_update as autoUpdate, ")// - .append(" schema_username as schemaUsername, schema_password as schemaPassword , timezone_id as timezoneId ")// - .append(" from tenants t");// - - public String schema() { - return this.sqlBuilder.toString(); - } - - @Override - public MifosPlatformTenant mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException { - - final Long id = rs.getLong("id"); - final String tenantIdentifier = rs.getString("identifier"); - final String name = rs.getString("name"); - final String schemaName = rs.getString("schemaName"); - final String schemaServer = rs.getString("schemaServer"); - final String schemaServerPort = rs.getString("schemaServerPort"); - final String schemaUsername = rs.getString("schemaUsername"); - final String schemaPassword = rs.getString("schemaPassword"); - final String timezoneId = rs.getString("timezoneId"); - final boolean autoUpdateEnabled = rs.getBoolean("autoUpdate"); - - return new MifosPlatformTenant(id, tenantIdentifier, name, schemaName, schemaServer, schemaServerPort, schemaUsername, - schemaPassword, timezoneId, autoUpdateEnabled); - } - } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java index b1802c506..23ef92d42 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java @@ -34,6 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Caching; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -67,7 +68,9 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit @Transactional @Override - @CacheEvict(value = "usersByUsername", allEntries = true) + @Caching(evict = { + @CacheEvict(value = "users", allEntries = true), + @CacheEvict(value = "usersByUsername", allEntries = true)}) public CommandProcessingResult createUser(final JsonCommand command) { try { @@ -111,7 +114,9 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit @Transactional @Override - @CacheEvict(value = "usersByUsername", allEntries = true) + @Caching(evict = { + @CacheEvict(value = "users", allEntries = true), + @CacheEvict(value = "usersByUsername", allEntries = true)}) public CommandProcessingResult updateUser(final Long userId, final JsonCommand command) { try { @@ -172,7 +177,9 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit @Transactional @Override - @CacheEvict(value = "usersByUsername", allEntries = true) + @Caching(evict = { + @CacheEvict(value = "users", allEntries = true), + @CacheEvict(value = "usersByUsername", allEntries = true)}) public CommandProcessingResult deleteUser(final Long userId) { final AppUser user = this.appUserRepository.findOne(userId); diff --git a/mifosng-provider/src/main/resources/META-INF/spring/ehcache.xml b/mifosng-provider/src/main/resources/META-INF/spring/ehcache.xml index 5b02dcb18..7a63ad5c8 100644 --- a/mifosng-provider/src/main/resources/META-INF/spring/ehcache.xml +++ b/mifosng-provider/src/main/resources/META-INF/spring/ehcache.xml @@ -6,6 +6,9 @@ xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"> + + Date: Fri, 4 Oct 2013 12:03:05 +0100 Subject: [PATCH 3/7] MIFOSX-716: evict user caches when roles and permissions change to stop stale data being returned. --- .../PermissionWritePlatformServiceJpaRepositoryImpl.java | 5 +++++ .../RoleWritePlatformServiceJpaRepositoryImpl.java | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java index 715b8d49a..1cceb518a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java @@ -19,6 +19,8 @@ import org.mifosplatform.useradministration.domain.PermissionRepository; import org.mifosplatform.useradministration.exception.PermissionNotFoundException; import org.mifosplatform.useradministration.serialization.PermissionsCommandFromApiJsonDeserializer; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Caching; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +39,9 @@ public class PermissionWritePlatformServiceJpaRepositoryImpl implements Permissi this.fromApiJsonDeserializer = fromApiJsonDeserializer; } + @Caching(evict = { + @CacheEvict(value = "users", allEntries = true), + @CacheEvict(value = "usersByUsername", allEntries = true)}) @Transactional @Override public CommandProcessingResult updateMakerCheckerPermissions(final JsonCommand command) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java index 26eedce63..aa7c25c32 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java @@ -25,6 +25,8 @@ import org.mifosplatform.useradministration.serialization.PermissionsCommandFrom import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Caching; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -95,6 +97,9 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf logger.error(dve.getMessage(), dve); } + @Caching(evict = { + @CacheEvict(value = "users", allEntries = true), + @CacheEvict(value = "usersByUsername", allEntries = true)}) @Transactional @Override public CommandProcessingResult updateRole(final Long roleId, final JsonCommand command) { @@ -124,6 +129,9 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf } } + @Caching(evict = { + @CacheEvict(value = "users", allEntries = true), + @CacheEvict(value = "usersByUsername", allEntries = true)}) @Transactional @Override public CommandProcessingResult updateRolePermissions(final Long roleId, final JsonCommand command) { From 622a4307ecba8bc3bd3dca03b2aff8e5a3ad7ccf Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Thu, 26 Sep 2013 20:47:39 +0530 Subject: [PATCH 4/7] fix for daily interest calculation --- .../loanaccount/loanschedule/domain/LoanApplicationTerms.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java index 008e70ddc..4dd8cca6c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java @@ -542,7 +542,7 @@ public final class LoanApplicationTerms { switch (this.interestCalculationPeriodMethod) { case DAILY: final BigDecimal dailyInterestRate = this.annualNominalInterestRate.divide(BigDecimal.valueOf(Long.valueOf(365)), mc) - .divide(BigDecimal.valueOf(Double.valueOf("100.0")), mc).multiply(BigDecimal.valueOf(this.repaymentEvery)); + .divide(BigDecimal.valueOf(Double.valueOf("100.0")), mc); final BigDecimal equivalentInterestRateForPeriod = dailyInterestRate .multiply(BigDecimal.valueOf(Long.valueOf(daysInPeriod))); From 61294724050fa9da60b1790303fc8416d61f63c1 Mon Sep 17 00:00:00 2001 From: mifoscontributer Date: Thu, 3 Oct 2013 14:48:10 +0530 Subject: [PATCH 5/7] mifosx-717 fix register/deregister datatable for constraint based approach --- .../core/data/DataValidatorBuilder.java | 21 ++++++++ ...tatableCommandFromApiJsonDeserializer.java | 8 +-- .../ReadWriteNonCoreDataServiceImpl.java | 54 ++++++++++--------- 3 files changed, 53 insertions(+), 30 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/DataValidatorBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/DataValidatorBuilder.java index 4768c1fe3..d8bf38f0e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/DataValidatorBuilder.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/DataValidatorBuilder.java @@ -241,6 +241,27 @@ public class DataValidatorBuilder { return this; } + public DataValidatorBuilder isOneOfTheseStringValues(final Object... values) { + if (this.value == null && this.ignoreNullValue) { return this; } + + final List valuesList = Arrays.asList(values); + final String valuesListStr = StringUtils.join(valuesList, ", "); + + if (this.value == null || !valuesList.contains(this.value.toString().toLowerCase())) { + final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") + .append(this.parameter).append(".is.not.one.of.expected.enumerations"); + final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter) + .append(" must be one of [ ").append(valuesListStr).append(" ] ").append("."); + + final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), + defaultEnglishMessage.toString(), this.parameter, this.value, values); + + this.dataValidationErrors.add(error); + } + + return this; + } + public DataValidatorBuilder isNotOneOfTheseValues(final Object... values) { if (this.value == null && this.ignoreNullValue) { return this; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java index 510222fdd..1d43f2dfc 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java @@ -45,7 +45,7 @@ public class DatatableCommandFromApiJsonDeserializer { private final Set supportedParametersForChangeColumns = new HashSet(Arrays.asList("name", "newName", "length", "mandatory", "after", "code", "newCode")); private final Set supportedParametersForDropColumns = new HashSet(Arrays.asList("name")); - private final Object[] supportedColumnTypes = { "String", "Number", "Decimal", "Date", "Text", "Dropdown" }; + private final Object[] supportedColumnTypes = { "string", "number", "decimal", "date", "text", "dropdown" }; private final Object[] supportedApptableNames = { "m_loan", "m_savings_account", "m_client", "m_group", "m_center", "m_office", "m_savings_product", "m_product_loan" }; @@ -58,9 +58,9 @@ public class DatatableCommandFromApiJsonDeserializer { private void validateType(final DataValidatorBuilder baseDataValidator, final JsonElement column) { final String type = this.fromApiJsonHelper.extractStringNamed("type", column); - baseDataValidator.reset().parameter("type").value(type).notBlank().isOneOfTheseValues(this.supportedColumnTypes); + baseDataValidator.reset().parameter("type").value(type).notBlank().isOneOfTheseStringValues(this.supportedColumnTypes); - if (type != null && type.equals("String")) { + if (type != null && type.equalsIgnoreCase("String")) { if (this.fromApiJsonHelper.parameterExists("length", column)) { final String lengthStr = this.fromApiJsonHelper.extractStringNamed("length", column); if (lengthStr != null && !StringUtils.isWhitespace(lengthStr) && StringUtils.isNumeric(lengthStr) @@ -80,7 +80,7 @@ public class DatatableCommandFromApiJsonDeserializer { } final String code = this.fromApiJsonHelper.extractStringNamed("code", column); - if (type != null && type.equals("Dropdown")) { + if (type != null && type.equalsIgnoreCase("Dropdown")) { if (code != null) { baseDataValidator.reset().parameter("code").value(code).notBlank().matchesRegularExpression(DATATABLE_NAME_REGEX_PATTERN); } else { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java index ff54ad7c3..9e5b41a70 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java @@ -71,12 +71,12 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ private final static HashMap apiTypeToMySQL = new HashMap() { { - put("String", "VARCHAR"); - put("Number", "INT"); - put("Decimal", "DECIMAL"); - put("Date", "DATE"); - put("Text", "TEXT"); - put("Dropdown", "INT"); + put("string", "VARCHAR"); + put("number", "INT"); + put("decimal", "DECIMAL"); + put("date", "DATE"); + put("text", "TEXT"); + put("dropdown", "INT"); } }; @@ -265,15 +265,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final String deleteRegisteredDatatableSql = "delete from x_registered_table where registered_table_name = '" + datatable + "'"; - String[] sqlArray = null; - if (this.configurationDomainService.isConstraintApproachEnabledForDatatables()) { - final String deleteColumnCodeSql = "delete from x_table_cloumn_code_mappings where column_alias_name like'" - + datatable.toLowerCase().replaceAll("\\s", "_") + "%'"; - sqlArray = new String[4]; - sqlArray[3] = deleteColumnCodeSql; - } else { - sqlArray = new String[3]; - } + String[] sqlArray = new String[3]; sqlArray[0] = deleteRolePermissionsSql; sqlArray[1] = deletePermissionsSql; sqlArray[2] = deleteRegisteredDatatableSql; @@ -362,7 +354,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final boolean isConstraintApproach) { String name = (column.has("name")) ? column.get("name").getAsString() : null; - final String type = (column.has("type")) ? column.get("type").getAsString() : null; + final String type = (column.has("type")) ? column.get("type").getAsString().toLowerCase() : null; final Integer length = (column.has("length")) ? column.get("length").getAsInt() : null; final Boolean mandatory = (column.has("mandatory")) ? column.get("mandatory").getAsBoolean() : false; final String code = (column.has("code")) ? column.get("code").getAsString() : null; @@ -381,11 +373,11 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ sqlBuilder = sqlBuilder.append("`" + name + "` " + mysqlType); if (type != null) { - if (type.equals("String")) { + if (type.equalsIgnoreCase("String")) { sqlBuilder = sqlBuilder.append("(" + length + ")"); - } else if (type.equals("Decimal")) { + } else if (type.equalsIgnoreCase("Decimal")) { sqlBuilder = sqlBuilder.append("(19,6)"); - } else if (type.equals("Dropdown")) { + } else if (type.equalsIgnoreCase("Dropdown")) { sqlBuilder = sqlBuilder.append("(11)"); } } @@ -526,14 +518,14 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ } else { if (code != null) { removeMappings.add(dataTableNameAlias + "_" + name); - if (newCode == null) { + if (newCode == null || !StringUtils.equalsIgnoreCase(name, newName)) { constrainBuilder.append(", DROP FOREIGN KEY `fk_").append(dataTableNameAlias).append("_").append(name) .append("` "); } } if (newCode != null) { codeMappings.put(dataTableNameAlias + "_" + newName, this.codeReadPlatformService.retriveCode(newCode).getCodeId()); - if (code == null) { + if (code == null || !StringUtils.equalsIgnoreCase(name, newName)) { constrainBuilder.append(",ADD CONSTRAINT `fk_").append(dataTableNameAlias).append("_").append(newName) .append("` ").append("FOREIGN KEY (`" + newName + "`) ").append("REFERENCES `") .append(CODE_VALUES_TABLE).append("` (`id`)"); @@ -596,7 +588,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final StringBuilder constrainBuilder, final Map codeMappings, final boolean isConstraintApproach) { String name = (column.has("name")) ? column.get("name").getAsString() : null; - final String type = (column.has("type")) ? column.get("type").getAsString() : null; + final String type = (column.has("type")) ? column.get("type").getAsString().toLowerCase() : null; final Integer length = (column.has("length")) ? column.get("length").getAsInt() : null; final Boolean mandatory = (column.has("mandatory")) ? column.get("mandatory").getAsBoolean() : false; final String after = (column.has("after")) ? column.get("after").getAsString() : null; @@ -616,11 +608,11 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ sqlBuilder = sqlBuilder.append(", ADD `" + name + "` " + mysqlType); if (type != null) { - if (type.equals("String") && length != null) { + if (type.equalsIgnoreCase("String") && length != null) { sqlBuilder = sqlBuilder.append("(" + length + ")"); - } else if (type.equals("Decimal")) { + } else if (type.equalsIgnoreCase("Decimal")) { sqlBuilder = sqlBuilder.append("(19,6)"); - } else if (type.equals("Dropdown")) { + } else if (type.equalsIgnoreCase("Dropdown")) { sqlBuilder = sqlBuilder.append("(11)"); } } @@ -828,8 +820,18 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ if (!isRegisteredDataTable(datatableName)) { throw new DatatableNotFoundException(datatableName); } validateDatatableName(datatableName); deregisterDatatable(datatableName); + String[] sqlArray = null; + if (this.configurationDomainService.isConstraintApproachEnabledForDatatables()) { + final String deleteColumnCodeSql = "delete from x_table_cloumn_code_mappings where column_alias_name like'" + + datatableName.toLowerCase().replaceAll("\\s", "_") + "_%'"; + sqlArray = new String[2]; + sqlArray[1] = deleteColumnCodeSql; + }else{ + sqlArray = new String[1]; + } final String sql = "DROP TABLE `" + datatableName + "`"; - this.jdbcTemplate.execute(sql); + sqlArray[0] = sql; + this.jdbcTemplate.batchUpdate(sqlArray); } catch (final SQLGrammarException e) { final Throwable realCause = e.getCause(); final List dataValidationErrors = new ArrayList(); From d9fca64f415fd05b8393b729f130cd1b7e18a28b Mon Sep 17 00:00:00 2001 From: ashok-conflux Date: Mon, 23 Sep 2013 13:09:43 +0530 Subject: [PATCH 6/7] Added missing Braces for create holidays in API doc --- api-docs/apiLive.htm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index d52b2fefc..74b3be20c 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -9158,8 +9158,8 @@ Request Body: "toDate": "25 October 2013", "repaymentsRescheduledTo": "26 October 2013", "offices": [ - "officeId":"1", - "officeId":"2" + {"officeId":"1"}, + {"officeId":"2"} ] } From 73adbcf99f755daf1ea8326aaf39581ae88f77c3 Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Sat, 5 Oct 2013 04:50:19 +0530 Subject: [PATCH 7/7] Update CHANGELOG.md for 1.10.3.RELEASE --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 034f12284..c1af47ad0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ See VERSIONING (https://github.com/openMF/mifosx/blob/master/VERSIONING.md) for Releases =============== +1. 4 Oct 2013 - 1.10.3.RELEASE 1. 22 Sep 2013 - 1.10.2.RELEASE 1. 20 Sep 2013 - 1.10.1.RELEASE 1. 19 Sep 2013 - 1.10.0.RELEASE @@ -39,6 +40,23 @@ Releases 1. 05 April 2013 - 0.11.1.beta 1. 05 April 2013 - 0.11.0.beta +1.10.3.RELEASE +============= +Bug Release + +Platform & API + +Bug + - [MIFOSX-679] - Not able to Create holiday through API + - [MIFOSX-694] - Unable to view users when caching is enabled + - [MIFOSX-696] - Declining balance - Equal principal payments(Daily) is not working as expected. + - [MIFOSX-716] - When updating details related to roles (name, permissions) - the incorrect cached details are returned for cached users + - [MIFOSX-717] - Register/Deregister data tables not working with constraint based approach + +Reference App + - [MIFOSX-698] - Unable to save the created permissions for created Role + + 1.10.2.RELEASE ============= Bug Release