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;
}
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;
}
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;
}
Aggregations