Using jira REST api - jira-rest-api

I'm currently trying to get worklogs from jira through java. I'm reading the documentation, about it(https://developer.atlassian.com/cloud/jira/platform/rest/#api/2/issue-createIssue) but i simply can't find some basic information like:
How do i start using that api with java ? Did i have to add something to my pom.xml ? If yes, what dependency ?
For my task(get worklogs), it's better use the java api or the rest API ?
Any of you guys can send me a light, recommend me a book or article about it or something ?
Thx in advance guys.

If its help you, I give you link to my repo on git, there is program to load scenario test to Jira with Zephyr.
There is two simple endpoints, to send post method.
Github
My pom:
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
</dependencies>

You can use JIRA's internal Java API, for example, with Groovy scripts via ScriptRunner plugin for JIRA.
You should import ComponentAccessor to get basic JIRA helper classes for the rest of logic.
Here is a Groovy script snippet to get all Worklog objects for a given issue:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.WorklogManager
worklogManager = ComponentAccessor.getWorklogManager()
def issueWorklogItems = worklogManager.getByIssue(issue)

If you want to read/modify Jira issue from an external code then you can use Jira Rest APIs. Following links will be helpful to understand fetching/updating worklog details for an jira issue,
To get all work logs for an Jira issue,
https://docs.atlassian.com/software/jira/docs/api/REST/8.0.2/#api/2/issue-getIssueWorklog
TO fetch specific worklog for an Jira issue,
https://docs.atlassian.com/software/jira/docs/api/REST/8.0.2/#api/2/issue-getIssueWorklog

Related

Spring doesn't see h2 database hence complain about database not available

I'm building a simple reactive web application ( Following Josh long's tech talk ) Simply put I have reactive web, r2dbc and h2 as dependencies.
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
So I expect spring would configure everything for me( It does for Josh ). But I get error saying not being able to connect to a database and there is a suggestion asking to include h2(which I already have). What am I doing wrong here?
Description:
Failed to configure a ConnectionFactory: 'url' attribute is not specified and no embedded database could be configured.
Reason: Failed to determine a suitable R2DBC Connection URL
Action:
Consider the following:
If you want an embedded database (H2), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
Ok it was missing r2dbc-h2 dependency. This happened because I didn't add r2dbc when I created the project with start.spring.io then added it and inspect the pom but only copied spring-boot-starter-data-r2dbc.
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-h2</artifactId>
<scope>runtime</scope>
</dependency>
Still bit confusing though. Spring boot says it looks in to the class path and auto configure dependencies but seems like sometimes it need given combination of dependencies.

Dependency 'io.quarkus:quarkus-quarkus-smallrye-reactive-messaging-rabbitmq:' not found

I am trying to implement RabbitMQ with Quarkus and in the Doc they said to use
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-quarkus-smallrye-reactive-messaging-rabbitmq</artifactId> </dependency>
and in my project i cant find this dependency
I think you've a typo in dependency name (Quarkus is mentioned twice), try this :
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-rabbitmq</artifactId>
</dependency>

How to use Bean Validation in a Helidon App?

I'm trying to create a simple Rest Resource using Helidon-MP but for some reason it doesn't work when I add the bean validation annotations on my method.
#POST
public Response generatePlan(#Valid #ValidPlan JsonObject payload) {
// some logic here
}
Is this the expected behavior? Or Should I add some dependency or configuration?
I tried to find something on the documentation, but I couldn't.
Thanks
I ended up doing as #LairdNelson answered and added the following dependencies in my pom.xml:
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator-cdi</artifactId>
<version>6.1.5.Final</version>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.el</artifactId>
</dependency>
Bean validation is not part of the MicroProfile set of specifications, so by default it is not part of Helidon MP, which is a MicroProfile implementation.
You may of course add an implementation of Bean Validation on your compile or runtime classpath provided it is a CDI portable extension (which is how you add arbitrary capabilities to any MicroProfile-compliant implementation). One such portable extension is the Hibernate Validator-backed one. There may certainly be others.

NoClassDefFoundError using with boxable plugin

I am using boxable plugin with pdfbox and I am trying to create a teble. I am getting error:
2015-09-09T10:36:52.453+0200|Severe: java.lang.NoClassDefFoundError: org/apache/pdfbox/pdmodel/edit/PDPageContentStream
at the line of code:
BaseTable table = new BaseTable(yStart,yStartNewPage, bottomMargin, tableWidth, margin, doc, page, true, drawContent);
Here is a part from pom.xml, describing the dependencies that I am using:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.dhorions</groupId>
<artifactId>boxable</artifactId>
<version>1.2</version>
</dependency>
Is there a bug in current version of dependencies or am I missing something?
Thank you very much for any help.
Remove this:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
2.0 is an unreleased version and is in development, and it has a different API. Boxable has its dependencies in its own pom.xml, it is currently requesting 1.8.8. (Which is not the latest version, but I don't think this matters for simple PDF creation)

Which maven2 artifacts are necessary to build a WS with CXF and Spring?

I'm trying to build a WS with Spring 3.0 and CXF. I'm following the steps of this article http://www.ibm.com/developerworks/library/ws-pojo-springcxf/
But in that article, the authors assume that you have cxf installed. I'd like to embed CXF in my .war.
Thanks in advance.
Normally, just depend on cxf-rt-frontend-jaxws and cxf-rt-transport-http. Pretty much the rest of the stuff needed would be pulled in transitively from those. (might not even need cxf-rt-transport-http) That would cover 90% of the usecases.
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.2.5</version>
</dependency>
For more advanced things like WS-Security and WS-RM and JAX-RS, you would need to add additional modules.