Skip to content

Commit f1a0659

Browse files
authored
Merge pull request #52 from digipost/jakarta
Use jakarta xml and java 11
2 parents da0ff4a + 5714476 commit f1a0659

40 files changed

+278
-173
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
java: [ '8', '11' ]
10+
java: [ '11', '17', '21' ]
1111

1212
name: build java ${{ matrix.java }}
1313
steps:

.java-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8
1+
11.0

NOTICE

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Licensed under Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.html
88

99
This software includes third party software subject to the following licenses:
1010

11+
Angus Activation Registries under EDL 1.0
1112
Apache Commons Codec under Apache License, Version 2.0
1213
Apache Commons Lang under Apache License, Version 2.0
1314
Apache HttpClient under Apache License, Version 2.0
@@ -21,16 +22,15 @@ This software includes third party software subject to the following licenses:
2122
Digipost HTTP Client Builder under The Apache Software License, Version 2.0
2223
Digipost User Agreements API Client under The Apache Software License, Version 2.0
2324
error-prone annotations under Apache 2.0
24-
Extended StAX API under Eclipse Distribution License - v 1.0
25-
fastinfoset under Apache License, Version 2.0 or Eclipse Distribution License - v 1.0
2625
FindBugs-jsr305 under The Apache Software License, Version 2.0
2726
Guava InternalFutureFailureAccess and InternalFutures under The Apache Software License, Version 2.0
2827
Guava ListenableFuture only under The Apache Software License, Version 2.0
2928
Guava: Google Core Libraries for Java under Apache License, Version 2.0
3029
istack common utility code runtime under Eclipse Distribution License - v 1.0
3130
J2ObjC Annotations under Apache License, Version 2.0
32-
jakarta.xml.bind-api under Eclipse Distribution License - v 1.0
33-
JavaBeans Activation Framework API jar under EDL 1.0
31+
Jakarta Activation API under EDL 1.0
32+
Jakarta XML Binding API under Eclipse Distribution License - v 1.0
33+
JAXB Core under Eclipse Distribution License - v 1.0
3434
JAXB Runtime under Eclipse Distribution License - v 1.0
3535
JCL 1.2 implemented over SLF4J under Apache License, Version 2.0
3636
SLF4J API Module under MIT License

docs/Gemfile.lock

+10-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GEM
1111
minitest (>= 5.1)
1212
mutex_m
1313
tzinfo (~> 2.0)
14-
addressable (2.8.4)
14+
addressable (2.8.5)
1515
public_suffix (>= 2.0.2, < 6.0)
1616
base64 (0.2.0)
1717
bigdecimal (3.1.4)
@@ -33,12 +33,13 @@ GEM
3333
ethon (0.16.0)
3434
ffi (>= 1.15.0)
3535
eventmachine (1.2.7)
36-
execjs (2.8.1)
37-
faraday (2.7.4)
36+
execjs (2.9.1)
37+
faraday (2.7.12)
38+
base64
3839
faraday-net_http (>= 2.0, < 3.1)
3940
ruby2_keywords (>= 0.0.4)
4041
faraday-net_http (3.0.2)
41-
ffi (1.15.5)
42+
ffi (1.16.3)
4243
forwardable-extended (2.6.0)
4344
gemoji (3.0.1)
4445
github-pages (228)
@@ -221,19 +222,19 @@ GEM
221222
jekyll-seo-tag (~> 2.1)
222223
minitest (5.20.0)
223224
mutex_m (0.2.0)
224-
nokogiri (1.14.3-x86_64-darwin)
225+
nokogiri (1.15.5-x86_64-darwin)
225226
racc (~> 1.4)
226227
octokit (4.25.1)
227228
faraday (>= 1, < 3)
228229
sawyer (~> 0.9)
229230
pathutil (0.16.2)
230231
forwardable-extended (~> 2.6)
231232
public_suffix (4.0.7)
232-
racc (1.6.2)
233+
racc (1.7.3)
233234
rb-fsevent (0.11.2)
234235
rb-inotify (0.10.1)
235236
ffi (~> 1.0)
236-
rexml (3.2.5)
237+
rexml (3.2.6)
237238
rouge (3.26.0)
238239
ruby2_keywords (0.0.5)
239240
rubyzip (2.3.2)
@@ -250,13 +251,13 @@ GEM
250251
unf (~> 0.1.4)
251252
terminal-table (1.8.0)
252253
unicode-display_width (~> 1.1, >= 1.1.1)
253-
typhoeus (1.4.0)
254+
typhoeus (1.4.1)
254255
ethon (>= 0.9.0)
255256
tzinfo (2.0.6)
256257
concurrent-ruby (~> 1.0)
257258
unf (0.1.4)
258259
unf_ext
259-
unf_ext (0.0.8.2)
260+
unf_ext (0.0.9.1)
260261
unicode-display_width (1.8.0)
261262
webrick (1.8.1)
262263

docs/_config.yml

+6-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# site title
22
title: Java client library for Digipost API for User Agreements
33
# current version of the software
4-
version: 1.2
4+
version: 4.0.0
55
# url of the download button
66
downloadUrl: https://github.com/digipost/digipost-useragreements-api-client-java
77
# licence of the software
@@ -10,8 +10,8 @@ licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
1010

1111
baseurl: "/digipost-useragreements-api-client-java"
1212

13-
currentVersion: "3.x"
14-
versions: ["3.x", "2.x", "1.x"]
13+
currentVersion: "4.x"
14+
versions: ["4.x", "3.x", "2.x", "1.x"]
1515

1616
collections:
1717
v1_x:
@@ -23,6 +23,9 @@ collections:
2323
v3_x:
2424
output: true
2525
permalink: /v3.x/
26+
v4_x:
27+
output: true
28+
permalink: /v4.x/
2629

2730
# list of additional links on the right of the top menu
2831
headerLinks:
@@ -51,23 +54,6 @@ githubButton:
5154
user: digipost
5255
repo: digipost-useragreements-api-client-java
5356

54-
# twitter buttons
55-
twitter:
56-
enabled: true
57-
via:
58-
hash:
59-
account: digipost_no
60-
61-
# facebook buttons
62-
facebook:
63-
enabled: false
64-
profileUrl:
65-
66-
# google analytics
67-
analytics:
68-
account:
69-
domain:
70-
7157
# DON'T MODIFY
7258
highlight: rouge
7359

docs/_layouts/default.html

-34
Original file line numberDiff line numberDiff line change
@@ -179,39 +179,5 @@
179179
<script>trianglify('{{site.header.color1}}', '{{site.header.color2}}');</script>
180180
{% endif %}
181181

182-
{% if site.twitter.enabled or site.twitter.account %}
183-
<script>
184-
window.twttr = (function (d,s,id) {
185-
var t, js, fjs = d.getElementsByTagName(s)[0];
186-
if (d.getElementById(id)) return; js=d.createElement(s); js.id=id; js.async=1;
187-
js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs);
188-
return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
189-
}(document, "script", "twitter-wjs"));
190-
</script>
191-
{% endif %}
192-
193-
{% if site.facebook.enabled or site.facebook.profileUrl %}
194-
<div id="fb-root"></div>
195-
<script>(function(d, s, id) {
196-
var js, fjs = d.getElementsByTagName(s)[0];
197-
if (d.getElementById(id)) return;
198-
js = d.createElement(s); js.id = id;
199-
js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
200-
fjs.parentNode.insertBefore(js, fjs);
201-
}(document, 'script', 'facebook-jssdk'));
202-
</script>
203-
{% endif %}
204-
205-
{% if site.analytics.account and site.analytics.domain %}
206-
<script>
207-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
208-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
209-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
210-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
211-
ga('create', '{{site.analytics.account}}', '{{site.analytics.domain}}');
212-
ga('send', 'pageview');
213-
</script>
214-
{% endif %}
215-
216182
</body>
217183
</html>

docs/_v4_x/1_introduction.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Introduction
3+
identifier: introduction
4+
layout: default
5+
---
6+
7+
This API makes it possible to access agreements between Digipost users and third parties, and followingly perform certain operations which the user has granted the third party.
8+
For instance, the user may permit that certain information may be provided to a third party in order to receive a service. The user may also grant the sender access to documents
9+
through an agreement. The agreement governs which documents the sender can access and what operations it can perform.
10+
11+
12+
### Download
13+
14+
The library can be acquired from Maven Central Repository, using the dependency management tool of your choice.
15+
For Maven you can use the following dependency:
16+
17+
```xml
18+
<dependency>
19+
<groupId>no.digipost</groupId>
20+
<artifactId>digipost-useragreements-api-client-java</artifactId>
21+
<version>4.0.0</version>
22+
</dependency>
23+
```
24+
25+
### Prerequisites
26+
27+
This library now requires Java 11 and above and uses `jakarta.xml-bind`.
28+
29+
30+
### Instantiate and configure client
31+
32+
```java
33+
InputStream key = getClass().getResourceAsStream("certificate.p12");
34+
35+
HttpHost proxy = new HttpHost("proxy.example.com", 8080, "http");
36+
37+
BrokerId brokerId = BrokerId.of(1234L);
38+
39+
DigipostUserAgreementsClient client = new DigipostUserAgreementsClient
40+
.Builder(brokerId, key, "password")
41+
.useProxy(proxy) //optional
42+
.setHttpClientBuilder(HttpClientBuilder.create()) //optional
43+
.serviceEndpoint(URI.create("https://api.digipost.no")) //optional
44+
.build();
45+
```
46+
47+
### Identify Digipost user
48+
49+
```java
50+
final SenderId senderId = SenderId.of(1234L);
51+
final UserId userId = UserId.of("01017012345");
52+
53+
final IdentificationResult identificationResult = client.identifyUser(senderId, userId);
54+
boolean isDigipost = identificationResult.getResult() == IdentificationResultCode.DIGIPOST;
55+
```
56+

docs/_v4_x/2_fetch_messages.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Messages sent to user
3+
identifier: fetch_messages
4+
layout: default
5+
---
6+
7+
The agreement type `FETCH_MESSAGES` allows a sender to retrieve metadata for
8+
documents that sender has previously sent to the user, that e.g. can be used to
9+
present a synthetic inbox to the user. The metadata includes a deep-link the
10+
user can use to access the document in Digipost.
11+
12+
13+
### Create, read, update and delete agreement
14+
15+
```java
16+
final SenderId senderId = SenderId.of(1234L);
17+
final UserId userId = UserId.of("01017012345");
18+
19+
//CreateAgreement
20+
client.createOrReplaceAgreement(senderId, Agreement.createAgreement(userId, AgreementType.FETCH_MESSAGES));
21+
22+
//GetAgreement
23+
final GetAgreementResult agreement = client.getAgreement(senderId, AgreementType.FETCH_MESSAGES, userId);
24+
25+
//UpdateAgreement
26+
client.createOrReplaceAgreement(senderId, Agreement.createAgreement(userId, AgreementType.FETCH_MESSAGES));
27+
28+
//DeleteAgreement
29+
client.deleteAgreement(senderId, AgreementType.FETCH_MESSAGES, userId);
30+
```
31+
32+
### Get and verify agreement
33+
34+
```java
35+
final SenderId senderId = SenderId.of(1234L);
36+
final UserId userId = UserId.of("01017012345");
37+
38+
final GetAgreementResult agreementResult = client.getAgreement(senderId, AgreementType.FETCH_MESSAGES, userId);
39+
if (agreementResult.isSuccess()) {
40+
final Agreement agreement = agreementResult.getAgreement();
41+
} else {
42+
switch (agreementResult.getFailedReason()) {
43+
case UNKNOWN_USER: //User does not have a Digipost account
44+
case NO_AGREEMENT: //No agreement exists for user
45+
}
46+
}
47+
```
48+
49+
### Get documents
50+
51+
```java
52+
final SenderId senderId = SenderId.of(1234L);
53+
final UserId userId = UserId.of("01017012345");
54+
55+
final List<Document> previouslyDeliveredDocs = client.getDocuments(senderId, AgreementType.FETCH_MESSAGES,
56+
userId, GetDocumentsQuery.empty());
57+
58+
final ZoneId OSLO_ZONE = ZoneId.of("Europe/Oslo");
59+
final List<Document> withinTimeWindow = client.getDocuments(senderId, AgreementType.FETCH_MESSAGES, userId,
60+
GetDocumentsQuery.builder()
61+
.deliveryTimeFrom(ZonedDateTime.of(2020, 1, 1, 0, 0, 0, 0, OSLO_ZONE))
62+
.deliveryTimeTo(ZonedDateTime.now(OSLO_ZONE))
63+
.build());
64+
```

docs/_v4_x/index.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
identifier: index
3+
layout: default
4+
redirect_from: /
5+
---
6+
7+
<!-- Documentation -->
8+
{% for dok in site.v4_x %}
9+
{% if dok.identifier != 'index' %}
10+
<section class="bs-docs-section">
11+
<h1 id="{{ dok.identifier }}" class="page-header">{{ dok.title}}</h1>
12+
{{dok.content}}
13+
</section>
14+
{% endif%}
15+
{% endfor %}

0 commit comments

Comments
 (0)