Search in sources :

Example 1 with ScpOtherEthnicity

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

the class SubstituteCareProviderCoreService method enrichSCPEntityAwareDTO.

/**
 * Build all entities which are required for creating SubstituteCareProvider entity
 */
private ExtendedSCPEntityAwareDTO enrichSCPEntityAwareDTO(SCPEntityAwareDTO scpEntityAwareDTO) {
    ExtendedSCPEntityAwareDTO dto = new ExtendedSCPEntityAwareDTO(scpEntityAwareDTO);
    final SubstituteCareProvider substituteCareProvider = dto.getEntity();
    substituteCareProvider.setIdentifier(IdGenerator.generateId());
    dto.setSubstituteCareProviderUc(buildSubstituteCareProviderUc(dto.getEntity()));
    dto.setPlacementHomeInformation(buildPlacementHomeInformation(dto.getEntity(), dto));
    enrichPhoneContactDetails(dto);
    List<ScpOtherEthnicity> clientScpEthnicities = dto.getEthnicityList().stream().map(ethnicity -> buildScpOtherEthnicity(ethnicity, dto.getEntity().getIdentifier())).collect(Collectors.toList());
    dto.setClientScpEthnicities(clientScpEthnicities);
    enrichOutOfStateChecks(dto);
    return dto;
}
Also used : PrincipalUtils.getStaffPersonId(gov.ca.cwds.security.utils.PrincipalUtils.getStaffPersonId) SubstituteCareProviderUcDao(gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderUcDao) SsaName3ParameterObject(gov.ca.cwds.data.legacy.cms.dao.SsaName3ParameterObject) DataAccessServicesException(gov.ca.cwds.cms.data.access.service.DataAccessServicesException) SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider) Date(java.util.Date) Inject(com.google.inject.Inject) LocalDateTime(java.time.LocalDateTime) DataAccessServiceLifecycle(gov.ca.cwds.cms.data.access.service.lifecycle.DataAccessServiceLifecycle) PhoneContactDetailDao(gov.ca.cwds.cms.data.access.dao.PhoneContactDetailDao) SubstituteCareProviderUc(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProviderUc) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) SCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) OutOfStateCheck(gov.ca.cwds.data.legacy.cms.entity.OutOfStateCheck) CountyOwnershipDao(gov.ca.cwds.cms.data.access.dao.CountyOwnershipDao) PlacementHomeInformationDao(gov.ca.cwds.cms.data.access.dao.PlacementHomeInformationDao) Authorize(gov.ca.cwds.security.annotations.Authorize) SubstituteCareProviderDao(gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderDao) DefaultDataAccessLifeCycle(gov.ca.cwds.cms.data.access.service.lifecycle.DefaultDataAccessLifeCycle) BusinessValidationService(gov.ca.cwds.cms.data.access.service.BusinessValidationService) CountyOwnership(gov.ca.cwds.data.legacy.cms.entity.CountyOwnership) SubstituteCareProviderDroolsConfiguration(gov.ca.cwds.cms.data.access.service.rules.SubstituteCareProviderDroolsConfiguration) PhoneContactDetail(gov.ca.cwds.data.legacy.cms.entity.PhoneContactDetail) OutOfStateCheckDao(gov.ca.cwds.cms.data.access.dao.OutOfStateCheckDao) SsaName3Dao(gov.ca.cwds.cms.data.access.dao.SsaName3Dao) DataAccessServiceBase(gov.ca.cwds.cms.data.access.service.DataAccessServiceBase) CountyOwnershipMapper(gov.ca.cwds.cms.data.access.mapper.CountyOwnershipMapper) ParametersValidator.checkNotPersisted(gov.ca.cwds.cms.data.access.utils.ParametersValidator.checkNotPersisted) PlacementHomeInformation(gov.ca.cwds.data.legacy.cms.entity.PlacementHomeInformation) Collectors(java.util.stream.Collectors) ParametersValidator(gov.ca.cwds.cms.data.access.utils.ParametersValidator) DroolsException(gov.ca.cwds.drools.DroolsException) List(java.util.List) ScpOtherEthnicityDao(gov.ca.cwds.cms.data.access.dao.ScpOtherEthnicityDao) ScpOtherEthnicity(gov.ca.cwds.data.legacy.cms.entity.ScpOtherEthnicity) LocalDate(java.time.LocalDate) StringUtils.upperCase(org.apache.commons.lang3.StringUtils.upperCase) Constants(gov.ca.cwds.cms.data.access.Constants) CWSIdentifier(gov.ca.cwds.cms.data.access.CWSIdentifier) ExtendedSCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO) DataAccessBundle(gov.ca.cwds.cms.data.access.service.lifecycle.DataAccessBundle) PhoneticSearchTables(gov.ca.cwds.cms.data.access.Constants.PhoneticSearchTables) Collections(java.util.Collections) ExtendedSCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO) SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider) ScpOtherEthnicity(gov.ca.cwds.data.legacy.cms.entity.ScpOtherEthnicity)

Example 2 with ScpOtherEthnicity

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

the class SubstituteCareProviderCoreService method buildScpOtherEthnicity.

private ScpOtherEthnicity buildScpOtherEthnicity(CWSIdentifier ethnicity, String scpId) {
    ScpOtherEthnicity clientScpEthnicity = new ScpOtherEthnicity();
    clientScpEthnicity.setEthnicityCode((short) ethnicity.getCwsId());
    clientScpEthnicity.setSubstituteCareProviderId(scpId);
    clientScpEthnicity.setId(IdGenerator.generateId());
    clientScpEthnicity.setLastUpdateId(getStaffPersonId());
    clientScpEthnicity.setLastUpdateTime(LocalDateTime.now());
    return clientScpEthnicity;
}
Also used : ScpOtherEthnicity(gov.ca.cwds.data.legacy.cms.entity.ScpOtherEthnicity)

Aggregations

ScpOtherEthnicity (gov.ca.cwds.data.legacy.cms.entity.ScpOtherEthnicity)2 Inject (com.google.inject.Inject)1 CWSIdentifier (gov.ca.cwds.cms.data.access.CWSIdentifier)1 Constants (gov.ca.cwds.cms.data.access.Constants)1 PhoneticSearchTables (gov.ca.cwds.cms.data.access.Constants.PhoneticSearchTables)1 CountyOwnershipDao (gov.ca.cwds.cms.data.access.dao.CountyOwnershipDao)1 OutOfStateCheckDao (gov.ca.cwds.cms.data.access.dao.OutOfStateCheckDao)1 PhoneContactDetailDao (gov.ca.cwds.cms.data.access.dao.PhoneContactDetailDao)1 PlacementHomeInformationDao (gov.ca.cwds.cms.data.access.dao.PlacementHomeInformationDao)1 ScpOtherEthnicityDao (gov.ca.cwds.cms.data.access.dao.ScpOtherEthnicityDao)1 SsaName3Dao (gov.ca.cwds.cms.data.access.dao.SsaName3Dao)1 SubstituteCareProviderDao (gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderDao)1 SubstituteCareProviderUcDao (gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderUcDao)1 ExtendedSCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO)1 SCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO)1 CountyOwnershipMapper (gov.ca.cwds.cms.data.access.mapper.CountyOwnershipMapper)1 BusinessValidationService (gov.ca.cwds.cms.data.access.service.BusinessValidationService)1 DataAccessServiceBase (gov.ca.cwds.cms.data.access.service.DataAccessServiceBase)1 DataAccessServicesException (gov.ca.cwds.cms.data.access.service.DataAccessServicesException)1 DataAccessBundle (gov.ca.cwds.cms.data.access.service.lifecycle.DataAccessBundle)1