diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 81df1c6c6..2b97c8b08 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -1371,19 +1371,19 @@ Office GL Account Mappings - officeglaccounts - Create Office GL Account Mapping
- List Journal Entries + financialactivityaccounts + Create Office GL Account Mapping
+ List Journal Entries - officeglaccounts/{entryId} + financialactivityaccounts/{entryId} - Retrieve a single Entry - Update Office GL Account Mapping - Delete Office GL Account Mapping + Retrieve a single Entry + Update Office GL Account Mapping + Delete Office GL Account Mapping @@ -28608,7 +28608,7 @@ Content-Type: application/json -   +  

List Office Level GL Account Mappings

@@ -28648,13 +28648,13 @@ Content-Type: application/json

Example Requests:

-
officeglaccounts
+
financialactivityaccounts

-
officeglaccounts?orderBy=id&sortOrder=DESC
+
financialactivityaccounts?orderBy=id&sortOrder=DESC
-GET https://DomainName/api/v1/officeglaccounts +GET https://DomainName/api/v1/financialactivityaccounts @@ -28677,7 +28677,7 @@ GET https://DomainName/api/v1/officeglaccounts
-   +  

Create Office GL Account

@@ -28696,10 +28696,10 @@ GET https://DomainName/api/v1/officeglaccounts
-POST https://DomainName/api/v1/officeglaccounts +POST https://DomainName/api/v1/financialactivityaccounts -POST officeglaccounts +POST financialactivityaccounts Content-Type: application/json Request Body: { @@ -28715,7 +28715,7 @@ Request Body:
-   +  

Update Office GL Account Mappings

@@ -28727,10 +28727,10 @@ Request Body:
-POST https://DomainName/api/v1/officeglaccounts/1 +POST https://DomainName/api/v1/financialactivityaccounts/1 -POST officeglaccounts +POST financialactivityaccounts Content-Type: application/json Request Body: { @@ -28747,18 +28747,18 @@ Request Body:
-  

Retrieve a single Entry

Example Requests:

-
officeglaccounts/1
+
financialactivityaccounts/1

-GET https://DomainName/api/v1/officeglaccounts/{entryId} +GET https://DomainName/api/v1/financialactivityaccounts/{entryId} { @@ -28777,7 +28777,7 @@ GET https://DomainName/api/v1/officeglaccounts/{entryId}
-  
@@ -28785,10 +28785,10 @@ GET https://DomainName/api/v1/officeglaccounts/{entryId}
-GET https://DomainName/api/v1/officeglaccounts/{mappingId} +GET https://DomainName/api/v1/financialactivityaccounts/{mappingId} -POST officeglaccounts/C1MAE935K0IAEYA?command=reverse +POST financialactivityaccounts/C1MAE935K0IAEYA?command=reverse Content-Type: application/json diff --git a/mifosng-db/migrations/core_db/V176__updates_to_financial_activity_accounts.sql b/mifosng-db/migrations/core_db/V176__updates_to_financial_activity_accounts.sql new file mode 100644 index 000000000..021f0dffc --- /dev/null +++ b/mifosng-db/migrations/core_db/V176__updates_to_financial_activity_accounts.sql @@ -0,0 +1,15 @@ +ALTER TABLE acc_gl_office_mapping DROP FOREIGN KEY `FK_office_mapping_office`; + +ALTER TABLE acc_gl_office_mapping DROP column office_id; + +ALTER TABLE `acc_gl_office_mapping` + ALTER `financial_account_type` DROP DEFAULT; + +ALTER TABLE `acc_gl_office_mapping` + CHANGE COLUMN `financial_account_type` `financial_activity_type` SMALLINT(5) NOT NULL; + +ALTER TABLE `acc_gl_office_mapping` + ADD UNIQUE INDEX `financial_activity_type` (`financial_activity_type`); + + +RENAME TABLE `acc_gl_office_mapping` TO `acc_gl_financial_activity_account`; \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/api/OfficeGLAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/api/FinancialActivityAccountsApiResource.java old mode 100755 new mode 100644 similarity index 71% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/api/OfficeGLAccountsApiResource.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/api/FinancialActivityAccountsApiResource.java index 68441d7f0..4571cd946 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/api/OfficeGLAccountsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/api/FinancialActivityAccountsApiResource.java @@ -7,6 +7,7 @@ package org.mifosplatform.accounting.accountmapping.api; import java.util.Arrays; import java.util.HashSet; +import java.util.List; import java.util.Set; import javax.ws.rs.Consumes; @@ -17,13 +18,12 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; -import org.mifosplatform.accounting.accountmapping.data.OfficeToGLAccountMappingData; -import org.mifosplatform.accounting.accountmapping.service.OfficeToGLAccountMappingReadPlatformService; +import org.mifosplatform.accounting.accountmapping.data.FinancialActivityAccountData; +import org.mifosplatform.accounting.accountmapping.service.FinancialActivityAccountReadPlatformService; import org.mifosplatform.commands.domain.CommandWrapper; import org.mifosplatform.commands.service.CommandWrapperBuilder; import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService; @@ -31,40 +31,38 @@ import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer; -import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; -import org.mifosplatform.portfolio.group.service.SearchParameters; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -@Path("/officeglaccounts") +@Path("/financialactivityaccounts") @Component @Scope("singleton") -public class OfficeGLAccountsApiResource { +public class FinancialActivityAccountsApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "officeData", "glAccountData", - "accountingMappingOptions", "officeOptions")); + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "glAccountData", + "accountingMappingOptions")); private final String resourceNameForPermission = "OFFICEGLACCOUNT"; - private final OfficeToGLAccountMappingReadPlatformService officeToGLAccountMappingReadPlatformService; - private final DefaultToApiJsonSerializer apiJsonSerializerService; + private final FinancialActivityAccountReadPlatformService financialActivityAccountReadPlatformService; + private final DefaultToApiJsonSerializer apiJsonSerializerService; private final ApiRequestParameterHelper apiRequestParameterHelper; private final PlatformSecurityContext context; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired - public OfficeGLAccountsApiResource(final PlatformSecurityContext context, - final OfficeToGLAccountMappingReadPlatformService officeToGLAccountMappingReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, + public FinancialActivityAccountsApiResource(final PlatformSecurityContext context, + final FinancialActivityAccountReadPlatformService officeToGLAccountMappingReadPlatformService, + final DefaultToApiJsonSerializer toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.apiRequestParameterHelper = apiRequestParameterHelper; this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; this.apiJsonSerializerService = toApiJsonSerializer; - this.officeToGLAccountMappingReadPlatformService = officeToGLAccountMappingReadPlatformService; + this.financialActivityAccountReadPlatformService = officeToGLAccountMappingReadPlatformService; } @GET @@ -75,7 +73,7 @@ public class OfficeGLAccountsApiResource { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); - OfficeToGLAccountMappingData officeToGLAccountMappingData = this.officeToGLAccountMappingReadPlatformService.retrieveTemplate(); + FinancialActivityAccountData officeToGLAccountMappingData = this.financialActivityAccountReadPlatformService.retrieveTemplate(); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.apiJsonSerializerService.serialize(settings, officeToGLAccountMappingData, RESPONSE_DATA_PARAMETERS); @@ -84,18 +82,13 @@ public class OfficeGLAccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") final String sqlSearch, - @QueryParam("externalId") final String externalId, @QueryParam("offset") final Integer offset, - @QueryParam("limit") final Integer limit, @QueryParam("orderBy") final String orderBy, - @QueryParam("sortOrder") final String sortOrder) { + public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); - final SearchParameters searchParameters = SearchParameters.forAccountTransfer(sqlSearch, externalId, offset, limit, orderBy, - sortOrder); - final Page mappings = this.officeToGLAccountMappingReadPlatformService.retrieveAll(searchParameters); + final List financialActivityAccounts = this.financialActivityAccountReadPlatformService.retrieveAll(); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); - return this.apiJsonSerializerService.serialize(settings, mappings, RESPONSE_DATA_PARAMETERS); + return this.apiJsonSerializerService.serialize(settings, financialActivityAccounts, RESPONSE_DATA_PARAMETERS); } @GET @@ -107,10 +100,10 @@ public class OfficeGLAccountsApiResource { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); - OfficeToGLAccountMappingData officeToGLAccountMappingData = this.officeToGLAccountMappingReadPlatformService.retrieve(mappingId); + FinancialActivityAccountData officeToGLAccountMappingData = this.financialActivityAccountReadPlatformService.retrieve(mappingId); if (settings.isTemplate()) { - OfficeToGLAccountMappingData templateData = this.officeToGLAccountMappingReadPlatformService.retrieveTemplate(); - officeToGLAccountMappingData = OfficeToGLAccountMappingData.associateTemplateData(templateData, officeToGLAccountMappingData); + FinancialActivityAccountData templateData = this.financialActivityAccountReadPlatformService.retrieveTemplate(); + officeToGLAccountMappingData = FinancialActivityAccountData.associateTemplateData(templateData, officeToGLAccountMappingData); } return this.apiJsonSerializerService.serialize(settings, officeToGLAccountMappingData, RESPONSE_DATA_PARAMETERS); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/data/FinancialActivityAccountData.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/data/FinancialActivityAccountData.java new file mode 100644 index 000000000..cdf41a11d --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/data/FinancialActivityAccountData.java @@ -0,0 +1,38 @@ +package org.mifosplatform.accounting.accountmapping.data; + +import java.util.List; +import java.util.Map; + +import org.mifosplatform.accounting.glaccount.data.GLAccountData; + +public class FinancialActivityAccountData { + + private final Long id; + private final GLAccountData glAccountData; + private final Map> accountingMappingOptions; + + public static FinancialActivityAccountData instance(final Long id, final GLAccountData glAccountData) { + final Map> accountingMappingOptions = null; + return new FinancialActivityAccountData(id, glAccountData, accountingMappingOptions); + } + + public static FinancialActivityAccountData template(final Map> accountingMappingOptions) { + final Long id = null; + final GLAccountData glAccountData = null; + return new FinancialActivityAccountData(id, glAccountData, accountingMappingOptions); + } + + public static FinancialActivityAccountData associateTemplateData(final FinancialActivityAccountData templateData, + final FinancialActivityAccountData accountMappingData) { + return new FinancialActivityAccountData(accountMappingData.id, accountMappingData.glAccountData, + templateData.accountingMappingOptions); + } + + private FinancialActivityAccountData(final Long id, final GLAccountData glAccountData, + final Map> accountingMappingOptions) { + this.id = id; + this.glAccountData = glAccountData; + this.accountingMappingOptions = accountingMappingOptions; + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/data/OfficeToGLAccountMappingData.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/data/OfficeToGLAccountMappingData.java deleted file mode 100755 index f542a3b06..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/data/OfficeToGLAccountMappingData.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.mifosplatform.accounting.accountmapping.data; - -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import org.mifosplatform.accounting.glaccount.data.GLAccountData; -import org.mifosplatform.organisation.office.data.OfficeData; - -public class OfficeToGLAccountMappingData { - - private final Long id; - private final OfficeData officeData; - private final GLAccountData glAccountData; - private final Map> accountingMappingOptions; - private final Collection officeOptions; - - public static OfficeToGLAccountMappingData instance(final Long id, final OfficeData officeData, final GLAccountData glAccountData) { - final Map> accountingMappingOptions = null; - final Collection officeOptions = null; - return new OfficeToGLAccountMappingData(id, officeData, glAccountData, accountingMappingOptions, officeOptions); - } - - public static OfficeToGLAccountMappingData template(final Map> accountingMappingOptions, - final Collection officeOptions) { - final Long id = null; - final OfficeData officeData = null; - final GLAccountData glAccountData = null; - return new OfficeToGLAccountMappingData(id, officeData, glAccountData, accountingMappingOptions, officeOptions); - } - - public static OfficeToGLAccountMappingData associateTemplateData(final OfficeToGLAccountMappingData templateData, - final OfficeToGLAccountMappingData accountMappingData) { - return new OfficeToGLAccountMappingData(accountMappingData.id, accountMappingData.officeData, accountMappingData.glAccountData, - templateData.accountingMappingOptions, templateData.officeOptions); - } - - private OfficeToGLAccountMappingData(final Long id, final OfficeData officeData, final GLAccountData glAccountData, - final Map> accountingMappingOptions, final Collection officeOptions) { - this.id = id; - this.officeData = officeData; - this.glAccountData = glAccountData; - this.accountingMappingOptions = accountingMappingOptions; - this.officeOptions = officeOptions; - } - -} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccount.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccount.java new file mode 100644 index 000000000..5f825ac2c --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccount.java @@ -0,0 +1,54 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.accounting.accountmapping.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import org.mifosplatform.accounting.glaccount.domain.GLAccount; +import org.springframework.data.jpa.domain.AbstractPersistable; + +@Entity +@Table(name = "acc_gl_financial_activity_account") +public class FinancialActivityAccount extends AbstractPersistable { + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "gl_account_id") + private GLAccount glAccount; + + @Column(name = "financial_activity_type", nullable = false) + private int financialActivityType; + + public static FinancialActivityAccount createNew(final GLAccount glAccount, final int financialAccountType) { + return new FinancialActivityAccount(glAccount, financialAccountType); + } + + protected FinancialActivityAccount() { + // + } + + private FinancialActivityAccount(final GLAccount glAccount, final int financialAccountType) { + this.glAccount = glAccount; + this.financialActivityType = financialAccountType; + } + + public GLAccount glAccount() { + return this.glAccount; + } + + public void updateGlAccount(final GLAccount glAccount) { + this.glAccount = glAccount; + } + + public int getFinancialActivityType() { + return this.financialActivityType; + } + +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccountRepository.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccountRepository.java new file mode 100644 index 000000000..50e42ea47 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccountRepository.java @@ -0,0 +1,19 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.accounting.accountmapping.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface FinancialActivityAccountRepository extends JpaRepository, + JpaSpecificationExecutor { + + @Query("from FinancialActivityAccount faa where faa.financialActivityType = :financialActivityType") + FinancialActivityAccount findByFinancialActivityType(@Param("financialActivityType") int financialAccountType); + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccountRepositoryWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccountRepositoryWrapper.java new file mode 100644 index 000000000..c8cd0a1dc --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/FinancialActivityAccountRepositoryWrapper.java @@ -0,0 +1,55 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.accounting.accountmapping.domain; + +import java.util.List; + +import org.mifosplatform.accounting.accountmapping.exception.FinancialActivityAccountNotFoundException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + *

+ * Wrapper for {@link FinancialActivityAccountRepository} that adds NULL + * checking and Error handling capabilities + *

+ */ +@Service +public class FinancialActivityAccountRepositoryWrapper { + + private final FinancialActivityAccountRepository repository; + + @Autowired + public FinancialActivityAccountRepositoryWrapper(final FinancialActivityAccountRepository repository) { + this.repository = repository; + } + + public FinancialActivityAccount findOneWithNotFoundDetection(final Long id) { + final FinancialActivityAccount financialActivityAccount = this.repository.findOne(id); + if (financialActivityAccount == null) { throw new FinancialActivityAccountNotFoundException(id); } + return financialActivityAccount; + } + + public FinancialActivityAccount findByFinancialActivityType(final int financialActivityType) { + return this.repository.findByFinancialActivityType(financialActivityType); + } + + public List findAll() { + return this.repository.findAll(); + } + + public void save(final FinancialActivityAccount entity) { + this.repository.save(entity); + } + + public void saveAndFlush(final FinancialActivityAccount entity) { + this.repository.saveAndFlush(entity); + } + + public void delete(final FinancialActivityAccount entity) { + this.repository.delete(entity); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMapping.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMapping.java deleted file mode 100755 index f6e0ef642..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMapping.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.accounting.accountmapping.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -import org.mifosplatform.accounting.glaccount.domain.GLAccount; -import org.mifosplatform.organisation.office.domain.Office; -import org.springframework.data.jpa.domain.AbstractPersistable; - -@Entity -@Table(name = "acc_gl_office_mapping") -public class OfficeToGLAccountMapping extends AbstractPersistable { - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "gl_account_id") - private GLAccount glAccount; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "office_id") - private Office office; - - @Column(name = "financial_account_type", nullable = false) - private int financialAccountType; - - public static OfficeToGLAccountMapping createNew(final GLAccount glAccount, final Office office, final int financialAccountType) { - return new OfficeToGLAccountMapping(glAccount, office, financialAccountType); - } - - protected OfficeToGLAccountMapping() { - // - } - - private OfficeToGLAccountMapping(final GLAccount glAccount, final Office office, final int financialAccountType) { - this.glAccount = glAccount; - this.office = office; - this.financialAccountType = financialAccountType; - } - - public GLAccount glAccount() { - return this.glAccount; - } - - public void updateGlAccount(final GLAccount glAccount) { - this.glAccount = glAccount; - } - - public Office office() { - return this.office; - } - - public void updateOffice(Office office) { - this.office = office; - } - - public int getFinancialAccountType() { - return this.financialAccountType; - } - - -} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMappingRepository.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMappingRepository.java deleted file mode 100755 index 31eb0995d..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMappingRepository.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.accounting.accountmapping.domain; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -public interface OfficeToGLAccountMappingRepository extends JpaRepository, - JpaSpecificationExecutor { - - @Query("from OfficeToGLAccountMapping otga where otga.office.id = :officeId and otga.financialAccountType = :financialAccountType") - OfficeToGLAccountMapping findByOfficeAndFinancialAccountType(@Param("officeId")Long officeId,@Param("financialAccountType") int financialAccountType); - - @Query("from OfficeToGLAccountMapping otga where otga.office.id =:officeId") - List findByOffice(@Param("officeId")Long officeId); -} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMappingRepositoryWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMappingRepositoryWrapper.java deleted file mode 100755 index 0e5c12d08..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/domain/OfficeToGLAccountMappingRepositoryWrapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.accounting.accountmapping.domain; - -import java.util.List; - -import org.mifosplatform.accounting.accountmapping.exception.OfficeToGLAccountMappingNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - *

- * Wrapper for {@link OfficeToGLAccountMappingRepository} that adds NULL - * checking and Error handling capabilities - *

- */ -@Service -public class OfficeToGLAccountMappingRepositoryWrapper { - - private final OfficeToGLAccountMappingRepository repository; - - @Autowired - public OfficeToGLAccountMappingRepositoryWrapper(final OfficeToGLAccountMappingRepository repository) { - this.repository = repository; - } - - public OfficeToGLAccountMapping findOneWithNotFoundDetection(final Long id) { - final OfficeToGLAccountMapping officeToGLAccountMapping = this.repository.findOne(id); - if (officeToGLAccountMapping == null) { throw new OfficeToGLAccountMappingNotFoundException(id); } - return officeToGLAccountMapping; - } - - public OfficeToGLAccountMapping findByOfficeAndFinancialAccountType(final Long officeId, final int financialAccountType) { - return this.repository.findByOfficeAndFinancialAccountType(officeId, financialAccountType); - } - - public List findByOffice(final Long officeId) { - return this.repository.findByOffice(officeId); - } - - public void save(final OfficeToGLAccountMapping entity) { - this.repository.save(entity); - } - - public void saveAndFlush(final OfficeToGLAccountMapping entity) { - this.repository.saveAndFlush(entity); - } - - public void delete(final OfficeToGLAccountMapping entity) { - this.repository.delete(entity); - } -} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/DuplicateOfficeToGLAccountMappingFoundException.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/DuplicateFinancialActivityAccountFoundException.java old mode 100755 new mode 100644 similarity index 65% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/DuplicateOfficeToGLAccountMappingFoundException.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/DuplicateFinancialActivityAccountFoundException.java index dee5821e9..e70cd780f --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/DuplicateOfficeToGLAccountMappingFoundException.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/DuplicateFinancialActivityAccountFoundException.java @@ -11,11 +11,11 @@ import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRul * A {@link RuntimeException} thrown when product to GL account mapping are not * found. */ -public class DuplicateOfficeToGLAccountMappingFoundException extends AbstractPlatformDomainRuleException { +public class DuplicateFinancialActivityAccountFoundException extends AbstractPlatformDomainRuleException { - public DuplicateOfficeToGLAccountMappingFoundException(final Long officeId, final Integer accountType) { - super("error.msg.officeToAccountMapping.exists.for.office", "Mapping for office with Id " + officeId - + " exist for an account of type " + accountType, officeId, accountType); + public DuplicateFinancialActivityAccountFoundException(final Integer financialActivityType) { + super("error.msg.officeToAccountMapping.exists.for.office", "Mapping for activity already exists " + financialActivityType, + financialActivityType); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/OfficeToGLAccountMappingNotFoundException.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/FinancialActivityAccountNotFoundException.java old mode 100755 new mode 100644 similarity index 82% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/OfficeToGLAccountMappingNotFoundException.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/FinancialActivityAccountNotFoundException.java index 6d61a52da..bcfedd10b --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/OfficeToGLAccountMappingNotFoundException.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/exception/FinancialActivityAccountNotFoundException.java @@ -11,14 +11,14 @@ import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceN * A {@link RuntimeException} thrown when product to GL account mapping are not * found. */ -public class OfficeToGLAccountMappingNotFoundException extends AbstractPlatformResourceNotFoundException { +public class FinancialActivityAccountNotFoundException extends AbstractPlatformResourceNotFoundException { - public OfficeToGLAccountMappingNotFoundException(final Long officeId, final String accountType) { + public FinancialActivityAccountNotFoundException(final Long officeId, final String accountType) { super("error.msg.officeToAccountMapping.not.found", "Mapping for office with Id " + officeId + " does not exist for an account of type " + accountType, officeId, accountType); } - public OfficeToGLAccountMappingNotFoundException(final Long id) { + public FinancialActivityAccountNotFoundException(final Long id) { super("error.msg.officeToAccountMapping.not.found", "Mapping for GL Account with Id " + id + " does not exist", id); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/CreateOfficeToGLAccountMappingHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/CreateFinancialActivityAccountHandler.java old mode 100755 new mode 100644 similarity index 67% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/CreateOfficeToGLAccountMappingHandler.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/CreateFinancialActivityAccountHandler.java index 4c2cd4e6e..3db068ab4 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/CreateOfficeToGLAccountMappingHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/CreateFinancialActivityAccountHandler.java @@ -5,7 +5,7 @@ */ package org.mifosplatform.accounting.accountmapping.handler; -import org.mifosplatform.accounting.accountmapping.service.OfficeToGLAccountMappingWritePlatformService; +import org.mifosplatform.accounting.accountmapping.service.FinancialActivityAccountWritePlatformService; import org.mifosplatform.commands.handler.NewCommandSourceHandler; import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; @@ -14,12 +14,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service -public class CreateOfficeToGLAccountMappingHandler implements NewCommandSourceHandler { +public class CreateFinancialActivityAccountHandler implements NewCommandSourceHandler { - private final OfficeToGLAccountMappingWritePlatformService writePlatformService; + private final FinancialActivityAccountWritePlatformService writePlatformService; @Autowired - public CreateOfficeToGLAccountMappingHandler(final OfficeToGLAccountMappingWritePlatformService writePlatformService) { + public CreateFinancialActivityAccountHandler(final FinancialActivityAccountWritePlatformService writePlatformService) { this.writePlatformService = writePlatformService; } @@ -27,6 +27,6 @@ public class CreateOfficeToGLAccountMappingHandler implements NewCommandSourceHa @Override public CommandProcessingResult processCommand(final JsonCommand command) { - return this.writePlatformService.createGLAccountMapping(command); + return this.writePlatformService.createGLAccountActivityMapping(command); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/DeleteOfficeToGLAccountMappingCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/DeleteFinancialActivityAccountCommandHandler.java old mode 100755 new mode 100644 similarity index 66% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/DeleteOfficeToGLAccountMappingCommandHandler.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/DeleteFinancialActivityAccountCommandHandler.java index 9f4b4bc9d..f1fbf6d3c --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/DeleteOfficeToGLAccountMappingCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/DeleteFinancialActivityAccountCommandHandler.java @@ -5,7 +5,7 @@ */ package org.mifosplatform.accounting.accountmapping.handler; -import org.mifosplatform.accounting.accountmapping.service.OfficeToGLAccountMappingWritePlatformService; +import org.mifosplatform.accounting.accountmapping.service.FinancialActivityAccountWritePlatformService; import org.mifosplatform.commands.handler.NewCommandSourceHandler; import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; @@ -14,18 +14,18 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service -public class DeleteOfficeToGLAccountMappingCommandHandler implements NewCommandSourceHandler { +public class DeleteFinancialActivityAccountCommandHandler implements NewCommandSourceHandler { - private final OfficeToGLAccountMappingWritePlatformService writePlatformService; + private final FinancialActivityAccountWritePlatformService writePlatformService; @Autowired - public DeleteOfficeToGLAccountMappingCommandHandler(final OfficeToGLAccountMappingWritePlatformService writePlatformService) { + public DeleteFinancialActivityAccountCommandHandler(final FinancialActivityAccountWritePlatformService writePlatformService) { this.writePlatformService = writePlatformService; } @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { - return this.writePlatformService.deleteGLAccountMapping(command.entityId(), command); + return this.writePlatformService.deleteGLAccountActivityMapping(command.entityId(), command); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/UpdateOfficeToGLAccountMappingCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/UpdateFinancialActivityAccountCommandHandler.java old mode 100755 new mode 100644 similarity index 66% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/UpdateOfficeToGLAccountMappingCommandHandler.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/UpdateFinancialActivityAccountCommandHandler.java index 3df80362f..b1ad61963 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/UpdateOfficeToGLAccountMappingCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/handler/UpdateFinancialActivityAccountCommandHandler.java @@ -5,7 +5,7 @@ */ package org.mifosplatform.accounting.accountmapping.handler; -import org.mifosplatform.accounting.accountmapping.service.OfficeToGLAccountMappingWritePlatformService; +import org.mifosplatform.accounting.accountmapping.service.FinancialActivityAccountWritePlatformService; import org.mifosplatform.commands.handler.NewCommandSourceHandler; import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; @@ -14,18 +14,18 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service -public class UpdateOfficeToGLAccountMappingCommandHandler implements NewCommandSourceHandler { +public class UpdateFinancialActivityAccountCommandHandler implements NewCommandSourceHandler { - private final OfficeToGLAccountMappingWritePlatformService writePlatformService; + private final FinancialActivityAccountWritePlatformService writePlatformService; @Autowired - public UpdateOfficeToGLAccountMappingCommandHandler(final OfficeToGLAccountMappingWritePlatformService writePlatformService) { + public UpdateFinancialActivityAccountCommandHandler(final FinancialActivityAccountWritePlatformService writePlatformService) { this.writePlatformService = writePlatformService; } @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { - return this.writePlatformService.updateGLAccountMapping(command.entityId(), command); + return this.writePlatformService.updateGLAccountActivityMapping(command.entityId(), command); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/serialization/OfficeToGLAccountMappingDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/serialization/FinancialActivityAccountDataValidator.java old mode 100755 new mode 100644 similarity index 86% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/serialization/OfficeToGLAccountMappingDataValidator.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/serialization/FinancialActivityAccountDataValidator.java index 8c5f35c13..4942f0bf7 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/serialization/OfficeToGLAccountMappingDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/serialization/FinancialActivityAccountDataValidator.java @@ -27,18 +27,18 @@ import com.google.gson.JsonElement; import com.google.gson.reflect.TypeToken; @Component -public final class OfficeToGLAccountMappingDataValidator { +public final class FinancialActivityAccountDataValidator { /** * The parameters supported for this command. */ private final Set supportedParameters = new HashSet(Arrays.asList("locale", - ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), "officeId")); + ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue())); private final FromJsonHelper fromApiJsonHelper; @Autowired - public OfficeToGLAccountMappingDataValidator(final FromJsonHelper fromApiJsonHelper) { + public FinancialActivityAccountDataValidator(final FromJsonHelper fromApiJsonHelper) { this.fromApiJsonHelper = fromApiJsonHelper; } @@ -58,9 +58,6 @@ public final class OfficeToGLAccountMappingDataValidator { baseDataValidator.reset().parameter(ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue()) .value(liabilityTransferInSuspenseAccountId).notNull().integerGreaterThanZero(); - final Long officeID = this.fromApiJsonHelper.extractLongNamed("officeId", element); - baseDataValidator.reset().parameter("officeId").value(officeID).notNull().integerGreaterThanZero(); - throwExceptionIfValidationWarningsExist(dataValidationErrors); } @@ -82,11 +79,6 @@ public final class OfficeToGLAccountMappingDataValidator { .value(liabilityTransferInSuspenseAccountId).notNull().integerGreaterThanZero(); } - if (this.fromApiJsonHelper.parameterExists("officeId", element)) { - final Long officeID = this.fromApiJsonHelper.extractLongNamed("officeId", element); - baseDataValidator.reset().parameter("officeId").value(officeID).notNull().integerGreaterThanZero(); - } - throwExceptionIfValidationWarningsExist(dataValidationErrors); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountReadPlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountReadPlatformService.java new file mode 100644 index 000000000..ec2c4aa1d --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountReadPlatformService.java @@ -0,0 +1,20 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.accounting.accountmapping.service; + +import java.util.List; + +import org.mifosplatform.accounting.accountmapping.data.FinancialActivityAccountData; + +public interface FinancialActivityAccountReadPlatformService { + + List retrieveAll(); + + FinancialActivityAccountData retrieve(Long mappingId); + + FinancialActivityAccountData retrieveTemplate(); + +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountReadPlatformServiceImpl.java new file mode 100644 index 000000000..78bfe5322 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountReadPlatformServiceImpl.java @@ -0,0 +1,91 @@ +package org.mifosplatform.accounting.accountmapping.service; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; +import java.util.Map; + +import org.mifosplatform.accounting.accountmapping.data.FinancialActivityAccountData; +import org.mifosplatform.accounting.accountmapping.exception.FinancialActivityAccountNotFoundException; +import org.mifosplatform.accounting.common.AccountingDropdownReadPlatformService; +import org.mifosplatform.accounting.glaccount.data.GLAccountData; +import org.mifosplatform.infrastructure.core.domain.JdbcSupport; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.EmptyResultDataAccessException; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.stereotype.Service; + +@Service +public class FinancialActivityAccountReadPlatformServiceImpl implements FinancialActivityAccountReadPlatformService { + + private final JdbcTemplate jdbcTemplate; + private final FinancialActivityAccountMapper financialActivityAccountMapper; + private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService; + + @Autowired + public FinancialActivityAccountReadPlatformServiceImpl(final RoutingDataSource dataSource, + final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) { + financialActivityAccountMapper = new FinancialActivityAccountMapper(); + this.jdbcTemplate = new JdbcTemplate(dataSource); + this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService; + } + + @Override + public List retrieveAll() { + String sql = "select " + financialActivityAccountMapper.schema(); + return this.jdbcTemplate.query(sql, financialActivityAccountMapper, new Object[] {}); + } + + @Override + public FinancialActivityAccountData retrieve(Long mappingId) { + try { + StringBuilder sqlBuilder = new StringBuilder(200); + sqlBuilder.append("select "); + sqlBuilder.append(this.financialActivityAccountMapper.schema()); + sqlBuilder.append(" where faa.id=?"); + return this.jdbcTemplate.queryForObject(sqlBuilder.toString(), this.financialActivityAccountMapper, new Object[] { mappingId }); + } catch (final EmptyResultDataAccessException e) { + throw new FinancialActivityAccountNotFoundException(mappingId); + } + } + + @Override + public FinancialActivityAccountData retrieveTemplate() { + final Map> accountOptions = this.accountingDropdownReadPlatformService.retrieveAccountMappingOptions(); + return FinancialActivityAccountData.template(accountOptions); + } + + private static final class FinancialActivityAccountMapper implements RowMapper { + + private final String sql; + + public FinancialActivityAccountMapper() { + StringBuilder sb = new StringBuilder(300); + sb.append(" faa.id , glaccount.id as glAccountId,glaccount.name as glAccountName,glaccount.gl_code as glCode "); + sb.append(" from acc_gl_financial_activity_account faa "); + sb.append(" join acc_gl_account glaccount on glaccount.id = faa.gl_account_id"); + sql = sb.toString(); + } + + public String schema() { + return sql; + } + + @Override + public FinancialActivityAccountData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException { + final Long id = JdbcSupport.getLong(rs, "id"); + final Long glAccountId = JdbcSupport.getLong(rs, "glAccountId"); + final String glAccountName = rs.getString("glAccountName"); + final String glCode = rs.getString("glCode"); + + final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode); + + final FinancialActivityAccountData accountMappingData = FinancialActivityAccountData.instance(id, gLAccountData); + return accountMappingData; + } + + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingWritePlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountWritePlatformService.java old mode 100755 new mode 100644 similarity index 55% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingWritePlatformService.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountWritePlatformService.java index 9f163d837..2dfad021c --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingWritePlatformService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountWritePlatformService.java @@ -8,12 +8,12 @@ package org.mifosplatform.accounting.accountmapping.service; import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; -public interface OfficeToGLAccountMappingWritePlatformService { +public interface FinancialActivityAccountWritePlatformService { - CommandProcessingResult createGLAccountMapping(JsonCommand command); + CommandProcessingResult createGLAccountActivityMapping(JsonCommand command); - CommandProcessingResult updateGLAccountMapping(Long mappingId, JsonCommand command); + CommandProcessingResult updateGLAccountActivityMapping(Long mappingId, JsonCommand command); - CommandProcessingResult deleteGLAccountMapping(Long mappingId, JsonCommand command); + CommandProcessingResult deleteGLAccountActivityMapping(Long mappingId, JsonCommand command); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountWritePlatformServiceImpl.java old mode 100755 new mode 100644 similarity index 55% rename from mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingWritePlatformServiceImpl.java rename to mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountWritePlatformServiceImpl.java index 2d827dc6e..405ba8b2a --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/FinancialActivityAccountWritePlatformServiceImpl.java @@ -3,11 +3,10 @@ package org.mifosplatform.accounting.accountmapping.service; import java.util.HashMap; import java.util.Map; -import org.mifosplatform.accounting.accountmapping.domain.OfficeToGLAccountMapping; -import org.mifosplatform.accounting.accountmapping.domain.OfficeToGLAccountMappingRepositoryWrapper; -import org.mifosplatform.accounting.accountmapping.exception.DuplicateOfficeToGLAccountMappingFoundException; -import org.mifosplatform.accounting.accountmapping.exception.MappingUpdateNotSupportedException; -import org.mifosplatform.accounting.accountmapping.serialization.OfficeToGLAccountMappingDataValidator; +import org.mifosplatform.accounting.accountmapping.domain.FinancialActivityAccount; +import org.mifosplatform.accounting.accountmapping.domain.FinancialActivityAccountRepositoryWrapper; +import org.mifosplatform.accounting.accountmapping.exception.DuplicateFinancialActivityAccountFoundException; +import org.mifosplatform.accounting.accountmapping.serialization.FinancialActivityAccountDataValidator; import org.mifosplatform.accounting.common.AccountingConstants.ORGANIZATION_ACCOUNTING_PARAMS; import org.mifosplatform.accounting.common.AccountingConstants.ORGANIZATION_ACCOUNTS; import org.mifosplatform.accounting.glaccount.domain.GLAccount; @@ -18,72 +17,64 @@ import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; import org.mifosplatform.infrastructure.core.data.CommandProcessingResultBuilder; import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper; -import org.mifosplatform.organisation.office.domain.Office; -import org.mifosplatform.organisation.office.domain.OfficeRepositoryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.google.gson.JsonElement; @Service -public class OfficeToGLAccountMappingWritePlatformServiceImpl implements OfficeToGLAccountMappingWritePlatformService { +public class FinancialActivityAccountWritePlatformServiceImpl implements FinancialActivityAccountWritePlatformService { - private final OfficeToGLAccountMappingRepositoryWrapper accountMappingRepository; - private final OfficeToGLAccountMappingDataValidator fromApiJsonDeserializer; + private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository; + private final FinancialActivityAccountDataValidator fromApiJsonDeserializer; private final FromJsonHelper fromApiJsonHelper; private final GLAccountRepositoryWrapper glAccountRepositoryWrapper; - private final OfficeRepositoryWrapper officeRepositoryWrapper; @Autowired - public OfficeToGLAccountMappingWritePlatformServiceImpl(final OfficeToGLAccountMappingRepositoryWrapper accountMappingRepository, - final OfficeToGLAccountMappingDataValidator fromApiJsonDeserializer, final FromJsonHelper fromApiJsonHelper, - final GLAccountRepositoryWrapper glAccountRepositoryWrapper, final OfficeRepositoryWrapper officeRepositoryWrapper) { - this.accountMappingRepository = accountMappingRepository; + public FinancialActivityAccountWritePlatformServiceImpl( + final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository, + final FinancialActivityAccountDataValidator fromApiJsonDeserializer, final FromJsonHelper fromApiJsonHelper, + final GLAccountRepositoryWrapper glAccountRepositoryWrapper) { + this.financialActivityAccountRepository = financialActivityAccountRepository; this.fromApiJsonDeserializer = fromApiJsonDeserializer; this.fromApiJsonHelper = fromApiJsonHelper; this.glAccountRepositoryWrapper = glAccountRepositoryWrapper; - this.officeRepositoryWrapper = officeRepositoryWrapper; } @Override - public CommandProcessingResult createGLAccountMapping(JsonCommand command) { + public CommandProcessingResult createGLAccountActivityMapping(JsonCommand command) { this.fromApiJsonDeserializer.validateForCreate(command.json()); final JsonElement element = this.fromApiJsonHelper.parse(command.json()); - final Long officeId = this.fromApiJsonHelper.extractLongNamed("officeId", element); - final Office office = this.officeRepositoryWrapper.findOneWithNotFoundDetection(officeId); - OfficeToGLAccountMapping accountMapping = createLiabilityTrasferSuspenceMapping(office, element); - checkForExistingMapping(accountMapping); - this.accountMappingRepository.save(accountMapping); + FinancialActivityAccount financialActivityAccount = createLiabilityTrasferSuspenceMapping(element); + checkForExistingMapping(financialActivityAccount); + this.financialActivityAccountRepository.save(financialActivityAccount); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // - .withEntityId(accountMapping.getId()) // + .withEntityId(financialActivityAccount.getId()) // .build(); } - private void checkForExistingMapping(final OfficeToGLAccountMapping accountMapping) { - OfficeToGLAccountMapping existingMapping = this.accountMappingRepository.findByOfficeAndFinancialAccountType(accountMapping - .office().getId(), accountMapping.getFinancialAccountType()); - if (existingMapping != null && !existingMapping.getId().equals(accountMapping.getId())) { throw new DuplicateOfficeToGLAccountMappingFoundException( - accountMapping.office().getId(), accountMapping.getFinancialAccountType()); } + private void checkForExistingMapping(final FinancialActivityAccount financialActivityAccount) { + FinancialActivityAccount existingMapping = this.financialActivityAccountRepository + .findByFinancialActivityType(financialActivityAccount.getFinancialActivityType()); + if (existingMapping != null) { throw new DuplicateFinancialActivityAccountFoundException( + financialActivityAccount.getFinancialActivityType()); } } @Override - public CommandProcessingResult updateGLAccountMapping(Long mappingId, JsonCommand command) { + public CommandProcessingResult updateGLAccountActivityMapping(Long mappingId, JsonCommand command) { this.fromApiJsonDeserializer.validateForUpdate(command.json()); - final OfficeToGLAccountMapping officeToGLAccountMapping = this.accountMappingRepository.findOneWithNotFoundDetection(mappingId); - Map changes = findChanges(command, officeToGLAccountMapping); + final FinancialActivityAccount financialActivityAccount = this.financialActivityAccountRepository + .findOneWithNotFoundDetection(mappingId); + Map changes = findChanges(command, financialActivityAccount); final JsonElement element = this.fromApiJsonHelper.parse(command.json()); if (changes.containsKey(ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue())) { final GLAccount glAccount = fetchGLAccount(element, ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), GLAccountType.LIABILITY); - officeToGLAccountMapping.updateGlAccount(glAccount); - } - - if (!changes.isEmpty()) { - checkForExistingMapping(officeToGLAccountMapping); - this.accountMappingRepository.save(officeToGLAccountMapping); + financialActivityAccount.updateGlAccount(glAccount); + this.financialActivityAccountRepository.save(financialActivityAccount); } return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -93,20 +84,21 @@ public class OfficeToGLAccountMappingWritePlatformServiceImpl implements OfficeT } @Override - public CommandProcessingResult deleteGLAccountMapping(Long mappingId, JsonCommand command) { - final OfficeToGLAccountMapping officeToGLAccountMapping = this.accountMappingRepository.findOneWithNotFoundDetection(mappingId); - this.accountMappingRepository.delete(officeToGLAccountMapping); + public CommandProcessingResult deleteGLAccountActivityMapping(Long mappingId, JsonCommand command) { + final FinancialActivityAccount officeToGLAccountMapping = this.financialActivityAccountRepository + .findOneWithNotFoundDetection(mappingId); + this.financialActivityAccountRepository.delete(officeToGLAccountMapping); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withEntityId(mappingId) // .build(); } - private OfficeToGLAccountMapping createLiabilityTrasferSuspenceMapping(final Office office, final JsonElement element) { + private FinancialActivityAccount createLiabilityTrasferSuspenceMapping(final JsonElement element) { final GLAccount glAccount = fetchGLAccount(element, ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), GLAccountType.LIABILITY); final Integer financialAccountType = ORGANIZATION_ACCOUNTS.LIABILITY_TRANSFER_SUSPENSE.getValue(); - return OfficeToGLAccountMapping.createNew(glAccount, office, financialAccountType); + return FinancialActivityAccount.createNew(glAccount, financialAccountType); } private GLAccount fetchGLAccount(final JsonElement element, final String paramName, final GLAccountType expectedAccountType) { @@ -133,19 +125,11 @@ public class OfficeToGLAccountMappingWritePlatformServiceImpl implements OfficeT return glAccount; } - public Map findChanges(JsonCommand command, OfficeToGLAccountMapping accountMapping) { + public Map findChanges(JsonCommand command, FinancialActivityAccount financialActivityAccount) { Map changes = new HashMap(); - final String officeParamName = "officeId"; - Long existingOfficeId = accountMapping.office().getId(); - if (command.isChangeInLongParameterNamed(officeParamName, existingOfficeId)) { - final Long newValue = command.longValueOfParameterNamed(officeParamName); - String defaultMsg = "Office updating not allowed "; - throw new MappingUpdateNotSupportedException("officeId", defaultMsg, newValue,existingOfficeId,accountMapping.getId()); - } - - Long existingGLAccountId = accountMapping.glAccount().getId(); + Long existingGLAccountId = financialActivityAccount.glAccount().getId(); if (command .isChangeInLongParameterNamed(ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), existingGLAccountId)) { final Long newValue = command.longValueOfParameterNamed(ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingReadPlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingReadPlatformService.java deleted file mode 100755 index 15f5718d5..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingReadPlatformService.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.accounting.accountmapping.service; - - -import org.mifosplatform.accounting.accountmapping.data.OfficeToGLAccountMappingData; -import org.mifosplatform.infrastructure.core.service.Page; -import org.mifosplatform.portfolio.group.service.SearchParameters; - -public interface OfficeToGLAccountMappingReadPlatformService { - - Page retrieveAll(final SearchParameters searchParameters); - - OfficeToGLAccountMappingData retrieve(Long mappingId); - - OfficeToGLAccountMappingData retrieveTemplate(); - -} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingReadPlatformServiceImpl.java deleted file mode 100755 index ee70cbfd0..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accountmapping/service/OfficeToGLAccountMappingReadPlatformServiceImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.mifosplatform.accounting.accountmapping.service; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import org.joda.time.LocalDate; -import org.mifosplatform.accounting.accountmapping.data.OfficeToGLAccountMappingData; -import org.mifosplatform.accounting.accountmapping.exception.OfficeToGLAccountMappingNotFoundException; -import org.mifosplatform.accounting.common.AccountingDropdownReadPlatformService; -import org.mifosplatform.accounting.glaccount.data.GLAccountData; -import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.Page; -import org.mifosplatform.infrastructure.core.service.PaginationHelper; -import org.mifosplatform.infrastructure.core.service.RoutingDataSource; -import org.mifosplatform.organisation.office.data.OfficeData; -import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; -import org.mifosplatform.portfolio.group.service.SearchParameters; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.stereotype.Service; - -@Service -public class OfficeToGLAccountMappingReadPlatformServiceImpl implements OfficeToGLAccountMappingReadPlatformService { - - private final JdbcTemplate jdbcTemplate; - private final OfficeToGLAccountMappingMapper accountMappingMapper; - private final PaginationHelper paginationHelper = new PaginationHelper(); - private final OfficeReadPlatformService officeReadPlatformService; - private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService; - - @Autowired - public OfficeToGLAccountMappingReadPlatformServiceImpl(final RoutingDataSource dataSource, - final OfficeReadPlatformService officeReadPlatformService, - final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) { - accountMappingMapper = new OfficeToGLAccountMappingMapper(); - this.jdbcTemplate = new JdbcTemplate(dataSource); - this.officeReadPlatformService = officeReadPlatformService; - this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService; - } - - @Override - public Page retrieveAll(final SearchParameters searchParameters) { - StringBuilder sqlBuilder = new StringBuilder(300); - sqlBuilder.append("select SQL_CALC_FOUND_ROWS "); - sqlBuilder.append(this.accountMappingMapper.schema()); - Object[] finalObjectArray = {}; - if (searchParameters.isOrderByRequested()) { - sqlBuilder.append(" order by ").append(searchParameters.getOrderBy()); - - if (searchParameters.isSortOrderProvided()) { - sqlBuilder.append(' ').append(searchParameters.getSortOrder()); - } - } - - if (searchParameters.isLimited()) { - sqlBuilder.append(" limit ").append(searchParameters.getLimit()); - if (searchParameters.isOffset()) { - sqlBuilder.append(" offset ").append(searchParameters.getOffset()); - } - } - final String sqlCountRows = "SELECT FOUND_ROWS()"; - return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), finalObjectArray, - this.accountMappingMapper); - } - - @Override - public OfficeToGLAccountMappingData retrieve(Long mappingId) { - try { - StringBuilder sqlBuilder = new StringBuilder(200); - sqlBuilder.append("select "); - sqlBuilder.append(this.accountMappingMapper.schema()); - sqlBuilder.append(" where om.id=?"); - return this.jdbcTemplate.queryForObject(sqlBuilder.toString(), this.accountMappingMapper, new Object[] { mappingId }); - } catch (final EmptyResultDataAccessException e) { - throw new OfficeToGLAccountMappingNotFoundException(mappingId); - } - } - - @Override - public OfficeToGLAccountMappingData retrieveTemplate() { - Collection officeOptions = this.officeReadPlatformService.retrieveAllOfficesForDropdown(); - final Map> accountOptions = this.accountingDropdownReadPlatformService.retrieveAccountMappingOptions(); - return OfficeToGLAccountMappingData.template(accountOptions, officeOptions); - } - - private static final class OfficeToGLAccountMappingMapper implements RowMapper { - - private final String sql; - - public OfficeToGLAccountMappingMapper() { - StringBuilder sb = new StringBuilder(300); - sb.append("om.id , office.id as officeId, office.name as officeName, "); - sb.append(" glaccount.id as glAccountId,glaccount.name as glAccountName,glaccount.gl_code as glCode "); - sb.append(" from acc_gl_office_mapping om "); - sb.append("inner join m_office office on office.id = om.office_id "); - sb.append("inner join acc_gl_account glaccount on glaccount.id = om.gl_account_id"); - sql = sb.toString(); - } - - public String schema() { - return sql; - } - - @Override - public OfficeToGLAccountMappingData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException { - final Long id = JdbcSupport.getLong(rs, "id"); - final Long officeId = JdbcSupport.getLong(rs, "officeId"); - final String officeName = rs.getString("officeName"); - final String nameDecorated = null; - final String externalId = null; - final LocalDate openingDate = null; - final String hierarchy = null; - final Long parentId = null; - final String parentName = null; - final Collection allowedParents = null; - final OfficeData officeData = new OfficeData(officeId, officeName, nameDecorated, externalId, openingDate, hierarchy, parentId, - parentName, allowedParents); - - final Long glAccountId = JdbcSupport.getLong(rs, "glAccountId"); - final String glAccountName = rs.getString("glAccountName"); - final String glCode = rs.getString("glCode"); - - final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode); - - final OfficeToGLAccountMappingData accountMappingData = OfficeToGLAccountMappingData.instance(id, officeData, gLAccountData); - return accountMappingData; - } - - } - -} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java index f9057fca2..63b231f51 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java @@ -14,9 +14,9 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; import org.joda.time.LocalDate; -import org.mifosplatform.accounting.accountmapping.domain.OfficeToGLAccountMapping; -import org.mifosplatform.accounting.accountmapping.domain.OfficeToGLAccountMappingRepository; -import org.mifosplatform.accounting.accountmapping.exception.OfficeToGLAccountMappingNotFoundException; +import org.mifosplatform.accounting.accountmapping.domain.FinancialActivityAccount; +import org.mifosplatform.accounting.accountmapping.domain.FinancialActivityAccountRepository; +import org.mifosplatform.accounting.accountmapping.exception.FinancialActivityAccountNotFoundException; import org.mifosplatform.accounting.closure.domain.GLClosure; import org.mifosplatform.accounting.closure.domain.GLClosureRepository; import org.mifosplatform.accounting.common.AccountingConstants.ACCRUAL_ACCOUNTS_FOR_LOAN; @@ -61,7 +61,7 @@ public class AccountingProcessorHelper { public static final String SAVINGS_TRANSACTION_IDENTIFIER = "S"; private final JournalEntryRepository glJournalEntryRepository; private final ProductToGLAccountMappingRepository accountMappingRepository; - private final OfficeToGLAccountMappingRepository officeToGLAccountMappingRepository; + private final FinancialActivityAccountRepository officeToGLAccountMappingRepository; private final GLClosureRepository closureRepository; private final OfficeRepository officeRepository; private final LoanTransactionRepository loanTransactionRepository; @@ -73,7 +73,7 @@ public class AccountingProcessorHelper { final ProductToGLAccountMappingRepository accountMappingRepository, final GLClosureRepository closureRepository, final OfficeRepository officeRepository, final LoanTransactionRepository loanTransactionRepository, final SavingsAccountTransactionRepository savingsAccountTransactionRepository, - final OfficeToGLAccountMappingRepository officeToGLAccountMappingRepository, + final FinancialActivityAccountRepository officeToGLAccountMappingRepository, final AccountTransfersReadPlatformService accountTransfersReadPlatformService) { this.glJournalEntryRepository = glJournalEntryRepository; this.accountMappingRepository = accountMappingRepository; @@ -572,11 +572,11 @@ public class AccountingProcessorHelper { Long officeId) { GLAccount glAccount = null; if (isOrganizationAccount(accountMappingTypeId)) { - OfficeToGLAccountMapping accountMapping = this.officeToGLAccountMappingRepository.findByOfficeAndFinancialAccountType(officeId, - accountMappingTypeId); - if (accountMapping == null) { throw new OfficeToGLAccountMappingNotFoundException(officeId, + FinancialActivityAccount financialActivityAccount = this.officeToGLAccountMappingRepository + .findByFinancialActivityType(accountMappingTypeId); + if (financialActivityAccount == null) { throw new FinancialActivityAccountNotFoundException(officeId, String.valueOf(accountMappingTypeId)); } - glAccount = accountMapping.glAccount(); + glAccount = financialActivityAccount.glAccount(); } else { ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(loanProductId, PortfolioProductType.LOAN.getValue(), accountMappingTypeId); @@ -652,11 +652,11 @@ public class AccountingProcessorHelper { final Long paymentTypeId, Long officeId) { GLAccount glAccount = null; if (isOrganizationAccount(accountMappingTypeId)) { - OfficeToGLAccountMapping accountMapping = this.officeToGLAccountMappingRepository.findByOfficeAndFinancialAccountType(officeId, - accountMappingTypeId); - if (accountMapping == null) { throw new OfficeToGLAccountMappingNotFoundException(officeId, + FinancialActivityAccount financialActivityAccount = this.officeToGLAccountMappingRepository + .findByFinancialActivityType(accountMappingTypeId); + if (financialActivityAccount == null) { throw new FinancialActivityAccountNotFoundException(officeId, String.valueOf(accountMappingTypeId)); } - glAccount = accountMapping.glAccount(); + glAccount = financialActivityAccount.glAccount(); } else { ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId, PortfolioProductType.SAVING.getValue(), accountMappingTypeId); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java index 9b33c32ab..8861c7738 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java @@ -790,11 +790,11 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer } else if (wrapper.isOfficeToGLAccountMapping()) { if (wrapper.isCreate()) { - handler = this.applicationContext.getBean("createOfficeToGLAccountMappingHandler", NewCommandSourceHandler.class); + handler = this.applicationContext.getBean("createFinancialActivityAccountHandler", NewCommandSourceHandler.class); } else if (wrapper.isUpdate()) { - handler = this.applicationContext.getBean("updateOfficeToGLAccountMappingCommandHandler", NewCommandSourceHandler.class); + handler = this.applicationContext.getBean("updateFinancialActivityAccountCommandHandler", NewCommandSourceHandler.class); } else if (wrapper.isDelete()) { - handler = this.applicationContext.getBean("deleteOfficeToGLAccountMappingCommandHandler", NewCommandSourceHandler.class); + handler = this.applicationContext.getBean("deleteFinancialActivityAccountCommandHandler", NewCommandSourceHandler.class); } else { throw new UnsupportedCommandException(wrapper.commandName()); }