Managing components
Managing components using JRJC is very similar to managing versions.
Getting ready
Create a JIRA REST client as mentioned in the Writing a Java client for the REST API recipe.
How to do it...
A new component can be added into a project as follows:
Create a
ComponentInput
object with the necessary details.ComponentInput componentInput = new ComponentInput("JRJC", "Test", "jobinkk", AssigneeType.COMPONENT_LEAD);
Use the
createComponent
method onComponentRestClient
.Promise<Component> component = jiraRestClient.getComponentRestClient().createComponent("DEMO", componentInput);
Once a component is created, you can retrieve it any time using the component URI.
Promise<Component> component= jiraRestClient.getComponentRestClient().getComponent(componentURI);
Given a component, you can update it by sending a new
ComponentInput
object with updated parameters. For example, if you want to change the project lead to "test", you can do it as follows:jiraRestClient.getComponentClient...