Search in sources :

Example 1 with ComponentReferenceDTO

use of org.apache.nifi.web.api.dto.ComponentReferenceDTO 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;
}
Also used : EnforcePolicyPermissionsThroughBaseResource(org.apache.nifi.authorization.resource.EnforcePolicyPermissionsThroughBaseResource) ComponentReferenceEntity(org.apache.nifi.web.api.entity.ComponentReferenceEntity) PermissionsDTO(org.apache.nifi.web.api.dto.PermissionsDTO) Authorizable(org.apache.nifi.authorization.resource.Authorizable) ComponentReferenceDTO(org.apache.nifi.web.api.dto.ComponentReferenceDTO) RevisionDTO(org.apache.nifi.web.api.dto.RevisionDTO)

Aggregations

Authorizable (org.apache.nifi.authorization.resource.Authorizable)1 EnforcePolicyPermissionsThroughBaseResource (org.apache.nifi.authorization.resource.EnforcePolicyPermissionsThroughBaseResource)1 ComponentReferenceDTO (org.apache.nifi.web.api.dto.ComponentReferenceDTO)1 PermissionsDTO (org.apache.nifi.web.api.dto.PermissionsDTO)1 RevisionDTO (org.apache.nifi.web.api.dto.RevisionDTO)1 ComponentReferenceEntity (org.apache.nifi.web.api.entity.ComponentReferenceEntity)1