use of org.apache.nifi.web.api.dto.RemoteProcessGroupDTO in project kylo by Teradata.
the class NiFiRemoteProcessGroupsRestClientV1 method enable.
@Nonnull
@Override
public Optional<RemoteProcessGroupDTO> enable(String remoteProcessGroupId) {
Optional<RemoteProcessGroupDTO> remoteProcessGroupDTO = findById(remoteProcessGroupId);
if (remoteProcessGroupDTO.isPresent()) {
if (!remoteProcessGroupDTO.get().isTransmitting()) {
RemoteProcessGroupDTO updatedGroup = new RemoteProcessGroupDTO();
updatedGroup.setTransmitting(true);
updatedGroup.setId(remoteProcessGroupId);
return Optional.of(update(updatedGroup));
}
return remoteProcessGroupDTO;
} else {
return Optional.empty();
}
}
use of org.apache.nifi.web.api.dto.RemoteProcessGroupDTO in project kylo by Teradata.
the class NifiRemoteProcessGroupUtil method remoteProcessGroupProperties.
public static List<NifiProperty> remoteProcessGroupProperties(RemoteProcessGroupDTO remoteProcessGroupDTO) {
List<NifiProperty> list = Arrays.stream(BeanUtils.getPropertyDescriptors(RemoteProcessGroupDTO.class)).filter(propertyDescriptor -> remoteProcessGroupPropertiesMap.containsKey(propertyDescriptor.getName())).map(propertyDescriptor -> {
NifiProperty property = new NifiProperty(remoteProcessGroupDTO.getParentGroupId(), remoteProcessGroupDTO.getId(), propertyDescriptor.getName(), getPropertyAsString(remoteProcessGroupDTO, propertyDescriptor));
property.setProcessorType(NifiConstants.NIFI_COMPONENT_TYPE.REMOTE_PROCESS_GROUP.name());
property.setProcessGroupId(remoteProcessGroupDTO.getParentGroupId());
property.setProcessorName(remoteProcessGroupDTO.getName() != null ? remoteProcessGroupDTO.getName() : remoteProcessGroupDTO.getTargetUri());
property.setProcessGroupName(NifiConstants.NIFI_COMPONENT_TYPE.REMOTE_PROCESS_GROUP.name());
NiFiPropertyDescriptor propertyDescriptorDTO = remoteProcessGroupPropertiesMap.get(propertyDescriptor.getName());
property.setPropertyDescriptor(propertyDescriptorDTO);
return property;
}).collect(Collectors.toList());
// add in the connected input port name as a hidden descriptor
if (remoteProcessGroupDTO.getContents() != null) {
NifiProperty connectedRemoteInputPort = remoteProcessGroupDTO.getContents().getInputPorts().stream().filter(port -> port.isConnected()).map(port -> {
NifiProperty property = new NifiProperty(remoteProcessGroupDTO.getParentGroupId(), remoteProcessGroupDTO.getId(), "Remote Input Port", port.getName());
property.setProcessorType(NifiConstants.NIFI_COMPONENT_TYPE.REMOTE_PROCESS_GROUP.name());
property.setProcessGroupId(remoteProcessGroupDTO.getParentGroupId());
property.setProcessorName(remoteProcessGroupDTO.getName() != null ? remoteProcessGroupDTO.getName() : remoteProcessGroupDTO.getTargetUri());
property.setProcessGroupName(NifiConstants.NIFI_COMPONENT_TYPE.REMOTE_PROCESS_GROUP.name());
property.setPropertyDescriptor(hiddenOnlyPropertyDescriptor("Remote Input Port", port.getName()));
property.setHidden(true);
return property;
}).findFirst().orElse(null);
if (connectedRemoteInputPort != null) {
list.add(connectedRemoteInputPort);
}
}
return list;
}
use of org.apache.nifi.web.api.dto.RemoteProcessGroupDTO in project nifi-minifi by apache.
the class RemoteProcessGroupSchemaTest method setup.
@Before
public void setup() {
remoteInputPortSchemaTest.setup();
dto = new RemoteProcessGroupDTO();
dto.setId(testId);
dto.setName(testName);
dto.setTargetUri(testUrl);
RemoteProcessGroupContentsDTO contents = new RemoteProcessGroupContentsDTO();
contents.setInputPorts(Arrays.asList(remoteInputPortSchemaTest.dto).stream().collect(Collectors.toSet()));
dto.setContents(contents);
dto.setComments(testComment);
dto.setCommunicationsTimeout(testTimeout);
dto.setYieldDuration(testYieldPeriod);
dto.setTransportProtocol(transportProtocol);
map = new HashMap<>();
map.put(CommonPropertyKeys.ID_KEY, testId);
map.put(CommonPropertyKeys.NAME_KEY, testName);
map.put(RemoteProcessGroupSchema.URL_KEY, testUrl);
map.put(CommonPropertyKeys.INPUT_PORTS_KEY, new ArrayList<>(Arrays.asList(remoteInputPortSchemaTest.map)));
map.put(CommonPropertyKeys.COMMENT_KEY, testComment);
map.put(RemoteProcessGroupSchema.TIMEOUT_KEY, testTimeout);
map.put(CommonPropertyKeys.YIELD_PERIOD_KEY, testYieldPeriod);
map.put(RemoteProcessGroupSchema.TRANSPORT_PROTOCOL_KEY, transportProtocol);
}
Aggregations