Search in sources :

Example 1 with CollectionUtils.isEqualCollection

use of org.apache.commons.collections4.CollectionUtils.isEqualCollection in project commons-collections by apache.

the class AbstractMultiValuedMapTest method testFullMapCompatibility.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testFullMapCompatibility() throws Exception {
    final MultiValuedMap map = makeFullMap();
    final MultiValuedMap map2 = (MultiValuedMap) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
    assertEquals("Map is the right size", map.size(), map2.size());
    for (final Object key : map.keySet()) {
        assertTrue("Map had inequal elements", CollectionUtils.isEqualCollection(map.get(key), map2.get(key)));
        if (isRemoveSupported()) {
            map2.remove(key);
        }
    }
    if (isRemoveSupported()) {
        assertEquals("Map had extra values", 0, map2.size());
    }
}
Also used : MultiValuedMap(org.apache.commons.collections4.MultiValuedMap) BulkTest(org.apache.commons.collections4.BulkTest) AbstractMapTest(org.apache.commons.collections4.map.AbstractMapTest) Test(org.junit.Test) AbstractSetTest(org.apache.commons.collections4.set.AbstractSetTest) AbstractMultiSetTest(org.apache.commons.collections4.multiset.AbstractMultiSetTest) AbstractCollectionTest(org.apache.commons.collections4.collection.AbstractCollectionTest) AbstractObjectTest(org.apache.commons.collections4.AbstractObjectTest) AbstractBagTest(org.apache.commons.collections4.bag.AbstractBagTest)

Example 2 with CollectionUtils.isEqualCollection

use of org.apache.commons.collections4.CollectionUtils.isEqualCollection in project cuba by cuba-platform.

the class WebDataGrid method applySettings.

@Override
public void applySettings(Element element) {
    if (!isSettingsEnabled()) {
        return;
    }
    final Element columnsElem = element.element("columns");
    if (columnsElem != null) {
        List<Column> modelColumns = getVisibleColumns();
        List<String> modelIds = modelColumns.stream().map(String::valueOf).collect(Collectors.toList());
        List<String> loadedIds = Dom4j.elements(columnsElem, "columns").stream().map(colElem -> colElem.attributeValue("id")).collect(Collectors.toList());
        if (CollectionUtils.isEqualCollection(modelIds, loadedIds)) {
            applyColumnSettings(element, modelColumns);
        }
    }
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) Datasource(com.haulmont.cuba.gui.data.Datasource) Dom4j(com.haulmont.bali.util.Dom4j) DsBuilder(com.haulmont.cuba.gui.data.DsBuilder) IconResolver(com.haulmont.cuba.web.gui.icons.IconResolver) Window(com.haulmont.cuba.gui.components.Window) AppUI(com.haulmont.cuba.web.AppUI) MenuItem(com.vaadin.addon.contextmenu.MenuItem) EventRouter(com.haulmont.bali.events.EventRouter) SecuredActionsHolder(com.haulmont.cuba.gui.components.Component.SecuredActionsHolder) FormatterBasedConverter(com.haulmont.cuba.web.toolkit.ui.converters.FormatterBasedConverter) Preconditions.checkNotNullArgument(com.haulmont.bali.util.Preconditions.checkNotNullArgument) com.haulmont.cuba.gui.components(com.haulmont.cuba.gui.components) PropertyDatasource(com.haulmont.cuba.gui.data.PropertyDatasource) ImmutableMap(com.google.common.collect.ImmutableMap) PropertyValueGenerator(com.vaadin.data.util.PropertyValueGenerator) App(com.haulmont.cuba.web.App) Collectors(java.util.stream.Collectors) ObjectToObjectConverter(com.haulmont.cuba.web.toolkit.ui.converters.ObjectToObjectConverter) PropertyChangeListener(java.beans.PropertyChangeListener) ComponentsHelper.findActionById(com.haulmont.cuba.gui.ComponentsHelper.findActionById) GeneratedPropertyContainer(com.vaadin.data.util.GeneratedPropertyContainer) ThemeConstants(com.haulmont.cuba.gui.theme.ThemeConstants) ClientConfig(com.haulmont.cuba.client.ClientConfig) ComponentsHelper(com.haulmont.cuba.gui.ComponentsHelper) com.haulmont.cuba.web.gui.components.renderers(com.haulmont.cuba.web.gui.components.renderers) java.util(java.util) CollectionFormatter(com.haulmont.cuba.gui.components.formatters.CollectionFormatter) GridContextMenuOpenListener(com.vaadin.addon.contextmenu.GridContextMenu.GridContextMenuOpenListener) MetaPropertyPath(com.haulmont.chile.core.model.MetaPropertyPath) CssLayout(com.vaadin.ui.CssLayout) MetaClass(com.haulmont.chile.core.model.MetaClass) CollectionUtils(org.apache.commons.collections4.CollectionUtils) com.haulmont.cuba.core.global(com.haulmont.cuba.core.global) Validator(com.vaadin.data.Validator) Field(com.haulmont.cuba.gui.components.Field) SortableDataGridIndexedCollectionDsWrapper(com.haulmont.cuba.web.gui.data.SortableDataGridIndexedCollectionDsWrapper) com.haulmont.cuba.gui.data.impl(com.haulmont.cuba.gui.data.impl) DataGridIndexedCollectionDsWrapper(com.haulmont.cuba.web.gui.data.DataGridIndexedCollectionDsWrapper) com.haulmont.cuba.web.toolkit.ui(com.haulmont.cuba.web.toolkit.ui) KeyCode(com.vaadin.event.ShortcutAction.KeyCode) Nullable(javax.annotation.Nullable) Item(com.vaadin.data.Item) Formatter(com.haulmont.cuba.gui.components.Formatter) DataGridContainer(com.haulmont.cuba.web.toolkit.data.DataGridContainer) MetaProperty(com.haulmont.chile.core.model.MetaProperty) StringToObjectConverter(com.haulmont.cuba.web.toolkit.ui.converters.StringToObjectConverter) ErrorMessage(com.vaadin.server.ErrorMessage) Preconditions(com.haulmont.bali.util.Preconditions) HeightMode(com.vaadin.shared.ui.grid.HeightMode) ShortcutListener(com.vaadin.event.ShortcutListener) Menu(com.vaadin.addon.contextmenu.Menu) Element(org.dom4j.Element) CollectionDatasource(com.haulmont.cuba.gui.data.CollectionDatasource) YesNoIconConverter(com.haulmont.cuba.web.toolkit.ui.converters.YesNoIconConverter) Entity(com.haulmont.cuba.core.entity.Entity) com.vaadin.ui(com.vaadin.ui) Component(com.vaadin.ui.Component) Element(org.dom4j.Element)

Example 3 with CollectionUtils.isEqualCollection

use of org.apache.commons.collections4.CollectionUtils.isEqualCollection in project CzechIdMng by bcvsolutions.

the class ContractSliceSynchronizationExecutor method isGuaranteesSame.

/**
 * Check if current contract's slices guarantees are same as in account values
 *
 * @param dto
 * @param newGuarantees
 * @return
 */
private boolean isGuaranteesSame(IdmContractSliceDto dto, List<IdmIdentityDto> newGuarantees) {
    // Guarantees
    IdmContractSliceGuaranteeFilter guaranteeFilter = new IdmContractSliceGuaranteeFilter();
    guaranteeFilter.setContractSliceId(dto.getId());
    List<IdmContractSliceGuaranteeDto> currentGuarantees = guaranteeService.find(guaranteeFilter, null).getContent();
    List<UUID> currentGuranteeIds = currentGuarantees.stream().map(gurrantee -> {
        return gurrantee.getGuarantee();
    }).collect(Collectors.toList());
    List<UUID> newGuranteeIds = newGuarantees.stream().map(gurrantee -> {
        return gurrantee.getId();
    }).collect(Collectors.toList());
    return CollectionUtils.isEqualCollection(currentGuranteeIds, newGuranteeIds);
}
Also used : OperationResultType(eu.bcvsolutions.idm.acc.domain.OperationResultType) ContractSliceGuaranteeEventType(eu.bcvsolutions.idm.core.model.event.ContractSliceGuaranteeEvent.ContractSliceGuaranteeEventType) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmContractSliceGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceGuaranteeFilter) ZonedDateTime(java.time.ZonedDateTime) ContractSliceEventType(eu.bcvsolutions.idm.core.model.event.ContractSliceEvent.ContractSliceEventType) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) ClearDirtyStateForContractSliceTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ClearDirtyStateForContractSliceTaskExecutor) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) ProcessAllAutomaticRoleByAttributeTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAllAutomaticRoleByAttributeTaskExecutor) StringUtils(org.apache.commons.lang3.StringUtils) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) ContractSliceEvent(eu.bcvsolutions.idm.core.model.event.ContractSliceEvent) ContractSliceGuaranteeEvent(eu.bcvsolutions.idm.core.model.event.ContractSliceGuaranteeEvent) AutomaticRoleManager(eu.bcvsolutions.idm.core.api.service.AutomaticRoleManager) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) EntityAccountService(eu.bcvsolutions.idm.acc.service.api.EntityAccountService) IdmLongRunningTaskFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) ImmutableMap(com.google.common.collect.ImmutableMap) ContractState(eu.bcvsolutions.idm.core.api.domain.ContractState) HrEndContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEndContractProcess) UUID(java.util.UUID) SchedulerManager(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulerManager) Collectors(java.util.stream.Collectors) IdmContractSlice_(eu.bcvsolutions.idm.core.model.entity.IdmContractSlice_) Serializable(java.io.Serializable) SysSyncContractConfig_(eu.bcvsolutions.idm.acc.entity.SysSyncContractConfig_) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) IdmScheduledTaskService(eu.bcvsolutions.idm.core.scheduler.api.service.IdmScheduledTaskService) SelectCurrentContractSliceTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.SelectCurrentContractSliceTaskExecutor) List(java.util.List) EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) IdmContractSliceFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceFilter) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) HrEnableContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEnableContractProcess) IdmContractSliceService(eu.bcvsolutions.idm.core.api.service.IdmContractSliceService) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) BooleanUtils(org.apache.commons.lang3.BooleanUtils) IdmContractSliceGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceGuaranteeDto) CollectionUtils(org.apache.commons.collections4.CollectionUtils) IdmTreeNode_(eu.bcvsolutions.idm.core.model.entity.IdmTreeNode_) MessageFormat(java.text.MessageFormat) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmContractSliceDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceDto) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) SynchronizationActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationActionType) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) CorrelationFilter(eu.bcvsolutions.idm.core.api.dto.filter.CorrelationFilter) IdmContractSliceGuaranteeService(eu.bcvsolutions.idm.core.api.service.IdmContractSliceGuaranteeService) AccContractSliceAccountDto(eu.bcvsolutions.idm.acc.dto.AccContractSliceAccountDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) Codeable(eu.bcvsolutions.idm.core.api.domain.Codeable) IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) HrContractExclusionProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrContractExclusionProcess) LongRunningTaskManager(eu.bcvsolutions.idm.core.scheduler.api.service.LongRunningTaskManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AccContractSliceAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccContractSliceAccountFilter) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) SyncIdentityContractDto(eu.bcvsolutions.idm.acc.dto.SyncIdentityContractDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) SchedulableTaskExecutor(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulableTaskExecutor) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Component(org.springframework.stereotype.Component) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) SynchronizationEntityExecutor(eu.bcvsolutions.idm.acc.service.api.SynchronizationEntityExecutor) AccContractSliceAccountService(eu.bcvsolutions.idm.acc.service.api.AccContractSliceAccountService) ContractSliceManager(eu.bcvsolutions.idm.core.api.service.ContractSliceManager) Assert(org.springframework.util.Assert) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) IdmContractSliceGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceGuaranteeFilter) IdmContractSliceGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractSliceGuaranteeDto) UUID(java.util.UUID)

Example 4 with CollectionUtils.isEqualCollection

use of org.apache.commons.collections4.CollectionUtils.isEqualCollection in project archiva by apache.

the class DefaultSecurityConfigurationService method updateConfiguration.

@Override
public SecurityConfiguration updateConfiguration(SecurityConfiguration newConfiguration) throws ArchivaRestServiceException {
    if (newConfiguration == null) {
        throw new ArchivaRestServiceException(ErrorMessage.of(ErrorKeys.MISSING_DATA), 400);
    }
    try {
        RedbackRuntimeConfiguration conf = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration();
        boolean userManagerChanged = !CollectionUtils.isEqualCollection(newConfiguration.getActiveUserManagers(), conf.getUserManagerImpls());
        boolean rbacManagerChanged = !CollectionUtils.isEqualCollection(newConfiguration.getActiveRbacManagers(), conf.getRbacManagerImpls());
        boolean ldapConfigured = newConfiguration.getActiveUserManagers().stream().anyMatch(um -> um.contains("ldap"));
        if (!ldapConfigured) {
            ldapConfigured = newConfiguration.getActiveRbacManagers().stream().anyMatch(um -> um.contains("ldap"));
        }
        updateConfig(newConfiguration, conf);
        redbackRuntimeConfigurationAdmin.updateRedbackRuntimeConfiguration(conf);
        if (userManagerChanged) {
            log.info("user managerImpls changed to {} so reload it", newConfiguration.getActiveUserManagers());
            userManager.initialize();
        }
        if (rbacManagerChanged) {
            log.info("rbac manager changed to {} so reload it", newConfiguration.getActiveRbacManagers());
            rbacManager.initialize();
            roleManager.initialize();
        }
        if (ldapConfigured) {
            try {
                ldapConnectionFactory.initialize();
            } catch (Exception e) {
                log.error("Could not initialize LDAP connection factory: {}", e.getMessage());
                throw new ArchivaRestServiceException(ErrorMessage.of(ErrorKeys.LDAP_CF_INIT_FAILED, e.getMessage()));
            }
        }
        Collection<PasswordRule> passwordRules = applicationContext.getBeansOfType(PasswordRule.class).values();
        for (PasswordRule passwordRule : passwordRules) {
            passwordRule.initialize();
        }
        Collection<CookieSettings> cookieSettingsList = applicationContext.getBeansOfType(CookieSettings.class).values();
        for (CookieSettings cookieSettings : cookieSettingsList) {
            cookieSettings.initialize();
        }
        Collection<Authenticator> authenticators = applicationContext.getBeansOfType(Authenticator.class).values();
        for (Authenticator authenticator : authenticators) {
            try {
                log.debug("Initializing authenticatior " + authenticator.getId());
                authenticator.initialize();
            } catch (Exception e) {
                log.error("Initialization of authenticator failed " + authenticator.getId(), e);
            }
        }
        if (ldapConfigured) {
            try {
                ldapUserMapper.initialize();
            } catch (Exception e) {
                throw new ArchivaRestServiceException(ErrorMessage.of(ErrorKeys.LDAP_USER_MAPPER_INIT_FAILED, e.getMessage()));
            }
        }
    } catch (RepositoryAdminException e) {
        throw new ArchivaRestServiceException(ErrorMessage.of(REPOSITORY_ADMIN_ERROR, e.getMessage()));
    }
    try {
        return SecurityConfiguration.ofRedbackConfiguration(redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration());
    } catch (RepositoryAdminException e) {
        log.error("Error while retrieve updated configuration: {}", e.getMessage());
        throw new ArchivaRestServiceException(ErrorMessage.of(REPOSITORY_ADMIN_ERROR, e.getMessage()));
    }
}
Also used : SecurityConfiguration(org.apache.archiva.rest.api.v2.model.SecurityConfiguration) LoggerFactory(org.slf4j.LoggerFactory) NamingException(javax.naming.NamingException) StringUtils(org.apache.commons.lang3.StringUtils) AuthenticationException(javax.naming.AuthenticationException) UserManager(org.apache.archiva.redback.users.UserManager) RBACManager(org.apache.archiva.redback.rbac.RBACManager) Map(java.util.Map) Authenticator(org.apache.archiva.redback.authentication.Authenticator) PasswordRule(org.apache.archiva.redback.policy.PasswordRule) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) QueryHelper(org.apache.archiva.components.rest.util.QueryHelper) Predicate(java.util.function.Predicate) Collection(java.util.Collection) INVALID_RESULT_SET_ERROR(org.apache.archiva.rest.api.v2.svc.ErrorKeys.INVALID_RESULT_SET_ERROR) Collectors(java.util.stream.Collectors) CacheConfiguration(org.apache.archiva.rest.api.v2.model.CacheConfiguration) BeanInformation(org.apache.archiva.rest.api.v2.model.BeanInformation) List(java.util.List) LdapConnectionConfiguration(org.apache.archiva.redback.common.ldap.connection.LdapConnectionConfiguration) REPOSITORY_ADMIN_ERROR(org.apache.archiva.rest.api.v2.svc.ErrorKeys.REPOSITORY_ADMIN_ERROR) Response(javax.ws.rs.core.Response) ServiceUnavailableException(javax.naming.ServiceUnavailableException) PostConstruct(javax.annotation.PostConstruct) RedbackRuntimeConfigurationAdmin(org.apache.archiva.admin.model.runtime.RedbackRuntimeConfigurationAdmin) NoPermissionException(javax.naming.NoPermissionException) ErrorKeys(org.apache.archiva.rest.api.v2.svc.ErrorKeys) ArchivaRestServiceException(org.apache.archiva.rest.api.v2.svc.ArchivaRestServiceException) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ResourceBundle(java.util.ResourceBundle) PropertyEntry(org.apache.archiva.components.rest.model.PropertyEntry) Service(org.springframework.stereotype.Service) SecurityConfigurationService(org.apache.archiva.rest.api.v2.svc.SecurityConfigurationService) AuthenticationNotSupportedException(javax.naming.AuthenticationNotSupportedException) Named(javax.inject.Named) LdapException(org.apache.archiva.redback.common.ldap.connection.LdapException) LdapConfiguration(org.apache.archiva.rest.api.v2.model.LdapConfiguration) LdapConnectionFactory(org.apache.archiva.redback.common.ldap.connection.LdapConnectionFactory) LdapUserMapper(org.apache.archiva.redback.common.ldap.user.LdapUserMapper) Logger(org.slf4j.Logger) Properties(java.util.Properties) RoleManager(org.apache.archiva.redback.role.RoleManager) ApplicationContext(org.springframework.context.ApplicationContext) LdapConnection(org.apache.archiva.redback.common.ldap.connection.LdapConnection) RedbackRuntimeConfiguration(org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration) CookieSettings(org.apache.archiva.redback.policy.CookieSettings) ErrorMessage(org.apache.archiva.rest.api.v2.svc.ErrorMessage) InvalidNameException(javax.naming.InvalidNameException) CommunicationException(javax.naming.CommunicationException) PagedResult(org.apache.archiva.components.rest.model.PagedResult) Comparator(java.util.Comparator) Collections(java.util.Collections) PasswordRule(org.apache.archiva.redback.policy.PasswordRule) CookieSettings(org.apache.archiva.redback.policy.CookieSettings) ArchivaRestServiceException(org.apache.archiva.rest.api.v2.svc.ArchivaRestServiceException) RedbackRuntimeConfiguration(org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) NamingException(javax.naming.NamingException) AuthenticationException(javax.naming.AuthenticationException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) ServiceUnavailableException(javax.naming.ServiceUnavailableException) NoPermissionException(javax.naming.NoPermissionException) ArchivaRestServiceException(org.apache.archiva.rest.api.v2.svc.ArchivaRestServiceException) AuthenticationNotSupportedException(javax.naming.AuthenticationNotSupportedException) LdapException(org.apache.archiva.redback.common.ldap.connection.LdapException) InvalidNameException(javax.naming.InvalidNameException) CommunicationException(javax.naming.CommunicationException) Authenticator(org.apache.archiva.redback.authentication.Authenticator)

Example 5 with CollectionUtils.isEqualCollection

use of org.apache.commons.collections4.CollectionUtils.isEqualCollection in project CzechIdMng by bcvsolutions.

the class ContractSynchronizationExecutor method isGuaranteesSame.

/**
 * Check if current contract's guarantees are same as in account values
 *
 * @param dto
 * @param newGuarantees
 * @return
 */
private boolean isGuaranteesSame(IdmIdentityContractDto dto, List<IdmIdentityDto> newGuarantees) {
    // Guarantees
    IdmContractGuaranteeFilter guaranteeFilter = new IdmContractGuaranteeFilter();
    guaranteeFilter.setIdentityContractId(dto.getId());
    List<IdmContractGuaranteeDto> currentGuarantees = guaranteeService.find(guaranteeFilter, null).getContent();
    List<UUID> currentGuranteeIds = currentGuarantees.stream().map(gurrantee -> {
        return gurrantee.getGuarantee();
    }).collect(Collectors.toList());
    List<UUID> newGuranteeIds = newGuarantees.stream().map(gurrantee -> {
        return gurrantee.getId();
    }).collect(Collectors.toList());
    return CollectionUtils.isEqualCollection(currentGuranteeIds, newGuranteeIds);
}
Also used : OperationResultType(eu.bcvsolutions.idm.acc.domain.OperationResultType) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) ZonedDateTime(java.time.ZonedDateTime) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessSkippedAutomaticRoleByTreeForContractTaskExecutor) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) ProcessAllAutomaticRoleByAttributeTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAllAutomaticRoleByAttributeTaskExecutor) ContractGuaranteeEventType(eu.bcvsolutions.idm.core.model.event.ContractGuaranteeEvent.ContractGuaranteeEventType) StringUtils(org.apache.commons.lang3.StringUtils) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) ContractGuaranteeEvent(eu.bcvsolutions.idm.core.model.event.ContractGuaranteeEvent) AutomaticRoleManager(eu.bcvsolutions.idm.core.api.service.AutomaticRoleManager) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) EntityAccountService(eu.bcvsolutions.idm.acc.service.api.EntityAccountService) Map(java.util.Map) IdmLongRunningTaskFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) ImmutableMap(com.google.common.collect.ImmutableMap) ContractPositionEventType(eu.bcvsolutions.idm.core.model.event.ContractPositionEvent.ContractPositionEventType) ContractState(eu.bcvsolutions.idm.core.api.domain.ContractState) IdentityContractEventType(eu.bcvsolutions.idm.core.model.event.IdentityContractEvent.IdentityContractEventType) AccContractAccountService(eu.bcvsolutions.idm.acc.service.api.AccContractAccountService) HrEndContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEndContractProcess) UUID(java.util.UUID) SchedulerManager(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulerManager) Collectors(java.util.stream.Collectors) Serializable(java.io.Serializable) SysSyncContractConfig_(eu.bcvsolutions.idm.acc.entity.SysSyncContractConfig_) IdmContractPositionDto(eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) IdmScheduledTaskService(eu.bcvsolutions.idm.core.scheduler.api.service.IdmScheduledTaskService) List(java.util.List) EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) IdentityContractEvent(eu.bcvsolutions.idm.core.model.event.IdentityContractEvent) ContractPositionEvent(eu.bcvsolutions.idm.core.model.event.ContractPositionEvent) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) HrEnableContractProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrEnableContractProcess) AccContractAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccContractAccountFilter) IdmContractPositionService(eu.bcvsolutions.idm.core.api.service.IdmContractPositionService) IdmTreeNodeService(eu.bcvsolutions.idm.core.api.service.IdmTreeNodeService) HashMap(java.util.HashMap) BooleanUtils(org.apache.commons.lang3.BooleanUtils) IdmContractGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter) CollectionUtils(org.apache.commons.collections4.CollectionUtils) IdmTreeNode_(eu.bcvsolutions.idm.core.model.entity.IdmTreeNode_) MessageFormat(java.text.MessageFormat) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) EntityStateManager(eu.bcvsolutions.idm.core.api.service.EntityStateManager) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) IdmContractPositionFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractPositionFilter) SynchronizationActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationActionType) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) CorrelationFilter(eu.bcvsolutions.idm.core.api.dto.filter.CorrelationFilter) EventResult(eu.bcvsolutions.idm.core.api.event.EventResult) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) HrContractExclusionProcess(eu.bcvsolutions.idm.core.scheduler.task.impl.hr.HrContractExclusionProcess) LongRunningTaskManager(eu.bcvsolutions.idm.core.scheduler.api.service.LongRunningTaskManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) SyncIdentityContractDto(eu.bcvsolutions.idm.acc.dto.SyncIdentityContractDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IdmContractGuaranteeService(eu.bcvsolutions.idm.core.api.service.IdmContractGuaranteeService) SchedulableTaskExecutor(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulableTaskExecutor) EventContext(eu.bcvsolutions.idm.core.api.event.EventContext) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Component(org.springframework.stereotype.Component) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) SynchronizationEntityExecutor(eu.bcvsolutions.idm.acc.service.api.SynchronizationEntityExecutor) AccContractAccountDto(eu.bcvsolutions.idm.acc.dto.AccContractAccountDto) Assert(org.springframework.util.Assert) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) UUID(java.util.UUID) IdmContractGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter)

Aggregations

Collectors (java.util.stream.Collectors)7 CollectionUtils (org.apache.commons.collections4.CollectionUtils)7 ImmutableMap (com.google.common.collect.ImmutableMap)5 List (java.util.List)5 StringUtils (org.apache.commons.lang3.StringUtils)5 UUID (java.util.UUID)3 AccResultCode (eu.bcvsolutions.idm.acc.domain.AccResultCode)2 AttributeMapping (eu.bcvsolutions.idm.acc.domain.AttributeMapping)2 OperationResultType (eu.bcvsolutions.idm.acc.domain.OperationResultType)2 SynchronizationActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationActionType)2 SynchronizationContext (eu.bcvsolutions.idm.acc.domain.SynchronizationContext)2 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)2 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)2 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)2 AccContractAccountDto (eu.bcvsolutions.idm.acc.dto.AccContractAccountDto)2 EntityAccountDto (eu.bcvsolutions.idm.acc.dto.EntityAccountDto)2 SyncIdentityContractDto (eu.bcvsolutions.idm.acc.dto.SyncIdentityContractDto)2 SysSyncActionLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto)2 SysSyncContractConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto)2 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)2