Search in sources :

Example 1 with RemoteProcessGroupDetailsDTO

use of org.apache.nifi.web.api.dto.action.component.details.RemoteProcessGroupDetailsDTO in project nifi by apache.

the class DtoFactory method createComponentDetailsDto.

/**
 * Creates a ComponentDetailsDTO for the specified ComponentDetails.
 *
 * @param componentDetails details
 * @return dto
 */
private ComponentDetailsDTO createComponentDetailsDto(final ComponentDetails componentDetails) {
    if (componentDetails == null) {
        return null;
    }
    if (componentDetails instanceof FlowChangeExtensionDetails) {
        final ExtensionDetailsDTO processorDetails = new ExtensionDetailsDTO();
        processorDetails.setType(((ExtensionDetails) componentDetails).getType());
        return processorDetails;
    } else if (componentDetails instanceof FlowChangeRemoteProcessGroupDetails) {
        final RemoteProcessGroupDetailsDTO remoteProcessGroupDetails = new RemoteProcessGroupDetailsDTO();
        remoteProcessGroupDetails.setUri(((RemoteProcessGroupDetails) componentDetails).getUri());
        return remoteProcessGroupDetails;
    } else {
        throw new WebApplicationException(new IllegalArgumentException(String.format("Unrecognized type of component details encountered %s during serialization. ", componentDetails.toString())));
    }
}
Also used : RemoteProcessGroupDetailsDTO(org.apache.nifi.web.api.dto.action.component.details.RemoteProcessGroupDetailsDTO) RemoteProcessGroupDetails(org.apache.nifi.action.component.details.RemoteProcessGroupDetails) FlowChangeRemoteProcessGroupDetails(org.apache.nifi.action.component.details.FlowChangeRemoteProcessGroupDetails) WebApplicationException(javax.ws.rs.WebApplicationException) FlowChangeExtensionDetails(org.apache.nifi.action.component.details.FlowChangeExtensionDetails) FlowChangeRemoteProcessGroupDetails(org.apache.nifi.action.component.details.FlowChangeRemoteProcessGroupDetails) ExtensionDetailsDTO(org.apache.nifi.web.api.dto.action.component.details.ExtensionDetailsDTO)

Aggregations

WebApplicationException (javax.ws.rs.WebApplicationException)1 FlowChangeExtensionDetails (org.apache.nifi.action.component.details.FlowChangeExtensionDetails)1 FlowChangeRemoteProcessGroupDetails (org.apache.nifi.action.component.details.FlowChangeRemoteProcessGroupDetails)1 RemoteProcessGroupDetails (org.apache.nifi.action.component.details.RemoteProcessGroupDetails)1 ExtensionDetailsDTO (org.apache.nifi.web.api.dto.action.component.details.ExtensionDetailsDTO)1 RemoteProcessGroupDetailsDTO (org.apache.nifi.web.api.dto.action.component.details.RemoteProcessGroupDetailsDTO)1