Search in sources :

Example 1 with BackendProviderHandler

use of org.guvnor.ala.ui.backend.service.handler.BackendProviderHandler in project kie-wb-common by kiegroup.

the class ProviderConverterImpl method toModel.

/**
 * @param provider A provider representation in the guvnor-ala core domain.
 * @return the converted version of the provider in the format managed by the UI related modules.
 */
@Override
public Provider toModel(org.guvnor.ala.runtime.providers.Provider provider) {
    Provider result = null;
    if (provider != null) {
        ProviderTypeKey providerTypeKey = new ProviderTypeKey(provider.getProviderType().getProviderTypeName(), provider.getProviderType().getVersion());
        ProviderKey providerKey = new ProviderKey(providerTypeKey, provider.getId());
        final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey);
        @SuppressWarnings("unchecked") final ProviderConfiguration providerConfiguration = (ProviderConfiguration) handler.getProviderConfigConverter().toModel(provider.getConfig());
        result = new Provider(providerKey, providerConfiguration);
    }
    return result;
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) BackendProviderHandler(org.guvnor.ala.ui.backend.service.handler.BackendProviderHandler) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Provider(org.guvnor.ala.ui.model.Provider) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration)

Aggregations

BackendProviderHandler (org.guvnor.ala.ui.backend.service.handler.BackendProviderHandler)1 Provider (org.guvnor.ala.ui.model.Provider)1 ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)1 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)1 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)1