All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.imunity.console.views.identity_provider.released_profile.OutputTranslationsService Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
/*
 * Copyright (c) 2019 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package io.imunity.console.views.identity_provider.released_profile;

import io.imunity.console.views.translation_profiles.TranslationsServiceBase;
import io.imunity.console.tprofile.ActionParameterComponentProvider;
import io.imunity.vaadin.elements.NotificationPresenter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pl.edu.icm.unity.base.message.MessageSource;
import pl.edu.icm.unity.base.translation.ProfileType;
import pl.edu.icm.unity.base.translation.TranslationProfile;
import pl.edu.icm.unity.engine.api.TranslationProfileManagement;
import pl.edu.icm.unity.engine.api.translation.out.OutputTranslationActionsRegistry;
import io.imunity.vaadin.endpoint.common.exceptions.ControllerException;

import java.util.List;
import java.util.stream.Collectors;

@Component
class OutputTranslationsService extends TranslationsServiceBase
{
	@Autowired
	OutputTranslationsService(MessageSource msg, TranslationProfileManagement profileMan,
			OutputTranslationActionsRegistry outputActionsRegistry,
			ActionParameterComponentProvider actionComponentFactory, NotificationPresenter notificationPresenter)
	{
		super(msg, profileMan, outputActionsRegistry, actionComponentFactory, notificationPresenter, ProfileType.OUTPUT);
	}

	protected List getProfiles() throws ControllerException
	{
		try
		{
			return profileMan.listOutputProfiles()
					.values()
					.stream()
					.collect(Collectors.toList());
		} catch (Exception e)
		{
			throw new ControllerException(msg.getMessage("TranslationProfilesController.getAllError"), e);
		}
	}

	protected TranslationProfile getProfile(String name) throws ControllerException
	{
		try
		{
			return profileMan.getOutputProfile(name);
		} catch (Exception e)
		{
			throw new ControllerException(msg.getMessage("TranslationProfilesController.getError", name), e);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy