@Around("within(org.apache.nifi.web.dao.ProcessGroupDAO+) && " + "execution(org.apache.nifi.groups.ProcessGroup updateVersionControlInformation(..))") public ProcessGroup updateVersionControlInformationAdvice(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable { final VersionControlInformationDTO vciDto = (VersionControlInformationDTO) proceedingJoinPoint.getArgs()[0]; final ProcessGroupDAO processGroupDAO = getProcessGroupDAO(); final ProcessGroup processGroup = processGroupDAO.getProcessGroup(vciDto.getGroupId()); final VersionControlInformation vci = processGroup.getVersionControlInformation(); final ProcessGroup updatedProcessGroup = (ProcessGroup) proceedingJoinPoint.proceed(); final Operation operation; if (vci == null) { operation = Operation.StartVersionControl; } else { operation = Operation.CommitLocalChanges; } saveUpdateAction(vciDto.getGroupId(), operation); return updatedProcessGroup; }
throw new IllegalArgumentException("Version Control Information must be supplied"); if (versionControlInfo.getGroupId() == null) { throw new IllegalArgumentException("Version Control Information must supply Process Group ID"); final String groupId = requestEntity.getVersionControlInformation().getGroupId();
throw new IllegalArgumentException("Version Control Information must be supplied."); if (requestVersionControlInfoDto.getGroupId() == null) { throw new IllegalArgumentException("The Process Group ID must be supplied."); if (!requestVersionControlInfoDto.getGroupId().equals(groupId)) { throw new IllegalArgumentException("The Process Group ID in the request body does not match the Process Group ID of the requested resource.");
throw new IllegalArgumentException("Version Control Information must be supplied."); if (requestVersionControlInfoDto.getGroupId() == null) { throw new IllegalArgumentException("The Process Group ID must be supplied."); if (!requestVersionControlInfoDto.getGroupId().equals(groupId)) { throw new IllegalArgumentException("The Process Group ID in the request body does not match the Process Group ID of the requested resource.");
@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; }