private TopologyVersion addCurrentTopologyVersionInfo(Long topologyId, Long timestamp) { TopologyVersion versionInfo = new TopologyVersion(); versionInfo.setName(CURRENT_VERSION); versionInfo.setDescription(""); versionInfo.setTimestamp(timestamp); versionInfo.setTopologyId(topologyId); return addTopologyVersionInfo(versionInfo); }
private void setupPlaceholderTopologyVersionInfo(StreamCatalogService catalogService) { if (transactionManager == null) throw new RuntimeException("TransactionManager is not initialized"); // it's one time setup hence just use it as local variable ManagedTransaction mt = new ManagedTransaction(transactionManager, TransactionIsolation.DEFAULT); try { mt.executeConsumer(() -> { TopologyVersion versionInfo = catalogService.getTopologyVersionInfo(StreamCatalogService.PLACEHOLDER_ID); if (versionInfo == null) { TopologyVersion topologyVersion = new TopologyVersion(); topologyVersion.setId(StreamCatalogService.PLACEHOLDER_ID); topologyVersion.setTopologyId(StreamCatalogService.PLACEHOLDER_ID); topologyVersion.setName("PLACEHOLDER_VERSIONINFO"); topologyVersion.setDescription("PLACEHOLDER_VERSIONINFO"); topologyVersion.setTimestamp(System.currentTimeMillis()); catalogService.addOrUpdateTopologyVersionInfo(StreamCatalogService.PLACEHOLDER_ID, topologyVersion); } }); } catch (Exception e) { throw new RuntimeException(e); } }
suffix = 1; versionInfo.setName(VERSION_PREFIX + suffix); if (versionInfo.getDescription() == null) { versionInfo.setDescription("");
public TopologyVersion(TopologyVersion other) { if (other != null) { setId(other.getId()); setTopologyId(other.getTopologyId()); setName(other.getName()); setDescription(other.getDescription()); setTimestamp(other.getTimestamp()); } }