@Override public void addFlowRegistry(final FlowRegistry registry) { final boolean duplicateName = registryById.values().stream() .anyMatch(reg -> reg.getName().equals(registry.getName())); if (duplicateName) { throw new IllegalStateException("Cannot add Flow Registry because a Flow Registry already exists with the name " + registry.getName()); } final FlowRegistry existing = registryById.putIfAbsent(registry.getIdentifier(), registry); if (existing != null) { throw new IllegalStateException("Cannot add Flow Registry " + registry + " because a Flow Registry already exists with the ID " + registry.getIdentifier()); } }
@Override public String getFlowRegistryName(final String flowRegistryId) { final FlowRegistry flowRegistry = flowRegistryClient.getFlowRegistry(flowRegistryId); return flowRegistry == null ? flowRegistryId : flowRegistry.getName(); }
@Override public String getRegistryName() { final String registryId = versionControlInformation.getRegistryIdentifier(); final FlowRegistry registry = flowController.getFlowRegistryClient().getFlowRegistry(registryId); return registry == null ? registryId : registry.getName(); }
private void addFlowRegistries(final Element parentElement, final FlowRegistryClient registryClient) { for (final String registryId : registryClient.getRegistryIdentifiers()) { final FlowRegistry flowRegistry = registryClient.getFlowRegistry(registryId); final Element registryElement = parentElement.getOwnerDocument().createElement("flowRegistry"); parentElement.appendChild(registryElement); addStringElement(registryElement, "id", flowRegistry.getIdentifier()); addStringElement(registryElement, "name", flowRegistry.getName()); addStringElement(registryElement, "url", flowRegistry.getURL()); addStringElement(registryElement, "description", flowRegistry.getDescription()); } }
public RegistryDTO createRegistryDto(FlowRegistry registry) { final RegistryDTO dto = new RegistryDTO(); dto.setDescription(registry.getDescription()); dto.setId(registry.getIdentifier()); dto.setName(registry.getName()); dto.setUri(registry.getURL()); return dto; }
final String registryName = flowRegistry == null ? registryId : flowRegistry.getName();
@Override public RegistryClientEntity updateRegistryClient(Revision revision, RegistryDTO registryDTO) { final RevisionClaim revisionClaim = new StandardRevisionClaim(revision); final NiFiUser user = NiFiUserUtils.getNiFiUser(); final FlowRegistry registry = registryDAO.getFlowRegistry(registryDTO.getId()); final RevisionUpdate<FlowRegistry> revisionUpdate = revisionManager.updateRevision(revisionClaim, user, () -> { final boolean duplicateName = registryDAO.getFlowRegistries().stream() .anyMatch(reg -> reg.getName().equals(registryDTO.getName()) && !reg.getIdentifier().equals(registryDTO.getId())); if (duplicateName) { throw new IllegalStateException("Cannot update Flow Registry because a Flow Registry already exists with the name " + registryDTO.getName()); } registry.setDescription(registryDTO.getDescription()); registry.setName(registryDTO.getName()); registry.setURL(registryDTO.getUri()); controllerFacade.save(); final Revision updatedRevision = revisionManager.getRevision(revision.getComponentId()).incrementRevision(revision.getClientId()); final FlowModification lastModification = new FlowModification(updatedRevision, user.getIdentity()); return new StandardRevisionUpdate<>(registry, lastModification); }); final FlowRegistry updatedReg = revisionUpdate.getComponent(); return createRegistryClientEntity(updatedReg); }
vci.setFlowName(versionedFlow.getName()); vci.setFlowDescription(versionedFlow.getDescription()); vci.setRegistryName(flowRegistry.getName());
@Override public ProcessGroup updateVersionControlInformation(final VersionControlInformationDTO versionControlInformation, final Map<String, String> versionedComponentMapping) { final String groupId = versionControlInformation.getGroupId(); final ProcessGroup group = locateProcessGroup(flowController, groupId); final String registryId = versionControlInformation.getRegistryId(); final FlowRegistry flowRegistry = flowController.getFlowRegistryClient().getFlowRegistry(registryId); final String registryName = flowRegistry == null ? registryId : flowRegistry.getName(); final NiFiRegistryFlowMapper mapper = new NiFiRegistryFlowMapper(flowController.getExtensionManager()); final VersionedProcessGroup flowSnapshot = mapper.mapProcessGroup(group, flowController.getControllerServiceProvider(), flowController.getFlowRegistryClient(), false); final StandardVersionControlInformation vci = StandardVersionControlInformation.Builder.fromDto(versionControlInformation) .registryName(registryName) .flowSnapshot(flowSnapshot) .build(); group.setVersionControlInformation(vci, versionedComponentMapping); group.onComponentModified(); return group; }
if (versionControlInfoDto != null) { final FlowRegistry flowRegistry = controller.getFlowRegistryClient().getFlowRegistry(versionControlInfoDto.getRegistryId()); final String registryName = flowRegistry == null ? versionControlInfoDto.getRegistryId() : flowRegistry.getName();