DefaultSysSystemMappingService extends AbstractEventableDtoService<SysSystemMappingDto, SysSystemMapping, SysSystemMappingFilter> implements SysSystemMappingService { @Override public SysSystemMappingDto save(SysSystemMappingDto dto, BasePermission... permission) { SystemEntityType entityType = dto.getEntityType(); if (SystemOperationType.PROVISIONING == dto.getOperationType() && !entityType.isSupportsProvisioning()) { throw new ResultCodeException(AccResultCode.PROVISIONING_NOT_SUPPORTS_ENTITY_TYPE, ImmutableMap.of("entityType", entityType)); } getAttributeMappingService() .findBySystemMapping(dto).forEach(attribute -> { getAttributeMappingService().validate(attribute, dto); }); return super.save(dto, permission); } @Autowired  DefaultSysSystemMappingService(SysSystemMappingRepository repository, EntityEventManager entityEventManager,
			GroovyScriptService groovyScriptService, List<AbstractScriptEvaluator> evaluators,
			ApplicationContext applicationContext); @Override SysSystemMappingDto save(SysSystemMappingDto dto, BasePermission... permission); @Override Page<UUID> findIds(SysSystemMappingFilter filter, Pageable pageable, BasePermission... permission); @Override List<SysSystemMappingDto> findBySystem(SysSystemDto system, SystemOperationType operation,
			SystemEntityType entityType); @Override List<SysSystemMappingDto> findBySystemId(UUID systemId, SystemOperationType operation,
			SystemEntityType entityType); @Override List<SysSystemMappingDto> findByObjectClass(SysSchemaObjectClassDto objectClass,
			SystemOperationType operation, SystemEntityType entityType); @Override boolean isEnabledProtection(AccAccountDto account); @Override Integer getProtectionInterval(AccAccountDto account); @Override SysSystemMappingDto clone(UUID id); @Override void export(UUID id, IdmExportImportDto batch); @Override void validate(UUID id); @Override boolean canBeAccountCreated(String uid, AbstractDto dto, String script, SysSystemDto system); @Override SysSystemMappingDto findProvisioningMapping(UUID systemId, SystemEntityType entityType); @Override MappingContext getMappingContext(SysSystemMappingDto mapping, SysSystemEntityDto systemEntity, AbstractDto dto, SysSystemDto system); @Override @Transactional SysSystemMappingDto duplicateMapping(UUID id, SysSchemaObjectClassDto schema,
			Map<UUID, UUID> schemaAttributesIds, Map<UUID, UUID> mappedAttributesIds, boolean usedInSameSystem);  }
@Test public void textFilterTest() { IdmBasePermission permission = IdmBasePermission.ADMIN; SystemEntityType entityType = SystemEntityType.IDENTITY; SysSystemDto system = createSystem(); SysSchemaObjectClassDto objectClass = createObjectClass(system); SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(entityType, objectClass); mappingSystem1.setName("SomeName01"); mappingService.save(mappingSystem1); SysSystemMappingDto mappingSystem2 = testHelper.createMappingSystem(entityType, objectClass); mappingSystem2.setName("SomeName02"); mappingService.save(mappingSystem2); SysSystemMappingDto mappingSystem3 = testHelper.createMappingSystem(entityType, objectClass); mappingSystem3.setName("SomeName22"); mappingService.save(mappingSystem3); SysSystemMappingFilter filter = new SysSystemMappingFilter(); filter.setText("SomeName0"); Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission); assertEquals(2, result.getTotalElements()); assertTrue(result.getContent().contains(mappingSystem1)); assertTrue(result.getContent().contains(mappingSystem2)); }
@Test public void treeTypeIdFilterTest() { IdmBasePermission permission = IdmBasePermission.ADMIN; SystemEntityType entityType = SystemEntityType.IDENTITY; IdmTreeTypeDto treeType = new IdmTreeTypeDto(); treeType.setName("SomeTreeTypeName"); treeType.setCode("CodeCodeCodeCode"); treeType = treeTypeService.save(treeType); IdmTreeTypeDto treeType2 = new IdmTreeTypeDto(); treeType2.setName("SomeTreeTypeName2"); treeType2.setCode("CodeCodeCodeCode2"); treeType2 = treeTypeService.save(treeType2); SysSystemDto system = createSystem(); SysSchemaObjectClassDto objectClass = createObjectClass(system); SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(entityType, objectClass); mappingSystem1.setTreeType(treeType.getId()); mappingSystem1 = mappingService.save(mappingSystem1); SysSystemMappingDto mappingSystem2 = testHelper.createMappingSystem(entityType, objectClass); mappingSystem2.setTreeType(treeType2.getId()); mappingSystem2 = mappingService.save(mappingSystem2); SysSystemMappingFilter filter = new SysSystemMappingFilter(); filter.setTreeTypeId(mappingSystem1.getTreeType()); Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission); assertEquals(1, result.getTotalElements()); assertTrue(result.getContent().contains(mappingSystem1)); assertFalse(result.getContent().contains(mappingSystem2)); }