@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; }
@Override protected Serializable getCreateCustomPayloadEvent( final Serializable afterObject, final AjaxRequestTarget target) { final ConnInstanceTO actual = ConnInstanceTO.class.cast(afterObject); return new CreateEvent( actual.getKey(), actual.getDisplayName(), TopologyNode.Kind.CONNECTOR, URI.create(actual.getLocation()).toASCIIString(), target); }