Search in sources :

Example 1 with IdmGenerateValueFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmGenerateValueFilter in project CzechIdMng by bcvsolutions.

the class DefaultValueGeneratorManager method getEnabledGenerateValues.

private List<IdmGenerateValueDto> getEnabledGenerateValues(Class<? extends AbstractDto> dtoType) {
    Assert.notNull(dtoType, "DTO type is required.");
    // 
    IdmGenerateValueFilter filter = new IdmGenerateValueFilter();
    filter.setDisabled(Boolean.FALSE);
    filter.setDtoType(dtoType.getCanonicalName());
    // we must create new instance of array list, given list is unmodifiable
    List<IdmGenerateValueDto> generateValues = new ArrayList<>(service.find(filter, null).getContent());
    // sort by order
    Collections.sort(generateValues, new Comparator<IdmGenerateValueDto>() {

        @Override
        public int compare(IdmGenerateValueDto o1, IdmGenerateValueDto o2) {
            return Shorts.compare(o1.getSeq(), o2.getSeq());
        }
    });
    return generateValues;
}
Also used : IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) IdmGenerateValueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmGenerateValueFilter) ArrayList(java.util.ArrayList)

Example 2 with IdmGenerateValueFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmGenerateValueFilter in project CzechIdMng by bcvsolutions.

the class ComplexHrProcessIntegrationTest method otherStuffClenaup.

private void otherStuffClenaup() {
    // script cleanup
    IdmScriptDto dto = scriptService.getByCode(stringToLocalDateScript);
    scriptService.delete(dto);
    dto = scriptService.getByCode(getIdentityUuidByPersonalNumScript);
    scriptService.delete(dto);
    // generator setting removal
    IdmGenerateValueFilter generatorFilter = new IdmGenerateValueFilter();
    generatorFilter.setDtoType(IdmIdentityDto.class.getCanonicalName());
    generatedAttributeService.find(generatorFilter, null).getContent().stream().filter(gen -> IdentityUsernameGenerator.class.getCanonicalName().equals(gen.getGeneratorType())).forEach(gen -> {
        generatedAttributeService.delete(gen);
    });
    generatedAttributeService.find(generatorFilter, null).getContent().stream().filter(gen -> IdentityEmailGenerator.class.getCanonicalName().equals(gen.getGeneratorType())).forEach(gen -> {
        generatedAttributeService.delete(gen);
    });
    // identity EAV
    IdmFormAttributeFilter formAttrFilt = new IdmFormAttributeFilter();
    formAttrFilt.setCode(eavAutoRoleAttrName);
    List<IdmFormAttributeDto> attrs = formAttrService.find(formAttrFilt, null).getContent();
    attrs.forEach(attr -> {
        // if deleted after identity is deleted, no value remains
        formService.deleteAttribute(attr);
    });
}
Also used : Arrays(java.util.Arrays) IdmScriptCategory(eu.bcvsolutions.idm.core.api.domain.IdmScriptCategory) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) ZonedDateTime(java.time.ZonedDateTime) SysSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) Autowired(org.springframework.beans.factory.annotation.Autowired) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) StringUtils(org.apache.commons.lang3.StringUtils) InMemoryDirectoryServer(com.unboundid.ldap.listener.InMemoryDirectoryServer) Map(java.util.Map) IdmLongRunningTaskFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter) SynchronizationUnlinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) IdentityUsernameGenerator(eu.bcvsolutions.idm.core.generator.identity.IdentityUsernameGenerator) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) LDIFReader(com.unboundid.ldif.LDIFReader) AutomaticRoleAttributeRuleType(eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleType) RecursionType(eu.bcvsolutions.idm.core.api.domain.RecursionType) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) IcConnectorKeyImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorKeyImpl) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) LongRunningFutureTask(eu.bcvsolutions.idm.core.scheduler.api.dto.LongRunningFutureTask) HrEndContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEndContractProcess) Set(java.util.Set) IdmFormAttributeFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormAttributeFilter) ReconciliationMissingAccountActionType(eu.bcvsolutions.idm.acc.domain.ReconciliationMissingAccountActionType) IdentityState(eu.bcvsolutions.idm.core.api.domain.IdentityState) Serializable(java.io.Serializable) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) IdmRoleCatalogueService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueService) IdmAutomaticRoleAttributeRuleService(eu.bcvsolutions.idm.core.api.service.IdmAutomaticRoleAttributeRuleService) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) HrEnableContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEnableContractProcess) SynchronizationSchedulableTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) IdmRoleTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmRoleTreeNodeService) IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) EntityEventProcessor(eu.bcvsolutions.idm.core.api.event.EntityEventProcessor) Schema(com.unboundid.ldap.sdk.schema.Schema) RoleEvent(eu.bcvsolutions.idm.core.model.event.RoleEvent) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Lists(com.google.common.collect.Lists) SynchronizationLinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationLinkedActionType) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) RoleEventType(eu.bcvsolutions.idm.core.model.event.RoleEvent.RoleEventType) LDAPException(com.unboundid.ldap.sdk.LDAPException) Before(org.junit.Before) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) IdmFormDefinitionFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormDefinitionFilter) SchedulerConfiguration(eu.bcvsolutions.idm.core.scheduler.api.config.SchedulerConfiguration) HrContractExclusionProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrContractExclusionProcess) LongRunningTaskManager(eu.bcvsolutions.idm.core.scheduler.api.service.LongRunningTaskManager) IdmGenerateValueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmGenerateValueFilter) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IOException(java.io.IOException) Test(org.junit.Test) EntityManager(javax.persistence.EntityManager) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) ScriptAuthorityType(eu.bcvsolutions.idm.core.api.domain.ScriptAuthorityType) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) AutomaticRoleAttributeRuleComparison(eu.bcvsolutions.idm.core.api.domain.AutomaticRoleAttributeRuleComparison) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) Assert(org.junit.Assert) LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection) Entry(com.unboundid.ldap.sdk.Entry) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) InMemoryDirectoryServerConfig(com.unboundid.ldap.listener.InMemoryDirectoryServerConfig) TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) SysConnectorKeyDto(eu.bcvsolutions.idm.acc.dto.SysConnectorKeyDto) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) IdmAutomaticRoleAttributeRuleDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeRuleDto) After(org.junit.After) SynchronizationMissingEntityActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationMissingEntityActionType) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) Assert.fail(org.junit.Assert.fail) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) IdmScriptAuthorityDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptAuthorityDto) ImmutableMap(com.google.common.collect.ImmutableMap) IdmGenerateValueService(eu.bcvsolutions.idm.core.api.service.IdmGenerateValueService) Collection(java.util.Collection) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) IdmRoleCompositionService(eu.bcvsolutions.idm.core.api.service.IdmRoleCompositionService) UUID(java.util.UUID) SchedulerManager(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulerManager) Collectors(java.util.stream.Collectors) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) Objects(java.util.Objects) IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) List(java.util.List) Query(javax.persistence.Query) EventConfiguration(eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration) LocalDate(java.time.LocalDate) IdmRoleCatalogueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IdmAutomaticRoleAttributeService(eu.bcvsolutions.idm.core.api.service.IdmAutomaticRoleAttributeService) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) IdmScriptService(eu.bcvsolutions.idm.core.api.service.IdmScriptService) HashMap(java.util.HashMap) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) LDIFException(com.unboundid.ldif.LDIFException) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) HashSet(java.util.HashSet) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) EntityStateManager(eu.bcvsolutions.idm.core.api.service.EntityStateManager) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IdmRoleCatalogueRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueRoleDto) IdmLongRunningTaskService(eu.bcvsolutions.idm.core.scheduler.api.service.IdmLongRunningTaskService) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) IdmTreeTypeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeTypeFilter) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmTreeTypeService(eu.bcvsolutions.idm.core.api.service.IdmTreeTypeService) IdmRoleCatalogueRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueRoleService) FileInputStream(java.io.FileInputStream) ApplicationContext(org.springframework.context.ApplicationContext) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmRoleTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleTreeNodeDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) IdmFormDefinitionService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormDefinitionService) IdentityEmailGenerator(eu.bcvsolutions.idm.core.generator.identity.IdentityEmailGenerator) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) IdmScriptAuthorityService(eu.bcvsolutions.idm.core.api.service.IdmScriptAuthorityService) InputStream(java.io.InputStream) Transactional(org.springframework.transaction.annotation.Transactional) IdmFormAttributeFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormAttributeFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto) IdmGenerateValueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmGenerateValueFilter) IdentityUsernameGenerator(eu.bcvsolutions.idm.core.generator.identity.IdentityUsernameGenerator) IdentityEmailGenerator(eu.bcvsolutions.idm.core.generator.identity.IdentityEmailGenerator) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Aggregations

IdmGenerateValueDto (eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto)2 IdmGenerateValueFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmGenerateValueFilter)2 ArrayList (java.util.ArrayList)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1 InMemoryDirectoryServer (com.unboundid.ldap.listener.InMemoryDirectoryServer)1 InMemoryDirectoryServerConfig (com.unboundid.ldap.listener.InMemoryDirectoryServerConfig)1 Entry (com.unboundid.ldap.sdk.Entry)1 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)1 LDAPException (com.unboundid.ldap.sdk.LDAPException)1 Schema (com.unboundid.ldap.sdk.schema.Schema)1 LDIFException (com.unboundid.ldif.LDIFException)1 LDIFReader (com.unboundid.ldif.LDIFReader)1 TestHelper (eu.bcvsolutions.idm.acc.TestHelper)1 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)1 ReconciliationMissingAccountActionType (eu.bcvsolutions.idm.acc.domain.ReconciliationMissingAccountActionType)1 SynchronizationLinkedActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationLinkedActionType)1 SynchronizationMissingEntityActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationMissingEntityActionType)1 SynchronizationUnlinkedActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType)1 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)1