Search in sources :

Example 1 with StateType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType in project cals-api by ca-cwds.

the class StateReferentialIntegrityForEachValidator method getPersistentObject.

@Override
protected <T extends PersistentObject> PersistentObject getPersistentObject(Session currentSession, T obj, Serializable primaryKey) {
    PersistentObject found;
    Query<StateType> query = currentSession.createNamedQuery(NAMED_QUERY_FIND_STATE_BY_CODE, StateType.class);
    query.setParameter("stateCode", primaryKey);
    found = query.uniqueResult();
    return found;
}
Also used : StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) PersistentObject(gov.ca.cwds.data.persistence.PersistentObject)

Example 2 with StateType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType in project cals-api by ca-cwds.

the class RFA1aRequiredFieldsValidationTest method checkDriverLicenseNumberFormTest.

@Test
public void checkDriverLicenseNumberFormTest() throws Exception {
    RFA1aFormDTO form = prepareValidForm();
    ApplicantDTO applicant = applicantHelper.getValidApplicant();
    applicant.setFirstName("Some");
    applicant.setDriverLicenseNumber("");
    StateType driverLicenseState = new StateType();
    driverLicenseState.setId("CA");
    driverLicenseState.setValue("California");
    applicant.setDriverLicenseState(driverLicenseState);
    applicantHelper.postApplicant(form.getId(), applicant);
    List<IssueDetails> cvIssues = getIssueDetails(form);
    // "CV000008");
    Assert.assertTrue(cvIssues.stream().anyMatch(id -> id.getCode().equals(REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER)));
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) Arrays(java.util.Arrays) REQUIRED_OTHER_PEOPLE_IN_RESIDENCE(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_OTHER_PEOPLE_IN_RESIDENCE) BeforeClass(org.junit.BeforeClass) REQUIRED_APPLICANT_DRIVER_LICENSE_STATE(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_STATE) PhoneNumberType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.PhoneNumberType) REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME) StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) IssueDetails(gov.ca.cwds.rest.exception.IssueDetails) REQUIRED_APPLICANT_PHONE_NUMBER(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_PHONE_NUMBER) REQUIRED_PHYSICAL_MAILING_THE_SAME(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_PHYSICAL_MAILING_THE_SAME) RFAAddressDTO(gov.ca.cwds.cals.service.dto.rfa.RFAAddressDTO) REQUIRED_MINOR_CHILD_DATE_OF_BIRTH(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_DATE_OF_BIRTH) REQUIRED_MINOR_CHILD_GENDER(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_GENDER) PhoneDTO(gov.ca.cwds.cals.service.dto.rfa.PhoneDTO) REQUIRED_HOME_LANGUAGES(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_HOME_LANGUAGES) REQUIRED_WEAPON_IN_HOME_FIELD(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_WEAPON_IN_HOME_FIELD) REQUIRED_RESIDENCE_ADDRESS_CITY(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_RESIDENCE_ADDRESS_CITY) REQUIRED_RESIDENCE_STREET_ADDRESS(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_RESIDENCE_STREET_ADDRESS) REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER) REQUIRED_APPLICANT_DATE_OF_BIRTH(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DATE_OF_BIRTH) REQUIRED_BODY_OF_WATER_EXIST_FIELD(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_BODY_OF_WATER_EXIST_FIELD) REQUIRED_MINOR_CHILD_ADOPTED(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_ADOPTED) IOException(java.io.IOException) Test(org.junit.Test) REQUIRED_MINOR_CHILD_FINANCIALLY_SUPPORTED(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_FINANCIALLY_SUPPORTED) Collectors(java.util.stream.Collectors) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) REQUIRED_RESIDENCE_ADDRESS_ZIP(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_RESIDENCE_ADDRESS_ZIP) TypedPersonNameDTO(gov.ca.cwds.cals.service.dto.rfa.TypedPersonNameDTO) List(java.util.List) REQUIRED_MINOR_CHILD_RELATIONSHIP_APPLICANT_ID(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_RELATIONSHIP_APPLICANT_ID) Response(javax.ws.rs.core.Response) MinorChildDTO(gov.ca.cwds.cals.service.dto.rfa.MinorChildDTO) REQUIRED_RESIDENCE_OWNERSHIP(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_RESIDENCE_OWNERSHIP) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ResidenceDTO(gov.ca.cwds.cals.service.dto.rfa.ResidenceDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME) Assert(org.junit.Assert) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) REQUIRED_RESIDENCE_ADDRESS_STATE(gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_RESIDENCE_ADDRESS_STATE) AddressType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.AddressType) StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) IssueDetails(gov.ca.cwds.rest.exception.IssueDetails) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) Test(org.junit.Test)

Example 3 with StateType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType in project cals-api by ca-cwds.

the class RFA1aCoreSubmitApplicationTest method submitApplication.

private RFA1aFormDTO submitApplication() throws Exception {
    RFA1aFormDTO form = formAHelper.createRFA1aForm();
    ApplicantDTO applicantDTO = applicantHelper.postApplicant(form.getId(), applicantHelper.getValidApplicant());
    ApplicantDTO secondApplicant = applicantHelper.getValidApplicant();
    secondApplicant.setFirstName("John");
    StateType driverLicenseState = new StateType();
    driverLicenseState.setId("MD");
    driverLicenseState.setValue("Maryland");
    secondApplicant.setDriverLicenseState(driverLicenseState);
    secondApplicant.getEthnicity().setId(2L);
    secondApplicant.getEthnicity().setValue("American Indian");
    secondApplicant = applicantHelper.postApplicant(form.getId(), secondApplicant);
    residenceHelper.putResidence(form.getId(), residenceHelper.getResidenceDTO());
    RFA1bFormDTO rfa1bForm = formBHelper.getRfa1bForm();
    formBHelper.postRfa1bForm(form.getId(), applicantDTO.getId(), rfa1bForm);
    otherAdultHelper.createOtherAdults(form.getId(), secondApplicant);
    minorChildHelper.createMinorChildren(form.getId(), applicantDTO);
    Response response = statusHelper.submitApplication(form.getId(), FIXTURE_PATH_TO_PRINCIPAL);
    assertEquals(Status.OK.getStatusCode(), response.getStatus());
    form = formAHelper.getRFA1aForm(form.getId());
    return form;
}
Also used : Response(javax.ws.rs.core.Response) RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)

Example 4 with StateType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType in project cals-api by ca-cwds.

the class RFAPacketResourceTest method testPacketApi.

@Test
public void testPacketApi() throws Exception {
    RFA1aFormDTO form = formAHelper.createRFA1aForm();
    ApplicantDTO applicantDTO = applicantHelper.postApplicant(form.getId(), applicantHelper.getValidApplicant());
    ApplicantDTO secondApplicant = applicantHelper.getValidApplicant();
    secondApplicant.setFirstName("John");
    StateType driverLicenseState = new StateType();
    driverLicenseState.setId("MD");
    driverLicenseState.setValue("Maryland");
    secondApplicant.setDriverLicenseState(driverLicenseState);
    secondApplicant.getEthnicity().setId(2L);
    secondApplicant.getEthnicity().setValue("American Indian");
    secondApplicant = applicantHelper.postApplicant(form.getId(), secondApplicant);
    residenceHelper.putResidence(form.getId(), residenceHelper.getResidenceDTO());
    RFA1bFormDTO rfa1bForm = formBHelper.getRfa1bForm();
    formBHelper.postRfa1bForm(form.getId(), applicantDTO.getId(), rfa1bForm);
    otherAdultHelper.createOtherAdults(form.getId(), secondApplicant);
    minorChildHelper.createMinorChildren(form.getId(), applicantDTO);
    WebTarget target = clientTestRule.target(API.RFA_PACKET + "/" + form.getId() + "/" + SUMMARY);
    Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
    PacketDTO packetDTO = invocation.get(PacketDTO.class);
    assertNotNull(packetDTO);
}
Also used : RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) Invocation(javax.ws.rs.client.Invocation) StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO) WebTarget(javax.ws.rs.client.WebTarget) PacketDTO(gov.ca.cwds.cals.service.dto.packet.PacketDTO) Test(org.junit.Test) BaseRFAIntegrationTest(gov.ca.cwds.cals.web.rest.rfa.BaseRFAIntegrationTest)

Example 5 with StateType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType in project cals-api by ca-cwds.

the class RFA1aPrintPDFTest method createRfa1aFormDTO.

private RFA1aFormDTO createRfa1aFormDTO() throws Exception {
    RFA1aFormDTO form = formAHelper.createRFA1aForm();
    ApplicantDTO applicantDTO = applicantHelper.postApplicant(form.getId(), applicantHelper.getValidApplicant());
    ApplicantDTO secondApplicant = applicantHelper.getValidApplicant();
    secondApplicant.setFirstName("John");
    StateType driverLicenseState = new StateType();
    driverLicenseState.setId("MD");
    driverLicenseState.setValue("Maryland");
    secondApplicant.setDriverLicenseState(driverLicenseState);
    secondApplicant.getEthnicity().setId(2L);
    secondApplicant.getEthnicity().setValue("American Indian");
    secondApplicant = applicantHelper.postApplicant(form.getId(), secondApplicant);
    residenceHelper.putResidence(form.getId(), residenceHelper.getResidenceDTO());
    RFA1bFormDTO rfa1bForm = formBHelper.getRfa1bForm();
    formBHelper.postRfa1bForm(form.getId(), applicantDTO.getId(), rfa1bForm);
    otherAdultHelper.createOtherAdults(form.getId(), secondApplicant);
    minorChildHelper.createMinorChildren(form.getId(), applicantDTO);
    return form;
}
Also used : RFA1bFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO) StateType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType) RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)

Aggregations

StateType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.StateType)7 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)4 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)4 RFA1bFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1bFormDTO)3 PersistentObject (gov.ca.cwds.data.persistence.PersistentObject)2 Response (javax.ws.rs.core.Response)2 Test (org.junit.Test)2 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)1 REQUIRED_APPLICANT_DATE_OF_BIRTH (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DATE_OF_BIRTH)1 REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_NUMBER)1 REQUIRED_APPLICANT_DRIVER_LICENSE_STATE (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_DRIVER_LICENSE_STATE)1 REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_FIRST_NAME)1 REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_OTHER_NAMES_LAST_NAME)1 REQUIRED_APPLICANT_PHONE_NUMBER (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_APPLICANT_PHONE_NUMBER)1 REQUIRED_BODY_OF_WATER_EXIST_FIELD (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_BODY_OF_WATER_EXIST_FIELD)1 REQUIRED_HOME_LANGUAGES (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_HOME_LANGUAGES)1 REQUIRED_MINOR_CHILD_ADOPTED (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_ADOPTED)1 REQUIRED_MINOR_CHILD_DATE_OF_BIRTH (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_DATE_OF_BIRTH)1 REQUIRED_MINOR_CHILD_FINANCIALLY_SUPPORTED (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_FINANCIALLY_SUPPORTED)1 REQUIRED_MINOR_CHILD_GENDER (gov.ca.cwds.cals.Constants.Validation.Business.Code.REQUIRED_MINOR_CHILD_GENDER)1