You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by emmanuelnnaa <gi...@git.apache.org> on 2016/08/02 11:27:40 UTC

[GitHub] incubator-fineract pull request #192: commit FINERACT-54 (Add ability to del...

GitHub user emmanuelnnaa opened a pull request:

    https://github.com/apache/incubator-fineract/pull/192

    commit FINERACT-54 (Add ability to delete code values by setting a flag (is_active) to 0)

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/emmanuelnnaa/incubator-fineract FINERACT-54

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-fineract/pull/192.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #192
    
----
commit fb43727b0127bb3c4ef19c88ecf544969e00f1ac
Author: Emmanuel Nnaa <em...@musoni.eu>
Date:   2016-07-20T12:18:49Z

    commit FINERACT-54 (Add ability to delete code values by setting a flag (is_active) to 0)

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-fineract pull request #192: commit FINERACT-54 (Add ability to del...

Posted by nazeer1100126 <gi...@git.apache.org>.
Github user nazeer1100126 commented on a diff in the pull request:

    https://github.com/apache/incubator-fineract/pull/192#discussion_r73326113
  
    --- Diff: fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java ---
    @@ -96,12 +97,27 @@ public CodeValueData retrieveCodeValue(final Long codeValueId) {
                 this.context.authenticatedUser();
     
                 final CodeValueDataMapper rm = new CodeValueDataMapper();
    -            final String sql = "select " + rm.schema() + "where cv.id = ? order by position";
    +            final String sql = "select " + rm.schema() + " where cv.id = ? and cv.is_active = 1 order by position";
     
                 return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeValueId });
             } catch (final EmptyResultDataAccessException e) {
                 throw new CodeValueNotFoundException(codeValueId);
             }
     
         }
    +
    +    @Override
    +    public Collection<CodeValueData> retrieveAllActiveCodeValues(Long codeId) {
    +        final Collection<CodeValueData> codeValues = this.retrieveAllCodeValues(codeId);
    --- End diff --
    
    Suggestion: get Active Code values from DB instead of getting all and looping them to find active ones. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-fineract pull request #192: commit FINERACT-54 (Add ability to del...

Posted by nazeer1100126 <gi...@git.apache.org>.
Github user nazeer1100126 commented on a diff in the pull request:

    https://github.com/apache/incubator-fineract/pull/192#discussion_r73325637
  
    --- Diff: fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java ---
    @@ -86,11 +88,16 @@ public CodeValuesApiResource(final PlatformSecurityContext context, final CodeVa
         @GET
         @Consumes({ MediaType.APPLICATION_JSON })
         @Produces({ MediaType.APPLICATION_JSON })
    -    public String retrieveAllCodeValues(@Context final UriInfo uriInfo, @PathParam("codeId") final Long codeId) {
    +    public String retrieveAllCodeValues(@Context final UriInfo uriInfo, @PathParam("codeId") final Long codeId, 
    +            @QueryParam("includeDeletedCodeValues") final String includeDeletedCodeValues) {
     
             this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
     
    -        final Collection<CodeValueData> codeValues = this.readPlatformService.retrieveAllCodeValues(codeId);
    +        Collection<CodeValueData> codeValues = this.readPlatformService.retrieveAllActiveCodeValues(codeId);
    --- End diff --
    
    avoid multiple DB calls when includeDeletedCodeValues is true 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---