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())));
}
}
Aggregations