<commit_before>package eu.bcvsolutions.idm.icf.rest.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.ImmutableMap;

import eu.bcvsolutions.idm.core.api.exception.ResultCodeException;
import eu.bcvsolutions.idm.core.api.rest.BaseController;
import eu.bcvsolutions.idm.core.api.rest.BaseEntityController;
import eu.bcvsolutions.idm.icf.IcfModuleDescriptor;
import eu.bcvsolutions.idm.icf.api.IcfConnectorInfo;
import eu.bcvsolutions.idm.icf.domain.IcfResultCode;
import eu.bcvsolutions.idm.icf.service.api.IcfConfigurationFacade;
import eu.bcvsolutions.idm.icf.service.impl.DefaultIcfConfigurationFacade;
import eu.bcvsolutions.idm.security.api.domain.Enabled;;

/**
 * Rest endpoint provides available connectors and their configuration
 * 
 * @author svandav
 *
 */
@RestController
@Enabled(IcfModuleDescriptor.MODULE_ID)
@RequestMapping(value = BaseEntityController.BASE_PATH + "/connectors")
public class IcfConnectorController implements BaseController {

	private IcfConfigurationFacade icfConfiguration;

	@Autowired
	public IcfConnectorController(DefaultIcfConfigurationFacade icfConfiguration) {
		this.icfConfiguration = icfConfiguration;
	}

	/**
	 * Return all local connectors of given framework
	 * 
	 * TODO: search quick?
	 * 
	 * @param framework - icf framework
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET, value = "/search/local")
	public ResponseEntity<Map<String, List<IcfConnectorInfo>>> getAvailableLocalConnectors(
			@RequestParam(required = false) String framework) {
		Map<String, List<IcfConnectorInfo>> infos = new HashMap<>();
		if (framework != null) {
			if (!icfConfiguration.getIcfConfigs().containsKey(framework)) {
				throw new ResultCodeException(IcfResultCode.ICF_FRAMEWORK_NOT_FOUND,
						ImmutableMap.of("framework", framework));
			}
			infos.put(framework, icfConfiguration.getIcfConfigs().get(framework)
					.getAvailableLocalConnectors());

		} else {
			infos = icfConfiguration.getAvailableLocalConnectors();
		}
		return new ResponseEntity<Map<String, List<IcfConnectorInfo>>>(infos, HttpStatus.OK);
	}
}
<commit_msg>Renamed ICF module to IC - rest impl<commit_after>package eu.bcvsolutions.idm.ic.rest.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.ImmutableMap;

import eu.bcvsolutions.idm.core.api.exception.ResultCodeException;
import eu.bcvsolutions.idm.core.api.rest.BaseController;
import eu.bcvsolutions.idm.core.api.rest.BaseEntityController;
import eu.bcvsolutions.idm.ic.IcModuleDescriptor;
import eu.bcvsolutions.idm.ic.api.IcConnectorInfo;
import eu.bcvsolutions.idm.ic.domain.IcResultCode;
import eu.bcvsolutions.idm.ic.service.api.IcConfigurationFacade;
import eu.bcvsolutions.idm.ic.service.impl.DefaultIcConfigurationFacade;
import eu.bcvsolutions.idm.security.api.domain.Enabled;;

/**
 * Rest endpoint provides available connectors and their configuration
 * 
 * @author svandav
 *
 */
@RestController
@Enabled(IcModuleDescriptor.MODULE_ID)
@RequestMapping(value = BaseEntityController.BASE_PATH + "/connectors")
public class IcConnectorController implements BaseController {

	private IcConfigurationFacade icConfiguration;

	@Autowired
	public IcConnectorController(DefaultIcConfigurationFacade icConfiguration) {
		this.icConfiguration = icConfiguration;
	}

	/**
	 * Return all local connectors of given framework
	 * 
	 * TODO: search quick?
	 * 
	 * @param framework - ic framework
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET, value = "/search/local")
	public ResponseEntity<Map<String, List<IcConnectorInfo>>> getAvailableLocalConnectors(
			@RequestParam(required = false) String framework) {
		Map<String, List<IcConnectorInfo>> infos = new HashMap<>();
		if (framework != null) {
			if (!icConfiguration.getIcConfigs().containsKey(framework)) {
				throw new ResultCodeException(IcResultCode.IC_FRAMEWORK_NOT_FOUND,
						ImmutableMap.of("framework", framework));
			}
			infos.put(framework, icConfiguration.getIcConfigs().get(framework)
					.getAvailableLocalConnectors());

		} else {
			infos = icConfiguration.getAvailableLocalConnectors();
		}
		return new ResponseEntity<Map<String, List<IcConnectorInfo>>>(infos, HttpStatus.OK);
	}
}

{'fraction_non_alphanumeric': 0.10624509033778476, 'fraction_numerical': 0.0, 'mean_word_length': 6.0055020632737275, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6546307', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1510, 'n_words': 254}