@Around("within(org.apache.nifi.web.dao.ProcessGroupDAO+) && " + "execution(org.apache.nifi.groups.ProcessGroup updateProcessGroupFlow(..))") public ProcessGroup updateProcessGroupFlowAdvice(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable { final Object[] args = proceedingJoinPoint.getArgs(); final String groupId = (String) args[0]; final ProcessGroupDAO processGroupDAO = getProcessGroupDAO(); final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId); final VersionControlInformation vci = processGroup.getVersionControlInformation(); final ProcessGroup updatedProcessGroup = (ProcessGroup) proceedingJoinPoint.proceed(); final VersionControlInformation updatedVci = updatedProcessGroup.getVersionControlInformation(); final Operation operation; if (vci == null) { operation = Operation.StartVersionControl; } else { if (updatedVci == null) { operation = Operation.StopVersionControl; } else if (vci.getVersion() == updatedVci.getVersion()) { operation = Operation.RevertLocalChanges; } else { operation = Operation.ChangeVersion; } } saveUpdateAction(groupId, operation); return updatedProcessGroup; }
coordinates.setBucketId(versionControlInfo.getBucketIdentifier()); coordinates.setFlowId(versionControlInfo.getFlowIdentifier()); coordinates.setVersion(versionControlInfo.getVersion()); versionedGroup.setVersionedFlowCoordinates(coordinates);
try { versionedFlowSnapshot = flowRegistry.getFlowContents(versionControlInfo.getBucketIdentifier(), versionControlInfo.getFlowIdentifier(), versionControlInfo.getVersion(), true, NiFiUserUtils.getNiFiUser()); } catch (final IOException | NiFiRegistryException e) { throw new NiFiCoreException("Failed to retrieve flow with Flow Registry in order to calculate local differences due to " + e.getMessage(), e);
addTextElement(versionControlInfoElement, "flowName", versionControlInfo.getFlowName()); addTextElement(versionControlInfoElement, "flowDescription", versionControlInfo.getFlowDescription()); addTextElement(versionControlInfoElement, "version", versionControlInfo.getVersion()); element.appendChild(versionControlInfoElement);
versionControlInformation.getBucketIdentifier(), versionControlInformation.getFlowIdentifier(), versionControlInformation.getVersion(), stripContentsFromRemoteDescendantGroups(versionControlInformation.getFlowSnapshot(), true), versionControlInformation.getStatus()) {
final int expectedVersion = currentVci == null ? 1 : currentVci.getVersion() + 1;
public VersionControlInformationDTO createVersionControlInformationDto(final ProcessGroup group) { if (group == null) { return null; } final VersionControlInformation versionControlInfo = group.getVersionControlInformation(); if (versionControlInfo == null) { return null; } final VersionControlInformationDTO dto = new VersionControlInformationDTO(); dto.setGroupId(group.getIdentifier()); dto.setRegistryId(versionControlInfo.getRegistryIdentifier()); dto.setRegistryName(versionControlInfo.getRegistryName()); dto.setBucketId(versionControlInfo.getBucketIdentifier()); dto.setBucketName(versionControlInfo.getBucketName()); dto.setFlowId(versionControlInfo.getFlowIdentifier()); dto.setFlowName(versionControlInfo.getFlowName()); dto.setFlowDescription(versionControlInfo.getFlowDescription()); dto.setVersion(versionControlInfo.getVersion()); final VersionedFlowStatus status = versionControlInfo.getStatus(); final VersionedFlowState state = status.getState(); dto.setState(state == null ? null : state.name()); dto.setStateExplanation(status.getStateExplanation()); return dto; }