Search in sources :

Example 1 with NameType

use of gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType in project api-core by ca-cwds.

the class R02769Test method createClient.

private static Client createClient() {
    Client client = new Client();
    client.setCommonLastName("DefaultLastName");
    client.setCommonFirstName("DefaultFirstName");
    client.setSuffixTitleDescription("DefaultSuffixDesc");
    NameType nameType = new NameType();
    nameType.setShortDescription("AKA");
    client.setNameType(nameType);
    return client;
}
Also used : NameType(gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType) Client(gov.ca.cwds.data.legacy.cms.entity.Client)

Example 2 with NameType

use of gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType in project api-core by ca-cwds.

the class OtherClientNameService method createOtherClientName.

public void createOtherClientName(OtherClientNameDTO otherClientNameDTO) {
    OtherClientName otherClientName = new OtherClientName();
    otherClientName.setClientId(otherClientNameDTO.getClientId());
    otherClientName.setNamePrefixDescription(Objects.toString(otherClientNameDTO.getNamePrefixDescription(), ""));
    otherClientName.setFirstName(Objects.toString(otherClientNameDTO.getFirstName(), ""));
    otherClientName.setLastName(Objects.toString(otherClientNameDTO.getLastName(), ""));
    otherClientName.setSuffixTitleDescription(Objects.toString(otherClientNameDTO.getSuffixTitleDescription(), ""));
    otherClientName.setMiddleName(Objects.toString(otherClientNameDTO.getMiddleName(), ""));
    otherClientName.setThirdId(generateId());
    NameType nameType = new NameType();
    nameType.setSystemId(otherClientNameDTO.getNameType());
    otherClientName.setNameType(nameType);
    otherClientName.setLastUpdateId(PrincipalUtils.getStaffPersonId());
    otherClientName.setLastUpdateTime(LocalDateTime.now());
    otherClientNameDao.create(otherClientName);
    createClientNameUc(otherClientName);
    createPhoneticSearchKeywords(otherClientName);
}
Also used : OtherClientName(gov.ca.cwds.data.legacy.cms.entity.OtherClientName) NameType(gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType)

Example 3 with NameType

use of gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType in project api-core by ca-cwds.

the class ClientDaoTest method testCreate.

@Test
public void testCreate() throws Exception {
    final String expectedFilePath = "/dbunit/Client/insert/Client_after_insert.xml";
    cleanAll(expectedFilePath);
    executeInTransaction(sessionFactory, (sessionFactory) -> {
        NameType nameType = nameTypeDao.find((short) 1313);
        assertNotNull(nameType);
        assertEquals("Legal", nameType.getShortDescription().trim());
        assertTrue(nameType.getSystemId().equals(new Short((short) 1313)));
        Client c = new Client();
        c.setIdentifier("AaiU7IW0Rt");
        // ADJDEL_IND
        c.setAdjudicatedDelinquentIndicator(false);
        // ADPTN_STCD
        c.setAdoptionStatus(AdoptionStatus.NOT_FREE);
        // ALN_REG_NO
        c.setAlienRegistrationNumber("AlienRegNum");
        // BIRTH_DT
        c.setBirthDate(LocalDate.of(1972, 8, 17));
        c.setBirthFacilityName("BirthFacilityName");
        // BIRTH_CITY
        c.setBirthCity("Sacramento");
        // CHLD_CLT_B
        c.setChildClientIndicator(false);
        // COM_FST_NM
        c.setCommonFirstName("Tumbling");
        // COM_LST_NM
        c.setCommonLastName("Lazenby");
        // COM_MID_NM
        c.setCommonMiddleName("Midname");
        // CONF_EFIND
        c.setConfidentialityInEffectIndicator(false);
        // CREATN_DT
        c.setCreationDate(LocalDate.of(2004, 8, 17));
        // DRV_LIC_NO
        c.setDriverLicenseNumber("license");
        // GENDER_CD
        c.setGender(Gender.MALE);
        // INCAPC_CD
        c.setIncapacitatedParentStatus(IncapacitatedParentStatus.UNKNOWN);
        // LITRATE_CD
        c.setLiterateStatus(LiterateStatus.UNKNOWN);
        // MAR_HIST_B
        c.setMaritalCohabitationHistoryIndicator(false);
        // MILT_STACD
        c.setMilitaryStatus(MilitaryStatus.NO_INFORMATION_AVAILABLE);
        // NMPRFX_DSC
        c.setNamePrefixDescription("prefix");
        // NAME_TPC
        c.setNameType(nameType);
        // SENSTV_IND
        c.setSensitivity(Sensitivity.NOT_APPLICABLE);
        // SS_NO
        c.setSocialSecurityNumber("977000271");
        // SSN_CHG_CD
        c.setSocialSecurityNumberChangedCode("O");
        // SUFX_TLDSC
        c.setSuffixTitleDescription("Jr.");
        // UNEMPLY_CD
        c.setParentUnemployedStatus(ParentUnemployedStatus.UNKNOWN);
        // COMMNT_DSC
        c.setCommentDescription("CommentDescription");
        // EST_DOB_CD
        c.setDateOfBirthStatus(DateOfBirthStatus.ESTIMATED);
        // HISP_CD
        c.setHispanicOrigin(HispanicOrigin.UNDETERMINED);
        // COTH_DESC
        c.setCurrentlyOtherDescription("CurrentlyOtherDescription");
        c.setPreviousOtherDescription("PreviousOtherDescription");
        // SOCPLC_CD
        c.setSoc158placementsStatus(Soc158placementsStatus.NO_SOC_158_PLACEMENTS);
        // LST_UPD_ID
        c.setLastUpdateId("0Rt");
        // B_STATE_C
        c.setBirthStateCode((short) 0);
        // B_CNTRY_C
        c.setBirthCountryCode((short) 0);
        // I_CNTRY_C
        c.setImmigrationCountryCode((short) 0);
        // D_STATE_C
        c.setDriverLicenseStateCode((short) 0);
        // IMGT_STC
        c.setImmigrationStatusCode((short) 0);
        // MRTL_STC
        c.setMaritalStatusCode((short) 0);
        // P_ETHNCTYC
        c.setPrimaryEthnicityCode((short) 0);
        // S_LANG_TC
        c.setSecondaryLanguageCode((short) 0);
        // P_LANG_TPC
        c.setPrimaryLanguageCode((short) 0);
        // RLGN_TPC
        c.setReligionCode((short) 0);
        dao.create(c);
    });
    IDataSet expectedDataSet = readXmlDataSet(expectedFilePath);
    ITable expectedTable = expectedDataSet.getTable("CLIENT_T");
    IDataSet actualDataSet = dbUnitConnection.createDataSet(new String[] { "CLIENT_T" });
    ITable actualTable = actualDataSet.getTable("CLIENT_T");
    assertTableEquals(expectedTable, actualTable);
}
Also used : NameType(gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType) ITable(org.dbunit.dataset.ITable) ChildClient(gov.ca.cwds.data.legacy.cms.entity.ChildClient) Client(gov.ca.cwds.data.legacy.cms.entity.Client) IDataSet(org.dbunit.dataset.IDataSet) Test(org.junit.Test) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)

Example 4 with NameType

use of gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType in project api-core by ca-cwds.

the class ClientDaoTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    cleanAllAndInsert("/dbunit/Client/update/Client_before_update.xml");
    executeInTransaction(sessionFactory, (sessionFactory) -> {
        NameType nameType = nameTypeDao.find((short) 1314);
        assertNotNull(nameType);
        assertEquals("Maiden", nameType.getShortDescription().trim());
        assertTrue(nameType.getSystemId().equals((short) 1314));
        Client c = dao.find("AaiU7IW0Rt");
        assertEquals(0, c.getBirthStateCode());
        // NAME_TPC
        c.setNameType(nameType);
        dao.update(c);
    });
    IDataSet expectedDataSet = readXmlDataSet("/dbunit/Client/update/Client_after_update.xml");
    ITable expectedTable = expectedDataSet.getTable("CLIENT_T");
    IDataSet actualDataSet = dbUnitConnection.createDataSet(new String[] { "CLIENT_T" });
    ITable actualTable = actualDataSet.getTable("CLIENT_T");
    assertTableEquals(expectedTable, actualTable);
}
Also used : NameType(gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType) ITable(org.dbunit.dataset.ITable) ChildClient(gov.ca.cwds.data.legacy.cms.entity.ChildClient) Client(gov.ca.cwds.data.legacy.cms.entity.Client) IDataSet(org.dbunit.dataset.IDataSet) Test(org.junit.Test) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)

Example 5 with NameType

use of gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType in project api-core by ca-cwds.

the class R02769Test method createDoeClient.

private static Client createDoeClient() {
    Client client = createClient();
    NameType nameType = new NameType();
    nameType.setShortDescription("Doe");
    client.setNameType(nameType);
    return client;
}
Also used : NameType(gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType) Client(gov.ca.cwds.data.legacy.cms.entity.Client)

Aggregations

NameType (gov.ca.cwds.data.legacy.cms.entity.syscodes.NameType)5 Client (gov.ca.cwds.data.legacy.cms.entity.Client)4 ChildClient (gov.ca.cwds.data.legacy.cms.entity.ChildClient)2 BaseCwsCmsInMemoryPersistenceTest (gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)2 IDataSet (org.dbunit.dataset.IDataSet)2 ITable (org.dbunit.dataset.ITable)2 Test (org.junit.Test)2 OtherClientName (gov.ca.cwds.data.legacy.cms.entity.OtherClientName)1