Andrea Cosentino created CAMEL-23576:
----------------------------------------

             Summary: camel-jira - align Exchange header constant names with 
Camel naming convention
                 Key: CAMEL-23576
                 URL: https://issues.apache.org/jira/browse/CAMEL-23576
             Project: Camel
          Issue Type: Improvement
          Components: camel-jira
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.21.0, 4.18.3, 4.14.8


The Exchange header constants defined in 
{{org.apache.camel.component.jira.JiraConstants}} use string values that do not 
follow the Camel naming convention ({{CamelJira*}}). Examples:

* {{ISSUE_KEY = "IssueKey"}}
* {{ISSUE_PROJECT_KEY = "ProjectKey"}}
* {{ISSUE_TRANSITION_ID = "IssueTransitionId"}}
* {{ISSUE_ASSIGNEE = "IssueAssignee"}} / {{ISSUE_ASSIGNEE_ID = 
"IssueAssigneeId"}}
* {{ISSUE_SUMMARY = "IssueSummary"}}
* {{ISSUE_TYPE_ID = "IssueTypeId"}} / {{ISSUE_TYPE_NAME = "IssueTypeName"}}
* {{ISSUE_PRIORITY_ID = "IssuePriorityId"}} / {{ISSUE_PRIORITY_NAME = 
"IssuePriorityName"}}
* {{ISSUE_COMPONENTS = "IssueComponents"}}
* {{ISSUE_COMMENT = "IssueComment"}}
* {{ISSUE_CHANGED = "IssueChanged"}}
* {{ISSUE_WATCHED_ISSUES = "IssueWatchedIssues"}}
* {{ISSUE_WATCHERS_ADD = "IssueWatchersAdd"}} / {{ISSUE_WATCHERS_REMOVE = 
"IssueWatchersRemove"}}
* {{PARENT_ISSUE_KEY = "ParentIssueKey"}} / {{CHILD_ISSUE_KEY = 
"ChildIssueKey"}}
* {{LINK_TYPE = "linkType"}}
* {{MINUTES_SPENT = "minutesSpent"}}

Sibling components ({{camel-cxf}} in CAMEL-23526, {{camel-aws-bedrock}} in 
CAMEL-23461, and others) have already been migrated to put their 
producer-facing Exchange header constants inside the {{Camel<Component>*}} 
namespace so they fall within the default {{HeaderFilterStrategy}} ({{Camel*}} 
/ {{org.apache.camel.*}}) at transport boundaries. The remaining non-prefixed 
values in {{JiraConstants}} are the last block in this family for the JIRA 
component.

h3. Proposed change

Rename the *string values* of the constants to the {{CamelJira*}} namespace, 
keeping the Java field names unchanged so routes that reference the constants 
symbolically continue to work without modification.

{code:java}
// Before
String ISSUE_KEY = "IssueKey";
String ISSUE_PROJECT_KEY = "ProjectKey";
String LINK_TYPE = "linkType";
String MINUTES_SPENT = "minutesSpent";

// After
String ISSUE_KEY = "CamelJiraIssueKey";
String ISSUE_PROJECT_KEY = "CamelJiraIssueProjectKey";
String LINK_TYPE = "CamelJiraLinkType";
String MINUTES_SPENT = "CamelJiraMinutesSpent";
{code}

Producers that read these headers ({{DeleteIssueProducer}}, 
{{TransitionIssueProducer}}, {{AddIssueProducer}}, {{UpdateIssueProducer}}, 
{{AddIssueLinkProducer}}, {{WatcherProducer}}, {{AddWorkLogProducer}}) only 
reference the Java fields and need no source changes. Tests that use the 
constants symbolically also need no changes. Tests, examples, or user routes 
that use the literal string values ({{"IssueKey"}}, {{"ProjectKey"}}, etc.) 
must be updated.

h3. Compatibility

This is a behavioural change for users that set the headers via literal string 
values. It must be documented in the 4.x upgrade guide 
({{docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc}} and 
the matching 4_18 / 4_14 backport guides).

h3. Files to update

* 
{{components/camel-jira/src/main/java/org/apache/camel/component/jira/JiraConstants.java}}
* {{components/camel-jira/src/main/docs/jira-component.adoc}} (regenerated 
catalog)
* Generated 
{{components/camel-jira/src/generated/resources/org/apache/camel/component/jira/jira.json}}
* {{docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc}} (and 
matching 4_18 / 4_14 for backports)

h3. Backports

The defect predates 4.x; the same {{JiraConstants}} layout exists on 
{{camel-4.18.x}} and {{camel-4.14.x}}. Plan to backport to 4.18.3 and 4.14.8 
alongside 4.21.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to