Search in sources :

Example 6 with RFA1bFormDTO

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

the class RFA1bResourceTest method getRFA1bFormApplicantTest.

@Test
public void getRFA1bFormApplicantTest() throws Exception {
    RFA1aFormDTO form1a = formAHelper.createRFA1aForm();
    RFA1bFormDTO created = getExternalEntityApiHelper().createEntity(form1a);
    ApplicantDTO applicantDTO = applicantHelper.getFirstExistedOrPostNewApplicant(form1a.getId(), applicantHelper.getValidApplicant());
    WebTarget target = clientTestRule.target(API.RFA_1A_FORMS + "/" + form1a.getId() + "/" + getExternalEntityApiHelper().getConfiguration().getApiPath() + "/" + API.RFA_1A_APPLICANTS + "/" + applicantDTO.getId());
    RFA1bFormDTO found = target.request().get(RFA1bFormDTO.class);
    assertThat(found).isEqualTo(created);
}
Also used : RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) WebTarget(javax.ws.rs.client.WebTarget) Test(org.junit.Test)

Example 7 with RFA1bFormDTO

use of gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO 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

RFA1bFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO)7 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)6 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)5 StateType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType)3 WebTarget (javax.ws.rs.client.WebTarget)3 Test (org.junit.Test)2 RFA1bDao (gov.ca.cwds.cals.persistence.dao.calsns.RFA1bDao)1 RFA1bForm (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1bForm)1 PacketDTO (gov.ca.cwds.cals.service.dto.packet.PacketDTO)1 CollectionDTO (gov.ca.cwds.cals.service.dto.rfa.collection.CollectionDTO)1 RFAApplicantAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAApplicantAwareEntityUpdateParams)1 RFAOtherAdultAwareEntityUpdateParams (gov.ca.cwds.cals.web.rest.parameter.RFAOtherAdultAwareEntityUpdateParams)1 BaseRFAIntegrationTest (gov.ca.cwds.cals.web.rest.rfa.BaseRFAIntegrationTest)1 TestExternalEntityConfiguration (gov.ca.cwds.cals.web.rest.rfa.configuration.TestExternalEntityConfiguration)1 ExpectedException (gov.ca.cwds.rest.exception.ExpectedException)1 Invocation (javax.ws.rs.client.Invocation)1 GenericType (javax.ws.rs.core.GenericType)1 Response (javax.ws.rs.core.Response)1