use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method createProcessor.
@Override
public ProcessorEntity createProcessor(final Revision revision, final String groupId, final ProcessorDTO processorDTO) {
final RevisionUpdate<ProcessorDTO> snapshot = createComponent(revision, processorDTO, () -> processorDAO.createProcessor(groupId, processorDTO), processor -> dtoFactory.createProcessorDto(processor));
final ProcessorNode processor = processorDAO.getProcessor(processorDTO.getId());
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(processor);
final ProcessorStatusDTO status = dtoFactory.createProcessorStatusDto(controllerFacade.getProcessorStatus(processorDTO.getId()));
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(processorDTO.getId()));
final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
return entityFactory.createProcessorEntity(snapshot.getComponent(), dtoFactory.createRevisionDTO(snapshot.getLastModification()), permissions, status, bulletinEntities);
}
use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method deleteRemoteProcessGroup.
@Override
public RemoteProcessGroupEntity deleteRemoteProcessGroup(final Revision revision, final String remoteProcessGroupId) {
final RemoteProcessGroup remoteProcessGroup = remoteProcessGroupDAO.getRemoteProcessGroup(remoteProcessGroupId);
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(remoteProcessGroup);
final RemoteProcessGroupDTO snapshot = deleteComponent(revision, remoteProcessGroup.getResource(), () -> remoteProcessGroupDAO.deleteRemoteProcessGroup(remoteProcessGroupId), true, dtoFactory.createRemoteProcessGroupDto(remoteProcessGroup));
return entityFactory.createRemoteProcessGroupEntity(snapshot, null, permissions, null, null);
}
use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method updateVariableRegistry.
@Override
public VariableRegistryEntity updateVariableRegistry(NiFiUser user, Revision revision, VariableRegistryDTO variableRegistryDto) {
final ProcessGroup processGroupNode = processGroupDAO.getProcessGroup(variableRegistryDto.getProcessGroupId());
final RevisionUpdate<VariableRegistryDTO> snapshot = updateComponent(user, revision, processGroupNode, () -> processGroupDAO.updateVariableRegistry(user, variableRegistryDto), processGroup -> dtoFactory.createVariableRegistryDto(processGroup, revisionManager));
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(processGroupNode);
final RevisionDTO updatedRevision = dtoFactory.createRevisionDTO(snapshot.getLastModification());
return entityFactory.createVariableRegistryEntity(snapshot.getComponent(), updatedRevision, permissions);
}
use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method createComponentReferenceEntity.
private ComponentReferenceEntity createComponentReferenceEntity(final String resource) {
ComponentReferenceEntity componentReferenceEntity = null;
try {
// get the component authorizable
Authorizable componentAuthorizable = authorizableLookup.getAuthorizableFromResource(resource);
// get the underlying base authorizable for the component reference
if (componentAuthorizable instanceof EnforcePolicyPermissionsThroughBaseResource) {
componentAuthorizable = ((EnforcePolicyPermissionsThroughBaseResource) componentAuthorizable).getBaseAuthorizable();
}
final ComponentReferenceDTO componentReference = dtoFactory.createComponentReferenceDto(componentAuthorizable);
if (componentReference != null) {
final PermissionsDTO componentReferencePermissions = dtoFactory.createPermissionsDto(componentAuthorizable);
final RevisionDTO componentReferenceRevision = dtoFactory.createRevisionDTO(revisionManager.getRevision(componentReference.getId()));
componentReferenceEntity = entityFactory.createComponentReferenceEntity(componentReference, componentReferenceRevision, componentReferencePermissions);
}
} catch (final ResourceNotFoundException e) {
// component not found for the specified resource
}
return componentReferenceEntity;
}
use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method deleteInputPort.
@Override
public PortEntity deleteInputPort(final Revision revision, final String inputPortId) {
final Port port = inputPortDAO.getPort(inputPortId);
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(port);
final PortDTO snapshot = deleteComponent(revision, port.getResource(), () -> inputPortDAO.deletePort(inputPortId), true, dtoFactory.createPortDto(port));
return entityFactory.createPortEntity(snapshot, null, permissions, null, null);
}
Aggregations