class AssetGroupTargetDetailsServiceImpl implements AssetGroupTargetDetailsService, Constants {

	@Override
	public List<TargetTypeRuleViewDetails> getTargetTypesByAssetGroupIdAndTargetTypeNotIn(String assetGroupName, Set<String> targetTypeNames) throws PacManException {
		AssetGroupDetails assetGroupDetails = assetGroupService.findByGroupName(assetGroupName);
		List<AssetGroupTargetDetails> allAssetGroupTargetDetails = Lists.newArrayList();
		if (assetGroupDetails != null) {
			if(targetTypeNames.isEmpty()) {
				allAssetGroupTargetDetails = assetGroupTargetDetailsRepository.findByGroupId(assetGroupDetails.getGroupId());
			} else {
				allAssetGroupTargetDetails = assetGroupTargetDetailsRepository.findByGroupIdAndTargetTypeNotIn(assetGroupDetails.getGroupId(), targetTypeNames);
			}
			List<TargetTypeRuleViewDetails> allStudentsDetails = allAssetGroupTargetDetails.parallelStream().map(fetchStickyExceptionTargetTypeRuleDetails).collect(Collectors.toList());
			return allStudentsDetails;
		} else {
			throw new PacManException("Asset Group does not exits");
		}
	}

}