Skip to content

Commit

Permalink
Client fees and MIFOSX-2169
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwasbabu committed Sep 4, 2015
1 parent 670b6ee commit 66ce3b4
Show file tree
Hide file tree
Showing 31 changed files with 522 additions and 940 deletions.
502 changes: 72 additions & 430 deletions api-docs/apiLive.htm

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {

private final static Logger logger = LoggerFactory.getLogger(AuditReadPlatformServiceImpl.class);
private final static Set<String> supportedOrderByValues = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
"subresourceId", "madeOnDate", "checkedOnDate", "officeName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo",
"clientId", "loanId"));
private final static Set<String> supportedOrderByValues = new HashSet<>(
Arrays.asList("id", "actionName", "entityName", "resourceId", "subresourceId", "madeOnDate", "checkedOnDate", "officeName",
"groupName", "clientName", "loanAccountNo", "savingsAccountNo", "clientId", "loanId"));

private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context;
Expand Down Expand Up @@ -250,8 +250,7 @@ public Collection<AuditData> retrieveEntries(final String useType, final String

if (isLimitedChecker) {
sql += " join m_permission p on REPLACE(p.action_name, '_CHECKER', '') = aud.action_name and p.entity_name = aud.entity_name and p.code like '%\\_CHECKER'"
+ " join m_role_permission rp on rp.permission_id = p.id"
+ " join m_role r on r.id = rp.role_id "
+ " join m_role_permission rp on rp.permission_id = p.id" + " join m_role r on r.id = rp.role_id "
+ " join m_appuser_role ur on ur.role_id = r.id and ur.appuser_id = " + currentUser.getId();
}
sql += extraCriteria;
Expand Down Expand Up @@ -328,12 +327,12 @@ private AuditData replaceIdsOnAuditData(final AuditData auditResult) {
final SavingsProductData savingProduct = this.savingsProductReadPlatformService.retrieveOne(productId);
commandAsJsonMap.put("productName", savingProduct.getName());
} else if (auditResult.getEntityName().equalsIgnoreCase("RECURRINGDEPOSITACCOUNT")) {
final DepositProductData depositProduct = this.depositProductReadPlatformService.retrieveOne(
DepositAccountType.RECURRING_DEPOSIT, productId);
final DepositProductData depositProduct = this.depositProductReadPlatformService
.retrieveOne(DepositAccountType.RECURRING_DEPOSIT, productId);
commandAsJsonMap.put("productName", depositProduct.getName());
} else if (auditResult.getEntityName().equalsIgnoreCase("FIXEDDEPOSITACCOUNT")) {
final DepositProductData depositProduct = this.depositProductReadPlatformService.retrieveOne(
DepositAccountType.FIXED_DEPOSIT, productId);
final DepositProductData depositProduct = this.depositProductReadPlatformService
.retrieveOne(DepositAccountType.FIXED_DEPOSIT, productId);
commandAsJsonMap.put("productName", depositProduct.getName());
} else {
commandAsJsonMap.put("productName", "");
Expand Down Expand Up @@ -386,11 +385,9 @@ private void updateEnumerations(Map<String, Object> commandAsJsonMap, JsonObject
commandAsJsonMap.remove(typeName);

final Integer enumTypeId = auditObject.get(typeName).getAsInt();
if (enumTypeId != null) {
final String code = LoanEnumerations.loanEnumueration(typeName, enumTypeId).getValue();
if (code != null) {
commandAsJsonMap.put(typeName, code);
}
final String code = LoanEnumerations.loanEnumueration(typeName, enumTypeId).getValue();
if (code != null) {
commandAsJsonMap.put(typeName, code);
}
}
}
Expand All @@ -409,18 +406,17 @@ private void updateEnumerations(Map<String, Object> commandAsJsonMap, JsonObject
commandAsJsonMap.remove(typeName);

final Integer enumTypeId = auditObject.get(typeName).getAsInt();
if (enumTypeId != null) {
final String code = SavingsEnumerations.savingEnumueration(typeName, enumTypeId).getValue();
if (code != null) {
commandAsJsonMap.put(typeName, code);
}
final String code = SavingsEnumerations.savingEnumueration(typeName, enumTypeId).getValue();
if (code != null) {
commandAsJsonMap.put(typeName, code);
}
}
}
}
}

private void replaceStaffIdWithStaffName(final String staffIdStr, final String staffNameParamName, Map<String, Object> commandAsJsonMap) {
private void replaceStaffIdWithStaffName(final String staffIdStr, final String staffNameParamName,
Map<String, Object> commandAsJsonMap) {

Long staffId = null;
if (StringUtils.isNotBlank(staffIdStr)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@
import org.mifosplatform.commands.domain.CommandWrapper;
import org.mifosplatform.commands.service.CommandWrapperBuilder;
import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService;
import org.mifosplatform.infrastructure.configuration.data.ExternalServicesData;
import org.mifosplatform.infrastructure.configuration.data.ExternalServicesPropertiesData;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesPropertiesReadPlatformService;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesReadPlatformService;
import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
Expand All @@ -41,7 +38,6 @@ public class ExternalServicesConfigurationApiResource {

private final PlatformSecurityContext context;
private final ExternalServicesPropertiesReadPlatformService externalServicePropertiesReadPlatformService;
private final ExternalServicesReadPlatformService externalServiceReadPlatformService;
private final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer;
// private final ToApiJsonSerializer<S3CredentialsData>
// s3ToApiJsonSerializer;
Expand All @@ -51,14 +47,12 @@ public class ExternalServicesConfigurationApiResource {
@Autowired
public ExternalServicesConfigurationApiResource(final PlatformSecurityContext context,
final ExternalServicesPropertiesReadPlatformService readPlatformService,
final ExternalServicesReadPlatformService externalServicesReadPlatformService,
final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.externalServicePropertiesReadPlatformService = readPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.externalServiceReadPlatformService = externalServicesReadPlatformService;
// this.s3ToApiJsonSerializer = s3ToApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public boolean isMeetingMandatoryForJLGLoans() {
return property.isEnabled();
}

@Override
public int getRoundingMode() {
final String propertyName = "rounding-mode";
int defaultValue = 6; // 6 Stands for HALF-EVEN
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package org.mifosplatform.infrastructure.configuration.domain;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

import javax.persistence.CascadeType;

/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
Expand All @@ -14,12 +8,9 @@

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.apache.commons.lang.StringUtils;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.springframework.data.jpa.domain.AbstractPersistable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.springframework.data.annotation.Id;

@Embeddable
public class ExternalServicePropertiesPK implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang.StringUtils;
import org.mifosplatform.infrastructure.configuration.data.ExternalServicesPropertiesData;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesConstants.EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesConstants.SMTP_JSON_INPUT_PARAMS;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.springframework.data.annotation.Id;

@Entity
@Table(name = "c_external_service_properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.persistence.Table;

import org.mifosplatform.infrastructure.configuration.exception.GlobalConfigurationPropertyCannotBeModfied;
import org.mifosplatform.infrastructure.configuration.exception.GlobalConfigurationPropertyNotFoundException;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.security.exception.ForcePasswordResetException;
import org.springframework.data.jpa.domain.AbstractPersistable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.mifosplatform.infrastructure.configuration.exception;

import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRuleException;
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;

public class GlobalConfigurationPropertyCannotBeModfied extends AbstractPlatformDomainRuleException{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,23 @@
package org.mifosplatform.infrastructure.configuration.serialization;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang.StringUtils;
import org.mifosplatform.infrastructure.configuration.exception.ExternalServiceConfigurationNotFoundException;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesConstants;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesConstants.EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesConstants.S3_JSON_INPUT_PARAMS;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesConstants.SMTP_JSON_INPUT_PARAMS;
import org.mifosplatform.infrastructure.core.data.ApiParameterError;
import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;

@Component
public class ExternalServicesPropertiesCommandFromApiJsonDeserializer {

private final Set<String> supportedParameters = EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS.getAllValues();
private final Set<String> S3SupportedParameters = S3_JSON_INPUT_PARAMS.getAllValues();
private final Set<String> SMTPSupportedParameters = SMTP_JSON_INPUT_PARAMS.getAllValues();
private final FromJsonHelper fromApiJsonHelper;
Expand All @@ -57,10 +49,6 @@ public void validateForUpdate(final String json, final String externalServiceNam
throw new ExternalServiceConfigurationNotFoundException(externalServiceName);
}

final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("external.service");
final JsonElement element = this.fromApiJsonHelper.parse(json);

}

public Set<String> getNameKeys(final String json) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@Service
public class ExternalServiceWritePlatformServiceJpaRepositoryImpl implements ExternalServiceWritePlatformService {

@SuppressWarnings("unused")
private final static Logger logger = LoggerFactory.getLogger(ExternalServiceWritePlatformServiceJpaRepositoryImpl.class);

private final PlatformSecurityContext context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.util.HashSet;
import java.util.Set;

import org.mifosplatform.infrastructure.codes.CodeConstants.CODEVALUE_JSON_INPUT_PARAMS;

public class ExternalServicesConstants {

public static final String S3_SERVICE_NAME = "S3";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.mifosplatform.infrastructure.configuration.data.SMTPCredentialsData;
import org.mifosplatform.infrastructure.configuration.exception.ExternalServiceConfigurationNotFoundException;
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
import org.mifosplatform.infrastructure.documentmanagement.data.DocumentData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down Expand Up @@ -82,7 +81,7 @@ public SMTPCredentialsData extractData(final ResultSet rs) throws SQLException,
private static final class ExternalServiceMapper implements RowMapper<ExternalServicesPropertiesData> {

@Override
public ExternalServicesPropertiesData mapRow(ResultSet rs, int rowNum) throws SQLException {
public ExternalServicesPropertiesData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
// TODO Auto-generated method stub
final String name = rs.getString("name");
String value = rs.getString("value");
Expand Down Expand Up @@ -114,6 +113,7 @@ public SMTPCredentialsData getSMTPCredentials() {
return smtpCredentialsData;
}

@Override
public Collection<ExternalServicesPropertiesData> retrieveOne(String serviceName) {
String serviceNameToUse = null;
switch (serviceName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
import org.mifosplatform.infrastructure.configuration.data.S3CredentialsData;
import org.mifosplatform.infrastructure.configuration.data.SMTPCredentialsData;
import org.mifosplatform.infrastructure.configuration.service.ExternalServicesPropertiesReadPlatformService;
import org.mifosplatform.infrastructure.core.domain.EmailDetail;
Expand Down
Loading

0 comments on commit 66ce3b4

Please sign in to comment.