How parameter contexts are handled when you paste a processor or process group in NiFi:
- The UI paste action starts in the frontend, notably in files like
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/copy-paste.service.ts
andflow.effects.ts
. - The actual merge and conflict logic for parameter contexts is handled on the backend, specifically in Java classes like
ParameterContextReplacer.java
and theProcessGroupResource
REST endpoint.
Based on the code and documentation:
- A new Parameter Context is created.
- The values are merged, NOT simply overwritten or ignored.
- New parameters in the pasted content are added to the existing context.
- Parameters that exist in both:
- If the value is identical, nothing changes.
- If the value is different, the existing value in the destination context is retained; the incoming value is ignored (not overwritten).
- Sensitive parameters: If a parameter is sensitive and does not exist, it is created but left empty.
"When importing a versioned flow from Flow Registry, if NiFi has a Parameter Context with the same name, the values are merged... If a parameter existed in both the versioned flow and the NiFi instance with identical values, no changes were made. If the parameter existed in both but with different values, the value in the NiFi instance remained unchanged."
—nifi-docs/src/main/asciidoc/user-guide.adoc#L2731-L2745
Parameter Exists in Dest? | Value Same? | What Happens? |
---|---|---|
No | N/A | Added to context |
Yes | Yes | No change |
Yes | No | Value in destination kept |
- Docs: See the section on "Parameters in Versioned Flows" and the merge example (user-guide.adoc#L2731-L2745).
- Code:
ParameterContextReplacer.java
is responsible for the merge logic, confirming the above behavior. - System Tests:
CopyPasteIT.java
integration tests also validate that parameter contexts are created or merged, not blindly overwritten.
In summary:
When pasting, existing parameter context items are NOT completely overwritten, and existing values are preserved if there's any difference. Only new/non-existing items are added to the destination parameter context, and existing keys/values remain unless they are identical, in which case nothing changes.