Search in sources :

Example 1 with RFAOtherAdultAwareEntityUpdateParams

use of gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams in project cals-api by ca-cwds.

the class LIC198bService method create.

@Override
public LIC198bFormDTO create(RFAExternalEntityUpdateParameterObject<LIC198bFormDTO> request) {
    LIC198bForm lic198bForm = composeEntity(request);
    LIC198bDao dao = (LIC198bDao) getDao();
    if (request instanceof RFAApplicantAwareEntityUpdateParams) {
        RFAApplicantAwareEntityUpdateParams params = (RFAApplicantAwareEntityUpdateParams) request;
        lic198bForm = dao.createForApplicant(lic198bForm, params.getApplicantId());
    } else if (request instanceof RFAOtherAdultAwareEntityUpdateParams) {
        RFAOtherAdultAwareEntityUpdateParams params = (RFAOtherAdultAwareEntityUpdateParams) request;
        lic198bForm = dao.createForOtherAdult(lic198bForm, params.getOtherAdultId());
    }
    return extractDTO(lic198bForm);
}
Also used : LIC198bDao(gov.ca.cwds.cals.persistence.dao.calsns.LIC198bDao) RFAApplicantAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams) RFAOtherAdultAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams) LIC198bForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm)

Example 2 with RFAOtherAdultAwareEntityUpdateParams

use of gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams in project cals-api by ca-cwds.

the class RFA1bService method find.

public RFA1bFormDTO find(RFAExternalEntityUpdateParameterObject<RFA1bFormDTO> params) {
    if (params instanceof RFAApplicantAwareEntityUpdateParams) {
        Long applicantId = ((RFAApplicantAwareEntityUpdateParams) params).getApplicantId();
        RFA1aApplicant applicant = applicantDao.find(applicantId);
        return extractDTO(applicant.getRfa1bForm());
    } else if (params instanceof RFAOtherAdultAwareEntityUpdateParams) {
        Long otherAdultId = ((RFAOtherAdultAwareEntityUpdateParams) params).getOtherAdultId();
        RFA1aOtherAdult rfa1aOtherAdult = otherAdultDao.find(otherAdultId);
        return extractDTO(rfa1aOtherAdult.getRfa1bForm());
    }
    return null;
}
Also used : RFAApplicantAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams) RFAOtherAdultAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams) RFA1aOtherAdult(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aOtherAdult) RFA1aApplicant(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aApplicant)

Example 3 with RFAOtherAdultAwareEntityUpdateParams

use of gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams in project cals-api by ca-cwds.

the class LIC198bService method find.

public LIC198bFormDTO find(RFAExternalEntityUpdateParameterObject<RFA1bFormDTO> params) {
    if (params instanceof RFAApplicantAwareEntityUpdateParams) {
        Long applicantId = ((RFAApplicantAwareEntityUpdateParams) params).getApplicantId();
        RFA1aApplicant applicant = applicantDao.find(applicantId);
        return extractDTO(applicant.getLic198bForm());
    } else if (params instanceof RFAOtherAdultAwareEntityUpdateParams) {
        Long otherAdultId = ((RFAOtherAdultAwareEntityUpdateParams) params).getOtherAdultId();
        RFA1aOtherAdult rfa1aOtherAdult = otherAdultDao.find(otherAdultId);
        return extractDTO(rfa1aOtherAdult.getLic198bForm());
    }
    return null;
}
Also used : RFAApplicantAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams) RFAOtherAdultAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams) RFA1aOtherAdult(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aOtherAdult) RFA1aApplicant(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aApplicant)

Example 4 with RFAOtherAdultAwareEntityUpdateParams

use of gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams in project cals-api by ca-cwds.

the class RFA1bService method create.

@Override
public RFA1bFormDTO create(RFAExternalEntityUpdateParameterObject<RFA1bFormDTO> request) {
    RFA1bFormDTO rfa1bFormDTO = find(request);
    if (rfa1bFormDTO != null) {
        throw new ExpectedException(Constants.ExpectedExceptionMessages.RFA_1B_FORM_ALREADY_EXISTS, BAD_REQUEST);
    }
    RFA1bForm rfa1bForm = composeEntity(request);
    RFA1bDao dao = (RFA1bDao) getDao();
    if (request instanceof RFAApplicantAwareEntityUpdateParams) {
        RFAApplicantAwareEntityUpdateParams params = (RFAApplicantAwareEntityUpdateParams) request;
        rfa1bForm = dao.createForApplicant(rfa1bForm, params.getApplicantId());
    } else if (request instanceof RFAOtherAdultAwareEntityUpdateParams) {
        RFAOtherAdultAwareEntityUpdateParams params = (RFAOtherAdultAwareEntityUpdateParams) request;
        rfa1bForm = dao.createForOtherAdult(rfa1bForm, params.getOtherAdultId());
    }
    return extractDTO(rfa1bForm);
}
Also used : RFAApplicantAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams) RFAOtherAdultAwareEntityUpdateParams(gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams) RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) RFA1bForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1bForm) ExpectedException(gov.ca.cwds.rest.exception.ExpectedException) RFA1bDao(gov.ca.cwds.cals.persistence.dao.calsns.RFA1bDao)

Aggregations

RFAApplicantAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams)4 RFAOtherAdultAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams)4 RFA1aApplicant (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aApplicant)2 RFA1aOtherAdult (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aOtherAdult)2 LIC198bDao (gov.ca.cwds.cals.persistence.dao.calsns.LIC198bDao)1 RFA1bDao (gov.ca.cwds.cals.persistence.dao.calsns.RFA1bDao)1 LIC198bForm (gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm)1 RFA1bForm (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1bForm)1 RFA1bFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO)1 ExpectedException (gov.ca.cwds.rest.exception.ExpectedException)1