test_class.declarator: identityService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmIdentityService identityService;
test_class.type: IdmIdentityService
test_class.var_name: identityService
test_class.file: Realization/backend/core/core-impl/src/test/java/eu/bcvsolutions/idm/core/generator/identity/IdentityEmailGeneratorTest.java
test_class.identifier: IdentityEmailGeneratorTest
test_class.superclass: extends AbstractGeneratorTest
test_case.body: @Test
  	public void testDisable() {
  		String emailSuffix = "ex.tld";
  		String emailSuffix1 = "@test.tld";
  		String emailSuffix2 = "bcvsolutions.tld";
  		String username = this.getHelper().createName();
  
  		IdmIdentityDto identityDto = new IdmIdentityDto();
  		identityDto.setFirstName(this.getHelper().createName());
  		identityDto.setLastName(this.getHelper().createName());
  		identityDto.setUsername(username);
  		
  		ValueGeneratorDto generator = getGenerator();
  
  		// first - this generator will be generate email
  		this.createGenerator(getDtoType(), getGeneratorType(),
  				this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(
  						IdentityEmailGenerator.EMAIL_SUFFIX, emailSuffix,
  						IdentityEmailGenerator.GENERATE_FROM_USERNAME, Boolean.TRUE.toString())), 10, null);
  
  		// second
  		IdmGenerateValueDto createGenerator = this.createGenerator(getDtoType(), getGeneratorType(),
  				this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(
  						IdentityEmailGenerator.EMAIL_SUFFIX, emailSuffix1,
  						IdentityEmailGenerator.GENERATE_FROM_USERNAME, Boolean.TRUE.toString())), 20, null);
  		createGenerator.setDisabled(true);
  		this.generatedAttributeService.save(createGenerator);
  
  		// the last
  		createGenerator = this.createGenerator(getDtoType(), getGeneratorType(),
  				this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(
  						IdentityEmailGenerator.EMAIL_SUFFIX, emailSuffix2)), 30, null);
  		createGenerator.setDisabled(true);
  		this.generatedAttributeService.save(createGenerator);
  
  		IdmIdentityDto generatedDto = valueGeneratorManager.generate(identityDto);
  		assertNotNull(generatedDto.getEmail());
  		assertEquals(username + "@" + emailSuffix, generatedDto.getEmail());
  	}
test_case.class_method_signature: IdentityEmailGeneratorTest.testDisable()
test_case.full_signature: @Test public void testDisable()
test_case.identifier: testDisable
test_case.invocations: createName getHelper setFirstName createName getHelper setLastName createName getHelper setUsername getGenerator createGenerator getDtoType getGeneratorType createConfiguration getFormDefinition of toString createGenerator getDtoType getGeneratorType createConfiguration getFormDefinition of toString setDisabled save createGenerator getDtoType getGeneratorType createConfiguration getFormDefinition of setDisabled save generate assertNotNull getEmail assertEquals getEmail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDisable()
focal_class.declarator: GENERATOR_NAME = "core-identity-email-value-generator"
focal_class.modifier: public static final
focal_class.original_string: public static final String GENERATOR_NAME = "core-identity-email-value-generator";
focal_class.type: String
focal_class.var_name: GENERATOR_NAME
focal_class.declarator: EMAIL_SUFFIX = "emailSuffix"
focal_class.modifier: public static
focal_class.original_string: public static String EMAIL_SUFFIX = "emailSuffix";
focal_class.type: String
focal_class.var_name: EMAIL_SUFFIX
focal_class.declarator: GENERATE_FROM_USERNAME = "generateFromUsername"
focal_class.modifier: public static
focal_class.original_string: public static String GENERATE_FROM_USERNAME = "generateFromUsername";
focal_class.type: String
focal_class.var_name: GENERATE_FROM_USERNAME
focal_class.declarator: AT_CONSTANT = '@'
focal_class.modifier: private static
focal_class.original_string: private static Character AT_CONSTANT = '@';
focal_class.type: Character
focal_class.var_name: AT_CONSTANT
focal_class.file: Realization/backend/core/core-impl/src/main/java/eu/bcvsolutions/idm/core/generator/identity/IdentityEmailGenerator.java
focal_class.identifier: IdentityEmailGenerator
focal_class.class_method_signature: IdentityEmailGenerator.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: IdentityEmailGenerator.getPropertyNames()
focal_class.full_signature: @Override public List<String> getPropertyNames()
focal_class.identifier: getPropertyNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<String>
focal_class.signature: List<String> getPropertyNames()
focal_class.class_method_signature: IdentityEmailGenerator.generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)
focal_class.full_signature: @Override public IdmIdentityDto generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)
focal_class.identifier: generate
focal_class.modifiers: @Override public
focal_class.parameters: (IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)
focal_class.return: IdmIdentityDto
focal_class.signature: IdmIdentityDto generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)
focal_class.class_method_signature: IdentityEmailGenerator.getTransformedSuffix(IdmGenerateValueDto valueGenerator, String emailSuffix)
focal_class.full_signature: private String getTransformedSuffix(IdmGenerateValueDto valueGenerator, String emailSuffix)
focal_class.identifier: getTransformedSuffix
focal_class.modifiers: private
focal_class.parameters: (IdmGenerateValueDto valueGenerator, String emailSuffix)
focal_class.return: String
focal_class.signature: String getTransformedSuffix(IdmGenerateValueDto valueGenerator, String emailSuffix)
focal_class.class_method_signature: IdentityEmailGenerator.getEmailSuffix(IdmGenerateValueDto valueGenerator)
focal_class.full_signature: private String getEmailSuffix(IdmGenerateValueDto valueGenerator)
focal_class.identifier: getEmailSuffix
focal_class.modifiers: private
focal_class.parameters: (IdmGenerateValueDto valueGenerator)
focal_class.return: String
focal_class.signature: String getEmailSuffix(IdmGenerateValueDto valueGenerator)
focal_class.class_method_signature: IdentityEmailGenerator.isGenerateFromUsername(IdmGenerateValueDto valueGenerator)
focal_class.full_signature: private boolean isGenerateFromUsername(IdmGenerateValueDto valueGenerator)
focal_class.identifier: isGenerateFromUsername
focal_class.modifiers: private
focal_class.parameters: (IdmGenerateValueDto valueGenerator)
focal_class.return: boolean
focal_class.signature: boolean isGenerateFromUsername(IdmGenerateValueDto valueGenerator)
focal_class.class_method_signature: IdentityEmailGenerator.getFormAttributes()
focal_class.full_signature: @Override public List<IdmFormAttributeDto> getFormAttributes()
focal_class.identifier: getFormAttributes
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<IdmFormAttributeDto>
focal_class.signature: List<IdmFormAttributeDto> getFormAttributes()
focal_class.superclass: extends AbstractIdentityValueGenerator
focal_method.body: @Override
  	public IdmIdentityDto generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator) {
  		Assert.notNull(dto, "DTO is required.");
  		Assert.notNull(valueGenerator, "Value generator is required.");
  		//		
  		// if exists email and configuration doesn't allow regenerate return dto
  		if (!valueGenerator.isRegenerateValue() && StringUtils.isNotEmpty(dto.getEmail())) {
  			return dto;
  		}
  		
  		String transformedUsername = null;
  		if (isGenerateFromUsername(valueGenerator)) {
  			transformedUsername = StringUtils.stripAccents(dto.getUsername());
  			transformedUsername = replaceAllWhiteSpaces(valueGenerator, transformedUsername);
  		} else {
  			transformedUsername = super.generateUsername(dto, valueGenerator);
  		}
  		//
  		if (StringUtils.isEmpty(transformedUsername) ) {
  			// transformed username is required
  			return dto;
  		}
  		//
  		if (StringUtils.contains(transformedUsername, AT_CONSTANT)) {
  			// username contains @ invalid mail return whole dto
  			return dto;
  		}
  		String emailSuffix = getEmailSuffix(valueGenerator);
  		if (StringUtils.isEmpty(emailSuffix)) {
  			// email suffix is empty
  			return dto;
  		}
  		//
  		StringBuilder result = new StringBuilder();
  		result.append(transformedUsername);
  		result.append(getTransformedSuffix(valueGenerator, emailSuffix));
  		
  		dto.setEmail(result.toString());
  		//
  		return dto;
  	}
focal_method.class_method_signature: IdentityEmailGenerator.generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)
focal_method.full_signature: @Override public IdmIdentityDto generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)
focal_method.identifier: generate
focal_method.invocations: notNull notNull isRegenerateValue isNotEmpty getEmail isGenerateFromUsername stripAccents getUsername replaceAllWhiteSpaces generateUsername isEmpty contains getEmailSuffix isEmpty append append getTransformedSuffix setEmail toString
focal_method.modifiers: @Override public
focal_method.parameters: (IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)
focal_method.return: IdmIdentityDto
focal_method.signature: IdmIdentityDto generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator)