/** * Creates a new JIRA issue. * * @param restclient REST client instance * @param project Key of the project to create the issue in * @param issueType Name of the issue type to create * * @return a fluent create instance * * @throws JiraException when the client fails to retrieve issue metadata */ public static FluentCreate create(RestClient restclient, String project, String issueType) throws JiraException { FluentCreate fc = new FluentCreate( restclient, getCreateMetadata(restclient, project, issueType)); return fc .field(Field.PROJECT, project) .field(Field.ISSUE_TYPE, issueType); }
/** * Get a list of options for a components * * @param project Key of the project context * @param issueType Name of the issue type * * @return a search result structure with results * * @throws JiraException when the search fails */ public List<Component> getComponentsAllowedValues(String project, String issueType) throws JiraException { JSONObject createMetadata = (JSONObject) Issue.getCreateMetadata(restclient, project, issueType); JSONObject fieldMetadata = (JSONObject) createMetadata.get(Field.COMPONENTS); List<Component> componentOptions = Field.getResourceArray( Component.class, fieldMetadata.get("allowedValues"), restclient ); return componentOptions; }
/** * Get a list of options for a custom field * * @param field field id * @param project Key of the project context * @param issueType Name of the issue type * * @return a search result structure with results * * @throws JiraException when the search fails */ public List<CustomFieldOption> getCustomFieldAllowedValues(String field, String project, String issueType) throws JiraException { JSONObject createMetadata = (JSONObject) Issue.getCreateMetadata(restclient, project, issueType); JSONObject fieldMetadata = (JSONObject) createMetadata.get(field); List<CustomFieldOption> customFieldOptions = Field.getResourceArray( CustomFieldOption.class, fieldMetadata.get("allowedValues"), restclient ); return customFieldOptions; }
/** * Creates a new JIRA issue. * * @param restclient REST client instance * @param project Key of the project to create the issue in * @param issueType Name of the issue type to create * * @return a fluent create instance * * @throws JiraException when the client fails to retrieve issue metadata */ public static FluentCreate create(RestClient restclient, String project, String issueType) throws JiraException { FluentCreate fc = new FluentCreate( restclient, getCreateMetadata(restclient, project, issueType)); return fc .field(Field.PROJECT, project) .field(Field.ISSUE_TYPE, issueType); }
/** * Get a list of options for a components * * @param project Key of the project context * @param issueType Name of the issue type * * @return a search result structure with results * * @throws JiraException when the search fails */ public List<Component> getComponentsAllowedValues(String project, String issueType) throws JiraException { JSONObject createMetadata = (JSONObject) Issue.getCreateMetadata(restclient, project, issueType); JSONObject fieldMetadata = (JSONObject) createMetadata.get(Field.COMPONENTS); List<Component> componentOptions = Field.getResourceArray( Component.class, fieldMetadata.get("allowedValues"), restclient ); return componentOptions; }
/** * Get a list of options for a custom field * * @param field field id * @param project Key of the project context * @param issueType Name of the issue type * * @return a search result structure with results * * @throws JiraException when the search fails */ public List<CustomFieldOption> getCustomFieldAllowedValues(String field, String project, String issueType) throws JiraException { JSONObject createMetadata = (JSONObject) Issue.getCreateMetadata(restclient, project, issueType); JSONObject fieldMetadata = (JSONObject) createMetadata.get(field); List<CustomFieldOption> customFieldOptions = Field.getResourceArray( CustomFieldOption.class, fieldMetadata.get("allowedValues"), restclient ); return customFieldOptions; }