public TopologyVersion addOrUpdateTopologyVersionInfo(Long versionId, TopologyVersion topologyVersion) { topologyVersion.setId(versionId); topologyVersion.setTimestamp(System.currentTimeMillis()); this.dao.addOrUpdate(topologyVersion); return topologyVersion; }
public TopologyVersion getTopologyVersionInfo(Long versionId) { TopologyVersion topologyVersion = new TopologyVersion(); topologyVersion.setId(versionId); return dao.get(topologyVersion.getStorableKey()); }
public TopologyVersion addTopologyVersionInfo(TopologyVersion topologyVersion) { if (topologyVersion.getId() == null) { topologyVersion.setId(this.dao.nextId(TOPOLOGY_VERSIONINFO_NAMESPACE)); } if (topologyVersion.getTimestamp() == null) { topologyVersion.setTimestamp(System.currentTimeMillis()); } dao.add(topologyVersion); return topologyVersion; }
public TopologyVersion removeTopologyVersionInfo(Long versionId) { TopologyVersion topologyVersion = new TopologyVersion(); topologyVersion.setId(versionId); return dao.remove(new StorableKey(TOPOLOGY_VERSIONINFO_NAMESPACE, topologyVersion.getPrimaryKey())); }
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); } }
public TopologyVersion(TopologyVersion other) { if (other != null) { setId(other.getId()); setTopologyId(other.getTopologyId()); setName(other.getName()); setDescription(other.getDescription()); setTimestamp(other.getTimestamp()); } }