use of com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptor in project kylo by Teradata.
the class NifiRemoteProcessGroupUtil method hiddenOnlyPropertyDescriptor.
private static NiFiPropertyDescriptor hiddenOnlyPropertyDescriptor(String key, String label) {
NiFiPropertyDescriptor descriptorDTO = new NiFiPropertyDescriptor();
descriptorDTO.setName(key);
descriptorDTO.setDisplayName(label);
descriptorDTO.setHidden(true);
return descriptorDTO;
}
use of com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptor in project kylo by Teradata.
the class NifiRemoteProcessGroupUtil method propertyDescriptorDTO.
private static NiFiPropertyDescriptor propertyDescriptorDTO(String key, String label, boolean required, boolean sensitive) {
NiFiPropertyDescriptor descriptorDTO = new NiFiPropertyDescriptor();
descriptorDTO.setName(key);
descriptorDTO.setDisplayName(label);
descriptorDTO.setRequired(required);
descriptorDTO.setSensitive(sensitive);
return descriptorDTO;
}
use of com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptor in project kylo by Teradata.
the class NifiPropertyUtil method getPropertiesForProcessor.
/**
* Return a list of properties on a gi en processor
*
* @param processGroup the processors group
* @param processor the processor
* @param propertyDescriptorTransform the transform utility
* @return the list of properties on the processor
*/
public static List<NifiProperty> getPropertiesForProcessor(ProcessGroupDTO processGroup, ProcessorDTO processor, NiFiPropertyDescriptorTransform propertyDescriptorTransform) {
List<NifiProperty> properties = new ArrayList<>();
for (Map.Entry<String, String> entry : processor.getConfig().getProperties().entrySet()) {
PropertyDescriptorDTO descriptorDTO = processor.getConfig().getDescriptors().get(entry.getKey());
if (descriptorDTO != null) {
final NiFiPropertyDescriptor propertyDescriptor = propertyDescriptorTransform.toNiFiPropertyDescriptor(processor.getConfig().getDescriptors().get(entry.getKey()));
final NifiProperty property = new NifiProperty(processor.getParentGroupId(), processor.getId(), entry.getKey(), entry.getValue(), propertyDescriptor);
property.setProcessGroupName(processGroup.getName());
property.setProcessorName(processor.getName());
property.setProcessorType(processor.getType());
properties.add(property);
}
}
return properties;
}
use of com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptor in project kylo by Teradata.
the class NiFiPropertyDescriptorTransformV1 method toNiFiPropertyDescriptor.
@Nonnull
@Override
public NiFiPropertyDescriptor toNiFiPropertyDescriptor(@Nonnull final PropertyDescriptorDTO dto) {
final NiFiPropertyDescriptor nifi = new NiFiPropertyDescriptor();
nifi.setName(dto.getName());
nifi.setDisplayName(dto.getDisplayName());
nifi.setDescription(dto.getDescription());
nifi.setDefaultValue(dto.getDefaultValue());
nifi.setRequired(dto.isRequired());
nifi.setSensitive(dto.isSensitive());
nifi.setDynamic(dto.isDynamic());
nifi.setSupportsEl(dto.getSupportsEl());
nifi.setIdentifiesControllerService(dto.getIdentifiesControllerService());
final List<AllowableValueEntity> allowableValues = dto.getAllowableValues();
if (allowableValues != null) {
nifi.setAllowableValues(allowableValues.stream().filter(allowableValueEntity -> allowableValueEntity.getAllowableValue() != null && allowableValueEntity.getAllowableValue().getValue() != null).map(AllowableValueEntity::getAllowableValue).map(this::toNiFiAllowableValue).collect(Collectors.toList()));
}
return nifi;
}
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