Search in sources :

Example 1 with ExtendedSCPEntityAwareDTO

use of gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO in project api-core by ca-cwds.

the class BaseDocToolRulesSubstituteCareProviderTest method setUp.

@Before
public void setUp() {
    businessValidationService = new BusinessValidationService(droolsService);
    SCPEntityAwareDTO scpEntityAwareDTO = new SCPEntityAwareDTO();
    entityAwareDTO = new ExtendedSCPEntityAwareDTO(scpEntityAwareDTO);
    PlacementHomeInformation placementHomeInformation = new PlacementHomeInformation();
    entityAwareDTO.setPlacementHomeInformation(placementHomeInformation);
    scpService = new SubstituteCareProviderCoreService(mock(SubstituteCareProviderDao.class));
    entityAwareDTO.setEntity(new SubstituteCareProvider());
}
Also used : SubstituteCareProviderCoreService(gov.ca.cwds.cms.data.access.service.impl.SubstituteCareProviderCoreService) SCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO) ExtendedSCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO) BusinessValidationService(gov.ca.cwds.cms.data.access.service.BusinessValidationService) ExtendedSCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO) PlacementHomeInformation(gov.ca.cwds.data.legacy.cms.entity.PlacementHomeInformation) SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider) Before(org.junit.Before)

Example 2 with ExtendedSCPEntityAwareDTO

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

Aggregations

ExtendedSCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO)2 SCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO)2 BusinessValidationService (gov.ca.cwds.cms.data.access.service.BusinessValidationService)2 PlacementHomeInformation (gov.ca.cwds.data.legacy.cms.entity.PlacementHomeInformation)2 SubstituteCareProvider (gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider)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 CountyOwnershipMapper (gov.ca.cwds.cms.data.access.mapper.CountyOwnershipMapper)1 DataAccessServiceBase (gov.ca.cwds.cms.data.access.service.DataAccessServiceBase)1 DataAccessServicesException (gov.ca.cwds.cms.data.access.service.DataAccessServicesException)1