Ejemplo n.º 1
0
  public void addUserOwnership(StepsovcCase stepsovcCase) {
    Beneficiary beneficiary =
        allBeneficiaries.findBeneficiaryByCode(stepsovcCase.getBeneficiary_code());
    Caregiver caregiver = allCaregivers.findCaregiverByCode(stepsovcCase.getCaregiver_code());

    if (beneficiary != null && caregiver != null) {
      commcareGateway.addUserOwnership(
          populateBeneficiaryCase(stepsovcCase, beneficiary), caregiver.getCgId());
    }
  }
Ejemplo n.º 2
0
  private CaseOwnershipInformation populateBeneficiaryCase(
      StepsovcCase stepsovcCase, Beneficiary beneficiary) {
    stepsovcCase.setCaregiver_code(beneficiary.getCaregiverCode());
    stepsovcCase.setCase_id(beneficiary.getCaseId());

    Caregiver caregiver = allCaregivers.findCaregiverByCode(beneficiary.getCaregiverCode());
    stepsovcCase.setCaregiver_name(caregiver.getFirstName());
    stepsovcCase.setUser_id(caregiver.getCgId());
    stepsovcCase.setOwner_id(caregiver.getCgId());

    return new BeneficiaryMapper().createOwnershipInfo(stepsovcCase);
  }