About PropertyDependency
Class
nifiapi.properties.PropertyDependency
The PropertyDependency
class defines dependencies between PropertyDescriptor instances within a processor. It specifies that the availability of one property depends on the value of another property.
Parameters
Name | Type | Description |
---|---|---|
property_descriptor | PropertyDescriptor | Targeted PropertyDescriptor instance |
*dependent_values | List(String) | A list of values triggering the presence of targeted property |
e.g.:
from nifiapi.properties import PropertyDescriptor, PropertyDependency
PROPERTY_A = PropertyDescriptor(
name="Property A",
description="Dropdown Property",
required=True,
allowable_values=[
"Value A",
"Value B",
"Value C"
],
)
PROPERTY_B = PropertyDescriptor(
name="Property B",
description='''
A conditional property, visible only when options "Value A" or "Value B"
is selected for Property A.
''',
required=True,
dependencies=[
PropertyDependency(PROPERTY_A, "Value A", "Value B")
],
)
caution
Note that all values that cross between Python and Java are serialised as strings, and should be represented as such when provided as dependent_values
from nifiapi.properties import (
PropertyDescriptor,
PropertyDependency,
StandardValidators
)
PROPERTY_A = PropertyDescriptor(
name="Property A",
description="Checkbox property",
required=True,
default_value=False,
validators=[
StandardValidators.BOOLEAN_VALIDATOR
],
)
# A conditional "Property B" visible only when a "Property A" is set to True
PROPERTY_B = PropertyDescriptor(
name="Property B",
description='''
Property B will be visible in the UI only if Property A is checked.
''',
dependencies=[
PropertyDependency(PROPERTY_A, "True")
],
)