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;
}
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);
}
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;
}
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;
}
Aggregations