class ConceptRoleRequestFormDefaultValueGenerator extends AbstractRoleParametrizationFormDefaultValueGenerator<IdmConceptRoleRequestDto> {

	@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;
	}

}