DefaultSysRoleSystemAttributeService extends
		AbstractReadWriteDtoService<SysRoleSystemAttributeDto, SysRoleSystemAttribute, SysRoleSystemAttributeFilter> implements SysRoleSystemAttributeService { @Transactional @Override public SysRoleSystemAttributeDto addRoleMappingAttribute(UUID systemId, UUID roleId, String attributeName, String transformationScript, String objectClassName) { Assert.notNull(systemId, "SystemId cannot be null!"); Assert.notNull(roleId, "RoleId cannot be null!"); Assert.notNull(attributeName, "Attribute name cannot be null"); Assert.hasLength(attributeName, "Attribute name cannot be blank"); UUID roleSystemId = getSysRoleSystem(systemId, roleId, objectClassName); SysRoleSystemAttributeDto systemAttribute = getSystemAttribute(roleSystemId, attributeName); if (systemAttribute == null) { systemAttribute = new SysRoleSystemAttributeDto(); } systemAttribute.setEntityAttribute(false); systemAttribute.setStrategyType(AttributeMappingStrategyType.MERGE); UUID systemAttributeMappingId = getSystemAttributeMapping(systemId, attributeName, objectClassName).getId(); systemAttribute.setName(attributeName); systemAttribute.setRoleSystem(roleSystemId); systemAttribute.setSystemAttributeMapping(systemAttributeMappingId); if (transformationScript != null) { systemAttribute.setTransformScript(transformationScript); } return this.save(systemAttribute); } @Autowired  DefaultSysRoleSystemAttributeService(SysRoleSystemAttributeRepository repository); @Override @Transactional SysRoleSystemAttributeDto save(SysRoleSystemAttributeDto dto, BasePermission... permission); @Override SysRoleSystemAttributeDto saveInternal(SysRoleSystemAttributeDto dto); @Override @Transactional void delete(SysRoleSystemAttributeDto roleSystemAttribute, BasePermission... permission); @Transactional @Override SysRoleSystemAttributeDto addRoleMappingAttribute(UUID systemId, UUID roleId, String attributeName,
			String transformationScript, String objectClassName); @Transactional @Override SysSystemMappingDto getSystemMapping(UUID systemId, String objectClassName,
			SystemOperationType operationType);  }
@Test public void testAddRoleMappingAttribute() { IdmRoleDto role = helper.createRole(); SysSystemDto system = helper.createTestResourceSystem(true); SysRoleSystemAttributeDto attribute = roleSystemAttributeService.addRoleMappingAttribute(system.getId(), role.getId(), helper.getSchemaColumnName(TestHelper.ATTRIBUTE_MAPPING_FIRSTNAME), null, IcObjectClassInfo.ACCOUNT); Assert.assertNotNull(attribute); SysRoleSystemFilter roleSystemFilter = new SysRoleSystemFilter(); roleSystemFilter.setRoleId(role.getId()); roleSystemFilter.setSystemId(system.getId()); List<SysRoleSystemDto> roleSystems = roleSystemService.find(roleSystemFilter, null).getContent(); Assert.assertEquals(1, roleSystems.size()); SysRoleSystemDto roleSystem = roleSystems.get(0); SysSystemMappingDto systemMapping = roleSystemAttributeService.getSystemMapping(system.getId(), IcObjectClassInfo.ACCOUNT, SystemOperationType.PROVISIONING); Assert.assertNotNull(systemMapping); Assert.assertEquals(systemMapping.getId(), roleSystem.getSystemMapping()); }