Search in sources :

Example 1 with LIC198bForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm in project cals-api by ca-cwds.

the class LIC198bDao method createForApplicant.

public LIC198bForm createForApplicant(LIC198bForm entity, Long applicantId) {
    LIC198bForm created = super.create(entity);
    RFA1aApplicant rfa1aApplicant = applicantDao.find(applicantId);
    rfa1aApplicant.setLic198bForm(created);
    applicantDao.update(rfa1aApplicant);
    return created;
}
Also used : RFA1aApplicant(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aApplicant) LIC198bForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm)

Example 2 with LIC198bForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm 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 3 with LIC198bForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm in project cals-api by ca-cwds.

the class LIC198bDao method createForOtherAdult.

public LIC198bForm createForOtherAdult(LIC198bForm entity, Long otherAdultId) {
    LIC198bForm created = super.create(entity);
    RFA1aOtherAdult otherAdult = otherAdultDao.find(otherAdultId);
    otherAdult.setLic198bForm(created);
    otherAdultDao.update(otherAdult);
    return created;
}
Also used : RFA1aOtherAdult(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aOtherAdult) LIC198bForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm)

Example 4 with LIC198bForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm in project cals-api by ca-cwds.

the class LIC198bDao method delete.

@Override
public LIC198bForm delete(Serializable id) {
    LIC198bForm entity = this.find(id);
    if (entity != null) {
        Optional.ofNullable(entity.getApplicant()).ifPresent(applicant -> {
            applicant.setLic198bForm(null);
            applicantDao.update(applicant);
        });
        Optional.ofNullable(entity.getOtherAdult()).ifPresent(otherAdult -> {
            otherAdult.setLic198bForm(null);
            otherAdultDao.update(otherAdult);
        });
        this.currentSession().delete(entity);
    }
    return entity;
}
Also used : LIC198bForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm)

Aggregations

LIC198bForm (gov.ca.cwds.cals.persistence.model.calsns.rfa.LIC198bForm)4 LIC198bDao (gov.ca.cwds.cals.persistence.dao.calsns.LIC198bDao)1 RFA1aApplicant (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aApplicant)1 RFA1aOtherAdult (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aOtherAdult)1 RFAApplicantAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams)1 RFAOtherAdultAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams)1