Search in sources :

Example 1 with ConnBundleTO

use of org.apache.syncope.common.lib.to.ConnBundleTO in project syncope by apache.

the class ConnectorWizardBuilder method buildModelSteps.

@Override
protected WizardModel buildModelSteps(final Serializable modelObject, final WizardModel wizardModel) {
    ConnInstanceTO connInstanceTO = ConnInstanceTO.class.cast(modelObject);
    wizardModel.add(new ConnectorDetailsPanel(connInstanceTO, bundles));
    wizardModel.add(new ConnectorConfPanel(connInstanceTO, bundles) {

        private static final long serialVersionUID = -5886691077681158494L;

        @Override
        protected Pair<Boolean, String> check(final AjaxRequestTarget target) {
            ConnInstanceTO connInstanceTO = ConnInstanceTO.class.cast(modelObject);
            ConnBundleTO bundleTO = ConnectorWizardBuilder.getBundle(connInstanceTO, bundles);
            connInstanceTO.setConnectorName(bundleTO.getConnectorName());
            connInstanceTO.setBundleName(bundleTO.getBundleName());
            connInstanceTO.setVersion(bundleTO.getVersion());
            return connectorRestClient.check(connInstanceTO);
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {
            tag.append("class", "scrollable-tab-content", " ");
        }
    });
    wizardModel.add(new ConnCapabilitiesPanel(new PropertyModel<>(connInstanceTO, "capabilities")));
    return wizardModel;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ConnBundleTO(org.apache.syncope.common.lib.to.ConnBundleTO) ComponentTag(org.apache.wicket.markup.ComponentTag) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) PropertyModel(org.apache.wicket.model.PropertyModel) Pair(org.apache.commons.lang3.tuple.Pair)

Example 2 with ConnBundleTO

use of org.apache.syncope.common.lib.to.ConnBundleTO in project syncope by apache.

the class ConnectorWizardBuilder method onApplyInternal.

@Override
protected Serializable onApplyInternal(final Serializable modelObject) {
    ConnInstanceTO connInstanceTO = ConnInstanceTO.class.cast(modelObject);
    ConnBundleTO bundleTO = ConnectorWizardBuilder.getBundle(connInstanceTO, bundles);
    connInstanceTO.setConnectorName(bundleTO.getConnectorName());
    connInstanceTO.setBundleName(bundleTO.getBundleName());
    connInstanceTO.setVersion(bundleTO.getVersion());
    // Reset pool configuration if all fields are null
    if (connInstanceTO.getPoolConf() != null && connInstanceTO.getPoolConf().getMaxIdle() == null && connInstanceTO.getPoolConf().getMaxObjects() == null && connInstanceTO.getPoolConf().getMaxWait() == null && connInstanceTO.getPoolConf().getMinEvictableIdleTimeMillis() == null && connInstanceTO.getPoolConf().getMinIdle() == null) {
        connInstanceTO.setPoolConf(null);
    }
    ConnInstanceTO res;
    if (mode == AjaxWizard.Mode.CREATE) {
        res = connectorRestClient.create(connInstanceTO);
    } else {
        connectorRestClient.update(connInstanceTO);
        res = connInstanceTO;
    }
    return res;
}
Also used : ConnBundleTO(org.apache.syncope.common.lib.to.ConnBundleTO) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO)

Example 3 with ConnBundleTO

use of org.apache.syncope.common.lib.to.ConnBundleTO in project syncope by apache.

the class ConnectorLogic method getBundles.

@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public List<ConnBundleTO> getBundles(final String lang) {
    if (StringUtils.isBlank(lang)) {
        CurrentLocale.set(Locale.ENGLISH);
    } else {
        CurrentLocale.set(new Locale(lang));
    }
    List<ConnBundleTO> connectorBundleTOs = new ArrayList<>();
    connIdBundleManager.getConnInfoManagers().forEach((uri, cim) -> {
        connectorBundleTOs.addAll(cim.getConnectorInfos().stream().map(bundle -> {
            ConnBundleTO connBundleTO = new ConnBundleTO();
            connBundleTO.setDisplayName(bundle.getConnectorDisplayName());
            connBundleTO.setLocation(uri.toString());
            ConnectorKey key = bundle.getConnectorKey();
            connBundleTO.setBundleName(key.getBundleName());
            connBundleTO.setConnectorName(key.getConnectorName());
            connBundleTO.setVersion(key.getBundleVersion());
            ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(bundle);
            connBundleTO.getProperties().addAll(properties.getPropertyNames().stream().map(propName -> binder.build(properties.getProperty(propName))).collect(Collectors.toList()));
            return connBundleTO;
        }).collect(Collectors.toList()));
    });
    return connectorBundleTOs;
}
Also used : Locale(java.util.Locale) CurrentLocale(org.identityconnectors.common.l10n.CurrentLocale) ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) ConnBundleTO(org.apache.syncope.common.lib.to.ConnBundleTO) ArrayList(java.util.ArrayList) ConfigurationProperties(org.identityconnectors.framework.api.ConfigurationProperties) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ConnBundleTO (org.apache.syncope.common.lib.to.ConnBundleTO)3 ConnInstanceTO (org.apache.syncope.common.lib.to.ConnInstanceTO)2 ArrayList (java.util.ArrayList)1 Locale (java.util.Locale)1 Pair (org.apache.commons.lang3.tuple.Pair)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 ComponentTag (org.apache.wicket.markup.ComponentTag)1 PropertyModel (org.apache.wicket.model.PropertyModel)1 CurrentLocale (org.identityconnectors.common.l10n.CurrentLocale)1 ConfigurationProperties (org.identityconnectors.framework.api.ConfigurationProperties)1 ConnectorKey (org.identityconnectors.framework.api.ConnectorKey)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 Transactional (org.springframework.transaction.annotation.Transactional)1