Search in sources :

Example 1 with ConnectDetailsDTO

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

the class DtoFactory method createActionDetailsDto.

/**
 * Creates an ActionDetailsDTO for the specified ActionDetails.
 *
 * @param actionDetails details
 * @return dto
 */
private ActionDetailsDTO createActionDetailsDto(final ActionDetails actionDetails) {
    if (actionDetails == null) {
        return null;
    }
    if (actionDetails instanceof FlowChangeConfigureDetails) {
        final ConfigureDetailsDTO configureDetails = new ConfigureDetailsDTO();
        configureDetails.setName(((ConfigureDetails) actionDetails).getName());
        configureDetails.setPreviousValue(((ConfigureDetails) actionDetails).getPreviousValue());
        configureDetails.setValue(((ConfigureDetails) actionDetails).getValue());
        return configureDetails;
    } else if (actionDetails instanceof FlowChangeConnectDetails) {
        final ConnectDetailsDTO connectDetails = new ConnectDetailsDTO();
        connectDetails.setSourceId(((ConnectDetails) actionDetails).getSourceId());
        connectDetails.setSourceName(((ConnectDetails) actionDetails).getSourceName());
        connectDetails.setSourceType(((ConnectDetails) actionDetails).getSourceType().toString());
        connectDetails.setRelationship(((ConnectDetails) actionDetails).getRelationship());
        connectDetails.setDestinationId(((ConnectDetails) actionDetails).getDestinationId());
        connectDetails.setDestinationName(((ConnectDetails) actionDetails).getDestinationName());
        connectDetails.setDestinationType(((ConnectDetails) actionDetails).getDestinationType().toString());
        return connectDetails;
    } else if (actionDetails instanceof FlowChangeMoveDetails) {
        final MoveDetailsDTO moveDetails = new MoveDetailsDTO();
        moveDetails.setPreviousGroup(((MoveDetails) actionDetails).getPreviousGroup());
        moveDetails.setPreviousGroupId(((MoveDetails) actionDetails).getPreviousGroupId());
        moveDetails.setGroup(((MoveDetails) actionDetails).getGroup());
        moveDetails.setGroupId(((MoveDetails) actionDetails).getGroupId());
        return moveDetails;
    } else if (actionDetails instanceof FlowChangePurgeDetails) {
        final PurgeDetailsDTO purgeDetails = new PurgeDetailsDTO();
        purgeDetails.setEndDate(((PurgeDetails) actionDetails).getEndDate());
        return purgeDetails;
    } else {
        throw new WebApplicationException(new IllegalArgumentException(String.format("Unrecognized type of action details encountered %s during serialization.", actionDetails.toString())));
    }
}
Also used : FlowChangeConnectDetails(org.apache.nifi.action.details.FlowChangeConnectDetails) ConfigureDetailsDTO(org.apache.nifi.web.api.dto.action.details.ConfigureDetailsDTO) MoveDetailsDTO(org.apache.nifi.web.api.dto.action.details.MoveDetailsDTO) FlowChangePurgeDetails(org.apache.nifi.action.details.FlowChangePurgeDetails) WebApplicationException(javax.ws.rs.WebApplicationException) FlowChangeConfigureDetails(org.apache.nifi.action.details.FlowChangeConfigureDetails) ConnectDetails(org.apache.nifi.action.details.ConnectDetails) FlowChangeConnectDetails(org.apache.nifi.action.details.FlowChangeConnectDetails) FlowChangeMoveDetails(org.apache.nifi.action.details.FlowChangeMoveDetails) FlowChangePurgeDetails(org.apache.nifi.action.details.FlowChangePurgeDetails) PurgeDetails(org.apache.nifi.action.details.PurgeDetails) PurgeDetailsDTO(org.apache.nifi.web.api.dto.action.details.PurgeDetailsDTO) ConnectDetailsDTO(org.apache.nifi.web.api.dto.action.details.ConnectDetailsDTO)

Aggregations

WebApplicationException (javax.ws.rs.WebApplicationException)1 ConnectDetails (org.apache.nifi.action.details.ConnectDetails)1 FlowChangeConfigureDetails (org.apache.nifi.action.details.FlowChangeConfigureDetails)1 FlowChangeConnectDetails (org.apache.nifi.action.details.FlowChangeConnectDetails)1 FlowChangeMoveDetails (org.apache.nifi.action.details.FlowChangeMoveDetails)1 FlowChangePurgeDetails (org.apache.nifi.action.details.FlowChangePurgeDetails)1 PurgeDetails (org.apache.nifi.action.details.PurgeDetails)1 ConfigureDetailsDTO (org.apache.nifi.web.api.dto.action.details.ConfigureDetailsDTO)1 ConnectDetailsDTO (org.apache.nifi.web.api.dto.action.details.ConnectDetailsDTO)1 MoveDetailsDTO (org.apache.nifi.web.api.dto.action.details.MoveDetailsDTO)1 PurgeDetailsDTO (org.apache.nifi.web.api.dto.action.details.PurgeDetailsDTO)1