test_class.declarator: identityContractService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmIdentityContractService identityContractService;
test_class.type: IdmIdentityContractService
test_class.var_name: identityContractService
test_class.file: Realization/backend/example/src/test/java/eu/bcvsolutions/idm/example/generator/contract/ContractPositionNameGeneratorTest.java
test_class.identifier: ContractPositionNameGeneratorTest
test_class.superclass: extends AbstractGeneratorTest
test_case.body: @Test
  	public void testWithoutPrefixAndSuffix() {
  		IdmIdentityDto identityDto = getHelper().createIdentity();
  		IdmIdentityContractDto contractDto = new IdmIdentityContractDto();
  		contractDto.setIdentity(identityDto.getId());
  
  		ValueGeneratorDto generator = getGenerator();
  
  		this.createGenerator(getDtoType(), getGeneratorType(),
  				this.createConfiguration(generator.getFormDefinition(), null), 1, null);
  
  		IdmIdentityContractDto generated = valueGeneratorManager.generate(contractDto);
  		assertNotNull(generated);
  		assertEquals(identityDto.getUsername(), generated.getPosition());
  	}
test_case.class_method_signature: ContractPositionNameGeneratorTest.testWithoutPrefixAndSuffix()
test_case.full_signature: @Test public void testWithoutPrefixAndSuffix()
test_case.identifier: testWithoutPrefixAndSuffix
test_case.invocations: createIdentity getHelper setIdentity getId getGenerator createGenerator getDtoType getGeneratorType createConfiguration getFormDefinition generate assertNotNull assertEquals getUsername getPosition
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testWithoutPrefixAndSuffix()
focal_class.declarator: LOG = org.slf4j.LoggerFactory.getLogger(ContractPositionNameGenerator.class)
focal_class.modifier: private static final
focal_class.original_string: private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(ContractPositionNameGenerator.class);
focal_class.type: org.slf4j.Logger
focal_class.var_name: LOG
focal_class.declarator: GENERATOR_NAME = "example-contract-position-name-value-generator"
focal_class.modifier: public static final
focal_class.original_string: public static final String GENERATOR_NAME = "example-contract-position-name-value-generator";
focal_class.type: String
focal_class.var_name: GENERATOR_NAME
focal_class.declarator: POSITION_NAME_SUFFIX = "positionNameSuffix"
focal_class.modifier: public static
focal_class.original_string: public static String POSITION_NAME_SUFFIX = "positionNameSuffix";
focal_class.type: String
focal_class.var_name: POSITION_NAME_SUFFIX
focal_class.declarator: POSITION_NAME_PREFIX = "positionNamePrefix"
focal_class.modifier: public static
focal_class.original_string: public static String POSITION_NAME_PREFIX = "positionNamePrefix";
focal_class.type: String
focal_class.var_name: POSITION_NAME_PREFIX
focal_class.declarator: identityService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private IdmIdentityService identityService;
focal_class.type: IdmIdentityService
focal_class.var_name: identityService
focal_class.file: Realization/backend/example/src/main/java/eu/bcvsolutions/idm/example/generator/contract/ContractPositionNameGenerator.java
focal_class.identifier: ContractPositionNameGenerator
focal_class.class_method_signature: ContractPositionNameGenerator.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: ContractPositionNameGenerator.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: ContractPositionNameGenerator.generate(IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)
focal_class.full_signature: @Override public IdmIdentityContractDto generate(IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)
focal_class.identifier: generate
focal_class.modifiers: @Override public
focal_class.parameters: (IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)
focal_class.return: IdmIdentityContractDto
focal_class.signature: IdmIdentityContractDto generate(IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)
focal_class.class_method_signature: ContractPositionNameGenerator.getSuffix(IdmGenerateValueDto generatorConfiguration)
focal_class.full_signature: private String getSuffix(IdmGenerateValueDto generatorConfiguration)
focal_class.identifier: getSuffix
focal_class.modifiers: private
focal_class.parameters: (IdmGenerateValueDto generatorConfiguration)
focal_class.return: String
focal_class.signature: String getSuffix(IdmGenerateValueDto generatorConfiguration)
focal_class.class_method_signature: ContractPositionNameGenerator.getPrefix(IdmGenerateValueDto generatorConfiguration)
focal_class.full_signature: private String getPrefix(IdmGenerateValueDto generatorConfiguration)
focal_class.identifier: getPrefix
focal_class.modifiers: private
focal_class.parameters: (IdmGenerateValueDto generatorConfiguration)
focal_class.return: String
focal_class.signature: String getPrefix(IdmGenerateValueDto generatorConfiguration)
focal_class.superclass: extends AbstractValueGenerator<IdmIdentityContractDto>
focal_method.body: @Override
  	public IdmIdentityContractDto generate(IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration) {
  		// if exists email and configuration doesn't allow regenerate return dto
  		if (!generatorConfiguration.isRegenerateValue() && StringUtils.isNotEmpty(dto.getPosition())) {
  			return dto;
  		}
  
  		IdmIdentityDto identityDto = DtoUtils.getEmbedded(dto, IdmIdentityContract_.identity, IdmIdentityDto.class, null);
  		if (identityDto == null) {
  			// embedded is not filled
  			identityDto = identityService.get(dto.getIdentity());
  		}
  
  		if (identityDto == null) {
  			// this is possible, when create identity contract by rest
  			LOG.error("New contract hasn't correctly filed identity ID [{}]", dto.getIdentity());
  			return dto;
  		}
  
  		String username = identityDto.getUsername();
  		
  		StringBuilder result = new StringBuilder();
  		
  		String prefix = this.getPrefix(generatorConfiguration);
  		String suffix = this.getSuffix(generatorConfiguration);
  		
  		if (StringUtils.isNotEmpty(prefix)) {
  			result.append(prefix);
  		}
  		result.append(username);
  		if (StringUtils.isNotEmpty(suffix)) {
  			result.append(suffix);
  		}
  
  		dto.setPosition(result.toString());
  		return dto;
  	}
focal_method.class_method_signature: ContractPositionNameGenerator.generate(IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)
focal_method.full_signature: @Override public IdmIdentityContractDto generate(IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)
focal_method.identifier: generate
focal_method.invocations: isRegenerateValue isNotEmpty getPosition getEmbedded get getIdentity error getIdentity getUsername getPrefix getSuffix isNotEmpty append append isNotEmpty append setPosition toString
focal_method.modifiers: @Override public
focal_method.parameters: (IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)
focal_method.return: IdmIdentityContractDto
focal_method.signature: IdmIdentityContractDto generate(IdmIdentityContractDto dto, IdmGenerateValueDto generatorConfiguration)