Search in sources :

Example 6 with SCPEntityAwareDTO

use of gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO 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 7 with SCPEntityAwareDTO

use of gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO in project cals-api by ca-cwds.

the class PlacementHomeEntityAwareDTOBuilder method appendSubstituteCareProviders.

public PlacementHomeEntityAwareDTOBuilder appendSubstituteCareProviders() {
    List<ApplicantDTO> applicants = Optional.ofNullable(form.getApplicants()).orElse(Collections.emptyList());
    for (ApplicantDTO applicant : applicants) {
        SCPEntityAwareDTO scpEntityAwareDTO = buildSubstituteCareProviderParameterObject(form, applicant);
        rfaApplicantIdsMap.put(applicant.getId(), scpEntityAwareDTO.getEntity());
        placementHomeEntityAwareDTO.addSCPParameterObject(scpEntityAwareDTO);
    }
    return this;
}
Also used : SCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO)

Aggregations

SCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO)7 SubstituteCareProvider (gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider)5 SubstituteCareProviderDao (gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderDao)3 SubstituteCareProviderCoreService (gov.ca.cwds.cms.data.access.service.impl.SubstituteCareProviderCoreService)3 Test (org.junit.Test)3 ExtendedSCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO)2 BusinessValidationService (gov.ca.cwds.cms.data.access.service.BusinessValidationService)2 PhoneContactDetail (gov.ca.cwds.data.legacy.cms.entity.PhoneContactDetail)2 PlacementHomeInformation (gov.ca.cwds.data.legacy.cms.entity.PlacementHomeInformation)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 SubstituteCareProviderUcDao (gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderUcDao)1