MIFOSX-124: get shell of accounting ready for development.

This commit is contained in:
Keith Woodlock
2012-11-06 17:31:36 +00:00
parent b185bc5f5b
commit 89b2a15e4c
68 changed files with 781 additions and 164 deletions
@@ -0,0 +1,17 @@
DROP TABLE if exists `m_acc_coa`;
CREATE TABLE `m_acc_coa` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`parent_id` bigint(20) DEFAULT NULL,
`gl_code` varchar(45) NOT NULL,
`is_disabled` tinyint(1) NOT NULL DEFAULT '0',
`manual_entries_allowed` tinyint(1) NOT NULL DEFAULT '0',
`category` varchar(45) NOT NULL,
`ledger_type` varchar(45) NOT NULL,
`description` varchar(500) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `acc_gl_code` (`gl_code`),
KEY `FK_ACC_0000000001` (`parent_id`),
CONSTRAINT `FK_ACC_0000000001` FOREIGN KEY (`parent_id`) REFERENCES `m_acc_coa` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
@@ -0,0 +1,69 @@
package org.mifosng.platform.accounting.api;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.accounting.api.commands.ChartOfAccountCommand;
import org.mifosng.platform.accounting.api.data.ChartOfAccountsData;
import org.mifosng.platform.accounting.api.infrastructure.AccountingApiDataConversionService;
import org.mifosng.platform.accounting.service.ChartOfAccountsReadPlatformService;
import org.mifosng.platform.accounting.service.ChartOfAccountsWritePlatformService;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/coa")
@Component
@Scope("singleton")
public class ChartOfAccountsApiResource {
@Autowired
private ChartOfAccountsReadPlatformService coaReadPlatformService;
@Autowired
private ChartOfAccountsWritePlatformService coaWritePlatformService;
@Autowired
private AccountingApiDataConversionService apiDataConversionService;
@Autowired
private PortfolioApiJsonSerializerService apiJsonSerializerService;
// private final static Logger logger = LoggerFactory.getLogger(ChartOfAccountsApiResource.class);
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveExistingChartOfAccounts(@Context final UriInfo uriInfo) {
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
final ChartOfAccountsData chartOfAccounts = this.coaReadPlatformService.retrieveChartOfAccounts();
return this.apiJsonSerializerService.serializeChartOfAccountDataToJson(prettyPrint, responseParameters, chartOfAccounts);
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String createChartOfAccounts(final String jsonRequestBody) {
final ChartOfAccountCommand command = this.apiDataConversionService.convertJsonToChartOfAccountCommand(null, jsonRequestBody);
final Long coaId = coaWritePlatformService.createAccount(command);
return this.apiJsonSerializerService.serializeEntityIdentifier(new EntityIdentifier(coaId));
}
}
@@ -0,0 +1,78 @@
package org.mifosng.platform.accounting.api.commands;
import java.util.Set;
/**
* Immutable command for adding an account to chart of accounts.
*/
public class ChartOfAccountCommand {
private final Long id;
private final String name;
private final Long parentId;
private final String glCode;
private final Boolean disabled;
private final Boolean manualEntriesAllowed;
private final String category;
private final String ledgerType;
private final String description;
private final Set<String> requestParameters;
public ChartOfAccountCommand(final Set<String> modifiedParameters,
final Long id, final String name,
final Long parentId, final String glCode, final Boolean disabled,
final Boolean manualEntriesAllowed, final String category,
final String ledgerType, final String description) {
this.requestParameters = modifiedParameters;
this.id = id;
this.name = name;
this.parentId = parentId;
this.glCode = glCode;
this.disabled = disabled;
this.manualEntriesAllowed = manualEntriesAllowed;
this.category = category;
this.ledgerType = ledgerType;
this.description = description;
}
public boolean isNamePassedOnRequest() {
return this.requestParameters.contains("name");
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public Long getParentId() {
return parentId;
}
public String getGlCode() {
return glCode;
}
public Boolean getDisabled() {
return disabled;
}
public Boolean getManualEntriesAllowed() {
return manualEntriesAllowed;
}
public String getCategory() {
return category;
}
public String getLedgerType() {
return ledgerType;
}
public String getDescription() {
return description;
}
}
@@ -0,0 +1,24 @@
package org.mifosng.platform.accounting.api.data;
import java.util.Collection;
/**
* Immutable object representing chart of accounts data.
*
* Note: no getter/setters required as google-gson will produce json from fields of object.
*/
public class ChartOfAccountsData {
@SuppressWarnings("unused")
private final Long id;
@SuppressWarnings("unused")
private final String name;
@SuppressWarnings("unused")
private final Collection<GeneralLedgerAccountData> accounts;
public ChartOfAccountsData(final Long id, final String name, final Collection<GeneralLedgerAccountData> accounts) {
this.id = id;
this.name = name;
this.accounts = accounts;
}
}
@@ -0,0 +1,43 @@
package org.mifosng.platform.accounting.api.data;
/**
* Immutable object representing a general ledger accounts data as required by chart of accounts.
*
* Note: no getter/setters required as google-gson will produce json from fields of object.
*/
public class GeneralLedgerAccountData {
@SuppressWarnings("unused")
private final Long id;
@SuppressWarnings("unused")
private final String name;
@SuppressWarnings("unused")
private final Long parentId;
@SuppressWarnings("unused")
private final String glCode;
@SuppressWarnings("unused")
private final boolean disabled;
@SuppressWarnings("unused")
private final boolean manualEntriesAllowed;
@SuppressWarnings("unused")
private final String category;
@SuppressWarnings("unused")
private final String ledgerType;
@SuppressWarnings("unused")
private final String description;
public GeneralLedgerAccountData(final Long id, final String name,
final Long parentId, final String glCode, final boolean disabled,
final boolean manualEntriesAllowed, final String category,
final String ledgerType, final String description) {
this.id = id;
this.name = name;
this.parentId = parentId;
this.glCode = glCode;
this.disabled = disabled;
this.manualEntriesAllowed = manualEntriesAllowed;
this.category = category;
this.ledgerType = ledgerType;
this.description = description;
}
}
@@ -0,0 +1,9 @@
package org.mifosng.platform.accounting.api.infrastructure;
import org.mifosng.platform.accounting.api.commands.ChartOfAccountCommand;
public interface AccountingApiDataConversionService {
ChartOfAccountCommand convertJsonToChartOfAccountCommand(Long resourceIdentifier, String json);
}
@@ -0,0 +1,11 @@
package org.mifosng.platform.accounting.api.infrastructure;
import java.util.Set;
import org.mifosng.platform.accounting.api.data.ChartOfAccountsData;
public interface AccountingApiJsonSerializerService {
String serializeChartOfAccountDataToJson(boolean prettyPrint, Set<String> responseParameters, ChartOfAccountsData chartOfAccounts);
}
@@ -0,0 +1,80 @@
package org.mifosng.platform.accounting.api.infrastructure.impl;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.mifosng.platform.accounting.api.commands.ChartOfAccountCommand;
import org.mifosng.platform.accounting.api.infrastructure.AccountingApiDataConversionService;
import org.mifosng.platform.infrastructure.api.JsonParserHelper;
import org.mifosng.platform.infrastructure.errorhandling.InvalidJsonException;
import org.mifosng.platform.infrastructure.errorhandling.UnsupportedParameterException;
import org.springframework.stereotype.Service;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
/**
* Service specifically for converting JSON requests into command ojects for accounting API.
*/
@Service
public class AccountingApiDataConversionServiceImpl implements AccountingApiDataConversionService {
private final Gson gsonConverter;
public AccountingApiDataConversionServiceImpl() {
gsonConverter = new Gson();
}
private void checkForUnsupportedParameters(Map<String, ?> requestMap, Set<String> supportedParams) {
List<String> unsupportedParameterList = new ArrayList<String>();
for (String providedParameter : requestMap.keySet()) {
if (!supportedParams.contains(providedParameter)) {
unsupportedParameterList.add(providedParameter);
}
}
if (!unsupportedParameterList.isEmpty()) {
throw new UnsupportedParameterException(unsupportedParameterList);
}
}
@Override
public ChartOfAccountCommand convertJsonToChartOfAccountCommand(final Long resourceIdentifier, final String json) {
if (StringUtils.isBlank(json)) {
throw new InvalidJsonException();
}
final Type typeOfMap = new TypeToken<Map<String, Object>>(){}.getType();
final Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
final Set<String> supportedParams = new HashSet<String>(
Arrays.asList("id", "name", "parentId", "glCode", "disabled", "manualEntriesAllowed", "category", "ledgerType", "description", "locale", "dateFormat")
);
checkForUnsupportedParameters(requestMap, supportedParams);
final JsonParser parser = new JsonParser();
final JsonElement element = parser.parse(json);
final JsonParserHelper helper = new JsonParserHelper();
final Set<String> requestParamatersDetected = new HashSet<String>();
final String name = helper.extractStringNamed("name", element, requestParamatersDetected);
final Long parentId = helper.extractLongNamed("parentId", element, requestParamatersDetected);
final String glCode = helper.extractStringNamed("glCode", element, requestParamatersDetected);
final Boolean disabled = helper.extractBooleanNamed("disabled", element, requestParamatersDetected);
final Boolean manualEntriesAllowed = helper.extractBooleanNamed("manualEntriesAllowed", element, requestParamatersDetected);
final String category = helper.extractStringNamed("category", element, requestParamatersDetected);
final String ledgerType = helper.extractStringNamed("ledgerType", element, requestParamatersDetected);
final String description = helper.extractStringNamed("description", element, requestParamatersDetected);
return new ChartOfAccountCommand(requestParamatersDetected, resourceIdentifier, name, parentId, glCode, disabled, manualEntriesAllowed, category, ledgerType, description);
}
}
@@ -0,0 +1,43 @@
package org.mifosng.platform.accounting.api.infrastructure.impl;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.mifosng.platform.accounting.api.data.ChartOfAccountsData;
import org.mifosng.platform.accounting.api.infrastructure.AccountingApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.infrastructure.api.GoogleGsonSerializerHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.Gson;
/**
* Implementation of {@link PortfolioApiJsonSerializerService} that uses google-gson to
* serialize Java object representation into JSON.
*/
@Service
public class GoogleGsonAccountingApiJsonSerializerService implements AccountingApiJsonSerializerService {
private static final Set<String> CHART_OF_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name"));
private final GoogleGsonSerializerHelper helper;
@Autowired
public GoogleGsonAccountingApiJsonSerializerService(
final GoogleGsonSerializerHelper helper) {
this.helper = helper;
}
@Override
public String serializeChartOfAccountDataToJson(final boolean prettyPrint,
final Set<String> responseParameters,
final ChartOfAccountsData chartOfAccounts) {
final Gson gsonDeserializer = helper
.createGsonBuilderWithParameterExclusionSerializationStrategy(
CHART_OF_ACCOUNTS_DATA_PARAMETERS, prettyPrint,
responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, chartOfAccounts);
}
}
@@ -0,0 +1,92 @@
package org.mifosng.platform.accounting.domain;
import java.util.LinkedList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.jpa.domain.AbstractPersistable;
@Entity
@Table(name = "m_acc_coa", uniqueConstraints={@UniqueConstraint(columnNames = {"gl_code"}, name="acc_gl_code")})
public class ChartOfAccounts extends AbstractPersistable<Long> {
@OneToMany(fetch = FetchType.EAGER)
@JoinColumn(name = "parent_id")
private final List<ChartOfAccounts> children = new LinkedList<ChartOfAccounts>();
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_id")
private ChartOfAccounts parent;
@SuppressWarnings("unused")
@Column(name = "name", nullable = false, length=45)
private String name;
@SuppressWarnings("unused")
@Column(name = "gl_code", nullable = false, length=100)
private String glCode;
@SuppressWarnings("unused")
@Column(name = "is_disabled", nullable=false)
private boolean disabed = false;
@SuppressWarnings("unused")
@Column(name = "manual_entries_allowed", nullable=false)
private boolean manualEntriesAllowed = true;
@SuppressWarnings("unused")
@Column(name = "category", nullable = false, length=45)
private String category;
@SuppressWarnings("unused")
@Column(name = "ledger_type", nullable = false, length=45)
private String ledgerType;
@SuppressWarnings("unused")
@Column(name = "description", nullable = false, length=500)
private String description;
public static ChartOfAccounts rootAccount(final String name) {
return new ChartOfAccounts(null, name);
}
public static ChartOfAccounts createNew(final ChartOfAccounts parent, final String name) {
return new ChartOfAccounts(parent, name);
}
protected ChartOfAccounts() {
//
}
private ChartOfAccounts(final ChartOfAccounts parent, final String name) {
this.parent = parent;
if (parent != null) {
this.parent.addChild(this);
}
if (StringUtils.isNotBlank(name)) {
this.name = name.trim();
} else {
this.name = null;
}
this.glCode = "TEST-1";
this.disabed = false;
this.manualEntriesAllowed = true;
this.category = "ASSETS";
this.ledgerType = "HEADER";
this.description = "Some description value..";
}
private void addChild(final ChartOfAccounts coa) {
this.children.add(coa);
}
}
@@ -0,0 +1,10 @@
package org.mifosng.platform.accounting.domain;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface ChartOfAccountsRepository extends
JpaRepository<ChartOfAccounts, Long>,
JpaSpecificationExecutor<ChartOfAccounts> {
// no added behaviour
}
@@ -0,0 +1,9 @@
package org.mifosng.platform.accounting.service;
import org.mifosng.platform.accounting.api.data.ChartOfAccountsData;
public interface ChartOfAccountsReadPlatformService {
ChartOfAccountsData retrieveChartOfAccounts();
}
@@ -0,0 +1,9 @@
package org.mifosng.platform.accounting.service;
import org.mifosng.platform.accounting.api.commands.ChartOfAccountCommand;
public interface ChartOfAccountsWritePlatformService {
Long createAccount(ChartOfAccountCommand command);
}
@@ -0,0 +1,53 @@
package org.mifosng.platform.accounting.service.impl;
import java.util.Arrays;
import java.util.Collection;
import org.mifosng.platform.accounting.api.data.ChartOfAccountsData;
import org.mifosng.platform.accounting.api.data.GeneralLedgerAccountData;
import org.mifosng.platform.accounting.service.ChartOfAccountsReadPlatformService;
import org.mifosng.platform.infrastructure.TenantAwareRoutingDataSource;
import org.mifosng.platform.security.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@Service
public class ChartOfAccountsReadPlatformServiceImpl implements ChartOfAccountsReadPlatformService {
@SuppressWarnings("unused")
private final JdbcTemplate jdbcTemplate;
@SuppressWarnings("unused")
private final PlatformSecurityContext context;
@Autowired
public ChartOfAccountsReadPlatformServiceImpl(
final PlatformSecurityContext context,
final TenantAwareRoutingDataSource dataSource) {
this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Override
public ChartOfAccountsData retrieveChartOfAccounts() {
// FIXME - KW - just stubbing impl for now.
boolean isLedgerAccountDisabled = false;
boolean isManualEntriesAllowed = true;
final String assetsGlCode = "1";
final String category = "ASSETS";
final Long parentId = null;
final String generalLedgerName = "Assets";
final String ledgerType = "HEADER";
final String description = "Some descriptoin of the general ledger accounts purpose.";
GeneralLedgerAccountData assetsHeader = new GeneralLedgerAccountData(Long.valueOf(1), generalLedgerName, parentId, assetsGlCode, isLedgerAccountDisabled, isManualEntriesAllowed, category, ledgerType, description);
GeneralLedgerAccountData liabilitiesHeader = new GeneralLedgerAccountData(Long.valueOf(1), "Liabilities", parentId, "2", isLedgerAccountDisabled, isManualEntriesAllowed, "LIABILITIES", ledgerType, description);
Collection<GeneralLedgerAccountData> accounts = Arrays.asList(assetsHeader, liabilitiesHeader);
return new ChartOfAccountsData(Long.valueOf(1), "Default Chart of Accounts", accounts);
}
}
@@ -0,0 +1,40 @@
package org.mifosng.platform.accounting.service.impl;
import org.mifosng.platform.accounting.api.commands.ChartOfAccountCommand;
import org.mifosng.platform.accounting.domain.ChartOfAccounts;
import org.mifosng.platform.accounting.domain.ChartOfAccountsRepository;
import org.mifosng.platform.accounting.service.ChartOfAccountsWritePlatformService;
import org.mifosng.platform.security.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class ChartOfAccountsWritePlatformServiceJpaRepositoryImpl implements ChartOfAccountsWritePlatformService {
// private final static Logger logger = LoggerFactory.getLogger(ChartOfAccountsWritePlatformServiceJpaRepositoryImpl.class);
private final PlatformSecurityContext context;
private final ChartOfAccountsRepository chartOfAccountsRepository;
@Autowired
public ChartOfAccountsWritePlatformServiceJpaRepositoryImpl(
final PlatformSecurityContext context,
final ChartOfAccountsRepository chartOfAccountsRepository) {
this.context = context;
this.chartOfAccountsRepository = chartOfAccountsRepository;
}
@Transactional
@Override
public Long createAccount(final ChartOfAccountCommand command) {
context.authenticatedUser();
final ChartOfAccounts entity = ChartOfAccounts.createNew(null, command.getName());
this.chartOfAccountsRepository.save(entity);
return entity.getId();
}
}
@@ -27,10 +27,10 @@ import org.mifosng.platform.api.data.AdditionalFieldsSetData;
import org.mifosng.platform.api.data.ApiParameterError; import org.mifosng.platform.api.data.ApiParameterError;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.GenericResultsetData; import org.mifosng.platform.api.data.GenericResultsetData;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.exceptions.NoAuthorizationException; import org.mifosng.platform.exceptions.NoAuthorizationException;
import org.mifosng.platform.exceptions.PlatformApiDataValidationException; import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.noncore.AdditionalFieldsService; import org.mifosng.platform.noncore.AdditionalFieldsService;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosng.platform.user.domain.AppUser; import org.mifosng.platform.user.domain.AppUser;
@@ -59,7 +59,7 @@ public class AdditionalFieldsApiResource {
private AdditionalFieldsService readWriteAdditionalFieldsService; private AdditionalFieldsService readWriteAdditionalFieldsService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -11,7 +11,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.mifosng.platform.api.data.AuthenticatedUserData; import org.mifosng.platform.api.data.AuthenticatedUserData;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.user.domain.AppUser; import org.mifosng.platform.user.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
@@ -34,7 +34,7 @@ public class AuthenticationApiResource {
private DaoAuthenticationProvider customAuthenticationProvider; private DaoAuthenticationProvider customAuthenticationProvider;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@POST @POST
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -19,11 +19,11 @@ import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.ChargeCommand; import org.mifosng.platform.api.commands.ChargeCommand;
import org.mifosng.platform.api.data.ChargeData; import org.mifosng.platform.api.data.ChargeData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.charge.service.ChargeReadPlatformService; import org.mifosng.platform.charge.service.ChargeReadPlatformService;
import org.mifosng.platform.charge.service.ChargeWritePlatformService; import org.mifosng.platform.charge.service.ChargeWritePlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -40,10 +40,10 @@ public class ChargesApiResource {
private ChargeWritePlatformService chargeWritePlatformService; private ChargeWritePlatformService chargeWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -22,12 +22,12 @@ import org.mifosng.platform.api.commands.ClientIdentifierCommand;
import org.mifosng.platform.api.data.ClientData; import org.mifosng.platform.api.data.ClientData;
import org.mifosng.platform.api.data.ClientIdentifierData; import org.mifosng.platform.api.data.ClientIdentifierData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.client.service.ClientReadPlatformService; import org.mifosng.platform.client.service.ClientReadPlatformService;
import org.mifosng.platform.client.service.ClientWritePlatformService; import org.mifosng.platform.client.service.ClientWritePlatformService;
import org.mifosng.platform.exceptions.DuplicateClientIdentifierException; import org.mifosng.platform.exceptions.DuplicateClientIdentifierException;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -44,10 +44,10 @@ public class ClientIdentifiersApiResource {
private ClientWritePlatformService clientWritePlatformService; private ClientWritePlatformService clientWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
private static final Set<String> typicalResponseParameters = new HashSet<String>( private static final Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "clientId", "documentTypeId", "description", Arrays.asList("id", "clientId", "documentTypeId", "description",
@@ -30,15 +30,15 @@ import org.mifosng.platform.api.data.ClientData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.NoteData; import org.mifosng.platform.api.data.NoteData;
import org.mifosng.platform.api.data.OfficeLookup; import org.mifosng.platform.api.data.OfficeLookup;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.client.service.ClientReadPlatformService; import org.mifosng.platform.client.service.ClientReadPlatformService;
import org.mifosng.platform.client.service.ClientWritePlatformService; import org.mifosng.platform.client.service.ClientWritePlatformService;
import org.mifosng.platform.common.ApplicationConstants; import org.mifosng.platform.common.ApplicationConstants;
import org.mifosng.platform.common.FileUtils; import org.mifosng.platform.common.FileUtils;
import org.mifosng.platform.exceptions.ClientNotFoundException; import org.mifosng.platform.exceptions.ClientNotFoundException;
import org.mifosng.platform.exceptions.ImageNotFoundException; import org.mifosng.platform.exceptions.ImageNotFoundException;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService; import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -65,13 +65,13 @@ public class ClientsApiResource {
private ClientWritePlatformService clientWritePlatformService; private ClientWritePlatformService clientWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private OfficeReadPlatformService officeReadPlatformService; private OfficeReadPlatformService officeReadPlatformService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
private static final Set<String> typicalResponseParameters = new HashSet<String>( private static final Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "officeId", "officeName", "externalId", "firstname", "lastname", "joinedDate", "displayName", "clientOrBusinessName", "imagePresent") Arrays.asList("id", "officeId", "officeName", "externalId", "firstname", "lastname", "joinedDate", "displayName", "clientOrBusinessName", "imagePresent")
@@ -18,9 +18,9 @@ import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.CodeCommand; import org.mifosng.platform.api.commands.CodeCommand;
import org.mifosng.platform.api.data.CodeData; import org.mifosng.platform.api.data.CodeData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.organisation.service.CodeWritePlatformService; import org.mifosng.platform.organisation.service.CodeWritePlatformService;
import org.mifosng.platform.organisation.service.CodeReadPlatformService; import org.mifosng.platform.organisation.service.CodeReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -39,10 +39,10 @@ public class CodesApiResource {
private CodeWritePlatformService writePlatformService; private CodeWritePlatformService writePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -16,11 +16,11 @@ import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.OrganisationCurrencyCommand; import org.mifosng.platform.api.commands.OrganisationCurrencyCommand;
import org.mifosng.platform.api.data.ConfigurationData; import org.mifosng.platform.api.data.ConfigurationData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.configuration.service.ConfigurationReadPlatformService; import org.mifosng.platform.configuration.service.ConfigurationReadPlatformService;
import org.mifosng.platform.configuration.service.ConfigurationWritePlatformService; import org.mifosng.platform.configuration.service.ConfigurationWritePlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -37,10 +37,10 @@ public class ConfigurationApiResource {
private ConfigurationWritePlatformService configurationWritePlatformService; private ConfigurationWritePlatformService configurationWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Path("currency") @Path("currency")
@@ -26,9 +26,9 @@ import org.codehaus.jettison.json.JSONObject;
import org.mifosng.platform.api.data.DatatableData; import org.mifosng.platform.api.data.DatatableData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.GenericResultsetData; import org.mifosng.platform.api.data.GenericResultsetData;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.exceptions.NoAuthorizationException; import org.mifosng.platform.exceptions.NoAuthorizationException;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.noncore.GenericDataService; import org.mifosng.platform.noncore.GenericDataService;
import org.mifosng.platform.noncore.ReadWriteNonCoreDataService; import org.mifosng.platform.noncore.ReadWriteNonCoreDataService;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
@@ -61,7 +61,7 @@ public class DataTableApiResource {
private ReadWriteNonCoreDataService readWriteNonCoreDataService; private ReadWriteNonCoreDataService readWriteNonCoreDataService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -32,10 +32,10 @@ import org.mifosng.platform.api.data.DepositPermissionData;
import org.mifosng.platform.api.data.DepositProductLookup; import org.mifosng.platform.api.data.DepositProductLookup;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.EnumOptionData; import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.exceptions.UnrecognizedQueryParamException; import org.mifosng.platform.exceptions.UnrecognizedQueryParamException;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
import org.mifosng.platform.saving.service.DepositAccountReadPlatformService; import org.mifosng.platform.saving.service.DepositAccountReadPlatformService;
import org.mifosng.platform.saving.service.DepositAccountWritePlatformService; import org.mifosng.platform.saving.service.DepositAccountWritePlatformService;
@@ -60,10 +60,10 @@ public class DepositAccountsApiResource {
private DepositAccountWritePlatformService depositAccountWritePlatformService; private DepositAccountWritePlatformService depositAccountWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
private static final Set<String> typicalResponseParameters = new HashSet<String>( private static final Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "externalId", "clientId", "clientName", Arrays.asList("id", "externalId", "clientId", "clientName",
@@ -24,10 +24,10 @@ import org.mifosng.platform.api.data.CurrencyData;
import org.mifosng.platform.api.data.DepositProductData; import org.mifosng.platform.api.data.DepositProductData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.EnumOptionData; import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.currency.service.CurrencyReadPlatformService; import org.mifosng.platform.currency.service.CurrencyReadPlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
import org.mifosng.platform.savingproduct.service.DepositProductReadPlatformService; import org.mifosng.platform.savingproduct.service.DepositProductReadPlatformService;
import org.mifosng.platform.savingproduct.service.DepositProductWritePlatformService; import org.mifosng.platform.savingproduct.service.DepositProductWritePlatformService;
@@ -51,10 +51,10 @@ public class DepositProductsApiResource {
private DepositProductWritePlatformService depositProductWritePlatformService; private DepositProductWritePlatformService depositProductWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@POST @POST
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -25,12 +25,12 @@ import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.DocumentCommand; import org.mifosng.platform.api.commands.DocumentCommand;
import org.mifosng.platform.api.data.DocumentData; import org.mifosng.platform.api.data.DocumentData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.common.ApplicationConstants; import org.mifosng.platform.common.ApplicationConstants;
import org.mifosng.platform.common.FileUtils; import org.mifosng.platform.common.FileUtils;
import org.mifosng.platform.documentmanagement.service.DocumentReadPlatformService; import org.mifosng.platform.documentmanagement.service.DocumentReadPlatformService;
import org.mifosng.platform.documentmanagement.service.DocumentWritePlatformService; import org.mifosng.platform.documentmanagement.service.DocumentWritePlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -51,7 +51,7 @@ public class DocumentManagementApiResource {
private DocumentWritePlatformService documentWritePlatformService; private DocumentWritePlatformService documentWritePlatformService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
private static final Set<String> typicalResponseParameters = new HashSet<String>( private static final Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "parentEntityType", "parentEntityId", "name", Arrays.asList("id", "parentEntityType", "parentEntityId", "name",
@@ -18,11 +18,11 @@ import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.FundCommand; import org.mifosng.platform.api.commands.FundCommand;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.FundData; import org.mifosng.platform.api.data.FundData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.fund.service.FundReadPlatformService; import org.mifosng.platform.fund.service.FundReadPlatformService;
import org.mifosng.platform.fund.service.FundWritePlatformService; import org.mifosng.platform.fund.service.FundWritePlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -39,10 +39,10 @@ public class FundsApiResource {
private FundWritePlatformService writePlatformService; private FundWritePlatformService writePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -26,12 +26,12 @@ import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.GroupAccountSummaryCollectionData; import org.mifosng.platform.api.data.GroupAccountSummaryCollectionData;
import org.mifosng.platform.api.data.GroupData; import org.mifosng.platform.api.data.GroupData;
import org.mifosng.platform.api.data.OfficeLookup; import org.mifosng.platform.api.data.OfficeLookup;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.client.service.ClientReadPlatformService; import org.mifosng.platform.client.service.ClientReadPlatformService;
import org.mifosng.platform.group.service.GroupReadPlatformService; import org.mifosng.platform.group.service.GroupReadPlatformService;
import org.mifosng.platform.group.service.GroupWritePlatformService; import org.mifosng.platform.group.service.GroupWritePlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService; import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -57,13 +57,13 @@ public class GroupsApiResource {
private ClientReadPlatformService clientReadPlatformService; private ClientReadPlatformService clientReadPlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private OfficeReadPlatformService officeReadPlatformService; private OfficeReadPlatformService officeReadPlatformService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@Autowired @Autowired
private PlatformSecurityContext context; private PlatformSecurityContext context;
@@ -23,12 +23,12 @@ import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.api.data.FundData; import org.mifosng.platform.api.data.FundData;
import org.mifosng.platform.api.data.LoanProductData; import org.mifosng.platform.api.data.LoanProductData;
import org.mifosng.platform.api.data.TransactionProcessingStrategyData; import org.mifosng.platform.api.data.TransactionProcessingStrategyData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.charge.service.ChargeReadPlatformService; import org.mifosng.platform.charge.service.ChargeReadPlatformService;
import org.mifosng.platform.currency.service.CurrencyReadPlatformService; import org.mifosng.platform.currency.service.CurrencyReadPlatformService;
import org.mifosng.platform.fund.service.FundReadPlatformService; import org.mifosng.platform.fund.service.FundReadPlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.loanproduct.service.LoanDropdownReadPlatformService; import org.mifosng.platform.loanproduct.service.LoanDropdownReadPlatformService;
import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService; import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService;
import org.mifosng.platform.loanproduct.service.LoanProductWritePlatformService; import org.mifosng.platform.loanproduct.service.LoanProductWritePlatformService;
@@ -51,10 +51,10 @@ public class LoanProductsApiResource {
private ChargeReadPlatformService chargeReadPlatformService; private ChargeReadPlatformService chargeReadPlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@Autowired @Autowired
private CurrencyReadPlatformService currencyReadPlatformService; private CurrencyReadPlatformService currencyReadPlatformService;
@@ -39,14 +39,14 @@ import org.mifosng.platform.api.data.LoanProductData;
import org.mifosng.platform.api.data.LoanTransactionData; import org.mifosng.platform.api.data.LoanTransactionData;
import org.mifosng.platform.api.data.StaffData; import org.mifosng.platform.api.data.StaffData;
import org.mifosng.platform.api.data.TransactionProcessingStrategyData; import org.mifosng.platform.api.data.TransactionProcessingStrategyData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.charge.service.ChargeReadPlatformService; import org.mifosng.platform.charge.service.ChargeReadPlatformService;
import org.mifosng.platform.currency.domain.MonetaryCurrency; import org.mifosng.platform.currency.domain.MonetaryCurrency;
import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.currency.domain.Money;
import org.mifosng.platform.exceptions.UnrecognizedQueryParamException; import org.mifosng.platform.exceptions.UnrecognizedQueryParamException;
import org.mifosng.platform.fund.service.FundReadPlatformService; import org.mifosng.platform.fund.service.FundReadPlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.loan.service.CalculationPlatformService; import org.mifosng.platform.loan.service.CalculationPlatformService;
import org.mifosng.platform.loan.service.LoanReadPlatformService; import org.mifosng.platform.loan.service.LoanReadPlatformService;
import org.mifosng.platform.loan.service.LoanWritePlatformService; import org.mifosng.platform.loan.service.LoanWritePlatformService;
@@ -85,10 +85,10 @@ public class LoansApiResource {
private CalculationPlatformService calculationPlatformService; private CalculationPlatformService calculationPlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@Autowired @Autowired
private StaffReadPlatformService staffReadPlatformService; private StaffReadPlatformService staffReadPlatformService;
@@ -18,9 +18,9 @@ import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.BranchMoneyTransferCommand; import org.mifosng.platform.api.commands.BranchMoneyTransferCommand;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.OfficeTransactionData; import org.mifosng.platform.api.data.OfficeTransactionData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService; import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.mifosng.platform.organisation.service.OfficeWritePlatformService; import org.mifosng.platform.organisation.service.OfficeWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -39,10 +39,10 @@ public class OfficeTransactionsApiResource {
private OfficeReadPlatformService readPlatformService; private OfficeReadPlatformService readPlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -23,9 +23,9 @@ import org.mifosng.platform.api.commands.OfficeCommand;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.OfficeData; import org.mifosng.platform.api.data.OfficeData;
import org.mifosng.platform.api.data.OfficeLookup; import org.mifosng.platform.api.data.OfficeLookup;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService; import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.mifosng.platform.organisation.service.OfficeWritePlatformService; import org.mifosng.platform.organisation.service.OfficeWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -44,10 +44,10 @@ public class OfficesApiResource {
private OfficeWritePlatformService writePlatformService; private OfficeWritePlatformService writePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -12,8 +12,8 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.data.PermissionData; import org.mifosng.platform.api.data.PermissionData;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.user.service.PermissionReadPlatformService; import org.mifosng.platform.user.service.PermissionReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
@@ -28,7 +28,7 @@ public class PermissionsApiResource {
private PermissionReadPlatformService permissionReadPlatformService; private PermissionReadPlatformService permissionReadPlatformService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -17,9 +17,9 @@ import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.data.GenericResultsetData; import org.mifosng.platform.api.data.GenericResultsetData;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.exceptions.NoAuthorizationException; import org.mifosng.platform.exceptions.NoAuthorizationException;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.noncore.ReadReportingService; import org.mifosng.platform.noncore.ReadReportingService;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosng.platform.user.domain.AppUser; import org.mifosng.platform.user.domain.AppUser;
@@ -43,7 +43,7 @@ public class ReportsApiResource {
private ReadReportingService readExtraDataAndReportingService; private ReadReportingService readExtraDataAndReportingService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -22,9 +22,9 @@ import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.PermissionData; import org.mifosng.platform.api.data.PermissionData;
import org.mifosng.platform.api.data.RoleData; import org.mifosng.platform.api.data.RoleData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.user.service.PermissionReadPlatformService; import org.mifosng.platform.user.service.PermissionReadPlatformService;
import org.mifosng.platform.user.service.RoleReadPlatformService; import org.mifosng.platform.user.service.RoleReadPlatformService;
import org.mifosng.platform.user.service.RoleWritePlatformService; import org.mifosng.platform.user.service.RoleWritePlatformService;
@@ -47,10 +47,10 @@ public class RolesApiResource {
private RoleWritePlatformService roleWritePlatformService; private RoleWritePlatformService roleWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON})
@@ -24,10 +24,10 @@ import org.mifosng.platform.api.data.CurrencyData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.EnumOptionData; import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.api.data.SavingProductData; import org.mifosng.platform.api.data.SavingProductData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.currency.service.CurrencyReadPlatformService; import org.mifosng.platform.currency.service.CurrencyReadPlatformService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.savingproduct.domain.SavingFrequencyType; import org.mifosng.platform.savingproduct.domain.SavingFrequencyType;
import org.mifosng.platform.savingproduct.domain.SavingInterestCalculationMethod; import org.mifosng.platform.savingproduct.domain.SavingInterestCalculationMethod;
import org.mifosng.platform.savingproduct.domain.SavingProductType; import org.mifosng.platform.savingproduct.domain.SavingProductType;
@@ -53,10 +53,10 @@ public class SavingProductsApiResource {
private SavingProductWritePlatformService savingProductWritePlatformService; private SavingProductWritePlatformService savingProductWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@Autowired @Autowired
private CurrencyReadPlatformService currencyReadPlatformService; private CurrencyReadPlatformService currencyReadPlatformService;
@@ -21,9 +21,9 @@ import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.SavingAccountCommand; import org.mifosng.platform.api.commands.SavingAccountCommand;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.SavingAccountData; import org.mifosng.platform.api.data.SavingAccountData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.saving.service.SavingAccountReadPlatformService; import org.mifosng.platform.saving.service.SavingAccountReadPlatformService;
import org.mifosng.platform.saving.service.SavingAccountWritePlatformService; import org.mifosng.platform.saving.service.SavingAccountWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -42,10 +42,10 @@ public class SavingsAccountApiResource {
private SavingAccountReadPlatformService savingAccountReadPlatformService; private SavingAccountReadPlatformService savingAccountReadPlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
private static final Set<String> typicalResponseParameters = new HashSet<String>( private static final Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "status", "externalId", "clientId", "clientName", "productId", "productName", "productType", "currencyData", "savingsDepostiAmountPerPeriod", "savingsFrequencyType", Arrays.asList("id", "status", "externalId", "clientId", "clientName", "productId", "productName", "productType", "currencyData", "savingsDepostiAmountPerPeriod", "savingsFrequencyType",
@@ -25,9 +25,9 @@ import org.mifosng.platform.api.data.LoanReassignmentData;
import org.mifosng.platform.api.data.OfficeLookup; import org.mifosng.platform.api.data.OfficeLookup;
import org.mifosng.platform.api.data.StaffAccountSummaryCollectionData; import org.mifosng.platform.api.data.StaffAccountSummaryCollectionData;
import org.mifosng.platform.api.data.StaffData; import org.mifosng.platform.api.data.StaffData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.loan.service.LoanWritePlatformService; import org.mifosng.platform.loan.service.LoanWritePlatformService;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService; import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.mifosng.platform.staff.service.StaffReadPlatformService; import org.mifosng.platform.staff.service.StaffReadPlatformService;
@@ -50,10 +50,10 @@ public class StaffApiResource {
private StaffWritePlatformService writePlatformService; private StaffWritePlatformService writePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@Autowired @Autowired
private OfficeReadPlatformService officeReadPlatformService; private OfficeReadPlatformService officeReadPlatformService;
@@ -24,9 +24,9 @@ import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.data.AppUserData; import org.mifosng.platform.api.data.AppUserData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.OfficeLookup; import org.mifosng.platform.api.data.OfficeLookup;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService; import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosng.platform.user.domain.AppUser; import org.mifosng.platform.user.domain.AppUser;
@@ -51,10 +51,10 @@ public class UsersApiResource {
private AppUserWritePlatformService appUserWritePlatformService; private AppUserWritePlatformService appUserWritePlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private PortfolioApiJsonSerializerService apiJsonSerializerService;
@Autowired @Autowired
private PlatformSecurityContext context; private PlatformSecurityContext context;
@@ -17,7 +17,7 @@ public class OfficeCommand {
private final Set<String> modifiedParameters; private final Set<String> modifiedParameters;
public OfficeCommand(Set<String> modifiedParameters, final Long id, final String officeName, public OfficeCommand(final Set<String> modifiedParameters, final Long id, final String officeName,
final String externalId, final Long parentId, final String externalId, final Long parentId,
final LocalDate openingDate) { final LocalDate openingDate) {
this.modifiedParameters = modifiedParameters; this.modifiedParameters = modifiedParameters;
@@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.mifosng.platform.accounting.api.data.ChartOfAccountsData;
import org.mifosng.platform.api.LoanScheduleData; import org.mifosng.platform.api.LoanScheduleData;
import org.mifosng.platform.api.data.AdditionalFieldsSetData; import org.mifosng.platform.api.data.AdditionalFieldsSetData;
import org.mifosng.platform.api.data.AppUserData; import org.mifosng.platform.api.data.AppUserData;
@@ -37,17 +38,18 @@ import org.mifosng.platform.api.data.RoleData;
import org.mifosng.platform.api.data.SavingAccountData; import org.mifosng.platform.api.data.SavingAccountData;
import org.mifosng.platform.api.data.SavingProductData; import org.mifosng.platform.api.data.SavingProductData;
import org.mifosng.platform.api.data.StaffData; import org.mifosng.platform.api.data.StaffData;
import org.mifosng.platform.infrastructure.api.GoogleGsonSerializerHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.google.gson.Gson; import com.google.gson.Gson;
/** /**
* Implementation of {@link ApiJsonSerializerService} that uses google-gson to * Implementation of {@link PortfolioApiJsonSerializerService} that uses google-gson to
* serialize Java object representation into JSON. * serialize Java object representation into JSON.
*/ */
@Service @Service
public class GoogleGsonApiJsonSerializerService implements ApiJsonSerializerService { public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApiJsonSerializerService {
private static final Set<String> PERMISSION_DATA_PARAMETERS = new HashSet<String>( private static final Set<String> PERMISSION_DATA_PARAMETERS = new HashSet<String>(
Arrays.asList("id", "name", "description", "code")); Arrays.asList("id", "name", "description", "code"));
@@ -213,10 +215,13 @@ public class GoogleGsonApiJsonSerializerService implements ApiJsonSerializerServ
"actualCommencementDate", "maturesOnDate", "projectedInterestAccuredOnMaturity", "actualInterestAccured", "projectedMaturityAmount", "actualMaturityAmount", "preClosureAllowed", "actualCommencementDate", "maturesOnDate", "projectedInterestAccuredOnMaturity", "actualInterestAccured", "projectedMaturityAmount", "actualMaturityAmount", "preClosureAllowed",
"preClosureInterestRate", "withdrawnonDate", "rejectedonDate", "closedonDate", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType")); "preClosureInterestRate", "withdrawnonDate", "rejectedonDate", "closedonDate", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType"));
// accounting
private static final Set<String> CHART_OF_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name"));
private final GoogleGsonSerializerHelper helper; private final GoogleGsonSerializerHelper helper;
@Autowired @Autowired
public GoogleGsonApiJsonSerializerService( public GoogleGsonPortfolioApiJsonSerializerService(
final GoogleGsonSerializerHelper helper) { final GoogleGsonSerializerHelper helper) {
this.helper = helper; this.helper = helper;
} }
@@ -729,7 +734,16 @@ public class GoogleGsonApiJsonSerializerService implements ApiJsonSerializerServ
SAVINGS_ACCOUNTS_DATA_PARAMETERS, prettyPrint, responseParameters); SAVINGS_ACCOUNTS_DATA_PARAMETERS, prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, return helper.serializedJsonFrom(gsonDeserializer,
accounts.toArray(new SavingAccountData[accounts.size()])); accounts.toArray(new SavingAccountData[accounts.size()]));
} }
@Override
public String serializeChartOfAccountDataToJson(
final boolean prettyPrint,
final Set<String> responseParameters,
final ChartOfAccountsData chartOfAccounts) {
final Gson gsonDeserializer = helper
.createGsonBuilderWithParameterExclusionSerializationStrategy(
CHART_OF_ACCOUNTS_DATA_PARAMETERS, prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, chartOfAccounts);
}
} }
@@ -29,7 +29,7 @@ import org.mifosng.platform.api.commands.SavingProductCommand;
import org.mifosng.platform.api.commands.StaffCommand; import org.mifosng.platform.api.commands.StaffCommand;
import org.mifosng.platform.api.commands.UserCommand; import org.mifosng.platform.api.commands.UserCommand;
public interface ApiDataConversionService { public interface PortfolioApiDataConversionService {
ChargeCommand convertJsonToChargeCommand(Long resourceIdentifier, String json); ChargeCommand convertJsonToChargeCommand(Long resourceIdentifier, String json);
@@ -41,7 +41,7 @@ public interface ApiDataConversionService {
UserCommand convertJsonToUserCommand(Long resourceIdentifier, String json); UserCommand convertJsonToUserCommand(Long resourceIdentifier, String json);
BranchMoneyTransferCommand convertJsonToBranchMoneyTransferCommand(String jsonRequestBody); BranchMoneyTransferCommand convertJsonToBranchMoneyTransferCommand(String json);
LoanProductCommand convertJsonToLoanProductCommand(Long resourceIdentifier, String json); LoanProductCommand convertJsonToLoanProductCommand(Long resourceIdentifier, String json);
@@ -49,43 +49,42 @@ public interface ApiDataConversionService {
DepositProductCommand convertJsonToDepositProductCommand(Long resourceIdentifier, String json); DepositProductCommand convertJsonToDepositProductCommand(Long resourceIdentifier, String json);
ClientCommand convertJsonToClientCommand(Long resourceIdentifier, String jsonRequestBody); ClientCommand convertJsonToClientCommand(Long resourceIdentifier, String json);
GroupCommand convertJsonToGroupCommand(Long resourceIdentifier, String jsonRequestBody); GroupCommand convertJsonToGroupCommand(Long resourceIdentifier, String json);
LoanApplicationCommand convertJsonToLoanApplicationCommand(Long resourceIdentifier, String jsonRequestBody); LoanApplicationCommand convertJsonToLoanApplicationCommand(Long resourceIdentifier, String json);
LoanChargeCommand convertJsonToLoanChargeCommand(Long loanChargeId, Long loanId, String jsonRequestBody); LoanChargeCommand convertJsonToLoanChargeCommand(Long loanChargeId, Long loanId, String json);
LoanStateTransitionCommand convertJsonToLoanStateTransitionCommand(Long resourceIdentifier, String jsonRequestBody); LoanStateTransitionCommand convertJsonToLoanStateTransitionCommand(Long resourceIdentifier, String json);
LoanTransactionCommand convertJsonToLoanTransactionCommand(Long resourceIdentifier, String jsonRequestBody); LoanTransactionCommand convertJsonToLoanTransactionCommand(Long resourceIdentifier, String json);
AdjustLoanTransactionCommand convertJsonToAdjustLoanTransactionCommand( AdjustLoanTransactionCommand convertJsonToAdjustLoanTransactionCommand(
Long loanId, Long transactionId, String jsonRequestBody); Long loanId, Long transactionId, String json);
OrganisationCurrencyCommand convertJsonToOrganisationCurrencyCommand(String jsonRequestBody); OrganisationCurrencyCommand convertJsonToOrganisationCurrencyCommand(String json);
NoteCommand convertJsonToNoteCommand(Long resourceIdentifier, Long clientId, String jsonRequestBody); NoteCommand convertJsonToNoteCommand(Long resourceIdentifier, Long clientId, String json);
DepositAccountCommand convertJsonToDepositAccountCommand(Long resourceIdentifier, String jsonRequestBody); DepositAccountCommand convertJsonToDepositAccountCommand(Long resourceIdentifier, String json);
DepositStateTransitionCommand convertJsonToDepositStateTransitionCommand(Long resourceIdentifier, String jsonRequestBody); DepositStateTransitionCommand convertJsonToDepositStateTransitionCommand(Long resourceIdentifier, String json);
DepositStateTransitionApprovalCommand convertJsonToDepositStateTransitionApprovalCommand(Long resourceIdentifier, String jsonRequestBody); DepositStateTransitionApprovalCommand convertJsonToDepositStateTransitionApprovalCommand(Long resourceIdentifier, String json);
StaffCommand convertJsonToStaffCommand(Long resourceIdentifier, String json); StaffCommand convertJsonToStaffCommand(Long resourceIdentifier, String json);
BulkLoanReassignmentCommand convertJsonToBulkLoanReassignmentCommand(String jsonRequestBody); BulkLoanReassignmentCommand convertJsonToBulkLoanReassignmentCommand(String json);
DepositAccountWithdrawalCommand convertJsonToDepositWithdrawalCommand(Long resourceIdentifier, String jsonRequestBody); DepositAccountWithdrawalCommand convertJsonToDepositWithdrawalCommand(Long resourceIdentifier, String json);
DepositAccountWithdrawInterestCommand convertJsonToDepositAccountWithdrawInterestCommand(Long resourceIdentifier, String jsonRequestBody); DepositAccountWithdrawInterestCommand convertJsonToDepositAccountWithdrawInterestCommand(Long resourceIdentifier, String json);
ClientIdentifierCommand convertJsonToClientIdentifierCommand(Long resourceIdentifier, Long clientId, String jsonRequestBody); ClientIdentifierCommand convertJsonToClientIdentifierCommand(Long resourceIdentifier, Long clientId, String json);
CodeCommand convertJsonToCodeCommand(Long resourceIdentifier, String json); CodeCommand convertJsonToCodeCommand(Long resourceIdentifier, String json);
SavingAccountCommand convertJsonToSavingAccountCommand(Long resourceIdentifier,String jsonRequestBody); SavingAccountCommand convertJsonToSavingAccountCommand(Long resourceIdentifier,String json);
} }
@@ -46,9 +46,10 @@ import org.mifosng.platform.api.commands.SavingProductCommand;
import org.mifosng.platform.api.commands.StaffCommand; import org.mifosng.platform.api.commands.StaffCommand;
import org.mifosng.platform.api.commands.UserCommand; import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.data.ApiParameterError; import org.mifosng.platform.api.data.ApiParameterError;
import org.mifosng.platform.api.errorhandling.InvalidJsonException;
import org.mifosng.platform.api.errorhandling.UnsupportedParameterException;
import org.mifosng.platform.exceptions.PlatformApiDataValidationException; import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
import org.mifosng.platform.infrastructure.api.JsonParserHelper;
import org.mifosng.platform.infrastructure.errorhandling.InvalidJsonException;
import org.mifosng.platform.infrastructure.errorhandling.UnsupportedParameterException;
import org.springframework.format.number.NumberFormatter; import org.springframework.format.number.NumberFormatter;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -60,11 +61,11 @@ import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@Service @Service
public class ApiDataConversionServiceImpl implements ApiDataConversionService { public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataConversionService {
private final Gson gsonConverter; private final Gson gsonConverter;
public ApiDataConversionServiceImpl() { public PortfolioApiDataConversionServiceImpl() {
gsonConverter = new Gson(); gsonConverter = new Gson();
} }
@@ -1618,7 +1619,5 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
return new SavingAccountCommand(modifiedParameters, resourceIdentifier, clientId, productId, externalId, currencyCode, digitsAfterDecimalValue, return new SavingAccountCommand(modifiedParameters, resourceIdentifier, clientId, productId, externalId, currencyCode, digitsAfterDecimalValue,
savingsDepositAmount, recurringInterestRate,savingInterestRate, tenure, commencementDate, savingProductType, tenureType, frequency, savingsDepositAmount, recurringInterestRate,savingInterestRate, tenure, commencementDate, savingProductType, tenureType, frequency,
interestType, minimumBalanceForWithdrawal, interestCalculationMethod, isLockinPeriodAllowed, isPartialDepositAllowed, lockinPeriod, lockinPeriodType); interestType, minimumBalanceForWithdrawal, interestCalculationMethod, isLockinPeriodAllowed, isPartialDepositAllowed, lockinPeriod, lockinPeriodType);
} }
} }
@@ -3,6 +3,7 @@ package org.mifosng.platform.api.infrastructure;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
import org.mifosng.platform.accounting.api.data.ChartOfAccountsData;
import org.mifosng.platform.api.LoanScheduleData; import org.mifosng.platform.api.LoanScheduleData;
import org.mifosng.platform.api.data.AdditionalFieldsSetData; import org.mifosng.platform.api.data.AdditionalFieldsSetData;
import org.mifosng.platform.api.data.AppUserData; import org.mifosng.platform.api.data.AppUserData;
@@ -36,7 +37,7 @@ import org.mifosng.platform.api.data.SavingAccountData;
import org.mifosng.platform.api.data.SavingProductData; import org.mifosng.platform.api.data.SavingProductData;
import org.mifosng.platform.api.data.StaffData; import org.mifosng.platform.api.data.StaffData;
public interface ApiJsonSerializerService { public interface PortfolioApiJsonSerializerService {
String serializeAuthenticatedUserDataToJson(boolean prettyPrint, AuthenticatedUserData authenticatedUserData); String serializeAuthenticatedUserDataToJson(boolean prettyPrint, AuthenticatedUserData authenticatedUserData);
@@ -138,4 +139,7 @@ public interface ApiJsonSerializerService {
String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<SavingAccountData> accounts); String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<SavingAccountData> accounts);
// TODO - KW - might devide serialize up into portfolio and account to reduce interface
String serializeChartOfAccountDataToJson(boolean prettyPrint, Set<String> responseParameters, ChartOfAccountsData chartOfAccounts);
} }
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.infrastructure.api;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.infrastructure.api;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@@ -6,7 +6,7 @@ import java.util.Set;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosng.platform.api.errorhandling.UnsupportedParameterException; import org.mifosng.platform.infrastructure.errorhandling.UnsupportedParameterException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.google.gson.ExclusionStrategy; import com.google.gson.ExclusionStrategy;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.infrastructure.api;
import java.lang.reflect.Type; import java.lang.reflect.Type;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.infrastructure.api;
import java.lang.reflect.Type; import java.lang.reflect.Type;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.infrastructure.api;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@@ -27,6 +27,20 @@ import com.google.gson.JsonPrimitive;
*/ */
public class JsonParserHelper { public class JsonParserHelper {
public Boolean extractBooleanNamed(final String parameterName, final JsonElement element, final Set<String> requestParamatersDetected) {
Boolean value = null;
if (element.isJsonObject()) {
JsonObject object = element.getAsJsonObject();
if (object.has(parameterName) && object.get(parameterName).isJsonPrimitive()) {
requestParamatersDetected.add(parameterName);
JsonPrimitive primitive = object.get(parameterName).getAsJsonPrimitive();
value = primitive.getAsBoolean();
}
}
return value;
}
public Long extractLongNamed(final String parameterName, public Long extractLongNamed(final String parameterName,
final JsonElement element, final Set<String> modifiedParameters) { final JsonElement element, final Set<String> modifiedParameters) {
Long longValue = null; Long longValue = null;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.infrastructure.api;
import java.util.Set; import java.util.Set;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
/** /**
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import java.util.List; import java.util.List;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.errorhandling; package org.mifosng.platform.infrastructure.errorhandling;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -18,10 +18,10 @@ import org.mifosng.platform.api.data.GenericResultsetData;
import org.mifosng.platform.api.data.ResultsetColumnHeader; import org.mifosng.platform.api.data.ResultsetColumnHeader;
import org.mifosng.platform.api.data.ResultsetColumnValue; import org.mifosng.platform.api.data.ResultsetColumnValue;
import org.mifosng.platform.api.data.ResultsetDataRow; import org.mifosng.platform.api.data.ResultsetDataRow;
import org.mifosng.platform.api.infrastructure.JsonParserHelper;
import org.mifosng.platform.exceptions.DataTableNotFoundException; import org.mifosng.platform.exceptions.DataTableNotFoundException;
import org.mifosng.platform.exceptions.PlatformApiDataValidationException; import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
import org.mifosng.platform.exceptions.PlatformDataIntegrityException; import org.mifosng.platform.exceptions.PlatformDataIntegrityException;
import org.mifosng.platform.infrastructure.api.JsonParserHelper;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosng.platform.user.domain.AppUser; import org.mifosng.platform.user.domain.AppUser;
import org.slf4j.Logger; import org.slf4j.Logger;