Search in sources :

Example 11 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class AuthorizationPluginInfoBuilder method pluginInfoFor.

@Override
public AuthorizationPluginInfo pluginInfoFor(String pluginId) {
    PluginDescriptor descriptor = store.find(pluginId);
    if (descriptor == null) {
        return null;
    }
    Image icon = store.getIcon(descriptor);
    ArrayList<PluginConfiguration> pluginConfigurations = PluginConfiguration.getPluginConfigurations(store.getProfileMetadata(descriptor));
    PluginView profileView = new PluginView(store.getProfileView(descriptor));
    PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(pluginConfigurations, profileView);
    ArrayList<PluginConfiguration> roleConfigurations = PluginConfiguration.getPluginConfigurations(store.getRoleMetadata(descriptor));
    PluginView roleView = new PluginView(store.getRoleView(descriptor));
    PluggableInstanceSettings roleSettings = new PluggableInstanceSettings(roleConfigurations, roleView);
    return new AuthorizationPluginInfo(descriptor, profileSettings, roleSettings, icon);
}
Also used : PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) AuthorizationPluginInfo(com.thoughtworks.go.server.ui.plugins.AuthorizationPluginInfo) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginView(com.thoughtworks.go.server.ui.plugins.PluginView) Image(com.thoughtworks.go.plugin.access.common.models.Image)

Example 12 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class AuthorizationViewModelBuilder method pluginInfoFor.

@Override
public PluginInfo pluginInfoFor(String pluginId) {
    PluginDescriptor descriptor = metadataStore.find(pluginId);
    if (descriptor == null) {
        return null;
    }
    Image icon = metadataStore.getIcon(descriptor);
    ArrayList<PluginConfiguration> pluginConfigurations = PluginConfiguration.getPluginConfigurations(metadataStore.getProfileMetadata(descriptor));
    PluginView profileView = new PluginView(metadataStore.getProfileView(descriptor));
    PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(pluginConfigurations, profileView);
    ArrayList<PluginConfiguration> roleConfigurations = PluginConfiguration.getPluginConfigurations(metadataStore.getRoleMetadata(descriptor));
    PluginView roleView = new PluginView(metadataStore.getRoleView(descriptor));
    PluggableInstanceSettings roleSettings = new PluggableInstanceSettings(roleConfigurations, roleView);
    return new PluginInfo(descriptor, AuthorizationPluginConstants.EXTENSION_NAME, null, profileSettings, roleSettings, icon);
}
Also used : PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginView(com.thoughtworks.go.server.ui.plugins.PluginView) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) Image(com.thoughtworks.go.plugin.access.common.models.Image)

Example 13 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class ElasticAgentPluginInfoBuilder method pluginInfoFor.

@Override
public ElasticPluginInfo pluginInfoFor(String pluginId) {
    PluginDescriptor descriptor = store.find(pluginId);
    if (descriptor == null) {
        return null;
    }
    Image icon = store.getIcon(descriptor);
    ArrayList<PluginConfiguration> pluginConfigurations = PluginConfiguration.getPluginConfigurations(store.getProfileMetadata(descriptor));
    PluginView pluginView = new PluginView(store.getProfileView(descriptor));
    PluggableInstanceSettings settings = new PluggableInstanceSettings(pluginConfigurations, pluginView);
    return new ElasticPluginInfo(descriptor, settings, icon);
}
Also used : PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginView(com.thoughtworks.go.server.ui.plugins.PluginView) ElasticPluginInfo(com.thoughtworks.go.server.ui.plugins.ElasticPluginInfo) Image(com.thoughtworks.go.plugin.access.common.models.Image)

Example 14 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class PackageViewModelBuilder method configurations.

private List<PluginConfiguration> configurations(PackageConfigurations packageConfigurations, String type) {
    ArrayList<PluginConfiguration> pluginConfigurations = new ArrayList<>();
    for (PackageConfiguration configuration : packageConfigurations.list()) {
        Map<String, Object> metaData = new HashMap<>();
        metaData.put(REQUIRED_OPTION, configuration.getOption(Property.REQUIRED));
        metaData.put(SECURE_OPTION, configuration.getOption(Property.SECURE));
        metaData.put(PART_OF_IDENTITY_OPTION, configuration.getOption(Property.PART_OF_IDENTITY));
        metaData.put(DISPLAY_NAME_OPTION, configuration.getOption(Property.DISPLAY_NAME));
        metaData.put(DISPLAY_ORDER_OPTION, configuration.getOption(Property.DISPLAY_ORDER));
        pluginConfigurations.add(new PluginConfiguration(configuration.getKey(), metaData, type));
    }
    return pluginConfigurations;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration)

Example 15 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class PluggableTaskViewModelBuilder method pluginInfoFor.

public PluginInfo pluginInfoFor(String pluginId) {
    if (!PluggableTaskConfigStore.store().hasPreferenceFor(pluginId)) {
        return null;
    }
    GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
    TaskPreference taskPreference = PluggableTaskConfigStore.store().preferenceFor(pluginId);
    List<PluginConfiguration> pluginConfigurations = configurations(taskPreference.getConfig());
    PluginView pluginView = new PluginView(taskPreference.getView().template());
    return new PluginInfo(descriptor, TaskExtension.TASK_EXTENSION, taskPreference.getView().displayValue(), new PluggableInstanceSettings(pluginConfigurations, pluginView));
}
Also used : PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginView(com.thoughtworks.go.server.ui.plugins.PluginView) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Aggregations

PluginConfiguration (com.thoughtworks.go.server.ui.plugins.PluginConfiguration)17 PluginInfo (com.thoughtworks.go.server.ui.plugins.PluginInfo)9 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)8 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)8 HashMap (java.util.HashMap)6 Image (com.thoughtworks.go.plugin.access.common.models.Image)5 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)4 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)2 Property (com.thoughtworks.go.plugin.api.config.Property)2 PluginProfileMetadata (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadata)1 PluginProfileMetadataKey (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKey)1 PluginProfileMetadataKeys (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKeys)1 PackageConfiguration (com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)1 SCMConfiguration (com.thoughtworks.go.plugin.access.scm.SCMConfiguration)1 SCMPreference (com.thoughtworks.go.plugin.access.scm.SCMPreference)1 AuthorizationPluginInfo (com.thoughtworks.go.server.ui.plugins.AuthorizationPluginInfo)1 ElasticPluginInfo (com.thoughtworks.go.server.ui.plugins.ElasticPluginInfo)1