use of org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentEntity in project nifi by apache.
the class ControllerServiceReferenceEndpointMerger method merge.
@Override
public NodeResponse merge(URI uri, String method, Set<NodeResponse> successfulResponses, Set<NodeResponse> problematicResponses, NodeResponse clientResponse) {
if (!canHandle(uri, method)) {
throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method);
}
final ControllerServiceReferencingComponentsEntity responseEntity = clientResponse.getClientResponse().readEntity(ControllerServiceReferencingComponentsEntity.class);
final Set<ControllerServiceReferencingComponentEntity> referencingComponents = responseEntity.getControllerServiceReferencingComponents();
final Map<NodeIdentifier, Set<ControllerServiceReferencingComponentEntity>> resultsMap = new HashMap<>();
for (final NodeResponse nodeResponse : successfulResponses) {
final ControllerServiceReferencingComponentsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(ControllerServiceReferencingComponentsEntity.class);
final Set<ControllerServiceReferencingComponentEntity> nodeReferencingComponents = nodeResponseEntity.getControllerServiceReferencingComponents();
resultsMap.put(nodeResponse.getNodeId(), nodeReferencingComponents);
}
ControllerServiceEntityMerger.mergeControllerServiceReferences(referencingComponents, resultsMap);
return new NodeResponse(clientResponse, responseEntity);
}
use of org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentEntity in project nifi by apache.
the class EntityFactory method createControllerServiceReferencingComponentEntity.
public ControllerServiceReferencingComponentEntity createControllerServiceReferencingComponentEntity(final ControllerServiceReferencingComponentDTO dto, final RevisionDTO revision, final PermissionsDTO permissions) {
final ControllerServiceReferencingComponentEntity entity = new ControllerServiceReferencingComponentEntity();
entity.setRevision(revision);
if (dto != null) {
entity.setPermissions(permissions);
entity.setId(dto.getId());
if (permissions != null && permissions.getCanRead()) {
entity.setComponent(dto);
}
}
return entity;
}
Aggregations