Skip to content

Commit

Permalink
Dev to master : beneficiary tag bug fix, downsync pagination fix (#576)
Browse files Browse the repository at this point in the history
* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-4062: added count api changes for household

* HLM-4062: Updated findbyid references

* HLM-4062: Updated pom.xml of household

* Hlm 3376 reviewcomments (#524)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-3376: added comments as per review comments

* HLM-3376 : added changes as per code review comments, each column's name included in query

* HLM-3376: query column names

* Hlm 4062 count api (#547)

* hlm-4062: updated household

* HLM-4062: added  count api support using cte for household

* HLM-4062: updated HouseholdRepository.java

* updated householdrowmapper.java

* HLM-4062:code refactor, removed useCTE parameter

* Project beneficiary tag cherrypick (#539)

* added downsync dummy api

* added downsync dummy api with res

* HLM-4062: added count api changes for household

* HLM-4062: Updated findbyid references

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-4062: Updated pom.xml of household

* Hlm 3376 reviewcomments (#524)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-3376: added comments as per review comments

* HLM-3376 : added changes as per code review comments, each column's name included in query

* HLM-3376: query column names

* Dev (#537)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-4062: added count api changes for household

* HLM-4062: Updated findbyid references

* HLM-4062: Updated pom.xml of household

* Hlm 3376 reviewcomments (#524)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-3376: added comments as per review comments

* HLM-3376 : added changes as per code review comments, each column's name included in query

* HLM-3376: query column names

---------

Co-authored-by: kanishq-egov <[email protected]>
Co-authored-by: kanishq-egov <[email protected]>

* Added project beneficiary tag field

* renamed project beneficiary tag to voucher tag

* Added project beneficiary tag field

* renamed project beneficiary tag to voucher tag

* rebased project-persister.yml from configs

* updated pom.xml: update common model version to 1.0.10

* updated db script, added unique constraint to tag column

* updated referral-management.yml

* updated db script

* project beneficiary voucher tag uniqueness validator and search support

* updated PbVoucherTagUniqueValidator.java

* Added and updated for unique field voucher tag create and update scenario

* project beneficiary bug fix

* removed unused import

* project beneficiary : voucherTag renamed to tag

* Hlm 4062 count api (#547) (#548)

* hlm-4062: updated household

* HLM-4062: added  count api support using cte for household

* HLM-4062: updated HouseholdRepository.java

* updated householdrowmapper.java

* HLM-4062:code refactor, removed useCTE parameter

Co-authored-by: kanishq-egov <[email protected]>

* referral management project beneficiary validation fix

* deleted persister and indexer file from project module resource folder

---------

Co-authored-by: kavi_elrey <[email protected]>
Co-authored-by: Vishal <[email protected]>

* HH member clientrefid (#551)

* adding clientRefId, Models version change, migration file

* adding clientRefId for HouseholdMemberSearch as List

* updated migration

* adding Notnull for clientrefId

---------

Co-authored-by: Vishal <[email protected]>

* Downsync smc referral module (#556)

* added downsync dummy api

* added downsync dummy api with res

* HLM-4062: added count api changes for household

* HLM-4062: Updated findbyid references

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-4062: Updated pom.xml of household

* Hlm 3376 reviewcomments (#524)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-3376: added comments as per review comments

* HLM-3376 : added changes as per code review comments, each column's name included in query

* HLM-3376: query column names

* Dev (#537)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-4062: added count api changes for household

* HLM-4062: Updated findbyid references

* HLM-4062: Updated pom.xml of household

* Hlm 3376 reviewcomments (#524)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-3376: added comments as per review comments

* HLM-3376 : added changes as per code review comments, each column's name included in query

* HLM-3376: query column names

---------

Co-authored-by: kanishq-egov <[email protected]>
Co-authored-by: kanishq-egov <[email protected]>

* Added project beneficiary tag field

* renamed project beneficiary tag to voucher tag

* Hlm 4062 count api (#547) (#548)

* hlm-4062: updated household

* HLM-4062: added  count api support using cte for household

* HLM-4062: updated HouseholdRepository.java

* updated householdrowmapper.java

* HLM-4062:code refactor, removed useCTE parameter

Co-authored-by: kanishq-egov <[email protected]>

* Project beneficiary tag cherrypick (#549)

* Added project beneficiary tag field

* renamed project beneficiary tag to voucher tag

* rebased project-persister.yml from configs

* updated pom.xml: update common model version to 1.0.10

* updated db script, added unique constraint to tag column

* updated referral-management.yml

* updated db script

* project beneficiary voucher tag uniqueness validator and search support

* updated PbVoucherTagUniqueValidator.java

* Added and updated for unique field voucher tag create and update scenario

* project beneficiary bug fix

* removed unused import

* project beneficiary : voucherTag renamed to tag

* referral management project beneficiary validation fix

---------

Co-authored-by: kanishq-egov <[email protected]>
Co-authored-by: Vishal <[email protected]>

* dummy api with same pagination response

* dummy api with same pagination response

* dummy api with same pagination response

* downsync data test

* data integrated till beneficiary

* Update CHANGELOG.md

* Delete health-services/project/src/main/resources/project-persistor.yml

* skip on empty result added

* skip on empty result added

* beneficary searhc based on individual clientref id added

* sideeffetc, ref, task fetch added

* tasks earch fix

* referral search fix

---------

Co-authored-by: kavi_elrey <[email protected]>
Co-authored-by: Vishal <[email protected]>

* Dev downsync fix smc (#561)

* household model reverse

* Update CHANGELOG.md

* Added changes for includeDeleted for downsync

* not null added

---------

Co-authored-by: kavi_elrey <[email protected]>
Co-authored-by: kanishq-egov <[email protected]>

* Dev master conflict fix (#562)

* HLM-3069: updated build.config.yml

* HLM-3069: updated build-config.yml renamed adrm to referralmanagement

* HLM-3372: increased stock version from 1.1.0 to 1.1.1-beta and project version from 1.1.0 to 1.1.1-beta

* referralmanagement version 1.0.0-beta, added changelog, localsetup

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* HLM-3069: null project beneficiary validation error fix

* HLM-3069: added comments and splitted validation condition

* Dev to master (#550)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-4062: added count api changes for household

* HLM-4062: Updated findbyid references

* HLM-4062: Updated pom.xml of household

* Hlm 3376 reviewcomments (#524)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-3376: added comments as per review comments

* HLM-3376 : added changes as per code review comments, each column's name included in query

* HLM-3376: query column names

* Hlm 4062 count api (#547)

* hlm-4062: updated household

* HLM-4062: added  count api support using cte for household

* HLM-4062: updated HouseholdRepository.java

* updated householdrowmapper.java

* HLM-4062:code refactor, removed useCTE parameter

---------

Co-authored-by: kavi_elrey@1993 <[email protected]>

---------

Co-authored-by: kanishq-egov <[email protected]>
Co-authored-by: kanishq-egov <[email protected]>

* Dev downsync fix smc (#563)

* household model reverse

* Update CHANGELOG.md

* Added changes for includeDeleted for downsync

* not null added

---------

Co-authored-by: kanishq-egov <[email protected]>

* Dev master conflict fix (#565)

* HLM-3069: updated build.config.yml

* HLM-3069: updated build-config.yml renamed adrm to referralmanagement

* HLM-3372: increased stock version from 1.1.0 to 1.1.1-beta and project version from 1.1.0 to 1.1.1-beta

* referralmanagement version 1.0.0-beta, added changelog, localsetup

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* HLM-3069: null project beneficiary validation error fix

* HLM-3069: added comments and splitted validation condition

* Dev to master (#550)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-4062: added count api changes for household

* HLM-4062: Updated findbyid references

* HLM-4062: Updated pom.xml of household

* Hlm 3376 reviewcomments (#524)

* HLM-3376: review comments commit

* HLM-3069: side effect code comments, code refactor

* HLM-3376: code review comments and code refactoring

* updated the common-models version to 1.0.10, and updated in dependent service

* HLM-3376 : Added additional field in side effect, referral.

* HLM-3376: missing column fix

* HLM-3372: constants type changed

* HLM-3376: removed not used validators

* code refactor and code comments

* hlm-3376: added test cases

* hlm-3376: referralmanagement context in test cases

* hlm-3376: changed parameters for find by id

* HLM-3372: typo fix

* hlm-3376: persister changes, removed invalid parameters

* hlm-3372: added changes as per code review, removed unused properties

* hlm-3376: recipient validator for faciliy not working fix

* HLM-3376: throwing exception on invalid recipient type

* HLM-3376: added comments as per review comments

* HLM-3376 : added changes as per code review comments, each column's name included in query

* HLM-3376: query column names

* Hlm 4062 count api (#547)

* hlm-4062: updated household

* HLM-4062: added  count api support using cte for household

* HLM-4062: updated HouseholdRepository.java

* updated householdrowmapper.java

* HLM-4062:code refactor, removed useCTE parameter

---------

Co-authored-by: kavi_elrey@1993 <[email protected]>

---------

Co-authored-by: kanishq-egov <[email protected]>
Co-authored-by: kanishq-egov <[email protected]>

* Dev downsync fix smc (#566)

* household model reverse

* Update CHANGELOG.md

* Added changes for includeDeleted for downsync

* not null added

---------

Co-authored-by: kanishq-egov <[email protected]>

* Added fix for testcases for householdmember (#570)

Co-authored-by: kanishq-egov <[email protected]>

* updated the version, and added the changelog (#571)

* updated the version, and added the changelog

* updated ReferralManagement CHANGELOG

* Update CHANGELOG.md

---------

Co-authored-by: kavi_elrey@1993 <[email protected]>

* HLM-4062: removed pagination from fields excluding household api call

* HLM-4062: missed in implementation (#574)

* HLM-4062: missed in implementation

* HLM-4062: default max is set to 1000 for not null limit value and 0 for offset value

* project beneficiary tag update failed fix HLM-4444

* HLM-4444: added code review comments

* sownsync bug fix for limit

---------

Co-authored-by: kavi_elrey <[email protected]>

* HLM-4444: project beneficiary update fix (#575)

* Update CHANGELOG.md

* updated changelog with dates (#577)

* updated stock module changelog (#578)

---------

Co-authored-by: kavi_elrey@1993 <[email protected]>
Co-authored-by: Vishal <[email protected]>
Co-authored-by: bhanu prakash <[email protected]>
Co-authored-by: Naveen J <[email protected]>
Co-authored-by: talele08 <[email protected]>
  • Loading branch information
6 people authored Nov 15, 2023
1 parent 2576451 commit b78923b
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 50 deletions.
4 changes: 2 additions & 2 deletions health-services/household/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
All notable changes to this module will be documented in this file.

## 1.1.1
## 1.1.1 - 2023-11-15

- Added total count for household
- Added a field for HouseholdMember : clientReferenceId
- Added a field for HouseholdMember-clientReferenceId

## 1.1.1-beta

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
All notable changes to this module will be documented in this file.

## 1.0.11
## 1.0.11 - 2023-11-15
- Client reference id added for member of household
- revert of household search change

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public class HouseholdSearch {
@JsonProperty("clientReferenceId")
private List<String> clientReferenceId = null;

// @JsonProperty("memberCount")
// private Integer memberCount = null;

@JsonProperty("boundaryCode")
private String localityCode = null;
}
Expand Down
2 changes: 1 addition & 1 deletion health-services/project/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
All notable changes to this module will be documented in this file.

## 1.1.1
## 1.1.1 - 2023-11-15
- Added tag in project beneficiary

## 1.1.1-beta 19-10-2023
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import static org.egov.common.utils.CommonUtils.notHavingErrors;
import static org.egov.common.utils.CommonUtils.populateErrorDetails;
import static org.egov.common.utils.ValidatorUtils.getErrorForUniqueEntity;

/**
* @author kanishq-egov
* This class, PbVoucherTagUniqueValidator, is a Spring component that serves as a validator for ensuring the uniqueness
* of voucher tags within a list of project beneficiaries. It implements the Validator interface, which allows it to
* validate a BeneficiaryBulkRequest containing a list of ProjectBeneficiary objects. Any duplicate voucher tags within
Expand Down Expand Up @@ -110,11 +110,11 @@ private void validateAndPopulateErrors(List<ProjectBeneficiary> validProjectBene

populateErrors(invalidEntities, errorDetailsMap);

List<String> existingVoucherTags = existingProjectBeneficiaries.stream().map(ProjectBeneficiary::getTag).collect(Collectors.toList());
Map<String, ProjectBeneficiary> existingProjectBeneficiaryVoucherTagMap = existingProjectBeneficiaries.stream().filter(projectBeneficiary -> projectBeneficiary.getTag() != null).collect(Collectors.toMap(ProjectBeneficiary::getTag, projectBeneficiary -> projectBeneficiary));
invalidEntities = validProjectBeneficiaries.stream()
.filter(notHavingErrors())
.filter(projectBeneficiary -> !existingProjectBeneficiaryMap.get(projectBeneficiary.getId()).getTag().equals(projectBeneficiary.getTag()))
.filter(projectBeneficiary -> isInvalid(projectBeneficiary, existingVoucherTags))
.filter(projectBeneficiary -> isUpdated(projectBeneficiary, existingProjectBeneficiaryMap))
.filter(projectBeneficiary -> isInvalid(projectBeneficiary, existingProjectBeneficiaryVoucherTagMap))
.collect(Collectors.toList());

populateErrors(invalidEntities, errorDetailsMap);
Expand All @@ -129,24 +129,46 @@ private void validateAndPopulateErrors(List<ProjectBeneficiary> validProjectBene
private void populateErrors(List<ProjectBeneficiary> invalidEntities, Map<ProjectBeneficiary, List<Error>> errorDetailsMap) {
// For each invalid entity, create an error and populate error details
invalidEntities.forEach(projectBeneficiary -> {
Error error = getErrorForUniqueEntity();
Error error = Error.builder().errorMessage("Project Beneficiary Tag Validation Failed").errorCode("INVALID_TAG").type(Error.ErrorType.NON_RECOVERABLE).exception(new CustomException("INVALID_TAG", "Project Beneficiary Tag Validation Failed")).build();
populateErrorDetails(projectBeneficiary, error, errorDetailsMap);
});
}

/**
* This method checks if a ProjectBeneficiary entity is invalid based on its voucher tag.
*
* @param entity The ProjectBeneficiary entity to check.
* @param existingVoucherTags
* @param entity The ProjectBeneficiary entity to check.
* @param existingProjectBeneficiaryVoucherTagMap The map containing existing ProjectBeneficiary entities
* indexed by their voucher tags.
* @return true if the entity is invalid, false otherwise.
*/
private boolean isInvalid(ProjectBeneficiary entity, List<String> existingVoucherTags) {
private boolean isInvalid(ProjectBeneficiary entity, Map<String, ProjectBeneficiary> existingProjectBeneficiaryVoucherTagMap) {
String id = entity.getId();
String tag = entity.getTag();

// Check if an entity with the same ID exists in the map and has a different tag
return existingVoucherTags.contains(tag);
return existingProjectBeneficiaryVoucherTagMap.keySet().contains(tag) && !existingProjectBeneficiaryVoucherTagMap.get(tag).getId().equals(id);
}

/**
* Checks if a ProjectBeneficiary entity is considered as updated based on its tag.
*
* @param entity The ProjectBeneficiary entity to check.
* @param existingProjectBeneficiaryMap A map containing existing ProjectBeneficiary entities based on their IDs.
* @return true if the entity is updated, false otherwise.
*/
private boolean isUpdated(ProjectBeneficiary entity, Map<String, ProjectBeneficiary> existingProjectBeneficiaryMap) {
String id = entity.getId();
String tag = entity.getTag();

// Retrieve the existing ProjectBeneficiary object to compare
ProjectBeneficiary projectBeneficiaryFromSearch = existingProjectBeneficiaryMap.get(id);

// check if existing ProjectBeneficiary Tag is null or not and if it is null whether it is updated or not
if(projectBeneficiaryFromSearch.getTag() == null) return tag != null;

// Check if the tag of the current entity is equal to the tag of the existing entity
return ( !projectBeneficiaryFromSearch.getTag().equals(tag)
|| ( tag != null && !tag.equals(projectBeneficiaryFromSearch.getTag()) ));
}
}
3 changes: 1 addition & 2 deletions health-services/referralmanagement/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Changelog
All notable changes to this module will be documented in this file.

## 1.0.0
## 1.0.0 - 2023-11-15
- Added Downsync Feature


## 1.0.0-beta
- Base version
- Added functionality for Side-Effects and Refferal management
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private List<String> searchHouseholds(DownsyncRequest downsyncRequest, Downsync

StringBuilder householdUrl = new StringBuilder(configs.getHouseholdHost())
.append(configs.getHouseholdSearchUrl());
householdUrl = appendUrlParams(householdUrl, criteria);
householdUrl = appendUrlParams(householdUrl, criteria, null, null);

HouseholdSearch householdSearch = HouseholdSearch.builder()
.localityCode(criteria.getLocality())
Expand Down Expand Up @@ -174,7 +174,7 @@ private List<String> searchIndividuals(DownsyncRequest downsyncRequest, Downsync

StringBuilder url = new StringBuilder(configs.getIndividualHost())
.append(configs.getIndividualSearchUrl());
url = appendUrlParams(url, criteria);
url = appendUrlParams(url, criteria, 0, individualIds.size());

IndividualSearch individualSearch = IndividualSearch.builder()
.id(new ArrayList<>(individualIds))
Expand Down Expand Up @@ -203,13 +203,12 @@ private Set<String> searchMembers(DownsyncRequest downsyncRequest, Downsync down
StringBuilder memberUrl = new StringBuilder(configs.getHouseholdHost())
.append(configs.getHouseholdMemberSearchUrl());

appendUrlParams(memberUrl, downsyncRequest.getDownsyncCriteria());

String memberIdsquery = "SELECT id from HOUSEHOLD_MEMBER where householdId IN (:householdIds)";

Map<String, Object> paramMap = new HashMap<>();
paramMap.put("householdIds", householdIds);

appendUrlParams(memberUrl, downsyncRequest.getDownsyncCriteria(), 0, householdIds.size());

/* FIXME SHOULD BE REMOVED AND SEARCH SHOULD BE enhanced with list of household ids*/
List<String> memberids = jdbcTemplate.queryForList(memberIdsquery, paramMap, String.class);

Expand Down Expand Up @@ -247,7 +246,7 @@ private List<String> searchBeneficiaries(DownsyncRequest downsyncRequest, Downsy

StringBuilder url = new StringBuilder(configs.getProjectHost())
.append(configs.getProjectBeneficiarySearchUrl());
url = appendUrlParams(url, criteria);
url = appendUrlParams(url, criteria, 0, individualClientRefIds.size());

String beneficiaryIdQuery = "SELECT id from PROJECT_BENEFICIARY where beneficiaryclientreferenceid IN (:beneficiaryIds)";

Expand Down Expand Up @@ -291,7 +290,6 @@ private List<String> searchTasks(DownsyncRequest downsyncRequest, Downsync downs

StringBuilder url = new StringBuilder(configs.getProjectHost())
.append(configs.getProjectTaskSearchUrl());
url = appendUrlParams(url, criteria);

String taskIdQuery = "SELECT id from PROJECT_TASK where projectBeneficiaryClientReferenceId IN (:beneficiaryClientRefIds)";

Expand All @@ -300,7 +298,8 @@ private List<String> searchTasks(DownsyncRequest downsyncRequest, Downsync downs

/* FIXME SHOULD BE REMOVED AND TASK SEARCH SHOULD BE enhanced with list of client-ref-beneficiary ids*/
List<String> taskIds = jdbcTemplate.queryForList(taskIdQuery, paramMap, String.class);

url = appendUrlParams(url, criteria, 0, taskIds.size());

if(CollectionUtils.isEmpty(taskIds))
return Collections.emptyList();

Expand Down Expand Up @@ -333,13 +332,13 @@ private void searchSideEffect(DownsyncRequest downsyncRequest, Downsync downsync
RequestInfo requestInfo = downsyncRequest.getRequestInfo();

// search side effect FIXME - tasks id array search not available
String taskIdQuery = "SELECT id from SIDE_EFFECT where taskClientReferenceId IN (:taskClientRefIds)";
String sEIdQuery = "SELECT id from SIDE_EFFECT where taskClientReferenceId IN (:taskClientRefIds)";

Map<String, Object> paramMap = new HashMap<>();
paramMap.put("taskClientRefIds", taskClientRefIds);

/* FIXME SHOULD BE REMOVED AND TASK SEARCH SHOULD BE enhanced with list of client-ref-beneficiary ids*/
List<String> SEIds = jdbcTemplate.queryForList(taskIdQuery, paramMap, String.class);
List<String> SEIds = jdbcTemplate.queryForList(sEIdQuery, paramMap, String.class);

if(CollectionUtils.isEmpty(SEIds))
return;
Expand All @@ -354,8 +353,8 @@ private void searchSideEffect(DownsyncRequest downsyncRequest, Downsync downsync

List<SideEffect> effects = sideEffectService.search(
effectSearchRequest,
criteria.getLimit(),
criteria.getOffset(),
SEIds.size(),
0,
criteria.getTenantId(),
criteria.getLastSyncedTime(),
criteria.getIncludeDeleted());
Expand All @@ -380,8 +379,8 @@ private void referralSearch(DownsyncRequest downsyncRequest, Downsync downsync,

List<Referral> referrals = referralService.search(
searchRequest,
criteria.getLimit(),
criteria.getOffset(),
beneficiaryClientRefIds.size(),
0,
criteria.getTenantId(),
criteria.getLastSyncedTime(),
criteria.getIncludeDeleted());
Expand All @@ -391,22 +390,34 @@ private void referralSearch(DownsyncRequest downsyncRequest, Downsync downsync,



/**
* append url params
*
* @param url
* @param criteria
* @return
*/
private StringBuilder appendUrlParams(StringBuilder url, DownsyncCriteria criteria) {

return url.append("?tenantId=")
.append(criteria.getTenantId())
.append("&offset=")
.append(criteria.getOffset())
.append("&limit=")
.append(criteria.getLimit())
.append("&includeDeleted=")
.append(criteria.getIncludeDeleted());
}
/**
* append url params
*
* @param url
* @param criteria
* @param includeLimitOffset
* @return
*/
private StringBuilder appendUrlParams(StringBuilder url, DownsyncCriteria criteria, Integer offset, Integer limit) {

url.append("?tenantId=")
.append(criteria.getTenantId())
.append("&includeDeleted=")
.append(criteria.getIncludeDeleted())
.append("&limit=");

if (null != limit)
url.append(limit);
else
url.append(criteria.getLimit());

url.append("&offset=");

if(null != offset)
url.append(offset);
else
url.append(criteria.getOffset());

return url;
}
}
3 changes: 3 additions & 0 deletions health-services/stock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
All notable changes to this module will be documented in this file.

## 1.1.1 - 2023-11-15
- Enhanced inventory flow for last mile delivery with QR code

## 1.1.1-beta
- Enhanced Inventory flow for last mile delivery

Expand Down

0 comments on commit b78923b

Please sign in to comment.