use of gov.ca.cwds.cals.persistence.dao.calsns.RFA1bDao 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);
}
Aggregations