use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.
the class StandardLabelDAO method locateLabel.
private Label locateLabel(final String labelId) {
final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
final Label label = rootGroup.findLabel(labelId);
if (label == null) {
throw new ResourceNotFoundException(String.format("Unable to find label with id '%s'.", labelId));
} else {
return label;
}
}
use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.
the class StandardPolicyBasedAuthorizerDAO method getAccessPolicy.
@Override
public AccessPolicy getAccessPolicy(final RequestAction requestAction, final Authorizable authorizable) {
final String resource = authorizable.getResource().getIdentifier();
final AccessPolicy accessPolicy = findAccessPolicy(requestAction, authorizable.getResource().getIdentifier());
if (accessPolicy == null) {
final Authorizable parentAuthorizable = authorizable.getParentAuthorizable();
if (parentAuthorizable == null) {
throw new ResourceNotFoundException(String.format("Unable to find access policy for %s on %s", requestAction.toString(), resource));
} else {
return getAccessPolicy(requestAction, parentAuthorizable);
}
}
return accessPolicy;
}
use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.
the class StandardProcessGroupDAO method updateVariableRegistry.
@Override
public ProcessGroup updateVariableRegistry(final NiFiUser user, final VariableRegistryDTO variableRegistry) {
final ProcessGroup group = locateProcessGroup(flowController, variableRegistry.getProcessGroupId());
if (group == null) {
throw new ResourceNotFoundException("Could not find Process Group with ID " + variableRegistry.getProcessGroupId());
}
final Map<String, String> variableMap = new HashMap<>();
// have to use forEach here instead of using Collectors.toMap because value may be null
variableRegistry.getVariables().stream().map(VariableEntity::getVariable).forEach(var -> variableMap.put(var.getName(), var.getValue()));
group.setVariables(variableMap);
group.onComponentModified();
return group;
}
use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.
the class StandardProcessorDAO method locateProcessor.
private ProcessorNode locateProcessor(final String processorId) {
final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
final ProcessorNode processor = rootGroup.findProcessor(processorId);
if (processor == null) {
throw new ResourceNotFoundException(String.format("Unable to find processor with id '%s'.", processorId));
} else {
return processor;
}
}
use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.
the class StandardRemoteProcessGroupDAO method locateRemoteProcessGroup.
private RemoteProcessGroup locateRemoteProcessGroup(final String remoteProcessGroupId) {
final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
final RemoteProcessGroup remoteProcessGroup = rootGroup.findRemoteProcessGroup(remoteProcessGroupId);
if (remoteProcessGroup == null) {
throw new ResourceNotFoundException(String.format("Unable to find remote process group with id '%s'.", remoteProcessGroupId));
} else {
return remoteProcessGroup;
}
}
Aggregations