use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class StandardNiFiServiceFacade method getVersionControlInformation.
@Override
public VersionControlInformationEntity getVersionControlInformation(final String groupId) {
final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
final VersionControlInformation versionControlInfo = processGroup.getVersionControlInformation();
if (versionControlInfo == null) {
return null;
}
final VersionControlInformationDTO versionControlDto = dtoFactory.createVersionControlInformationDto(processGroup);
final RevisionDTO groupRevision = dtoFactory.createRevisionDTO(revisionManager.getRevision(groupId));
return entityFactory.createVersionControlInformationEntity(versionControlDto, groupRevision);
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class StandardNiFiServiceFacade method createFlowSnapshot.
private InstantiatedVersionedProcessGroup createFlowSnapshot(final String processGroupId) {
final ProcessGroup processGroup = processGroupDAO.getProcessGroup(processGroupId);
final NiFiRegistryFlowMapper mapper = new NiFiRegistryFlowMapper();
final InstantiatedVersionedProcessGroup versionedGroup = mapper.mapProcessGroup(processGroup, controllerFacade.getControllerServiceProvider(), flowRegistryClient, false);
return versionedGroup;
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class StandardNiFiServiceFacade method deleteVersionControl.
@Override
public VersionControlInformationEntity deleteVersionControl(final Revision revision, final String processGroupId) {
final ProcessGroup group = processGroupDAO.getProcessGroup(processGroupId);
final RevisionUpdate<VersionControlInformationDTO> snapshot = updateComponent(revision, group, () -> processGroupDAO.disconnectVersionControl(processGroupId), processGroup -> dtoFactory.createVersionControlInformationDto(group));
return entityFactory.createVersionControlInformationEntity(snapshot.getComponent(), dtoFactory.createRevisionDTO(snapshot.getLastModification()));
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class StandardNiFiServiceFacade method verifyCanRevertLocalModifications.
@Override
public void verifyCanRevertLocalModifications(final String groupId, final VersionedFlowSnapshot versionedFlowSnapshot) {
final ProcessGroup group = processGroupDAO.getProcessGroup(groupId);
group.verifyCanRevertLocalModifications();
// verify that the process group can be updated to the given snapshot. We do not verify that connections can
// be removed, because the flow may still be running, and it only matters that the connections can be removed once the components
// have been stopped.
group.verifyCanUpdate(versionedFlowSnapshot, false, false);
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class DtoFactory method createVariableRegistryDto.
public VariableRegistryDTO createVariableRegistryDto(final ProcessGroup processGroup, final RevisionManager revisionManager) {
final ComponentVariableRegistry variableRegistry = processGroup.getVariableRegistry();
final List<String> variableNames = variableRegistry.getVariableMap().keySet().stream().map(descriptor -> descriptor.getName()).collect(Collectors.toList());
final Set<VariableEntity> variableEntities = new LinkedHashSet<>();
for (final String variableName : variableNames) {
final VariableDTO variableDto = new VariableDTO();
variableDto.setName(variableName);
variableDto.setValue(variableRegistry.getVariableValue(variableName));
variableDto.setProcessGroupId(processGroup.getIdentifier());
final Set<AffectedComponentEntity> affectedComponentEntities = createAffectedComponentEntities(processGroup.getComponentsAffectedByVariable(variableName), revisionManager);
boolean canWrite = true;
for (final AffectedComponentEntity affectedComponent : affectedComponentEntities) {
final PermissionsDTO permissions = affectedComponent.getPermissions();
if (!permissions.getCanRead() || !permissions.getCanWrite()) {
canWrite = false;
break;
}
}
variableDto.setAffectedComponents(affectedComponentEntities);
final VariableEntity variableEntity = new VariableEntity();
variableEntity.setVariable(variableDto);
variableEntity.setCanWrite(canWrite);
variableEntities.add(variableEntity);
}
final VariableRegistryDTO registryDto = new VariableRegistryDTO();
registryDto.setProcessGroupId(processGroup.getIdentifier());
registryDto.setVariables(variableEntities);
return registryDto;
}
Aggregations