diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/AccountingApiDataConversionServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/AccountingApiDataConversionServiceImpl.java index a87d99c88..e969a61be 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/AccountingApiDataConversionServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/AccountingApiDataConversionServiceImpl.java @@ -13,9 +13,9 @@ import org.joda.time.LocalDate; import org.mifosplatform.accounting.api.commands.GLAccountCommand; import org.mifosplatform.accounting.api.commands.GLClosureCommand; import org.mifosplatform.accounting.api.infrastructure.AccountingApiDataConversionService; -import org.mifosplatform.infrastructure.core.api.JsonParserHelper; import org.mifosplatform.infrastructure.core.exception.InvalidJsonException; import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException; +import org.mifosplatform.infrastructure.core.serialization.JsonParserHelper; import org.springframework.stereotype.Service; import com.google.gson.Gson; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/GoogleGsonAccountingApiJsonSerializerService.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/GoogleGsonAccountingApiJsonSerializerService.java index 025dbc077..276f15e3a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/GoogleGsonAccountingApiJsonSerializerService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/api/infrastructure/impl/GoogleGsonAccountingApiJsonSerializerService.java @@ -8,9 +8,9 @@ import java.util.Set; import org.mifosplatform.accounting.api.data.GLAccountData; import org.mifosplatform.accounting.api.data.GLClosureData; import org.mifosplatform.accounting.api.infrastructure.AccountingApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.GoogleGsonSerializerHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.GoogleGsonSerializerHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/handler/CodeCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/handler/CodeCommandHandler.java index 3d9771380..cf8af6d24 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/handler/CodeCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/handler/CodeCommandHandler.java @@ -7,8 +7,8 @@ import org.joda.time.LocalDate; import org.mifosplatform.commands.domain.CommandSource; import org.mifosplatform.commands.service.ChangeDetectionService; import org.mifosplatform.infrastructure.codes.command.CodeCommand; +import org.mifosplatform.infrastructure.codes.serialization.CodeCommandFromCommandJsonDeserializer; import org.mifosplatform.infrastructure.codes.service.CodeWritePlatformService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandDeserializerService; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.client.service.RollbackTransactionAsCommandIsNotApprovedByCheckerException; import org.mifosplatform.useradministration.domain.AppUser; @@ -20,15 +20,15 @@ public class CodeCommandHandler implements CommandSourceHandler { private final PlatformSecurityContext context; private final ChangeDetectionService changeDetectionService; - private final PortfolioCommandDeserializerService commandDeserializerService; + private final CodeCommandFromCommandJsonDeserializer fromCommandJsonDeserializer; private final CodeWritePlatformService writePlatformService; @Autowired public CodeCommandHandler(final PlatformSecurityContext context, final ChangeDetectionService changeDetectionService, - final PortfolioCommandDeserializerService commandDeserializerService, final CodeWritePlatformService writePlatformService) { + final CodeCommandFromCommandJsonDeserializer fromCommandJsonDeserializer, final CodeWritePlatformService writePlatformService) { this.context = context; this.changeDetectionService = changeDetectionService; - this.commandDeserializerService = commandDeserializerService; + this.fromCommandJsonDeserializer = fromCommandJsonDeserializer; this.writePlatformService = writePlatformService; } @@ -39,7 +39,7 @@ public class CodeCommandHandler implements CommandSourceHandler { final LocalDate asToday = new LocalDate(); final Long resourceId = commandSource.resourceId(); - final CodeCommand command = this.commandDeserializerService.deserializeCodeCommand(resourceId, commandSource.json(), false); + final CodeCommand command = this.fromCommandJsonDeserializer.commandFromCommandJson(resourceId, commandSource.json()); CommandSource commandSourceResult = commandSource.copy(); @@ -57,8 +57,7 @@ public class CodeCommandHandler implements CommandSourceHandler { commandSource.resourceId(), commandSource.json()); commandSourceResult.updateJsonTo(jsonOfChangesOnly); - final CodeCommand changesOnly = this.commandDeserializerService - .deserializeCodeCommand(resourceId, jsonOfChangesOnly, false); + final CodeCommand changesOnly = this.fromCommandJsonDeserializer.commandFromCommandJson(resourceId, jsonOfChangesOnly); this.writePlatformService.updateCode(changesOnly); commandSourceResult.markAsChecked(maker, asToday); @@ -83,24 +82,24 @@ public class CodeCommandHandler implements CommandSourceHandler { final AppUser checker = context.authenticatedUser(); Long resourceId = commandSourceResult.resourceId(); - final CodeCommand command = this.commandDeserializerService.deserializeCodeCommand(resourceId, commandSourceResult.json(), true); + final CodeCommand command = this.fromCommandJsonDeserializer.commandFromCommandJson(resourceId, commandSourceResult.json(), true); if (commandSourceResult.isCreate()) { final List allowedPermissions = Arrays.asList("ALL_FUNCTIONS", "CREATE_CODE_MAKER"); - context.authenticatedUser().validateHasPermissionTo("CREATE_USER_MAKER", allowedPermissions); + context.authenticatedUser().validateHasPermissionTo("CREATE_CODE_MAKER", allowedPermissions); resourceId = this.writePlatformService.createCode(command); commandSourceResult.updateResourceId(resourceId); commandSourceResult.markAsChecked(checker, new LocalDate()); } else if (commandSourceResult.isUpdate()) { final List allowedPermissions = Arrays.asList("ALL_FUNCTIONS", "UPDATE_CODE_MAKER"); - context.authenticatedUser().validateHasPermissionTo("UPDATE_USER_MAKER", allowedPermissions); + context.authenticatedUser().validateHasPermissionTo("UPDATE_CODE_MAKER", allowedPermissions); this.writePlatformService.updateCode(command); commandSourceResult.markAsChecked(checker, new LocalDate()); } else if (commandSourceResult.isDelete()) { final List allowedPermissions = Arrays.asList("ALL_FUNCTIONS", "DELETE_CODE_MAKER"); - context.authenticatedUser().validateHasPermissionTo("DELETE_USER_MAKER", allowedPermissions); + context.authenticatedUser().validateHasPermissionTo("DELETE_CODE_MAKER", allowedPermissions); this.writePlatformService.deleteCode(command); commandSourceResult.markAsChecked(checker, new LocalDate()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/ChangeDetectionServiceJdbc.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/ChangeDetectionServiceJdbc.java index e9c650b49..6818f827f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/ChangeDetectionServiceJdbc.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/ChangeDetectionServiceJdbc.java @@ -2,7 +2,7 @@ package org.mifosplatform.commands.service; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.portfolio.client.command.ClientCommand; import org.mifosplatform.portfolio.client.data.ClientData; import org.mifosplatform.portfolio.client.service.ClientReadPlatformService; @@ -15,12 +15,12 @@ public class ChangeDetectionServiceJdbc implements ChangeDetectionService { private final PortfolioApiDataConversionService apiDataConversionService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final ClientReadPlatformService clientReadPlatformService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; @Autowired public ChangeDetectionServiceJdbc( final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final ClientReadPlatformService clientReadPlatformService) { this.apiDataConversionService = apiDataConversionService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java index 556a85395..94e863ac7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java @@ -2,6 +2,7 @@ package org.mifosplatform.infrastructure.codes.api; import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -18,14 +19,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService; -import org.mifosplatform.infrastructure.codes.command.CodeCommand; import org.mifosplatform.infrastructure.codes.data.CodeData; +import org.mifosplatform.infrastructure.codes.serialization.CodeCommandFromApiJsonDeserializer; import org.mifosplatform.infrastructure.codes.service.CodeReadPlatformService; -import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; -import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; -import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; +import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; @@ -36,26 +36,30 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class CodesApiResource { + /** + * The set of parameters that are supported in response for {@link CodeData} + * . + */ + private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "systemDefined")); private final String resourceNameForPermissions = "CODE"; private final PlatformSecurityContext context; private final CodeReadPlatformService readPlatformService; - private final PortfolioApiJsonSerializerService apiJsonSerializerService; - private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CodeCommandFromApiJsonDeserializer fromApiJsonDeserializer; + private final DefaultToApiJsonSerializer toApiJsonSerializer; + private final ApiRequestParameterHelper apiRequestParameterHelper; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired public CodesApiResource(final PlatformSecurityContext context, final CodeReadPlatformService readPlatformService, - final PortfolioApiJsonSerializerService apiJsonSerializerService, - final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CodeCommandFromApiJsonDeserializer fromApiJsonDeserializer, final DefaultToApiJsonSerializer toApiJsonSerializer, + final ApiRequestParameterHelper apiRequestParameterHelper, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; - this.apiJsonSerializerService = apiJsonSerializerService; - this.apiDataConversionService = apiDataConversionService; - this.commandSerializerService = commandSerializerService; + this.fromApiJsonDeserializer = fromApiJsonDeserializer; + this.toApiJsonSerializer = toApiJsonSerializer; + this.apiRequestParameterHelper = apiRequestParameterHelper; this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; } @@ -66,12 +70,10 @@ public class CodesApiResource { context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions); - final Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); - final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); - final Collection codes = this.readPlatformService.retrieveAllCodes(); - return this.apiJsonSerializerService.serializeCodeDataToJson(prettyPrint, responseParameters, codes); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return this.toApiJsonSerializer.serialize(settings, codes, RESPONSE_DATA_PARAMETERS); } @POST @@ -82,13 +84,12 @@ public class CodesApiResource { final List allowedPermissions = Arrays.asList("ALL_FUNCTIONS", "CREATE_CODE"); context.authenticatedUser().validateHasPermissionTo("CREATE_CODE", allowedPermissions); - final CodeCommand command = this.apiDataConversionService.convertApiRequestJsonToCodeCommand(null, apiRequestBodyAsJson); - final String commandSerializedAsJson = this.commandSerializerService.serializeCommandToJson(command); + final String commandSerializedAsJson = this.fromApiJsonDeserializer.serializedCommandJsonFromApiJson(apiRequestBodyAsJson); final EntityIdentifier result = this.commandsSourceWritePlatformService.logCommandSource("CREATE", "codes", null, commandSerializedAsJson); - return this.apiJsonSerializerService.serializeEntityIdentifier(result); + return this.toApiJsonSerializer.serialize(result); } @GET @@ -97,12 +98,10 @@ public class CodesApiResource { @Produces({ MediaType.APPLICATION_JSON }) public String retreiveOffice(@PathParam("codeId") final Long codeId, @Context final UriInfo uriInfo) { - final Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); - final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); - final CodeData code = this.readPlatformService.retrieveCode(codeId); - return this.apiJsonSerializerService.serializeCodeDataToJson(prettyPrint, responseParameters, code); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return this.toApiJsonSerializer.serialize(settings, code, RESPONSE_DATA_PARAMETERS); } @PUT @@ -114,13 +113,12 @@ public class CodesApiResource { final List allowedPermissions = Arrays.asList("ALL_FUNCTIONS", "UPDATE_CODE"); context.authenticatedUser().validateHasPermissionTo("UPDATE_CODE", allowedPermissions); - final CodeCommand command = this.apiDataConversionService.convertApiRequestJsonToCodeCommand(codeId, apiRequestBodyAsJson); - final String commandSerializedAsJson = this.commandSerializerService.serializeCommandToJson(command); + final String commandSerializedAsJson = this.fromApiJsonDeserializer.serializedCommandJsonFromApiJson(codeId, apiRequestBodyAsJson); final EntityIdentifier result = this.commandsSourceWritePlatformService.logCommandSource("UPDATE", "codes", codeId, commandSerializedAsJson); - return this.apiJsonSerializerService.serializeEntityIdentifier(result); + return this.toApiJsonSerializer.serialize(result); } @DELETE @@ -134,6 +132,6 @@ public class CodesApiResource { final EntityIdentifier result = this.commandsSourceWritePlatformService.logCommandSource("DELETE", "codes", codeId, "{}"); - return this.apiJsonSerializerService.serializeEntityIdentifier(result); + return this.toApiJsonSerializer.serialize(result); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/command/CodeCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/command/CodeCommand.java index 95da77808..b78120c2e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/command/CodeCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/command/CodeCommand.java @@ -9,7 +9,9 @@ import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder; import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException; /** - * Immutable command for creating or updating details of a code. + *

Immutable command for creating or updating details of a code.

+ * + *

Transient fields are not intended for serialization.

*/ public class CodeCommand { @@ -26,22 +28,6 @@ public class CodeCommand { this.name = name; } - public String getName() { - return this.name; - } - - public Long getId() { - return this.id; - } - - public boolean isNameChanged() { - return this.parametersPassedInRequest.contains("name"); - } - - public boolean isApprovedByChecker() { - return this.makerCheckerApproval; - } - public void validateForCreate() { List dataValidationErrors = new ArrayList(); @@ -62,4 +48,20 @@ public class CodeCommand { if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors); } } + + public String getName() { + return this.name; + } + + public Long getId() { + return this.id; + } + + public boolean isNameChanged() { + return this.parametersPassedInRequest.contains("name"); + } + + public boolean isApprovedByChecker() { + return this.makerCheckerApproval; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java index f5e151e82..7a95f9664 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java @@ -20,7 +20,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_code", uniqueConstraints = { @UniqueConstraint(columnNames = { "code_name" }, name = "code_name") }) public class Code extends AbstractPersistable { - @SuppressWarnings("unused") @Column(name = "code_name", length = 100) private String name; @@ -45,6 +44,10 @@ public class Code extends AbstractPersistable { this.systemDefined = false; } + public String name() { + return this.name; + } + public boolean isSystemDefined() { return this.systemDefined; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java new file mode 100644 index 000000000..6ca9b9f02 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java @@ -0,0 +1,68 @@ +package org.mifosplatform.infrastructure.codes.serialization; + +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.mifosplatform.infrastructure.codes.command.CodeCommand; +import org.mifosplatform.infrastructure.core.serialization.FromApiJsonDeserializer; +import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.google.gson.reflect.TypeToken; + +/** + * Implementation of {@link FromApiJsonDeserializer} for {@link CodeCommand}'s. + */ +@Component +public final class CodeCommandFromApiJsonDeserializer implements FromApiJsonDeserializer { + + /** + * The parameters supported for this command. + */ + private final Set supportedParameters = new HashSet(Arrays.asList("name")); + + private final FromJsonHelper fromApiJsonHelper; + private final CodeCommandFromCommandJsonDeserializer fromCommandJsonDeserializer; + private final CommandSerializer commandSerializerService; + + @Autowired + public CodeCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper, + final CodeCommandFromCommandJsonDeserializer fromCommandJsonDeserializer, + final CommandSerializer commandSerializerService) { + this.fromApiJsonHelper = fromApiJsonHelper; + this.fromCommandJsonDeserializer = fromCommandJsonDeserializer; + this.commandSerializerService = commandSerializerService; + } + + @Override + public CodeCommand commandFromApiJson(final String json) { + return commandFromApiJson(null, json); + } + + @Override + public CodeCommand commandFromApiJson(final Long codeId, final String json) { + + final Type typeOfMap = new TypeToken>() {}.getType(); + + fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters); + + return this.fromCommandJsonDeserializer.commandFromCommandJson(codeId, json); + } + + @Override + public String serializedCommandJsonFromApiJson(final String json) { + final CodeCommand command = commandFromApiJson(json); + return this.commandSerializerService.serializeCommandToJson(command); + } + + @Override + public String serializedCommandJsonFromApiJson(final Long codeId, final String json) { + final CodeCommand command = commandFromApiJson(codeId, json); + return this.commandSerializerService.serializeCommandToJson(command); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromCommandJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromCommandJsonDeserializer.java new file mode 100644 index 000000000..c70c7d567 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromCommandJsonDeserializer.java @@ -0,0 +1,50 @@ +package org.mifosplatform.infrastructure.codes.serialization; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; +import org.mifosplatform.infrastructure.codes.command.CodeCommand; +import org.mifosplatform.infrastructure.core.exception.InvalidJsonException; +import org.mifosplatform.infrastructure.core.serialization.FromCommandJsonDeserializer; +import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.google.gson.JsonElement; + +/** + * + */ +@Component +public final class CodeCommandFromCommandJsonDeserializer implements FromCommandJsonDeserializer { + + private final FromJsonHelper fromJsonHelper; + + @Autowired + public CodeCommandFromCommandJsonDeserializer(final FromJsonHelper fromApiJsonHelper) { + this.fromJsonHelper = fromApiJsonHelper; + } + + @Override + public CodeCommand commandFromCommandJson(final String commandAsJson) { + return commandFromCommandJson(null, commandAsJson); + } + + @Override + public CodeCommand commandFromCommandJson(final Long codeId, final String commandAsJson) { + return commandFromCommandJson(codeId, commandAsJson, false); + } + + @Override + public CodeCommand commandFromCommandJson(Long codeId, String commandAsJson, boolean makerCheckerApproval) { + if (StringUtils.isBlank(commandAsJson)) { throw new InvalidJsonException(); } + + final Set parametersPassedInRequest = new HashSet(); + + final JsonElement element = fromJsonHelper.parse(commandAsJson); + final String name = fromJsonHelper.extractStringNamed("name", element, parametersPassedInRequest); + + return new CodeCommand(parametersPassedInRequest, makerCheckerApproval, codeId, name); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java index 3828c6a6b..b6ebf00c4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java @@ -97,7 +97,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf context.authenticatedUser(); - final Code code = retrieveCodeBy(command.getName()); + final Code code = retrieveCodeBy(command.getId()); if (code.isSystemDefined()) { throw new SystemDefinedCodeCannotBeChangedException(); } @@ -114,4 +114,10 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf if (code == null) { throw new CodeNotFoundException(name); } return code; } + + private Code retrieveCodeBy(final Long codeId) { + final Code code = this.codeRepository.findOne(codeId); + if (code == null) { throw new CodeNotFoundException(codeId.toString()); } + return code; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/ApiRequestParameterHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/ApiRequestParameterHelper.java new file mode 100644 index 000000000..25cf0b664 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/ApiRequestParameterHelper.java @@ -0,0 +1,31 @@ +package org.mifosplatform.infrastructure.core.api; + +import java.util.Set; + +import javax.ws.rs.core.MultivaluedMap; + +import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.springframework.stereotype.Component; + +/** + *

+ * Used to process the query parameters provided in a API request to see features of + * the RESTful API are being asked for such as: + *

+ *
    + *
  • Pretty printing through pretty=true, defaults to false
  • + *
  • Partial response through fields=id, name etc, when empty, the full data + * is returned by default.
  • + *
queryParameters) { + + final Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(queryParameters); + final boolean prettyPrint = ApiParameterHelper.prettyPrint(queryParameters); + + return ApiRequestJsonSerializationSettings.from(prettyPrint, responseParameters); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/GoogleGsonPortfolioApiJsonSerializerService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/GoogleGsonPortfolioApiJsonSerializerService.java index 9dbe2f0e2..224cc4e8c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/GoogleGsonPortfolioApiJsonSerializerService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/GoogleGsonPortfolioApiJsonSerializerService.java @@ -6,8 +6,8 @@ import java.util.HashSet; import java.util.Set; import org.mifosplatform.commands.data.CommandSourceData; -import org.mifosplatform.infrastructure.codes.data.CodeData; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.GoogleGsonSerializerHelper; import org.mifosplatform.infrastructure.dataqueries.data.DatatableData; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; import org.mifosplatform.infrastructure.documentmanagement.data.DocumentData; @@ -152,8 +152,6 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi private static final Set LOAN_CHARGES_DATA_PARAMETERS = new HashSet(Arrays.asList("chargeOptions")); - private static final Set CODE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "codename")); - private static final Set MAKER_CHECKER_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "taskName", "madeOnDate")); private static final Set SAVINGS_ACCOUNTS_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "status", "externalId", @@ -489,6 +487,7 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi return helper.serializedJsonFrom(gsonDeserializer, staff.toArray(new StaffData[staff.size()])); } + @Deprecated @Override public String serializeEntityIdentifier(final EntityIdentifier identifier) { final Set DATA_PARAMETERS = new HashSet(Arrays.asList("entityId")); @@ -527,20 +526,6 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi return helper.serializedJsonFrom(gsonDeserializer, documentData); } - @Override - public String serializeCodeDataToJson(final boolean prettyPrint, final Set responseParameters, final Collection codes) { - final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CODE_DATA_PARAMETERS, - prettyPrint, responseParameters); - return helper.serializedJsonFrom(gsonDeserializer, codes.toArray(new CodeData[codes.size()])); - } - - @Override - public String serializeCodeDataToJson(final boolean prettyPrint, final Set responseParameters, final CodeData code) { - final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CODE_DATA_PARAMETERS, - prettyPrint, responseParameters); - return helper.serializedJsonFrom(gsonDeserializer, code); - } - @Override public String serializeMakerCheckerDataToJson(final boolean prettyPrint, final Set responseParameters, final Collection entries) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionService.java index 0546d6e03..c07af9d81 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionService.java @@ -1,6 +1,5 @@ package org.mifosplatform.infrastructure.core.api; -import org.mifosplatform.infrastructure.codes.command.CodeCommand; import org.mifosplatform.organisation.monetary.command.CurrencyCommand; import org.mifosplatform.organisation.office.command.BranchMoneyTransferCommand; import org.mifosplatform.organisation.office.command.OfficeCommand; @@ -97,8 +96,6 @@ public interface PortfolioApiDataConversionService { ClientIdentifierCommand convertApiRequestJsonToClientIdentifierCommand(Long resourceIdentifier, Long clientId, String json); - CodeCommand convertApiRequestJsonToCodeCommand(Long resourceIdentifier, String json); - SavingAccountCommand convertJsonToSavingAccountCommand(Long resourceIdentifier, String json); GuarantorCommand convertJsonToGuarantorCommand(Long resourceIdentifier, Long loanId, String json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionServiceImpl.java index f427ccd36..da02272a8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiDataConversionServiceImpl.java @@ -17,11 +17,11 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; import org.joda.time.LocalDate; import org.joda.time.format.DateTimeFormat; -import org.mifosplatform.infrastructure.codes.command.CodeCommand; import org.mifosplatform.infrastructure.core.data.ApiParameterError; import org.mifosplatform.infrastructure.core.exception.InvalidJsonException; import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException; import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException; +import org.mifosplatform.infrastructure.core.serialization.JsonParserHelper; import org.mifosplatform.organisation.monetary.command.CurrencyCommand; import org.mifosplatform.organisation.office.command.BranchMoneyTransferCommand; import org.mifosplatform.organisation.office.command.OfficeCommand; @@ -1515,22 +1515,6 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo return this.portfolioCommandDeserializerService.deserializeClientIdentifierCommand(resourceIdentifier, clientId, json, false); } - @Override - public CodeCommand convertApiRequestJsonToCodeCommand(final Long resourceIdentifier, final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - - final Type typeOfMap = new TypeToken>() {}.getType(); - final Map requestMap = gsonConverter.fromJson(json, typeOfMap); - - final Set supportedParams = new HashSet(Arrays.asList("name")); - - checkForUnsupportedParameters(requestMap, supportedParams); - - // no difference between api request json format and internal command - // json format. - return this.portfolioCommandDeserializerService.deserializeCodeCommand(resourceIdentifier, json, false); - } - @Override public SavingAccountCommand convertJsonToSavingAccountCommand(Long resourceIdentifier, String json) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiJsonSerializerService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiJsonSerializerService.java index 2e7585c78..f76b0cd7c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiJsonSerializerService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioApiJsonSerializerService.java @@ -4,7 +4,6 @@ import java.util.Collection; import java.util.Set; import org.mifosplatform.commands.data.CommandSourceData; -import org.mifosplatform.infrastructure.codes.data.CodeData; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.dataqueries.data.DatatableData; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; @@ -128,6 +127,12 @@ public interface PortfolioApiJsonSerializerService { String serializeStaffDataToJson(boolean prettyPrint, Set responseParameters, Collection staff); + /** + * @deprecated see + * {@link CodesToApiJsonSerializer#serialize(EntityIdentifier)} + * for example for what to use now. + */ + @Deprecated String serializeEntityIdentifier(EntityIdentifier identifier); String serializeClientIdentifierDataToJson(boolean prettyPrint, Set responseParameters, @@ -140,10 +145,6 @@ public interface PortfolioApiJsonSerializerService { String serializeDocumentDataToJson(boolean prettyPrint, Set responseParameters, DocumentData documentData); - String serializeCodeDataToJson(boolean prettyPrint, Set responseParameters, Collection codes); - - String serializeCodeDataToJson(boolean prettyPrint, Set responseParameters, CodeData code); - String serializeMakerCheckerDataToJson(boolean prettyPrint, Set responseParameters, Collection entries); String serializeSavingAccountsDataToJson(boolean prettyPrint, Set responseParameters, SavingAccountData account); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeerializerServiceGoogleGson.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeerializerServiceGoogleGson.java index f2e252121..214d8a7ca 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeerializerServiceGoogleGson.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeerializerServiceGoogleGson.java @@ -7,8 +7,8 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; import org.joda.time.LocalDate; -import org.mifosplatform.infrastructure.codes.command.CodeCommand; import org.mifosplatform.infrastructure.core.exception.InvalidJsonException; +import org.mifosplatform.infrastructure.core.serialization.JsonParserHelper; import org.mifosplatform.organisation.monetary.command.CurrencyCommand; import org.mifosplatform.organisation.office.command.BranchMoneyTransferCommand; import org.mifosplatform.organisation.office.command.OfficeCommand; @@ -126,20 +126,6 @@ public class PortfolioCommandDeerializerServiceGoogleGson implements PortfolioCo repeatPassword, email, officeId, notSelectedRoles, roles); } - @Override - public CodeCommand deserializeCodeCommand(final Long codeId, final String commandAsJson, final boolean makerCheckerApproval) { - if (StringUtils.isBlank(commandAsJson)) { throw new InvalidJsonException(); } - - final JsonParserHelper helper = new JsonParserHelper(); - final JsonElement element = parser.parse(commandAsJson); - - final Set parametersPassedInRequest = new HashSet(); - - final String name = helper.extractStringNamed("name", element, parametersPassedInRequest); - - return new CodeCommand(parametersPassedInRequest, makerCheckerApproval, codeId, name); - } - @Override public StaffCommand deserializeStaffCommand(final Long staffId, final String commandAsJson, final boolean makerCheckerApproval) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeserializerService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeserializerService.java index a6a3ee75f..d6bca300b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeserializerService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandDeserializerService.java @@ -1,6 +1,5 @@ package org.mifosplatform.infrastructure.core.api; -import org.mifosplatform.infrastructure.codes.command.CodeCommand; import org.mifosplatform.organisation.monetary.command.CurrencyCommand; import org.mifosplatform.organisation.office.command.BranchMoneyTransferCommand; import org.mifosplatform.organisation.office.command.OfficeCommand; @@ -35,8 +34,6 @@ public interface PortfolioCommandDeserializerService { UserCommand deserializeUserCommand(Long userId, String commandAsJson, boolean makerCheckerApproval); - CodeCommand deserializeCodeCommand(Long codeId, String commandAsJson, boolean makerCheckerApproval); - StaffCommand deserializeStaffCommand(Long staffId, String commandAsJson, boolean makerCheckerApproval); FundCommand deserializeFundCommand(Long fundId, String commandAsJson, boolean makerCheckerApproval); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandSerializerServiceJson.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandSerializerServiceJson.java deleted file mode 100644 index 55792a2e3..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandSerializerServiceJson.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.mifosplatform.infrastructure.core.api; - -import java.util.HashSet; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.google.gson.Gson; - -/** - * Implementation of {@link PortfolioCommandSerializerService} that serializes - * the commands into JSON using google-gson. - */ -@Service -public class PortfolioCommandSerializerServiceJson implements PortfolioCommandSerializerService { - - private final GoogleGsonSerializerHelper helper; - - @Autowired - public PortfolioCommandSerializerServiceJson(final GoogleGsonSerializerHelper helper) { - this.helper = helper; - } - - @Override - public String serializeCommandToJson(Object command) { - final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(new HashSet(), false, - new HashSet()); - return helper.serializedJsonFrom(gsonDeserializer, command); - } -} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java index e59e70973..9d6fcbd16 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java @@ -4,117 +4,123 @@ import java.util.ArrayList; import java.util.List; public class ApiParameterError { - - /** - * A developer friendly plain English description of why the HTTP error response was returned from the API. - */ - private String developerMessage; - - /** - * A user friendly plain English description of why the HTTP error response was returned from the API that can be presented to end users. - */ - private String defaultUserMessage; - - /** - * A code that can be used for globalisation support by client applications of the API. - */ - private String userMessageGlobalisationCode; - - /** - * The name of the field or parameter passed to the API that this error relates to. - */ - private String parameterName; - - /** - * The actual value of the parameter (if any) as passed to API. - */ - private Object value; - /** - * Arguments related to the user error message. - */ - private List args = new ArrayList(); + /** + * A developer friendly plain English description of why the HTTP error + * response was returned from the API. + */ + private String developerMessage; - public static ApiParameterError generalError(String globalisationMessageCode, String defaultUserMessage, Object... defaultUserMessageArgs) { - return new ApiParameterError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); - } + /** + * A user friendly plain English description of why the HTTP error response + * was returned from the API that can be presented to end users. + */ + private String defaultUserMessage; - public static ApiParameterError resourceIdentifierNotFound(String globalisationMessageCode, String defaultUserMessage, Object... defaultUserMessageArgs) { - return new ApiParameterError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); - } + /** + * A code that can be used for globalisation support by client applications + * of the API. + */ + private String userMessageGlobalisationCode; - public static ApiParameterError parameterError(final String globalisationMessageCode, final String defaultUserMessage, - final String parameterName, final Object... defaultUserMessageArgs) { - ApiParameterError error = new ApiParameterError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); - error.setParameterName(parameterName); - return error; - } - - protected ApiParameterError() { - // - } + /** + * The name of the field or parameter passed to the API that this error + * relates to. + */ + private String parameterName; - private ApiParameterError(final String globalisationMessageCode, final String defaultUserMessage, final Object[] defaultUserMessageArgs) { - this.userMessageGlobalisationCode = globalisationMessageCode; - this.developerMessage = defaultUserMessage; - this.defaultUserMessage = defaultUserMessage; - - List messageArgs = new ArrayList(); - if (defaultUserMessageArgs != null) { - for (Object object : defaultUserMessageArgs) { - messageArgs.add(ApiErrorMessageArg.from(object)); - } - } - this.args = messageArgs; - - this.parameterName="id"; - } + /** + * The actual value of the parameter (if any) as passed to API. + */ + private Object value; - public String getDeveloperMessage() { - return developerMessage; - } + /** + * Arguments related to the user error message. + */ + private List args = new ArrayList(); - public void setDeveloperMessage(String developerMessage) { - this.developerMessage = developerMessage; - } + public static ApiParameterError generalError(String globalisationMessageCode, String defaultUserMessage, + Object... defaultUserMessageArgs) { + return new ApiParameterError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); + } - public String getDefaultUserMessage() { - return defaultUserMessage; - } + public static ApiParameterError resourceIdentifierNotFound(String globalisationMessageCode, String defaultUserMessage, + Object... defaultUserMessageArgs) { + return new ApiParameterError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); + } - public void setDefaultUserMessage(String defaultUserMessage) { - this.defaultUserMessage = defaultUserMessage; - } + public static ApiParameterError parameterError(final String globalisationMessageCode, final String defaultUserMessage, + final String parameterName, final Object... defaultUserMessageArgs) { + ApiParameterError error = new ApiParameterError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); + error.setParameterName(parameterName); + return error; + } - public String getUserMessageGlobalisationCode() { - return userMessageGlobalisationCode; - } + protected ApiParameterError() { + // + } - public void setUserMessageGlobalisationCode(String userMessageGlobalisationCode) { - this.userMessageGlobalisationCode = userMessageGlobalisationCode; - } + private ApiParameterError(final String globalisationMessageCode, final String defaultUserMessage, final Object[] defaultUserMessageArgs) { + this.userMessageGlobalisationCode = globalisationMessageCode; + this.developerMessage = defaultUserMessage; + this.defaultUserMessage = defaultUserMessage; - public String getParameterName() { - return parameterName; - } + List messageArgs = new ArrayList(); + if (defaultUserMessageArgs != null) { + for (Object object : defaultUserMessageArgs) { + messageArgs.add(ApiErrorMessageArg.from(object)); + } + } + this.args = messageArgs; - public void setParameterName(String parameterName) { - this.parameterName = parameterName; - } + this.parameterName = "id"; + } - public Object getValue() { - return value; - } + public String getDeveloperMessage() { + return developerMessage; + } - public void setValue(Object value) { - this.value = value; - } + public void setDeveloperMessage(String developerMessage) { + this.developerMessage = developerMessage; + } - public List getArgs() { - return args; - } + public String getDefaultUserMessage() { + return defaultUserMessage; + } - public void setArgs(List args) { - this.args = args; - } + public void setDefaultUserMessage(String defaultUserMessage) { + this.defaultUserMessage = defaultUserMessage; + } + + public String getUserMessageGlobalisationCode() { + return userMessageGlobalisationCode; + } + + public void setUserMessageGlobalisationCode(String userMessageGlobalisationCode) { + this.userMessageGlobalisationCode = userMessageGlobalisationCode; + } + + public String getParameterName() { + return parameterName; + } + + public void setParameterName(String parameterName) { + this.parameterName = parameterName; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public List getArgs() { + return args; + } + + public void setArgs(List args) { + this.args = args; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ApiRequestJsonSerializationSettings.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ApiRequestJsonSerializationSettings.java new file mode 100644 index 000000000..abb59af89 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ApiRequestJsonSerializationSettings.java @@ -0,0 +1,38 @@ +package org.mifosplatform.infrastructure.core.serialization; + +import java.util.Set; + +/** + * A class to encapsulate settings we allow on API that affect how JSON is to be + * serialized for the response to api call. + */ +public class ApiRequestJsonSerializationSettings { + + private final boolean prettyPrint; + private final Set parametersForPartialResponse; + + public ApiRequestJsonSerializationSettings(final boolean prettyPrint, final Set parametersForPartialResponse) { + this.prettyPrint = prettyPrint; + this.parametersForPartialResponse = parametersForPartialResponse; + } + + public static ApiRequestJsonSerializationSettings from(final boolean prettyPrint, final Set parametersForPartialResponse) { + + // FIXME - kw - rather than always creating new objects for this could + // just send by common ones like, prettyprint=false, empty response + // parameters + return new ApiRequestJsonSerializationSettings(prettyPrint, parametersForPartialResponse); + } + + public boolean isPrettyPrint() { + return this.prettyPrint; + } + + public Set getParametersForPartialResponse() { + return this.parametersForPartialResponse; + } + + public boolean isPartialResponseRequired() { + return !this.parametersForPartialResponse.isEmpty(); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandSerializerService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/CommandSerializer.java similarity index 52% rename from mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandSerializerService.java rename to mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/CommandSerializer.java index 2cd3f4c24..fc6f85ef8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/PortfolioCommandSerializerService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/CommandSerializer.java @@ -1,4 +1,5 @@ -package org.mifosplatform.infrastructure.core.api; +package org.mifosplatform.infrastructure.core.serialization; + /** * Service for serializing commands into another format. @@ -7,9 +8,9 @@ package org.mifosplatform.infrastructure.core.api; * Known implementations: *

* - * @see PortfolioCommandSerializerServiceJson + * @see CommandSerializerDefaultToJson */ -public interface PortfolioCommandSerializerService { +public interface CommandSerializer { String serializeCommandToJson(Object command); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/CommandSerializerDefaultToJson.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/CommandSerializerDefaultToJson.java new file mode 100644 index 000000000..e31182851 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/CommandSerializerDefaultToJson.java @@ -0,0 +1,24 @@ +package org.mifosplatform.infrastructure.core.serialization; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Implementation of {@link CommandSerializer} that serializes + * the commands into JSON using google-gson. + */ +@Component +public class CommandSerializerDefaultToJson implements CommandSerializer { + + private final ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson excludeNothingWithPrettyPrintingOff; + + @Autowired + public CommandSerializerDefaultToJson(final ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson excludeNothingWithPrettyPrintingOff) { + this.excludeNothingWithPrettyPrintingOff = excludeNothingWithPrettyPrintingOff; + } + + @Override + public String serializeCommandToJson(Object command) { + return excludeNothingWithPrettyPrintingOff.serialize(command); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DefaultToApiJsonSerializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DefaultToApiJsonSerializer.java new file mode 100644 index 000000000..bd584a940 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DefaultToApiJsonSerializer.java @@ -0,0 +1,73 @@ +package org.mifosplatform.infrastructure.core.serialization; + +import java.util.Collection; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.google.gson.Gson; + +/** + * An abstract helper implementation of {@link ToApiJsonSerializer} for + * resources to serialize their Java data objects into JSON. + */ +@Component +public final class DefaultToApiJsonSerializer implements ToApiJsonSerializer { + + private final ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson excludeNothingWithPrettyPrintingOff; + private final ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson excludeNothingWithPrettyPrintingOn; + private final GoogleGsonSerializerHelper helper; + + @Autowired + public DefaultToApiJsonSerializer( + final ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson excludeNothingWithPrettyPrintingOff, + final ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson excludeNothingWithPrettyPrintingOn, + final GoogleGsonSerializerHelper helper) { + this.excludeNothingWithPrettyPrintingOff = excludeNothingWithPrettyPrintingOff; + this.excludeNothingWithPrettyPrintingOn = excludeNothingWithPrettyPrintingOn; + this.helper = helper; + } + + @Override + public String serialize(final Object object) { + return this.excludeNothingWithPrettyPrintingOff.serialize(object); + } + + @Override + public String serialize(final ApiRequestJsonSerializationSettings settings, final Collection collection, + final Set supportedResponseParameters) { + final Gson delegatedSerializer = findAppropriateSerializer(settings, supportedResponseParameters); + return serializeWithSettings(delegatedSerializer, settings, collection.toArray()); + } + + @Override + public String serialize(final ApiRequestJsonSerializationSettings settings, final T singleObject, + final Set supportedResponseParameters) { + final Gson delegatedSerializer = findAppropriateSerializer(settings, supportedResponseParameters); + return serializeWithSettings(delegatedSerializer, settings, singleObject); + } + + private String serializeWithSettings(final Gson gson, final ApiRequestJsonSerializationSettings settings, final Object... dataObject) { + String json = null; + if (gson != null) { + json = helper.serializedJsonFrom(gson, dataObject); + } else { + if (settings.isPrettyPrint()) { + json = this.excludeNothingWithPrettyPrintingOn.serialize(dataObject); + } else { + json = serialize(dataObject); + } + } + return json; + } + + private Gson findAppropriateSerializer(final ApiRequestJsonSerializationSettings settings, final Set supportedResponseParameters) { + Gson gson = null; + if (settings.isPartialResponseRequired()) { + gson = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(supportedResponseParameters, + settings.isPrettyPrint(), settings.getParametersForPartialResponse()); + } + return gson; + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson.java new file mode 100644 index 000000000..81132c109 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson.java @@ -0,0 +1,33 @@ +package org.mifosplatform.infrastructure.core.serialization; + +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.mifosplatform.infrastructure.core.api.JodaDateTimeAdapter; +import org.mifosplatform.infrastructure.core.api.JodaLocalDateAdapter; +import org.springframework.stereotype.Component; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + *

A google gson implementation of {@link ExcludeNothingJsonSerializer} contract.

+ * + *

It serializes all fields of any Java {@link Object} passed to it.

+ */ +@Component +public final class ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson { + + private final Gson gson; + + public ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson() { + GsonBuilder builder = new GsonBuilder(); + builder.registerTypeAdapter(LocalDate.class, new JodaLocalDateAdapter()); + builder.registerTypeAdapter(DateTime.class, new JodaDateTimeAdapter()); + + this.gson = builder.create(); + } + + public String serialize(final Object result) { + return this.gson.toJson(result); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson.java new file mode 100644 index 000000000..8239393bb --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson.java @@ -0,0 +1,34 @@ +package org.mifosplatform.infrastructure.core.serialization; + +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.mifosplatform.infrastructure.core.api.JodaDateTimeAdapter; +import org.mifosplatform.infrastructure.core.api.JodaLocalDateAdapter; +import org.springframework.stereotype.Component; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + *

A google gson implementation of {@link ExcludeNothingJsonSerializer} contract.

+ * + *

It serializes all fields of any Java {@link Object} passed to it.

+ */ +@Component +public final class ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson { + + private final Gson gson; + + public ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson() { + GsonBuilder builder = new GsonBuilder(); + builder.registerTypeAdapter(LocalDate.class, new JodaLocalDateAdapter()); + builder.registerTypeAdapter(DateTime.class, new JodaDateTimeAdapter()); + builder.setPrettyPrinting(); + + this.gson = builder.create(); + } + + public String serialize(final Object result) { + return this.gson.toJson(result); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromApiJsonDeserializer.java new file mode 100644 index 000000000..a42c55b9f --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromApiJsonDeserializer.java @@ -0,0 +1,15 @@ +package org.mifosplatform.infrastructure.core.serialization; + +/** + * + */ +public interface FromApiJsonDeserializer { + + T commandFromApiJson(final String json); + + T commandFromApiJson(final Long resourceId, final String json); + + String serializedCommandJsonFromApiJson(final String json); + + String serializedCommandJsonFromApiJson(final Long resourceId, final String json); +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromCommandJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromCommandJsonDeserializer.java new file mode 100644 index 000000000..956f48543 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromCommandJsonDeserializer.java @@ -0,0 +1,13 @@ +package org.mifosplatform.infrastructure.core.serialization; + +/** + * + */ +public interface FromCommandJsonDeserializer { + + T commandFromCommandJson(final String json); + + T commandFromCommandJson(final Long resourceId, final String json); + + T commandFromCommandJson(final Long resourceId, final String json, final boolean makerCheckerApproval); +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromJsonHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromJsonHelper.java new file mode 100644 index 000000000..ae5397a82 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromJsonHelper.java @@ -0,0 +1,53 @@ +package org.mifosplatform.infrastructure.core.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.core.exception.InvalidJsonException; +import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException; +import org.springframework.stereotype.Component; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + +@Component +public class FromJsonHelper { + + private final Gson gsonConverter; + private final JsonParserHelper helperDelegator; + private final JsonParser parser; + + public FromJsonHelper() { + this.gsonConverter = new Gson(); + helperDelegator = new JsonParserHelper(); + parser = new JsonParser(); + } + + public void checkForUnsupportedParameters(final Type typeOfMap, final String json, final Set supportedParams) { + if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + + final Map requestMap = gsonConverter.fromJson(json, typeOfMap); + + List unsupportedParameterList = new ArrayList(); + for (String providedParameter : requestMap.keySet()) { + if (!supportedParams.contains(providedParameter)) { + unsupportedParameterList.add(providedParameter); + } + } + + if (!unsupportedParameterList.isEmpty()) { throw new UnsupportedParameterException(unsupportedParameterList); } + } + + public JsonElement parse(final String json) { + return parser.parse(json); + } + + public String extractStringNamed(final String parameterName, final JsonElement element, final Set parametersPassedInRequest) { + return helperDelegator.extractStringNamed(parameterName, element, parametersPassedInRequest); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/GoogleGsonSerializerHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/GoogleGsonSerializerHelper.java similarity index 88% rename from mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/GoogleGsonSerializerHelper.java rename to mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/GoogleGsonSerializerHelper.java index 2cc486894..045800179 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/GoogleGsonSerializerHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/GoogleGsonSerializerHelper.java @@ -1,4 +1,4 @@ -package org.mifosplatform.infrastructure.core.api; +package org.mifosplatform.infrastructure.core.serialization; import java.util.ArrayList; import java.util.HashSet; @@ -6,6 +6,9 @@ import java.util.Set; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import org.mifosplatform.infrastructure.core.api.JodaDateTimeAdapter; +import org.mifosplatform.infrastructure.core.api.JodaLocalDateAdapter; +import org.mifosplatform.infrastructure.core.api.ParameterListExclusionStrategy; import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException; import org.springframework.stereotype.Service; @@ -17,7 +20,7 @@ import com.google.gson.GsonBuilder; * Helper class for serialization of java objects into JSON using google-gson. */ @Service -public class GoogleGsonSerializerHelper { +public final class GoogleGsonSerializerHelper { public Gson createGsonBuilder(final boolean prettyPrint) { final GsonBuilder builder = new GsonBuilder(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/JsonParserHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/JsonParserHelper.java similarity index 99% rename from mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/JsonParserHelper.java rename to mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/JsonParserHelper.java index d20faa3da..b4021400f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/JsonParserHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/JsonParserHelper.java @@ -1,4 +1,4 @@ -package org.mifosplatform.infrastructure.core.api; +package org.mifosplatform.infrastructure.core.serialization; import java.math.BigDecimal; import java.text.DecimalFormat; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ToApiJsonSerializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ToApiJsonSerializer.java new file mode 100644 index 000000000..41d3a68a6 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/ToApiJsonSerializer.java @@ -0,0 +1,13 @@ +package org.mifosplatform.infrastructure.core.serialization; + +import java.util.Collection; +import java.util.Set; + +public interface ToApiJsonSerializer { + + String serialize(final Object object); + + String serialize(final ApiRequestJsonSerializationSettings settings, Collection collection, Set supportedResponseParameters); + + String serialize(final ApiRequestJsonSerializationSettings settings, T single, Set supportedResponseParameters); +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java index 4df33fceb..63d933865 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java @@ -12,10 +12,10 @@ import java.util.Set; import javax.sql.rowset.CachedRowSet; import org.apache.commons.lang.StringUtils; -import org.mifosplatform.infrastructure.core.api.JsonParserHelper; import org.mifosplatform.infrastructure.core.data.ApiParameterError; import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException; import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityException; +import org.mifosplatform.infrastructure.core.serialization.JsonParserHelper; import org.mifosplatform.infrastructure.dataqueries.data.DatatableData; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; import org.mifosplatform.infrastructure.dataqueries.data.ResultsetColumnHeader; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java index ece4245fe..589be7c2f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java @@ -17,8 +17,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.command.CurrencyCommand; import org.mifosplatform.organisation.monetary.data.ConfigurationData; @@ -38,7 +38,7 @@ public class CurrenciesApiResource { private final OrganisationCurrencyReadPlatformService readPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired @@ -46,7 +46,7 @@ public class CurrenciesApiResource { final OrganisationCurrencyReadPlatformService readPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java index 0c839f282..a290f2780 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java @@ -18,8 +18,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.command.BranchMoneyTransferCommand; import org.mifosplatform.organisation.office.data.OfficeTransactionData; @@ -40,7 +40,7 @@ public class OfficeTransactionsApiResource { private final OfficeReadPlatformService readPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired @@ -48,7 +48,7 @@ public class OfficeTransactionsApiResource { final OfficeReadPlatformService readPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java index 849779fee..ee03f0332 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java @@ -21,8 +21,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.command.OfficeCommand; import org.mifosplatform.organisation.office.data.OfficeData; @@ -43,7 +43,7 @@ public class OfficesApiResource { private final OfficeReadPlatformService readPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired @@ -51,7 +51,7 @@ public class OfficesApiResource { final OfficeReadPlatformService readPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java index b2bc6432b..40eb6a22d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java @@ -22,8 +22,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeLookup; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; @@ -53,13 +53,13 @@ public class StaffApiResource { private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; @Autowired public StaffApiResource(final PlatformSecurityContext context, final StaffReadPlatformService readPlatformService, final OfficeReadPlatformService officeReadPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java index 054f4af44..e988a2f5d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java @@ -21,8 +21,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.charge.command.ChargeDefinitionCommand; import org.mifosplatform.portfolio.charge.data.ChargeData; @@ -41,7 +41,7 @@ public class ChargesApiResource { private final PlatformSecurityContext context; private final ChargeReadPlatformService readPlatformService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @@ -49,7 +49,7 @@ public class ChargesApiResource { public ChargesApiResource(final PlatformSecurityContext context, final ChargeReadPlatformService readPlatformService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java index 6dd7f06a3..18d431127 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java @@ -23,8 +23,8 @@ import org.mifosplatform.infrastructure.codes.service.CodeValueReadPlatformServi import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.client.command.ClientIdentifierCommand; import org.mifosplatform.portfolio.client.data.ClientData; @@ -46,7 +46,7 @@ public class ClientIdentifiersApiResource { private final ClientReadPlatformService clientReadPlatformService; private final CodeValueReadPlatformService codeValueReadPlatformService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @@ -54,7 +54,7 @@ public class ClientIdentifiersApiResource { public ClientIdentifiersApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java index 4d9438633..abaf47681 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java @@ -30,9 +30,9 @@ import org.mifosplatform.infrastructure.core.api.ApiConstants; import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.core.domain.Base64EncodedImage; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.core.service.FileUtils; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeLookup; @@ -68,7 +68,7 @@ public class ClientsApiResource { private final ClientWritePlatformService clientWritePlatformService; private final OfficeReadPlatformService officeReadPlatformService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioCommandsReadPlatformService commandSourceReadPlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @@ -77,7 +77,7 @@ public class ClientsApiResource { public ClientsApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService, final ClientWritePlatformService clientWritePlatformService, final OfficeReadPlatformService officeReadPlatformService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioCommandsReadPlatformService commandsReadPlatformService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java index 533e683cc..650525879 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java @@ -20,8 +20,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.fund.command.FundCommand; import org.mifosplatform.portfolio.fund.data.FundData; @@ -41,14 +41,14 @@ public class FundsApiResource { private final FundReadPlatformService readPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired public FundsApiResource(final PlatformSecurityContext context, final FundReadPlatformService readPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java index 9f51b1906..22f2fc1f7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java @@ -24,10 +24,10 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.exception.UnrecognizedQueryParamException; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency; import org.mifosplatform.organisation.monetary.domain.Money; @@ -90,7 +90,7 @@ public class LoansApiResource { private final GuarantorReadPlatformService guarantorReadPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired @@ -102,7 +102,7 @@ public class LoansApiResource { final GuarantorReadPlatformService guarantorReadPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.loanReadPlatformService = loanReadPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java index 544493cbb..759fe292e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java @@ -20,9 +20,9 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.core.data.EnumOptionData; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService; @@ -54,7 +54,7 @@ public class LoanProductsApiResource { private final LoanDropdownReadPlatformService dropdownReadPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired @@ -63,7 +63,7 @@ public class LoanProductsApiResource { final FundReadPlatformService fundReadPlatformService, final LoanDropdownReadPlatformService dropdownReadPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.loanProductReadPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/PermissionsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/PermissionsApiResource.java index 5df967492..c5e732db9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/PermissionsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/PermissionsApiResource.java @@ -18,8 +18,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.useradministration.command.PermissionsCommand; import org.mifosplatform.useradministration.data.PermissionUsageData; @@ -39,7 +39,7 @@ public class PermissionsApiResource { private final PermissionReadPlatformService permissionReadPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired @@ -48,7 +48,7 @@ public class PermissionsApiResource { final PermissionReadPlatformService readPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.permissionReadPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/RolesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/RolesApiResource.java index 3d2f652c9..1f4233a46 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/RolesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/RolesApiResource.java @@ -24,8 +24,8 @@ import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; import org.mifosplatform.infrastructure.core.api.PortfolioCommandDeserializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.useradministration.command.RoleCommand; import org.mifosplatform.useradministration.command.RolePermissionCommand; @@ -50,7 +50,7 @@ public class RolesApiResource { private final PermissionReadPlatformService permissionReadPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandsReadPlatformService commandSourceReadPlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final PortfolioCommandDeserializerService commandDeserializerService; @@ -62,7 +62,7 @@ public class RolesApiResource { final PermissionReadPlatformService permissionReadPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandsReadPlatformService commandSourceReadPlatformService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final PortfolioCommandDeserializerService commandDeserializerService) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/UsersApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/UsersApiResource.java index 5a623322e..48b12e71f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/UsersApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/api/UsersApiResource.java @@ -22,8 +22,8 @@ import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformSer import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; -import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; +import org.mifosplatform.infrastructure.core.serialization.CommandSerializer; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeLookup; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; @@ -46,14 +46,14 @@ public class UsersApiResource { private final OfficeReadPlatformService officeReadPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; - private final PortfolioCommandSerializerService commandSerializerService; + private final CommandSerializer commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired public UsersApiResource(final PlatformSecurityContext context, final AppUserReadPlatformService readPlatformService, final OfficeReadPlatformService officeReadPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, - final PortfolioCommandSerializerService commandSerializerService, + final CommandSerializer commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/domain/PasswordMustBeDifferentException.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/exception/PasswordMustBeDifferentException.java similarity index 65% rename from mifosng-provider/src/main/java/org/mifosplatform/useradministration/domain/PasswordMustBeDifferentException.java rename to mifosng-provider/src/main/java/org/mifosplatform/useradministration/exception/PasswordMustBeDifferentException.java index 8631f79e3..57b2c8386 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/domain/PasswordMustBeDifferentException.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/exception/PasswordMustBeDifferentException.java @@ -1,4 +1,4 @@ -package org.mifosplatform.useradministration.domain; +package org.mifosplatform.useradministration.exception; public class PasswordMustBeDifferentException extends RuntimeException { // basic runtime exception diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/domain/UsernameMustBeDifferentException.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/exception/UsernameMustBeDifferentException.java similarity index 65% rename from mifosng-provider/src/main/java/org/mifosplatform/useradministration/domain/UsernameMustBeDifferentException.java rename to mifosng-provider/src/main/java/org/mifosplatform/useradministration/exception/UsernameMustBeDifferentException.java index 08ba12aab..a89a0e8a9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/domain/UsernameMustBeDifferentException.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/exception/UsernameMustBeDifferentException.java @@ -1,4 +1,4 @@ -package org.mifosplatform.useradministration.domain; +package org.mifosplatform.useradministration.exception; public class UsernameMustBeDifferentException extends RuntimeException { // basic runtime exception