Search in sources :

Example 1 with OtherAdultDTO

use of gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO in project cals-api by ca-cwds.

the class RFA1aFormMapper method toOtherAdultDTO.

default OtherAdultDTO toOtherAdultDTO(RFA1aOtherAdult entity) {
    OtherAdultDTO otherAdultDTO = entity.getOtherAdult();
    Optional.ofNullable(entity.getRfa1bForm()).ifPresent(rfa1bForm -> otherAdultDTO.setRfa1bForm(rfa1bForm.getEntityDTO()));
    Optional.ofNullable(entity.getLic198bForm()).ifPresent(lic198bForm -> otherAdultDTO.setLic198bForm(lic198bForm.getEntityDTO()));
    return otherAdultDTO;
}
Also used : OtherAdultDTO(gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO)

Example 2 with OtherAdultDTO

use of gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO in project cals-api by ca-cwds.

the class Rfa1aFormGenerationTest method getOtherAdult.

public OtherAdultDTO getOtherAdult(Long applicantId, int seed) throws Exception {
    OtherAdultDTO otherAdult = mapper.readValue(OTHER_ADULTS_FIXTURE, OtherAdultDTO.class);
    otherAdult.setFirstName(otherAdult.getFirstName() + seed);
    otherAdult.setLastName(otherAdult.getLastName() + seed);
    otherAdult.getRelationshipToApplicants().get(0).setApplicantId(applicantId);
    return otherAdult;
}
Also used : OtherAdultDTO(gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO)

Example 3 with OtherAdultDTO

use of gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO in project cals-api by ca-cwds.

the class PacketBuilder method otherAdults.

public PacketBuilder otherAdults(RFA1aFormDTO rfa1aFormDTO) {
    List<PersonSummaryDTO> otherAdults = new ArrayList<>();
    if (checkIfSectionIsNotEmpty(rfa1aFormDTO.getOtherAdults())) {
        for (OtherAdultDTO otherAdult : rfa1aFormDTO.getOtherAdults()) {
            otherAdults.add(new PersonSummaryDTO(otherAdult.getId(), otherAdult.getFirstName(), otherAdult.getLastName(), checkIdIfExists(otherAdult.getRfa1bForm())));
        }
    }
    this.otherAdults = otherAdults;
    return this;
}
Also used : OtherAdultDTO(gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO) ArrayList(java.util.ArrayList) PersonSummaryDTO(gov.ca.cwds.cals.service.dto.packet.PersonSummaryDTO)

Example 4 with OtherAdultDTO

use of gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO in project cals-api by ca-cwds.

the class OtherAdultsHelper method createOtherAdults.

public List<OtherAdultDTO> createOtherAdults(Long formId, ApplicantDTO relativeApplicant) throws Exception {
    List<OtherAdultDTO> otherAdultsDTOs = new ArrayList<>(2);
    for (int i = 0; i < 2; i++) {
        OtherAdultDTO otherAdultDTO = getOtherAdultDTO(relativeApplicant);
        otherAdultDTO.setFirstName(otherAdultDTO.getFirstName() + i);
        otherAdultDTO.setLastName(otherAdultDTO.getLastName() + i);
        otherAdultsDTOs.add(postOtherAdult(formId, otherAdultDTO));
    }
    return otherAdultsDTOs;
}
Also used : OtherAdultDTO(gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO) ArrayList(java.util.ArrayList)

Example 5 with OtherAdultDTO

use of gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO in project cals-api by ca-cwds.

the class OtherAdultsHelper method getOtherAdultDTO.

public OtherAdultDTO getOtherAdultDTO(ApplicantDTO relativeApplicant, String fixture) throws IOException {
    OtherAdultDTO otherAdultDTO = clientTestRule.getMapper().readValue(fixture, OtherAdultDTO.class);
    // Assume that we have only one relationship object
    otherAdultDTO.getRelationshipToApplicants().get(0).setApplicantId(relativeApplicant.getId());
    return otherAdultDTO;
}
Also used : OtherAdultDTO(gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO)

Aggregations

OtherAdultDTO (gov.ca.cwds.cals.service.dto.rfa.OtherAdultDTO)8 ArrayList (java.util.ArrayList)5 PersonSummaryDTO (gov.ca.cwds.cals.service.dto.packet.PersonSummaryDTO)2 AdoptionHistoryDTO (gov.ca.cwds.cals.service.dto.rfa.AdoptionHistoryDTO)2 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)2 ApplicantsDeclarationDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantsDeclarationDTO)2 ApplicantsHistoryDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantsHistoryDTO)2 ApplicantsRelationshipDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantsRelationshipDTO)2 ChildDesiredDTO (gov.ca.cwds.cals.service.dto.rfa.ChildDesiredDTO)2 MinorChildDTO (gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO)2 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)2 ReferencesDTO (gov.ca.cwds.cals.service.dto.rfa.ReferencesDTO)2 ResidenceDTO (gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO)2 Test (org.junit.Test)2 API (gov.ca.cwds.cals.Constants.API)1 IncomeType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.IncomeType)1 AdultChildDTO (gov.ca.cwds.cals.service.dto.rfa.AdultChildDTO)1 FormerSpouseDTO (gov.ca.cwds.cals.service.dto.rfa.FormerSpouseDTO)1 RelationshipToApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.RelationshipToApplicantDTO)1 CollectionDTO (gov.ca.cwds.cals.service.dto.rfa.collection.CollectionDTO)1