test_class.declarator: formDefinitionService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmFormDefinitionService formDefinitionService;
test_class.type: IdmFormDefinitionService
test_class.var_name: formDefinitionService
test_class.declarator: formAttributeService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmFormAttributeService formAttributeService;
test_class.type: IdmFormAttributeService
test_class.var_name: formAttributeService
test_class.declarator: roleService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmRoleService roleService;
test_class.type: IdmRoleService
test_class.var_name: roleService
test_class.declarator: generateValueService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmGenerateValueService generateValueService;
test_class.type: IdmGenerateValueService
test_class.var_name: generateValueService
test_class.declarator: roleRequestService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmRoleRequestService roleRequestService;
test_class.type: IdmRoleRequestService
test_class.var_name: roleRequestService
test_class.declarator: conceptRoleRequestService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmConceptRoleRequestService conceptRoleRequestService;
test_class.type: IdmConceptRoleRequestService
test_class.var_name: conceptRoleRequestService
test_class.declarator: roleFormAttributeService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private IdmRoleFormAttributeService roleFormAttributeService;
test_class.type: IdmRoleFormAttributeService
test_class.var_name: roleFormAttributeService
test_class.file: Realization/backend/core/core-impl/src/test/java/eu/bcvsolutions/idm/core/generator/role/ConceptRoleRequestFormDefaultValueGeneratorTest.java
test_class.identifier: ConceptRoleRequestFormDefaultValueGeneratorTest
test_class.superclass: extends AbstractGeneratorTest
test_case.body: @Test
  	public void testGreenLine() {
  		IdmRoleDto role = getHelper().createRole();
  
  		// prepare new form definition
  		IdmFormDefinitionDto formDefinition = createFormDefinition();
  		role.setIdentityRoleAttributeDefinition(formDefinition.getId());
  		role = roleService.save(role);
  
  		// prepare form attribute 1
  		String attrCode1 = getHelper().createName();
  		String attrDefaultValue1 = "666";
  		IdmFormAttributeDto att1 = createAttribute(attrCode1, attrDefaultValue1, PersistentType.LONG,
  				formDefinition.getId());
  		roleFormAttributeService.addAttributeToSubdefintion(role, att1);
  
  		// prepare form attribute 2
  		String attrCode2 = getHelper().createName();
  		String attrDefaultValue2 = getHelper().createName() + getHelper().createName();
  		IdmFormAttributeDto att2 = createAttribute(attrCode2, attrDefaultValue2, PersistentType.SHORTTEXT,
  				formDefinition.getId());
  		roleFormAttributeService.addAttributeToSubdefintion(role, att2);
  
  		// prepare form attribute 3 without default value
  		String attrCode3 = getHelper().createName();
  		IdmFormAttributeDto att3 = createAttribute(attrCode3, null, PersistentType.SHORTTEXT, formDefinition.getId());
  		roleFormAttributeService.addAttributeToSubdefintion(role, att3);
  
  		IdmConceptRoleRequestDto roleRequestDto = new IdmConceptRoleRequestDto();
  		roleRequestDto.setRole(role.getId());
  
  		// check eav before
  		List<IdmFormInstanceDto> eavs = roleRequestDto.getEavs();
  		assertTrue(eavs.isEmpty());
  
  		createGenerator();
  
  		// generate and check values after
  		roleRequestDto = this.valueGeneratorManager.generate(roleRequestDto);
  		eavs = roleRequestDto.getEavs();
  		assertFalse(eavs.isEmpty());
  
  		// get newly generated eav only for given form definition
  		IdmFormInstanceDto generatedEav = eavs.stream()
  				.filter(eav -> eav.getFormDefinition().getCode().equals(formDefinition.getCode())).findFirst()
  				.orElse(null);
  		assertNotNull(generatedEav);
  
  		// check values
  		List<IdmFormValueDto> values = generatedEav.getValues().stream()
  				.filter(val -> val.getFormAttribute().equals(att1.getId())).collect(Collectors.toList());
  		assertEquals(1, values.size());
  		IdmFormValueDto value = values.get(0);
  		assertEquals(attrDefaultValue1, value.getValue().toString());
  
  		values = generatedEav.getValues().stream().filter(val -> val.getFormAttribute().equals(att2.getId()))
  				.collect(Collectors.toList());
  		assertEquals(1, values.size());
  		value = values.get(0);
  		assertEquals(attrDefaultValue2, value.getValue().toString());
  
  		values = generatedEav.getValues().stream().filter(val -> val.getFormAttribute().equals(att3.getId()))
  				.collect(Collectors.toList());
  		assertEquals(0, values.size());
  	}
test_case.class_method_signature: ConceptRoleRequestFormDefaultValueGeneratorTest.testGreenLine()
test_case.full_signature: @Test public void testGreenLine()
test_case.identifier: testGreenLine
test_case.invocations: createRole getHelper createFormDefinition setIdentityRoleAttributeDefinition getId save createName getHelper createAttribute getId addAttributeToSubdefintion createName getHelper createName getHelper createName getHelper createAttribute getId addAttributeToSubdefintion createName getHelper createAttribute getId addAttributeToSubdefintion setRole getId getEavs assertTrue isEmpty createGenerator generate getEavs assertFalse isEmpty orElse findFirst filter stream equals getCode getFormDefinition getCode assertNotNull collect filter stream getValues equals getFormAttribute getId toList assertEquals size get assertEquals toString getValue collect filter stream getValues equals getFormAttribute getId toList assertEquals size get assertEquals toString getValue collect filter stream getValues equals getFormAttribute getId toList assertEquals size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGreenLine()
focal_class.declarator: GENERATOR_NAME = "core-concept-role-request-form-default-value-generator"
focal_class.modifier: public static final
focal_class.original_string: public static final String GENERATOR_NAME = "core-concept-role-request-form-default-value-generator";
focal_class.type: String
focal_class.var_name: GENERATOR_NAME
focal_class.declarator: roleService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private IdmRoleService roleService;
focal_class.type: IdmRoleService
focal_class.var_name: roleService
focal_class.declarator: identityRoleService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private IdmIdentityRoleThinService identityRoleService;
focal_class.type: IdmIdentityRoleThinService
focal_class.var_name: identityRoleService
focal_class.file: Realization/backend/core/core-impl/src/main/java/eu/bcvsolutions/idm/core/generator/role/ConceptRoleRequestFormDefaultValueGenerator.java
focal_class.identifier: ConceptRoleRequestFormDefaultValueGenerator
focal_class.class_method_signature: ConceptRoleRequestFormDefaultValueGenerator.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: ConceptRoleRequestFormDefaultValueGenerator.generate(IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)
focal_class.full_signature: @Override public IdmConceptRoleRequestDto generate(IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)
focal_class.identifier: generate
focal_class.modifiers: @Override public
focal_class.parameters: (IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)
focal_class.return: IdmConceptRoleRequestDto
focal_class.signature: IdmConceptRoleRequestDto generate(IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)
focal_class.superclass: extends AbstractRoleParametrizationFormDefaultValueGenerator<IdmConceptRoleRequestDto>
focal_method.body: @Override
  	public IdmConceptRoleRequestDto generate(IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator) {
  		Assert.notNull(dto, "DTO is required.");
  		Assert.notNull(valueGenerator, "Value generator is required.");
  
  		// For remove concept is useless generate default values
  		if (ConceptRoleRequestOperation.REMOVE == dto.getOperation()) {
  			return dto;
  		}
  
  		UUID roleId = dto.getRole();
  		IdmRoleDto roleDto = null;
  
  		// Role id may not be set
  		if (roleId == null) {
  			IdmIdentityRoleDto identityRoleDto = identityRoleService.get(dto.getIdentityRole());
  			roleDto = DtoUtils.getEmbedded(identityRoleDto, IdmIdentityRole_.role, IdmRoleDto.class);
  		} else {
  			roleDto = roleService.get(roleId);
  		}
  
  		// Defensive behavior if role doesn't exist
  		if (roleDto == null) {
  			return dto;
  		}
  
  		// TODO: now exists only one form instance for identity roles and conpcets
  		List<IdmFormInstanceDto> existingEavs = dto.getEavs();
  		IdmFormInstanceDto eavs = getDefaultValuesByRoleDefinition(roleDto, valueGenerator,
  				existingEavs.isEmpty() ? null : existingEavs.get(0), dto);
  		if (eavs == null) {
  			return dto;
  		}
  		dto.getEavs().clear();
  		dto.getEavs().add(eavs);
  		return dto;
  	}
focal_method.class_method_signature: ConceptRoleRequestFormDefaultValueGenerator.generate(IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)
focal_method.full_signature: @Override public IdmConceptRoleRequestDto generate(IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)
focal_method.identifier: generate
focal_method.invocations: notNull notNull getOperation getRole get getIdentityRole getEmbedded get getEavs getDefaultValuesByRoleDefinition isEmpty get clear getEavs add getEavs
focal_method.modifiers: @Override public
focal_method.parameters: (IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)
focal_method.return: IdmConceptRoleRequestDto
focal_method.signature: IdmConceptRoleRequestDto generate(IdmConceptRoleRequestDto dto, IdmGenerateValueDto valueGenerator)