use of com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptor 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;
}
Aggregations