use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method createInputPort.
@Override
public PortEntity createInputPort(final Revision revision, final String groupId, final PortDTO inputPortDTO) {
final RevisionUpdate<PortDTO> snapshot = createComponent(revision, inputPortDTO, () -> inputPortDAO.createPort(groupId, inputPortDTO), port -> dtoFactory.createPortDto(port));
final Port port = inputPortDAO.getPort(inputPortDTO.getId());
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(port);
final PortStatusDTO status = dtoFactory.createPortStatusDto(controllerFacade.getInputPortStatus(port.getIdentifier()));
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(port.getIdentifier()));
final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
return entityFactory.createPortEntity(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 createLabelEntity.
private LabelEntity createLabelEntity(final Label label) {
final RevisionDTO revision = dtoFactory.createRevisionDTO(revisionManager.getRevision(label.getIdentifier()));
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(label);
return entityFactory.createLabelEntity(dtoFactory.createLabelDto(label), revision, permissions);
}
use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method deleteOutputPort.
@Override
public PortEntity deleteOutputPort(final Revision revision, final String outputPortId) {
final Port port = outputPortDAO.getPort(outputPortId);
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(port);
final PortDTO snapshot = deleteComponent(revision, port.getResource(), () -> outputPortDAO.deletePort(outputPortId), true, dtoFactory.createPortDto(port));
return entityFactory.createPortEntity(snapshot, null, permissions, null, null);
}
use of org.apache.nifi.web.api.dto.PermissionsDTO in project nifi by apache.
the class StandardNiFiServiceFacade method updateOutputPort.
@Override
public PortEntity updateOutputPort(final Revision revision, final PortDTO outputPortDTO) {
final Port outputPortNode = outputPortDAO.getPort(outputPortDTO.getId());
final RevisionUpdate<PortDTO> snapshot = updateComponent(revision, outputPortNode, () -> outputPortDAO.updatePort(outputPortDTO), port -> dtoFactory.createPortDto(port));
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(outputPortNode);
final PortStatusDTO status = dtoFactory.createPortStatusDto(controllerFacade.getOutputPortStatus(outputPortNode.getIdentifier()));
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(outputPortNode.getIdentifier()));
final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
return entityFactory.createPortEntity(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 getConnectionStatus.
@Override
public ConnectionStatusEntity getConnectionStatus(final String connectionId) {
final Connection connection = connectionDAO.getConnection(connectionId);
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(connection);
final ConnectionStatusDTO dto = dtoFactory.createConnectionStatusDto(controllerFacade.getConnectionStatus(connectionId));
return entityFactory.createConnectionStatusEntity(dto, permissions);
}
Aggregations